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


Python DB.delete_store方法代码示例

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


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

示例1: StoragePanel

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

#.........这里部分代码省略.........
            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
#            self.clear()
            return


    def show_store(self, d):
        try:
            #    General Information
            self.txtName.SetValue(d.name)
            self.lblName.SetLabel(d.name)
开发者ID:,项目名称:,代码行数:70,代码来源:


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