Esempio n. 1
0
    def __init__(self,
                 cbk,
                 comment_idx,
                 post_id,
                 post_title,
                 realname=u"",
                 email=u"",
                 website=u"http://",                 
                 contents=u""):

        self.comment_idx = comment_idx
        self.post_id = post_id
        self.post_title = post_title
        self.realname = realname
        self.email = email
        self.website = website
        self.contents = contents
        self.last_idx = 1
        
        body = Listbox( [ (u"",u"") ], self.update_value_check_lock )
        menu = [ ( LABELS.loc.cm_menu_canc, self.cancel_app ) ]
        Dialog.__init__(self, cbk, LABELS.loc.cm_info_new_cmt, body, menu)
        
        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyLeftArrow, self.close_app)
            self.bind(key_codes.EKeyRightArrow, self.update_value_check_lock)
Esempio n. 2
0
    def __init__(self,
                 cbk,
                 post_title=u"",
                 contents=u"",
                 blog_categories = [LABELS.loc.wp_list_uncategorized],                 
                 categories = [],
                 blog_tags = [],
                 tags = [],
                 publish = True):
        
        self.post_title = post_title
        self.contents = contents
        self.blog_categories = blog_categories
        self.categories = categories
        self.blog_tags = blog_tags
        self.tags = tags
        self.images = []
        self.find_images()
        self.publish = publish
        self.last_idx = 0
        self.save = False
        self.init_dir=""

        body = Listbox([ (u"",u"") ], self.update_value_check_lock)
        menu = [ (LABELS.loc.pt_menu_canc, self.cancel_app) ]
        Dialog.__init__(self, cbk, LABELS.loc.pt_info_new_post, body, menu)
        
        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyLeftArrow, self.close_app)
            self.bind(key_codes.EKeyRightArrow, self.update_value_check_lock)
Esempio n. 3
0
    def __init__(self,cbk,title):
        # TODO Better icons or remove them
        icons = [Icon(MIFFILE,16384+8,16384+8),
                 Icon(MIFFILE,16384+6,16384+6),
                 Icon(MIFFILE,16384+4,16384+4),
                 Icon(MIFFILE,16384+2,16384+2),
                 Icon(MIFFILE,16384+16,16384+16),
                 ]
        menu_labels = [ LABELS.loc.wm_menu_post,
                        LABELS.loc.wm_menu_comm,
                        LABELS.loc.wm_menu_cats,
                        LABELS.loc.wm_menu_tags,
                        LABELS.loc.wm_menu_stat,
                        ]
        funcs = [self.posts,
                 self.comments,
                 self.categories,
                 self.tags,
                 self.stats,
                 ]
        menu = map(lambda a,b: (a,b), menu_labels, funcs)
        menu += [(LABELS.loc.wm_menu_exit, self.close_app)]
        items = map(lambda a,b: (a,u"",b), menu_labels, icons)
        Dialog.__init__(self,cbk,title,Listbox(items,self.update_value),menu)
        Dialog.__init__(self,cbk,title,self.body,menu)

        self.dlg = None
        
        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyRightArrow, self.update_value)
            self.bind(key_codes.EKeyLeftArrow, self.key_left)
Esempio n. 4
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)
Esempio n. 5
0
 def close_app(self):
     if not self.cancel:
         ny = popup_menu( [LABELS.loc.gm_no, LABELS.loc.gm_yes], LABELS.loc.cm_pmenu_updt_cmt)
         if ny is None:
             return
         if ny == 0:
             self.cancel = True
     Dialog.close_app(self)
Esempio n. 6
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 )
Esempio n. 7
0
    def __init__(self,cbk):
        self.dlg = None
        self.lang_changed = False
        self.body = Listbox( [(u"",u"")],self.update_value)
        Dialog.__init__(self, cbk, LABELS.loc.wm_menu_sets, self.body)

        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyRightArrow, self.update_value)
            self.bind(key_codes.EKeyLeftArrow, self.close_app)        
Esempio n. 8
0
    def __init__(self, cbk, contents=u""):
        body = Text( self.commment_to_text(contents) )
        body.focus = True
        body.set_pos( 0 )

        Dialog.__init__(self, cbk, LABELS.loc.cm_info_cmt_contents, body,
                        [(LABELS.loc.cm_menu_canc, self.cancel_app)])

        self.refresh()
