当前位置: 首页>>代码示例>>Python>>正文


Python DB.store_usage方法代码示例

本文整理汇总了Python中lib.db.DB.store_usage方法的典型用法代码示例。如果您正苦于以下问题:Python DB.store_usage方法的具体用法?Python DB.store_usage怎么用?Python DB.store_usage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.db.DB的用法示例。


在下文中一共展示了DB.store_usage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StoragePanel

# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import store_usage [as 别名]

#.........这里部分代码省略.........
            self.btnFTPHidePassword.SetLabel("Show")

    def onDBHidePassword(self, event):
        if self.db_hidden:
            self.txtDBPass.SetWindowStyle(wx.NORMAL)
            self.db_hidden = False
            self.btnDBHidePassword.SetLabel("Hide")
        else:
            self.txtDBPass.SetWindowStyle(wx.TE_PASSWORD)
            self.db_hidden = True
            self.btnDBHidePassword.SetLabel("Show")


######################################################################
#
#        Save and Load
#
######################################################################
    def update_state(self):
        if self.state == ViewState:
            self.lblName.Show(True)
            self.txtName.Show(False)
        if self.state == NewState:
            self.lblName.Show(False)
            self.txtName.Show(True)
            self.pnlName.Fit()


    def clear(self):
        d = FolderStore("<name>", "", False, "<folder>")
        self.show_store(d)

    def delete(self, name):
        use = self.db.store_usage(name)
        if use.size > 0:
            log.debug(name, utils.readable_form(use.size))
            msg = _("Store '{store}' contains {size} of backups.\nAre you sure?").format(
                                                store=name, size=utils.readable_form(use.size))
            mbox = OptionDialog(self, msg, _("Delete Store"), _("Also delete all backup data stored on the store."))
            if mbox.ShowModal() == wx.ID_OK:
                with ProgressDialog(self, _("Deleting"), _("Deleting store %s.\nPlease wait. This can take a while..." % name)):
                    
                    self.delete_store(name, mbox.chkOption.GetValue())
                    self.clear()
                    self.state = ViewState
        else:
            ret = dlg.OkCancel(self, _("Store '{store}' is not currently used. Delete?").format(store=name))
            if ret == wx.ID_OK:
                with ProgressDialog(self, _("Deleting"), _("Deleting store %s.\nPlease wait. This can take a while..." % name)):
                    self.delete_store(name, False)
                    self.clear()
                    self.state = ViewState
        app.broadcast_update()


    def show(self, name):
        #    Load it
        try:
            store = self.config.storage[name].copy()
            self.state = ViewState
            self.show_store(store)
        except :
            #   Missing backup!
            dlg.Warn(self, _("The store '{store}' seems to be corrupt.").format(store=name))
#            self.update_store_list()
#            self.state = ViewState
开发者ID:,项目名称:,代码行数:70,代码来源:


注:本文中的lib.db.DB.store_usage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。