def __init__(self): app.screen='normal' # TODO check all app.xyz use app.directional_pad = False LABELS.set_locale(DB["language"]) self.wp_icon = Icon(MIFFILE,16384+14,16384+14) self.blogs = json.loads(DB["blog_list"]) items = [ (b["account"],b["blog"],self.wp_icon) for b in self.blogs ] menu = [(LABELS.loc.wm_menu_exit, self.close_app)] Application.__init__(self, u"Wordmobi", Listbox( items, self.check_update_value )) self._update_menu() # TODO # { # Temporary fix before changing how persistence is treated. # New persistence module must be created to avoid this line and e32db. __changed = False for n in range(len(self.blogs)): if not self.blogs[n].has_key("api_key"): self.blogs[n]["api_key"] = "" __changed = True if __changed: DB["blog_list"]=json.dumps(self.blogs) DB.save() # # } # self.dlg = None sel_access_point() if not TOUCH_ENABLED: self.bind(key_codes.EKeyRightArrow, self.check_update_value) self.bind(key_codes.EKeyLeftArrow, self.close_app)
def language(self): langs = [(LABELS.loc.st_menu_en_us, u"en_us"), (LABELS.loc.st_menu_pt_br, u"pt_br"), (LABELS.loc.st_menu_es, u"es"), (LABELS.loc.st_menu_tr, u"tr"), (LABELS.loc.st_menu_it, u"it"), (LABELS.loc.st_menu_nl, u"nl"), (LABELS.loc.st_menu_de, u"de"), (LABELS.loc.st_menu_ro, u"ro"), (LABELS.loc.st_menu_zh_cn, u"zh_cn"), (LABELS.loc.st_menu_fr, u"fr"), (LABELS.loc.st_menu_ru, u"ru"), (LABELS.loc.st_menu_id, u"id")] langs.sort() item = popup_menu(map(lambda x:x[0], langs), LABELS.loc.st_pmenu_lang ) if item is not None: loc = langs[item][1] if DB["language"] != loc: LABELS.set_locale(loc) DB["language"] = loc DB.save() self.refresh() BLOG.refresh() # update global defines self.lang_changed = True