Esempio n. 9
0
 def __init__(self, callback, nombre_cliente, pedido, pedidos_detalles,
         productos):
     self.nombre_cliente = nombre_cliente
     self.pedido = pedido
     self.pedidos_detalles = pedidos_detalles
     self.productos = productos
     items = self.get_ilistbox_items()
     self.ilistbox = Ilistbox(items)
     self.body = self.ilistbox.listbox
     Dialog.__init__(self, callback, u"Editar pedido", self.body)
Esempio n. 10
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 )
Esempio n. 11
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 )
Esempio n. 12
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 )      
Esempio n. 13
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)
Esempio n. 14
0
    def __init__(self,cbk):
        self.last_idx = 0
        body = Listbox([u""], self.check_popup_menu)
        self.menu_items = [(LABELS.loc.tg_menu_updt, self.update)]
        menu = self.menu_items + [(LABELS.loc.tg_menu_clos, self.close_app)]
        Dialog.__init__(self, cbk, LABELS.loc.wm_menu_tags, body, menu)

        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyUpArrow, self.key_up)
            self.bind(key_codes.EKeyDownArrow, self.key_down)
            self.bind(key_codes.EKeyLeftArrow, self.key_left)
Esempio n. 15
0
 def __init__(self,cbk,
              api_key=u"",
              blog_uri=u"http://blogname.wordpress.com",
              max_days=365):
     self.api_key = api_key
     self.blog_uri = blog_uri
     self.max_days = max_days
     self.last_idx = 0
     body = Listbox([(u"",u"")],self.update_value)
     menu = [( u"Cancel",self.cancel_app)]
     Dialog.__init__(self,cbk,u"Settings",body,menu)
Esempio n. 16
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 )
Esempio n. 17
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 )
Esempio n. 18
0
    def __init__(self, cbk):
        self.twitter_enabled = DB["twitter_enabled"]
        self.twitter_user = DB["twitter_user"]             
        self.twitter_password = DB["twitter_pass"]

        self.last_idx = 0
        body =  Listbox( [ (u"",u"") ], self.update_value )
        menu = [( LABELS.loc.st_menu_canc, self.cancel_app )]
        
        Dialog.__init__(self, cbk, LABELS.loc.st_info_twitter_set, body,  menu)

        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyLeftArrow, self.close_app)
            self.bind(key_codes.EKeyRightArrow, self.update_value)
Esempio n. 19
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 )
Esempio n. 20
0
 def __init__(self,cbk):
     self.items = [ ( u"Wordmobi %s" % VERSION, LABELS.loc.ab_menu_wordmobi_defi_val ),
                    ( LABELS.loc.ab_menu_wordmobi_auth, u"Marcelo Barros de Almeida" ),
                    ( LABELS.loc.ab_menu_wordmobi_mail, u"*****@*****.**" ),
                    ( LABELS.loc.ab_menu_wordmobi_srcc, u"http://wordmobi.googlecode.com" ),
                    ( LABELS.loc.ab_menu_wordmobi_blog, u"http://wordmobi.wordpress.com" ),
                    ( LABELS.loc.ab_menu_wordmobi_lics, u"GNU GPLv3" ),
                    ( LABELS.loc.ab_menu_wordmobi_warn, LABELS.loc.ab_menu_wordmobi_warn_val ) ]
     values = map( lambda x: (x[0], x[1]), self.items )
     menu = [(LABELS.loc.wm_menu_exit, self.close_app)]
     
     Dialog.__init__(self, cbk, LABELS.loc.wm_menu_abou, Listbox( values, self.show_info ), menu)
     
     if not TOUCH_ENABLED:
         self.bind(key_codes.EKeyLeftArrow, self.close_app)
         self.bind(key_codes.EKeyRightArrow, self.show_info)
