示例#1
0
class FacilisAppDelegate(NSObject):
    def applicationWillFinishLaunching_(self, sender):
        self.start()
    
    def applicationDidFinishLaunching_(self, sender):
        NSLog("Application loaded")
    
    def application_openFile_(self, sender, fname):
        fname = fname.encode("utf-8")
        name = split(fname)[1]
        try:
            url = self.app.addFile(fname)
        except IOError:
            self.notifier.notify("Error", "Error", "Something bad happened. Try again.")
        except IsADir:
            self.notifier.notify("IsDir", "Error", name + " is a directory.")
        else:
            self.notifier.notify("FileAdded", u"File added to Facilis", u"\"" + name + u"\" was just added to Facilis; its URL was copied to the pasteboard. You can now paste it anywhere.")

    def start(self):
        self.app = FacilisApp()
        self.app.start()
        self.notifier = Growl.GrowlNotifier("Facilis", [FILEADDED, ISDIR, ERROR, STARTUP])
        self.notifier.register()
        self.notifier.notify("Startup", "Facilis", "Facilis just started on port " + str(self.app.config['port']))
示例#2
0
文件: mac.py 项目: joaomoreno/facilis
class FacilisMac(object):
    """Cocoa interface for Facilis."""
    
    def __init__(self):
        """Gives directions to the user and starts the interface."""
        self.app = FacilisApp()
    
    def start(self):
        """Starts the interface."""
        try:
            self.app.start()
        except PortInUse, p:
            print "Port already in use:", p
            exit(-2)
示例#3
0
文件: cli.py 项目: joaomoreno/facilis
class FacilisCLI(object):
    """Command line interface for Facilis."""
    
    def __init__(self, cin=stdin):
        """Gives directions to the user and starts the interface."""
        print "\nFacilis - Send files and folders through HTTP without hassle"
        self.app = FacilisApp()
        self.cin = cin
    
    def start(self):
        """Starts the interface."""
        try:
            self.app.start()
        except PortInUse, p:
            print "Port already in use:", p
            exit(-2)
        else:
示例#4
0
文件: mac.py 项目: joaomoreno/facilis
 def __init__(self):
     """Gives directions to the user and starts the interface."""
     self.app = FacilisApp()
示例#5
0
 def start(self):
     self.app = FacilisApp()
     self.app.start()
     self.notifier = Growl.GrowlNotifier("Facilis", [FILEADDED, ISDIR, ERROR, STARTUP])
     self.notifier.register()
     self.notifier.notify("Startup", "Facilis", "Facilis just started on port " + str(self.app.config['port']))
示例#6
0
文件: cli.py 项目: joaomoreno/facilis
 def __init__(self, cin=stdin):
     """Gives directions to the user and starts the interface."""
     print "\nFacilis - Send files and folders through HTTP without hassle"
     self.app = FacilisApp()
     self.cin = cin