def __init__(self, jd): self.eventsData = [] # self.eventsDataIsSet = False ## not used self.pluginsText = "" ### self.jd = jd date = core.jd_to_primary(jd) self.year, self.month, self.day = date self.weekDay = core.jwday(jd) self.weekNum = core.getWeekNumber(self.year, self.month, self.day) # self.weekNumNeg = self.weekNum + 1 - core.getYearWeeksCount(self.year) self.weekNumNeg = self.weekNum - int(calTypes.primaryModule().avgYearLen / 7) self.holiday = self.weekDay in core.holidayWeekDays ################### self.dates = [date if mode == calTypes.primary else jd_to(jd, mode) for mode in range(len(calTypes))] """ self.dates = dict([ ( mode, date if mode==calTypes.primary else jd_to(jd, mode) ) for mode in calTypes.active ]) """ ################### for k in core.plugIndex: plug = core.allPlugList[k] if plug: try: plug.update_cell(self) except: myRaiseTback() ################### # t0 = now() self.eventsData = event_lib.getDayOccurrenceData(jd, eventGroups) ## here? FIXME
def __init__(self, jd): self.eventsData = [] #self.eventsDataIsSet = False ## not used self.pluginsText = '' ### self.jd = jd date = core.jd_to_primary(jd) self.year, self.month, self.day = date self.weekDay = core.jwday(jd) self.weekNum = core.getWeekNumber(self.year, self.month, self.day) #self.weekNumNeg = self.weekNum + 1 - core.getYearWeeksCount(self.year) self.weekNumNeg = self.weekNum - int(calTypes.primaryModule().avgYearLen / 7) self.holiday = (self.weekDay in core.holidayWeekDays) ################### self.dates = [ date if mode==calTypes.primary else jd_to(jd, mode) for mode in range(len(calTypes)) ] ''' self.dates = dict([ ( mode, date if mode==calTypes.primary else jd_to(jd, mode) ) for mode in calTypes.active ]) ''' ################### for k in core.plugIndex: plug = core.allPlugList[k] if plug: try: plug.update_cell(self) except: myRaiseTback() ################### #t0 = now() self.eventsData = event_lib.getDayOccurrenceData(jd, eventGroups)## here? FIXME
def loadExternalPlugin(_file, **data): _file = getPlugPath(_file) fname = split(_file)[-1] if not isfile(_file): log.error("plugin file \"%s\" not found! maybe removed?" % _file) #try: # plugIndex.remove( return None # FIXME #plug = BaseJsonPlugin( # _file, # mode=0, # title="Failed to load plugin", # enable=enable, # show_date=show_date, #) #plug.external = True #return plug ### direc = dirname(_file) name = splitext(fname)[0] ### if not data.get("enable"): return DummyExternalPlugin( _file, pluginsTitleByName.get(name, name), ) ### mainFile = data.get("mainFile") if not mainFile: log.error("invalid external plugin \"%s\"" % _file) return ### mainFile = getPlugPath(mainFile) ### pyEnv = { "__file__": mainFile, "BasePlugin": BasePlugin, "BaseJsonPlugin": BaseJsonPlugin, } try: exec(open(mainFile, encoding="utf-8").read(), pyEnv) except: log.error("error while loading external plugin \"%s\"" % _file) myRaiseTback() return ### cls = pyEnv.get("TextPlugin") if cls is None: log.error("invalid external plugin \"%s\", no TextPlugin class" % _file) return ### try: plugin = cls(_file) except: log.error("error while loading external plugin \"%s\"" % _file) myRaiseTback() return #sys.path.insert(0, direc) #try: # mod = __import__(name) #except: # myRaiseTback() # return None #finally: # sys.path.pop(0) ## mod.module_init(rootDir, ) ## FIXME #try: # plugin = mod.TextPlugin(_file) #except: # myRaiseTback() # #print(dir(mod)) # return plugin.external = True plugin.setData(data) plugin.onCurrentDateChange(localtime()[:3]) return plugin
def loadExternalPlugin(_file, **data): _file = getPlugPath(_file) fname = split(_file)[-1] if not isfile(_file): log.error('plugin file "%s" not found! maybe removed?'%_file) #try: # plugIndex.remove( return None #????????????????????????? ##plug = BaseJsonPlugin(_file, mode=0, title='Failed to load plugin', enable=enable, show_date=show_date) ##plug.external = True ##return plug ### direc = dirname(_file) name = splitext(fname)[0] ### if not data.get('enable'): return DummyExternalPlugin( _file, pluginsTitleByName.get(name, name), ) ### try: mainFile = data['mainFile'] except KeyError: log.error('invalid external plugin "%s"'%_file) return ### mainFile = getPlugPath(mainFile) ### pyEnv = { '__file__': mainFile, 'BasePlugin': BasePlugin, 'BaseJsonPlugin': BaseJsonPlugin, } try: exec(open(mainFile).read(), pyEnv) except: log.error('error while loading external plugin "%s"'%_file) myRaiseTback() return ### try: cls = pyEnv['TextPlugin'] except KeyError: log.error('invalid external plugin "%s", no TextPlugin class'%_file) return ### try: plugin = cls(_file) except: log.error('error while loading external plugin "%s"'%_file) myRaiseTback() return #sys.path.insert(0, direc) #try: # mod = __import__(name) #except: # myRaiseTback() # return None #finally: # sys.path.pop(0) ## mod.module_init(rootDir, ) ## FIXME #try: # plugin = mod.TextPlugin(_file) #except: # myRaiseTback() # #print(dir(mod)) # return plugin.external = True plugin.setData(data) plugin.onCurrentDateChange(localtime()[:3]) return plugin
def loadExternalPlugin(_file, **data): _file = getPlugPath(_file) fname = split(_file)[-1] if not isfile(_file): log.error('plugin file "%s" not found! maybe removed?' % _file) #try: # plugIndex.remove( return None #????????????????????????? ##plug = BaseJsonPlugin(_file, mode=0, title='Failed to load plugin', enable=enable, show_date=show_date) ##plug.external = True ##return plug ### direc = dirname(_file) name = splitext(fname)[0] ### if not data.get('enable'): return DummyExternalPlugin( _file, pluginsTitleByName.get(name, name), ) ### try: mainFile = data['mainFile'] except KeyError: log.error('invalid external plugin "%s"' % _file) return ### mainFile = getPlugPath(mainFile) ### pyEnv = { '__file__': mainFile, 'BasePlugin': BasePlugin, 'BaseJsonPlugin': BaseJsonPlugin, } try: exec(open(mainFile).read(), pyEnv) except: log.error('error while loading external plugin "%s"' % _file) myRaiseTback() return ### try: cls = pyEnv['TextPlugin'] except KeyError: log.error('invalid external plugin "%s", no TextPlugin class' % _file) return ### try: plugin = cls(_file) except: log.error('error while loading external plugin "%s"' % _file) myRaiseTback() return #sys.path.insert(0, direc) #try: # mod = __import__(name) #except: # myRaiseTback() # return None #finally: # sys.path.pop(0) ## mod.module_init(rootDir, ) ## FIXME #try: # plugin = mod.TextPlugin(_file) #except: # myRaiseTback() # #print(dir(mod)) # return plugin.external = True plugin.setData(data) plugin.onCurrentDateChange(localtime()[:3]) return plugin