hostswitcher.py 文件源码

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

项目:hostswitcher 作者: fiefdx 项目源码 文件源码
def OnDelete(self, evt):
        name = self.combo_box_1.GetValue()
        fpath = os.path.join(DataPath, name)
        if name != "default":
            msg_dialog = wx.MessageDialog(self,
                                          "Are you sure that you want to delete file \"%s\"" % name,
                                          "Delete \"%s\"" % name, wx.YES_NO | wx.ICON_EXCLAMATION)
            msg_dialog.Centre(wx.BOTH)
            r = msg_dialog.ShowModal()
            if r == wx.ID_YES:
                if os.path.exists(fpath) and os.path.isfile(fpath):
                    os.remove(fpath)
                    index = self.combo_box_1.GetSelection()
                    self.combo_box_1.Delete(index)
                    self.combo_box_1.Select(0)
            msg_dialog.Destroy()
        else:
            msg_dialog = wx.MessageDialog(self,
                                          "\"%s\" can't be deleted.\nYou can edit it only." % name,
                                          "\"%s\" can't be deleted." % name, wx.OK | wx.ICON_ERROR)
            msg_dialog.Centre(wx.BOTH)
            msg_dialog.ShowModal()
            msg_dialog.Destroy()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号