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


Python Project.loadFromFrame方法代码示例

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


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

示例1: MyFrame

# 需要导入模块: from Project import Project [as 别名]
# 或者: from Project.Project import loadFromFrame [as 别名]

#.........这里部分代码省略.........
            self.save(None)

    def exit(self, event):
        if self.askForSavingIfNeed() and not self.progress:
            print("\nQuit PySaved...")
            sys.exit(0)

    def search_icon(self, event):
        dia = wx.FileDialog(self, "Select a file to open", wildcard="Icon-files (*.ico)|*.ico", style=wx.FD_OPEN)
        if dia.ShowModal() == wx.ID_OK:
            self.input_icon.SetValue(dia.GetPath())

    def search_execfile(self, event):
        dia = wx.FileDialog(self, "Select a file to open", wildcard="Python-files (*.py)|*.py", style=wx.FD_OPEN)
        if dia.ShowModal() == wx.ID_OK:
            self.input_execfile.SetValue(dia.GetPath())

    def addPath(self, event):
        dia = wx.DirDialog(self, "Select a dir")
        if dia.ShowModal() == wx.ID_OK:
            if dia.GetPath() not in self.project.pathstosearchin:
                self.project.pathstosearchin.append(dia.GetPath())
                self.project.loadAllhiddenmodules(self)
            
    def editPath(self, event):
        sel = self.list_pathstosearchin.GetSelection()
        strSel = self.list_pathstosearchin.GetStringSelection()
        if sel == -1: return
        
        while True:
            dia = wx.TextEntryDialog(self, u"Enter a new path for '{}'".format(strSel), "Edit Path", strSel)
            if dia.ShowModal() == wx.ID_OK:
                if dia.GetValue().strip() == "" or not os.path.exists(dia.GetValue()):
                    wx.MessageDialog(self, "Unknown path!", "", wx.ICON_ERROR).ShowModal()
                else:
                    self.project.pathstosearchin[sel] = dia.GetValue()
                    self.project.loadAllhiddenmodules(self)
                    break

    def delPath(self, event):
        sel = self.list_pathstosearchin.GetSelection()
        if sel == -1: return
        del(self.project.pathstosearchin[sel])
        self.project.loadAllhiddenmodules(self)

    def event_search_outpath(self, event):
        dia = wx.DirDialog(self, "Select a dir to save in")
        if dia.ShowModal() == wx.ID_OK:
            self.input_outpath.SetValue(dia.GetPath())

    def event_search_temppath(self, event):
        dia = wx.DirDialog(self, "Select a dir to save in")
        if dia.ShowModal() == wx.ID_OK:
            self.input_outpath.SetValue(dia.GetPath())

    def start(self, event):
        self.project.loadFromFrame(self)
        c = builder.Connector(self.project)
        thread.start_new(self.loop, (c,))
        thread.start_new(builder.build, (c,))
        thread.start_new(builder.log, (c,))
    
    def loop(self, c):
        def success():
            wx.MessageDialog(self, "Building package successful!", "Successful!", wx.ICON_INFORMATION).ShowModal()
        def error(fm):
            wx.MessageDialog(self, u"Error while building package:\n\n{}".format(fm), "Error!", wx.ICON_ERROR).ShowModal()
        def log(l):
            self.list_log.SetItems(l)
            self.list_log.Select(len(l)-1)
        
        self.progress = True
        wx.CallAfter(self.Disable)
        while True:
            time.sleep(0.1)
            
            wx.CallAfter(log, c.log)
                
            if c.finished:
                wx.CallAfter(success)
                break
            elif c.error:
                wx.CallAfter(error, c.errormsg)
                break
        
        wx.CallAfter(self.Enable, True)
        self.progress = False
    
    def about(self, event):
        info = wx.AboutDialogInfo()
        
        info.SetName("PySaved")
        info.SetVersion("0.1")
        info.SetCopyright("(c) 2015 by Arne Hannappel")
        info.AddArtist("Adrian Gisder")
        info.SetWebSite("http://www.arnehannappel.de/index.php/programme/pysaved")
        info.SetDescription("PySaved is a simple GUI for PyInstaller, a program that converts Python (2.6-2.7) programs into stand-alone executables.")
        info.SetLicence(statics.gplv2)
        
        wx.AboutBox(info)
开发者ID:akhof,项目名称:PySaved,代码行数:104,代码来源:frame.py


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