Пример #1
0
    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)
Пример #2
0
 def close_app(self):
     ny = popup_menu( [LABELS.loc.gm_yes, LABELS.loc.gm_no], LABELS.loc.wm_pmenu_exit )
     if ny is not None:
         if ny == 0:
             BLOG.save()
             self.clear_cache()
             Application.close_app(self)
Пример #3
0
    def __init__(self, app_dir="C:\\"):
        db_path = os.path.join(app_dir, u"verbo.e32dbm")
        appuifw.app.screen = "normal"

        self.lib_mgr = LibManager(db_path)
        self.book_list = []
        self.main_menu = [(u"Import book", self.add_book),
                          (u"Remove book", self.rm_book),
                          (u"Exit", self.close_app)]

        Application.__init__(self, u"Verbo",
                             appuifw.Listbox([(u"", u"")], lambda: None), [])
        self.update_liblist()
Пример #4
0
 def __init__(self):
     """
     """
     self.update_in_progress = False
     if not self.load():
         self.api_key = u"api_key"
         self.blog_uri = u"http://blog_name.wordpress.com"
         self.max_days = 365
         self.stats = {"daily"  :{"data":[],"title":u"Blog views per day"},
                       "weekly" :{"data":[],"title":u"Blog views per week"},
                       "monthly":{"data":[],"title":u"Blog views per month"},
                       "current":"daily"}
     self.dlg = None
     self.wps = WPStats(self.api_key,self.blog_uri,max_days=self.max_days)
     self.scr_buf = None
     self.toolbar = None
     app.screen = 'full'
     app.directional_pad = False
     self.body = Canvas(redraw_callback = self.stats_canvas_redraw,
                        event_callback = self.stats_event,
                        resize_callback = self.stats_resize)
     # alloc maximum size, avoiding new allocation when resizing
     sz = max(sysinfo.display_pixels())
     self.scr_buf = graphics.Image.new((sz,sz))
     if sz < 400:
         # create small graphics for tiny screens
         self.SRD = 2
         self.SLW = 2
     self.body.bind(key_codes.EKeyLeftArrow,self.key_left)
     self.body.bind(key_codes.EKeyRightArrow,self.key_right)
     self.body.bind(key_codes.EKeySelect,self.key_sel)
     self.body.bind(key_codes.EKeyUpArrow,self.key_up)
     self.body.bind(key_codes.EKeyDownArrow,self.key_down)
     self.tooltip = InfoPopup()
     self.font = ('dense',16,graphics.FONT_ANTIALIAS)
     self.set_new_data(self.stats[self.stats["current"]]["title"],
                       self.stats[self.stats["current"]]["data"])
     self.create_toolbar(sz < 400)
     Application.__init__(self,u"WP Stats",self.body)
Пример #5
0
 def close_app(self):
     Application.close_app(self)
Пример #6
0
#!/usr/bin/env python3
'''
Main app entry point.

'''
import tkinter as tk
from window import Application

root = tk.Tk()
root.geometry("400x400")
app = Application(master=root)
app.mainloop()
Пример #7
0
 def refresh(self):
     Application.refresh(self)
     self.stats_canvas_redraw()