mwapp.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:mediawiki_ui 作者: allanburleson 项目源码 文件源码
def __init__(self, wikis):
        addbtn = ui.ButtonItem(image=ui.Image.named('iob:ios7_plus_empty_32'),
                               action=self.add)
        # self.editbtn so it can be used in WikiList.edit
        self.editbtn = ui.ButtonItem(title='Edit', action=self.edit)
        items = None
        # If save file exists use it
        if os.path.isfile(os.path.expanduser('~/.mwsave.dat')):
            s = shelve.open(os.path.expanduser('~/.mwsave'))
            try:
                wikis = s['wikis']
            except KeyError:
                pass
            s.close()
        self.tv = ui.TableView(name='Wikis')
        self.nv = ui.NavigationView(self.tv)
        self.tv.delegate = TableViewDelegate(wikis)
        items = []
        # Create data source from dictionary of wikis
        for wiki in wikis:
            items.append({'title': wiki,
                          'accessory_type': 'detail_disclosure_button'})
        self.tv.data_source = ui.ListDataSource(items)
        self.tv.data_source.move_enabled = True
        self.tv.data_source.edit_action = self.removeFromWikis
        self.tv.right_button_items = [addbtn]
        self.tv.left_button_items = [self.editbtn]
        self.nv.present('fullscreen', hide_title_bar=True)
        # Wait until the view closes to save app data
        self.nv.wait_modal()
        self.save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号