def __init__(self, applet, iid): """Create applet for Forismatic Notify""" self.applet=applet self.iid=iid self.conf = Preference.Config(applet,self.cb_TimePeriod,self.cb_Theme,self.cb_Lang) (self.TimePeriod, self.Theme,self.Language) =\ self.conf.get_settings() self.theme_path = os.path.join(path,'Themes',self.Theme) self.time = self.TimePeriod*60 if self.time==0: self.time = 300 GnomeAppletSkeleton.__init__(self, applet, iid)
"""with codecs.open(saved_quote_path, encoding='utf-8',mode='w') as file_w: file_w.write(quoteText) file_w.write("\n"+quoteAuthor) file_w.closed""" #write to GConf self.conf.set_Quote(quoteText, quoteAuthor, quoteLink) #print "%s \n %s \n %s "%(quoteText, quoteAuthor, quoteLink) #print "end" def quote_lang(self): """Return current language for quote""" self.Language = self.conf.get_settings()[2] if self.Language == 'English' or self.Language == 'english' \ or self.Language == 'en': return 'en' elif self.Language == 'Russian' or self.Language == 'russian' \ or self.Language == 'ru': return 'ru' else: return None if __name__ == '__main__': import Preference conf = Preference.Config() path = os.getcwd() quote = Forismatic(conf, path) quote.save_qote()