Exemplo n.º 1
0
    def refresh(self):
        Dialog.refresh(self) # must be called *before* 
        
        self.headlines = BLOG.category_names_list()
        self.last_idx = min( self.last_idx, len(self.headlines)-1 ) # avoiding problems after removing
        self.set_title( LABELS.loc.ca_info_cat_pos % ( self.body.current()+1,len(self.headlines) ) )

        self.body.set_list( self.headlines, self.last_idx )
Exemplo n.º 2
0
 def refresh(self):
     if self.blog_uri.endswith(u"/"):
         self.blog_uri = self.blog_uri[:-1]
     values = [(u"Blog URI",self.blog_uri),
               (u"API Key",u"*"*len(self.api_key)),
               (u"Days",unicode(self.max_days))]
     self.body.set_list(values,self.last_idx)
     Dialog.refresh(self)
Exemplo n.º 3
0
 def refresh(self):
     menu = []
     if self.names:
         menu = map(lambda x: (x, lambda: None), self.names)
         items = self.names + [u"<empty>"]
     else:
         items = [u"<empty>"]
     self.menu = menu + [(u"Exit", self.close_app)]
     self.body.set_list(items, 0)
     Dialog.refresh(self)
Exemplo n.º 4
0
 def refresh(self):
     Dialog.refresh(self)
     self.set_title(LABELS.loc.wm_menu_sets)
     idx = self.body.current()
     items = [ ( LABELS.loc.st_menu_blog,u""),
               ( LABELS.loc.st_menu_proxy, u""),
               ( LABELS.loc.st_menu_access_point, u""),
               ( LABELS.loc.st_menu_lang, u""),
               ( LABELS.loc.st_menu_twitter, u"")]
     self.body.set_list( items, idx )
Exemplo n.º 5
0
    def refresh(self):
        Dialog.refresh(self) # must be called *before*

        lst_values = [ (LABELS.loc.cm_menu_pstt, self.post_title), \
                       (LABELS.loc.cm_menu_cont, self.contents[:50]), \
                       (LABELS.loc.cm_menu_name, self.realname ), \
                       (LABELS.loc.cm_menu_mail, self.email), \
                       (LABELS.loc.cm_menu_webs, self.website) ]

        app.body.set_list( lst_values, self.last_idx )      
Exemplo n.º 6
0
 def refresh(self):
     Dialog.refresh(self)
     if self.twitter_enabled == u"True":
         twitter = LABELS.loc.st_menu_twitter_on
     else:
         twitter = LABELS.loc.st_menu_twitter_off
     values = [ (LABELS.loc.st_menu_twitter_ena, twitter ), \
                (LABELS.loc.st_menu_proxy_usr, self.twitter_user), \
                (LABELS.loc.st_menu_proxy_pwd, u"*"*len( self.twitter_password ) ) ]
     app.body.set_list( values, self.last_idx )
Exemplo n.º 7
0
 def refresh(self):
     Dialog.refresh(self)
     if self.proxy_enabled == u"True":
         prx = LABELS.loc.st_menu_proxy_on
     else:
         prx = LABELS.loc.st_menu_proxy_off
     values = [ (LABELS.loc.st_menu_proxy_ena, prx ), \
                (LABELS.loc.st_menu_proxy_add, self.proxy_address ), \
                (LABELS.loc.st_menu_proxy_prt, unicode( self.proxy_port ) ), \
                (LABELS.loc.st_menu_proxy_usr, self.proxy_user), \
                (LABELS.loc.st_menu_proxy_pwd, u"*"*len( self.proxy_password ) ) ]
     app.body.set_list( values, self.last_idx )
Exemplo n.º 8
0
 def refresh(self):
     Dialog.refresh(self) # must be called *before*
     if not self.blogs:
         self.blogs = [ {"account":u"Account name",
                         "user":u"user name",
                         "pass":u"password",
                         "blog":u"http://blogname.wordpress.com",
                         "num_posts":10,
                         "num_comments":20,
                         "api_key":u""}]
     values = [ (b["account"],b["blog"]) for b in self.blogs ]
     self.last_idx = min( self.last_idx, len(values)-1 )
     app.body.set_list( values, self.last_idx )
Exemplo n.º 9
0
    def refresh(self):
        Dialog.refresh(self) # must be called *before*
        if self.blog.endswith(u"/xmlrpc.php"):
            self.blog = self.blog[:self.blog.find(u"/xmlrpc.php")]
        if self.blog.endswith(u"/"):
            self.blog = self.blog[:-1]
        values = [ (LABELS.loc.st_menu_blog_acc, self.account ),
                   (LABELS.loc.st_menu_blog_url, self.blog ),
                   (LABELS.loc.st_menu_blog_usr, self.user ),
                   (LABELS.loc.st_menu_blog_pwd, u"*"*len(self.passw)),
                   (LABELS.loc.st_menu_blog_npt, unicode(self.num_posts)),
                   (LABELS.loc.st_menu_blog_cpp, unicode(self.num_comments)),
                   (LABELS.loc.st_menu_blog_key, self.api_key)]

        app.body.set_list( values, self.last_idx )