Esempio n. 21
0
    def __init__(self,cbk,blogs):
        self.dlg = None
        self.last_idx = 0
        self.blogs = blogs
        menu = [(LABELS.loc.st_menu_edt_blog, self.edit),
                (LABELS.loc.st_menu_new_blog, self.add),
                (LABELS.loc.st_menu_cpy_blog, self.copy),
                (LABELS.loc.st_menu_del_blog, self.delete),
                (LABELS.loc.st_menu_canc, self.cancel_app)]

        body =  Listbox( [ (u"",u"") ], self.edit )
        Dialog.__init__(self, cbk, LABELS.loc.st_info_blog_acc_set, body,  menu)

        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyLeftArrow, self.close_app)
            self.bind(key_codes.EKeyRightArrow, self.edit)
Esempio n. 22
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 )
Esempio n. 23
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 )

        
Esempio n. 24
0
 def __init__(self):
     self.taken = False
     self.filename = ""
     # camera defines
     self.setup = {'image_size':0, 'flash_mode':0, 'exp_mode':0, 'white_mode':0  }       
     body = Canvas(redraw_callback = None)
     sz = max(body.size)
     self.scr_buf = graphics.Image.new((sz,sz))        
     menu = [ (LABELS.loc.pt_menu_pict, self.take_photo),
              (LABELS.loc.pt_menu_res,self.img_size_menu),
              (LABELS.loc.pt_menu_flash,self.flash_mode_menu),
              (LABELS.loc.pt_menu_expos,self.exp_mode_menu),
              (LABELS.loc.pt_menu_white,self.white_mode_menu),
              (LABELS.loc.pt_menu_canc, self.cancel_app) ]
     Dialog.__init__(self, lambda: True, LABELS.loc.pt_info_pict, body, menu, self.cancel_app)
     
     if not TOUCH_ENABLED:
         self.bind(key_codes.EKeySelect, self.take_photo)
Esempio n. 25
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)
Esempio n. 26
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
Esempio n. 27
0
    def close_app(self):
        if not self.cancel:
            yns = popup_menu([LABELS.loc.gm_yes,
                             LABELS.loc.gm_no,
                             LABELS.loc.pt_list_save_it],
                            LABELS.loc.pt_pmenu_send_post)
            if yns is None:
                return
            if yns == 1:
                self.cancel = True
                self.save = False
            elif yns == 2:
                self.cancel = True
                self.save = True
            else:
                self.cancel = False
                self.save = False

        Dialog.close_app(self)
Esempio n. 28
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)   
Esempio n. 29
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)
Esempio n. 30
0
    def __init__(self,cbk):
        self.status_list = { LABELS.loc.cm_list_any:"",
                             LABELS.loc.cm_list_spam:"spam",
                             LABELS.loc.cm_list_moderated:"approve",
                             LABELS.loc.cm_list_unmoderated:"hold" }
        self.last_idx = 0
        self.headlines = []
        body = Listbox( [ (u"", u"") ], self.check_popup_menu )
        self.menu_items = [( LABELS.loc.cm_menu_updt, self.update ),
                           ( LABELS.loc.cm_menu_view, self.contents ),
                           ( LABELS.loc.cm_menu_dele, self.delete ),
                           ( LABELS.loc.cm_menu_cnew, self.new ) ]
        menu = self.menu_items + [( LABELS.loc.cm_menu_clos, self.close_app )]
        Dialog.__init__(self, cbk, LABELS.loc.wm_menu_comm, body, menu)

        if not TOUCH_ENABLED:
            self.bind(key_codes.EKeyUpArrow, self.key_up)
            self.bind(key_codes.EKeyDownArrow, self.key_down)
            self.bind(key_codes.EKeyLeftArrow, self.key_left)
            self.bind(key_codes.EKeyRightArrow, self.key_right)
Esempio n. 31
0
    def __init__(self, cbk, book_title, book_path, last_pos):
        menu = [(u"Start", self.reader_start), (u"Pause", self.reader_pause),
                (u"Close book", self.close_reader)]

        self.book_title = book_title
        self.book_path = book_path
        self.pause = False
        self.currword_idx = last_pos
        self.wpm = 250
        self.init_delay()
        self.words = []
        self.words_num = 0
        self.parse_words()

        self.old_orientation = appuifw.app.orientation
        appuifw.app.orientation = "landscape"
        self.draw = Draw()

        Dialog.__init__(self, cbk, self.book_title, self.draw.canvas, menu,
                        self.close_reader)

        self.reader_pause()