コード例 #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