Exemplo n.º 10
0
    def refresh(self):
        Dialog.refresh(self) # must be called *before* 

        if not BLOG.comments:
            self.headlines = [ (LABELS.loc.cm_info_empty, LABELS.loc.cm_info_udt_cmts_lst) ]
        else:
            self.headlines = []
            for c in BLOG.comments:
                (y, mo, d, h, m, s) = parse_iso8601( c['date_created_gmt'].value )
                line1 = u"%d/%s %02d:%02d %s (%s)" % (d,MONTHS[mo-1],h,m,self.translate_status(c['status']),\
                                                      utf8_to_unicode( c['author'] ))
                line2 = utf8_to_unicode( c['content'][:50] )
                self.headlines.append( ( line1 , line2 ) )
                               
        self.last_idx = min( self.last_idx, len(self.headlines)-1 ) # avoiding problems after removing
        app.body.set_list( self.headlines, self.last_idx )
Exemplo n.º 11
0
    def refresh(self):
        #Dialog.refresh(self) # must be called *before*        
        #self.headlines = BLOG.tag_names_list()
        Dialog.refresh(self) # must be called *before* 

        self.headlines = BLOG.tag_names_list()
        if not self.headlines:
            self.headlines = [ LABELS.loc.tg_info_udt_tags_lst ]
            
        #self.headlines = []
        #for t in BLOG.tags:
        #    line = u"%s (%s)" % (t['name'],t['count'])
        #    self.headlines.append(line)
                               
        self.last_idx = min( self.last_idx, len(self.headlines)-1 ) # avoiding problems after removing
        app.body.set_list( self.headlines, self.last_idx )

        
Exemplo n.º 12
0
 def __init__(self,cbk):
     """
     """
     self.blog_uri = BLOG.curr_blog["blog"]
     self.api_key = BLOG.curr_blog["api_key"]
     self.proxy = BLOG.proxy
     self.max_days = 365
     self.stats = {"daily"  :{"data":[],"title":LABELS.loc.ws_info_daily},
                   "weekly" :{"data":[],"title":LABELS.loc.ws_info_weekly},
                   "monthly":{"data":[],"title":LABELS.loc.ws_info_monthly},
                   "current":"daily"}
     self.wps = WPStats(self.api_key,self.blog_uri,max_days=self.max_days,proxy=self.proxy)
     self.scr_buf = None
     self.toolbar = None
     app.screen = 'normal'
     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
     if not TOUCH_ENABLED:
         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)
     self.menu = [(LABELS.loc.ws_menu_updt,self.update_stats),
                  (LABELS.loc.ws_menu_views,(
                      (LABELS.loc.ws_menu_daily,lambda: self.set_view('daily')),
                      (LABELS.loc.ws_menu_weekly,lambda: self.set_view('weekly')),
                      (LABELS.loc.ws_menu_monthly,lambda: self.set_view('monthly')))),
                  (LABELS.loc.ws_menu_exit,self.close_app)]
     Dialog.__init__(self,cbk,LABELS.loc.wm_menu_stat,self.body,self.menu)
     Dialog.refresh(self)
Exemplo n.º 13
0
    def run(self):
        Dialog.refresh(self)

        try:
            camera.start_finder(self.redraw)
        except:
            note(LABELS.loc.pt_err_cant_start_viewf,"error")
            return None
        
        while (not self.taken) and (not self.cancel):
            e32.ao_yield()
            
        try:
            camera.stop_finder()
            camera.release()
        except:
            note(LABELS.loc.pt_err_cant_stop_viewf,"error")
        
        return self.filename
Exemplo n.º 14
0
    def refresh(self):
        Dialog.refresh(self) # must be called *before*
        
        imgs = unicode(",".join(self.images))
        cats = unicode(",".join(self.categories))
        tags = unicode(",".join(self.tags))
        if self.publish:
            pub = LABELS.loc.pt_info_no_pub
        else:
            pub = LABELS.loc.pt_info_draft

        lst_values = [(LABELS.loc.pt_menu_titl, self.post_title),
                      (LABELS.loc.pt_menu_cont, self.contents[:50]),
                      (LABELS.loc.pt_menu_cats, cats),
                      (LABELS.loc.pt_menu_tags, tags),
                      (LABELS.loc.pt_menu_imgs, imgs),
                      (LABELS.loc.pt_menu_pubs, pub)]

        app.body.set_list(lst_values, self.last_idx)   
Exemplo n.º 15
0
 def update_stats(self):
     if self.ui_is_locked():
         return
     yn = popup_menu([LABELS.loc.gm_yes,LABELS.loc.gm_no],LABELS.loc.ws_pmenu_downl_stats)
     if yn is not None:
         if yn == 0:
             self.lock_ui(LABELS.loc.ws_info_downloading)
             try:
                 self.stats['daily']['data'] = self.wps.get_blog_views()
             except:
                 note(LABELS.loc.ws_info_downl_failed,"info")
             else:
                 self.set_title(LABELS.loc.ws_info_processing)
                 self.stats['monthly']['data'] = conv2monthly(self.stats['daily']['data'])
                 self.stats['weekly']['data'] = conv2weekly(self.stats['daily']['data'])
                 self.set_new_data(self.stats[self.stats["current"]]["title"],
                                   self.stats[self.stats["current"]]["data"])
             self.unlock_ui()
             Dialog.refresh(self)
             self.set_title(LABELS.loc.ws_stats_dlg)
