def config(self) : if self.sharedconfig == None : rcpath = KStandardDirs.locateLocal("config", "fb-plasmoidrc") self.sharedconfig = KSharedConfig.openConfig(rcpath) self.initSettings() self.writeSettings() return KConfigGroup(self.sharedconfig, "main")
def __init__ (self, parent, path="", relative=False, busName=None, busPath=None): SatyrObject.__init__ (self, parent, busName, busPath) self.songs= [] self.count= 0 # (re)defined by an aggregator if we're in one of those self.offset= 0 # BUG: path is not reread from the config file! # it breaks rescanning self.configValues= ( ('path', str, path), ) self.loadConfig () # print busPath, self.path # if the user requests a new path, use it if self.path!=path and path!="": path= os.path.abspath (path) self.path= path self.forceScan= True logger.info ("new path, forcing (re)scan") else: self.forceScan= False self.relative= relative logger.debug ("Collection(): %s", self.path) self.watch= KDirWatch (self) self.watch.addDir (self.path, KDirWatch.WatchMode (KDirWatch.WatchFiles|KDirWatch.WatchSubDirs)) self.watch.created.connect (self.newFiles) self.scanners= [] self.scanning= False self.loadMetadata= False if busPath is not None: self.collectionFile= str (KStandardDirs.locateLocal ('data', 'satyr/%s.tdb' % self.dbusName (busPath))) else: self.collectionFile= str (KStandardDirs.locateLocal ('data', 'satyr/collection.tdb'))
def __init__(self): self.dbFile = KStandardDirs.locateLocal("data","getstuffback/db.pickle") if exists(self.dbFile): tree = etree.parse(self.dbFile) for loan in tree.getroot(): l = Loan() for attrNode in loan: if (attrNode.tag in ['date','expected_date']) and ( attrNode.text is not None): try: dateObj = datetime.strptime(attrNode.text, "%Y-%m-%dT%H:%M:%f") l[attrNode.tag] = dateObj except ValueError: pass # ignore invalid data else: l[attrNode.tag] = attrNode.text self.loans.append(l) # flush memory del(tree)
def getLocalData(fileName): return KStandardDirs.locateLocal('data', os.path.join('eclectus', fileName))