當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。