Exemplo n.º 16
0
    def refresh(self):
        Dialog.refresh(self) # must be called *before* 

        if not BLOG.posts:
            self.headlines = [ (LABELS.loc.pt_info_empty, LABELS.loc.pt_info_updt_pst_lst) ]
        else:
            self.headlines = []
            for p in BLOG.posts:
                status = u""
                (y, mo, d, h, m, s) = parse_iso8601(p['dateCreated'].value)
                if BLOG.post_is_only_local(p):
                    status = u"[@] "
                elif BLOG.post_is_local(p):
                    status = u"[*] "
                elif p.has_key('post_status'):
                    if p['post_status'] != 'publish':
                        status = u"[#]"

                line1 = status + u"%02d/%s/%02d  %02d:%02d " % (d,MONTHS[mo-1],y,h,m) 
                line2 = utf8_to_unicode(p['title'])
                self.headlines.append((line1 , line2))
                               
        self.last_idx = min(self.last_idx, len(self.headlines)-1) # avoiding problems after removing
        self.body.set_list(self.headlines, self.last_idx)
Exemplo n.º 17
0
 def refresh(self):
     Dialog.refresh(self)
     self.stats_canvas_redraw()
Exemplo n.º 18
0
    def refresh(self):
        def gen_label(menu):
            prefix = u""
            if self.text_snippets[menu]["MENU_STATE"] is not None:
                if self.text_snippets[menu]["MENU_STATE"]:
                    prefix = u"/"
            return (prefix + self.text_snippets[menu]["MENU_NAME"])
        def gen_ckb(menu):
            if self.text_snippets[menu]["MENU_STATE"] is None:
                if self.text_snippets[menu]["OPEN_FUNC"] is None:
                    def cbk():
                        self.body.add(self.text_snippets[menu]["OPEN_TAG"])
                        self.refresh()
                    return cbk
                else:
                    return self.text_snippets[menu]["OPEN_FUNC"]
            elif self.text_snippets[menu]["MENU_STATE"] == False:
                if self.text_snippets[menu]["OPEN_FUNC"] is None:
                    def cbk():
                        self.body.add(self.text_snippets[menu]["OPEN_TAG"])
                        self.text_snippets[menu]["MENU_STATE"] = not self.text_snippets[menu]["MENU_STATE"]
                        self.refresh()
                    return cbk
                else:
                    return self.text_snippets[menu]["OPEN_FUNC"]
            else:
                if self.text_snippets[menu]["CLOSE_FUNC"] is None:
                    def cbk():
                        self.body.add(self.text_snippets[menu]["CLOSE_TAG"])
                        self.text_snippets[menu]["MENU_STATE"] = not self.text_snippets[menu]["MENU_STATE"]
                        self.refresh()
                    return cbk
                else:
                    return self.text_snippets[menu]["CLOSE_FUNC"]                
                    
        self.global_menu = [(LABELS.loc.pt_menu_text,(
                       (gen_label("BOLD"), gen_ckb("BOLD")),
                       (gen_label("ITALIC"), gen_ckb("ITALIC")),
                       (gen_label("QUOTE"), gen_ckb("QUOTE")),
                       (gen_label("MORE"), gen_ckb("MORE")),
                       (gen_label("CODE"), gen_ckb("CODE")),
                       (gen_label("STRIKE"), gen_ckb("STRIKE")),
                       (gen_label("SPACE"), gen_ckb("SPACE")),
                       (gen_label("H1"), gen_ckb("H1")),
                       (gen_label("H2"), gen_ckb("H2")),
                       (gen_label("H3"), gen_ckb("H3")),
                       (gen_label("H4"), gen_ckb("H4")))
                      ),
                     (LABELS.loc.pt_menu_refs,(
                        (gen_label("IMAGE"), gen_ckb("IMAGE")),
                        (gen_label("LINK"), gen_ckb("LINK")),
                        (gen_label("LINKYT"), gen_ckb("LINKYT")))#,
                        #(gen_label("LINKQIK"), gen_ckb("LINKQIK")))
                      ),
                    (LABELS.loc.pt_menu_lsts,(
                        (gen_label("OLIST"), gen_ckb("OLIST")),
                        (gen_label("ULIST"), gen_ckb("ULIST")),
                        (gen_label("ILIST"), gen_ckb("ILIST")))
                     ),                     
                    (LABELS.loc.pt_menu_revs,(
                        (gen_label("INS"), gen_ckb("INS")),
                        (gen_label("DEL"), gen_ckb("DEL")))
                     ),
                     (LABELS.loc.pt_menu_prvw, self.preview_html),
                     (LABELS.loc.pt_menu_canc, self.cancel_app)]

        Dialog.refresh(self)