本文整理汇总了Python中Project.Project.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Python Project.isEmpty方法的具体用法?Python Project.isEmpty怎么用?Python Project.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project.Project
的用法示例。
在下文中一共展示了Project.isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyFrame
# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import isEmpty [as 别名]
#.........这里部分代码省略.........
grid_sizer_3.Add(self.search_outpath, 0, 0, 0)
grid_sizer_3.Add(self.label_temppath, 0, wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_3.Add(self.input_temppath, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
grid_sizer_3.Add(self.search_temppath, 0, 0, 0)
grid_sizer_3.AddGrowableCol(1)
grid_sizer_2.Add(grid_sizer_3, 1, wx.EXPAND, 0)
grid_sizer_2.Add(self.sl2, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.radiobox_saveas, 0, 0, 0)
grid_sizer_4.Add(self.checkbox_debug, 0, 0, 0)
grid_sizer_4.Add(self.checkbox_unicode, 0, 0, 0)
grid_sizer_2.Add(grid_sizer_4, 1, wx.EXPAND, 0)
grid_sizer_2.Add(self.sl3, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.bitmap_start, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
grid_sizer_2.Add(self.sl4, 0, wx.EXPAND, 0)
grid_sizer_2.Add(self.label_log, 0, 0, 0)
grid_sizer_2.Add(self.list_log, 0, wx.EXPAND, 0)
self.nb_pane_2.SetSizer(grid_sizer_2)
grid_sizer_2.AddGrowableRow(8)
grid_sizer_2.AddGrowableCol(0)
self.nb.AddPage(self.nb_panel_1, "Project")
self.nb.AddPage(self.nb_pane_2, "Build")
main_sizer.Add(self.nb, 1, wx.EXPAND, 0)
main_sizer.Add((20, 20), 0, 0, 0)
main_sizer.Add((20, 20), 0, 0, 0)
main_sizer.Add((20, 20), 0, 0, 0)
main_sizer.Add((20, 20), 0, 0, 0)
self.SetSizer(main_sizer)
main_sizer.Fit(self)
main_sizer.AddGrowableRow(1)
main_sizer.AddGrowableCol(1)
self.Layout()
def askForSavingIfNeed(self):
if (self.path == None or self.project.needSave(self)) and not self.project.isEmpty(self):
res = wx.MessageDialog(self, "Do you want to save this project?", "Save?", wx.ICON_QUESTION | wx.YES_NO | wx.CANCEL | wx.YES_DEFAULT).ShowModal()
if res == wx.ID_CANCEL:
return False
elif res == wx.ID_YES:
self.save(None)
return True
def new(self, event):
if self.askForSavingIfNeed():
self.project = Project()
self.project.loadAllhiddenmodules(self)
self.project.initialFrame(self)
self.path = None
def open(self, event=None, path=None):
if self.askForSavingIfNeed():
if path == None:
dia = wx.FileDialog(self, "Select a file to open", wildcard="PySaved-files (*.pysa)|*.pysa", style=wx.FD_OPEN)
if dia.ShowModal() == wx.ID_OK:
path = dia.GetPath()
else: return
try:
print(u"Loading project from: '{0}'".format(path))
p = Project()
p.load(self, path)
self.project = p
self.project.loadAllhiddenmodules(self)
self.path = path
except:
wx.MessageDialog(self, u"Cannot open file: '{0}'".format(path), "Cannot open file", wx.ICON_ERROR).ShowModal()