示例#1
0
def download_complete(success, ctx):
    (user, destname, sharepath, open_content) = ctx
    if success and open_content:
         if not open_file(destname):
             notification.ok_dialog('Can not open file',
                 'Can not open file: %s\nUnknown format, or not supported.' % (destname))
    if not success:
        notification.ok_dialog('File sharing',
            'Unable to download a file from %s: %s' % (user.tag(), sharepath))
示例#2
0
    def open_cb(self, widget):
        model, selected = self.sharelist_view.get_selection().get_selected_rows()
        if len(selected) == 0:
            notification.notify('No file selected!', highpri=True)
            return
        row = self.sharelist[selected[0]]

        meta = row[self.COL_SHAREMETA]
        sharepath = row[self.COL_SHAREPATH]
        guiname = row[self.COL_GUINAME]
        shareid = meta['id']

        fullpath = filesharing.native_path(shareid, sharepath)
        if fullpath == None:
            warning('FileSharingGUI: Can not open shareid %d sharepath %s\n' %(shareid, sharepath))
            return

        notification.notify('Opening content %s' %(guiname))

        if not open_file(fullpath):
            notification.ok_dialog('Can not open file', 'Can not open file: %s\nUnknown format, or not supported.' %(fullpath))
示例#3
0
 def download_cb(self, success, ctx):
     (destname, open_content) = ctx
     if success and open_content:
          if not open_file(destname):
              notification.ok_dialog('Can not open file',
                  'Can not open file: %s\nUnknown format, or not supported.' % (destname))
示例#4
0

if __name__ == "__main__":

    app = KeePassHttpX.sharedApplication()

    # Bring app to top
    NSApp.activateIgnoringOtherApps_(True)

    viewController = PasswordDialogController.alloc().initWithWindowNibName_(
        'PasswordDialog')
    viewController.showWindow_(viewController)
    #viewController.worksWhenModal = True

    defaults = NSUserDefaultsController.sharedUserDefaultsController().values()
    db_path = getKey(defaults, 'db_path')

    if db_path is None:
        db_path = openfile.open_file()
        defaults.setValue_forKey_(db_path, 'db_path')

    #password = getKey(defaults, 'password')
    #print getKey(defaults, 'password')

    print "KeePass DB v1 path:" + db_path

    t = threading.Thread(target=start, args=(db_path, password))
    t.setDaemon(True)
    t.start()
    AppHelper.runEventLoop()
示例#5
0
文件: main.py 项目: ha1t/KeePassHttpX
    server.activate()

if __name__ == "__main__":

    app = KeePassHttpX.sharedApplication()

    # Bring app to top
    NSApp.activateIgnoringOtherApps_(True)

    viewController = PasswordDialogController.alloc().initWithWindowNibName_('PasswordDialog')
    viewController.showWindow_(viewController)
    #viewController.worksWhenModal = True

    defaults = NSUserDefaultsController.sharedUserDefaultsController().values()
    db_path = getKey(defaults, 'db_path')

    if db_path is None:
        db_path = openfile.open_file();
        defaults.setValue_forKey_(db_path, 'db_path');

    #password = getKey(defaults, 'password')
    #print getKey(defaults, 'password')

    print "KeePass DB v1 path:" + db_path

    t = threading.Thread(target=start, args=(db_path, password))
    t.setDaemon(True)
    t.start()
    AppHelper.runEventLoop()