def updateRepoAction(self, silence = False): if not self.iface.updateRepositories(): if not silence: self.showFailMessage() return False if network_available(): if not AppInfoClient().checkOutDB()[0]: AppInfoClient().setServer('http://appinfo.pardus.org.tr') AppInfoClient().checkOutDB() return True
def __init__(self, parent=None): QAbstractTableModel.__init__(self, parent) self.iface = backend.pm.Iface() self._flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable self.initPhase() self.state = parent.state self.appinfo = AppInfoClient() self.appinfo.setServer('http://appinfo.pardus.org.tr') if not self.appinfo.initializeLocalDB()[0]: self.appinfo.checkOutDB()
parser.add_option("-p", "--pkgupdate", default = False, dest="updatepkgdb", help="update package db", action="store_true") parser.add_option("-c", "--create", default = False, dest="createdb", help="creates a score db", action="store_true") parser.add_option("-s", "--setserver", dest="server", default="", help="set remote appinfo server", action="store", type="string") parser.add_option("-u", "--update", default = False, dest="updatedb", help="updates score db", action="store_true") (options, args) = parser.parse_args() if len(args) > 2:# or (not options.resetdb and len(args) < 2): parser.print_usage() sys.exit(0) clientonly = True client = AppInfoClient() if any([options.createdb, options.updatepkgdb, options.resetdb, len(args) > 1]): clientonly = False server = AppInfoServer() print ' - Trying to initialize Server DB:', server.initializeDB(options.filename)[1] if options.createdb: print ' - Trying to create db:' , server.createDB(options.filename or 'appinfo.db')[1] if options.updatepkgdb: print ' - Trying to update packagelist:', server.updatePackageList()[1] if options.resetdb: print ' - Trying to reset scores:', server.resetPackageScores() if not options.resetdb and len(args) > 1: print ' - Trying to update package "%s" score:' % args[0], server.updatePackageScore(args[0], float(args[1]))[1]