Beremiz.py
changeset 1924 fc67b02d44e0
parent 1922 5353f4086a45
child 1926 d430a67c8462
equal deleted inserted replaced
1923:65edbc03fdbf 1924:fc67b02d44e0
    45         self.app_dir = paths.AbsDir(__file__)
    45         self.app_dir = paths.AbsDir(__file__)
    46         self.projectOpen = None
    46         self.projectOpen = None
    47         self.buildpath = None
    47         self.buildpath = None
    48         self.splash = None
    48         self.splash = None
    49         self.splashPath = self.Bpath("images", "splash.png")
    49         self.splashPath = self.Bpath("images", "splash.png")
       
    50         self.modules= ["BeremizIDE"]
    50 
    51 
    51     def Bpath(self, *args):
    52     def Bpath(self, *args):
    52         return os.path.join(self.app_dir, *args)
    53         return os.path.join(self.app_dir, *args)
    53 
    54 
    54     def ShowSplashScreen(self):
    55     def ShowSplashScreen(self):
   169             updateinfoThread.start()
   170             updateinfoThread.start()
   170             updateinfoThread.join(2)
   171             updateinfoThread.join(2)
   171             self.splash.SetText(text=self.updateinfo)
   172             self.splash.SetText(text=self.updateinfo)
   172 
   173 
   173     def ImportModules(self):
   174     def ImportModules(self):
   174         import BeremizIDE
   175         for modname in self.modules:
   175         self.frame_class = BeremizIDE.Beremiz
   176             mod = __import__(modname)
       
   177             setattr(self, modname, mod)
   176 
   178 
   177     def InstallExceptionHandler(self):
   179     def InstallExceptionHandler(self):
   178         import version
   180         import version
   179         import util.ExceptionHandler
   181         import util.ExceptionHandler
   180         util.ExceptionHandler.AddExceptHook(version.app_version)
   182         util.ExceptionHandler.AddExceptHook(version.app_version)
   181 
   183 
   182     def CreateUI(self,**kwargs):
   184     def CreateUI(self):
   183         self.frame = self.frame_class(None, self.projectOpen, self.buildpath, **kwargs)
   185         self.frame = self.BeremizIDE.Beremiz(None, self.projectOpen, self.buildpath)
   184 
   186 
   185     def ShowUI(self):
   187     def CloseSplash(self):
   186         if self.splash:
   188         if self.splash:
   187             self.splash.Close()
   189             self.splash.Close()
       
   190 
       
   191     def ShowUI(self):
   188         self.frame.Show()
   192         self.frame.Show()
   189 
   193 
   190     def PreStart(self):
   194     def PreStart(self):
   191         self.ProcessCommandLineArgs()
   195         self.ProcessCommandLineArgs()
   192         self.CreateApplication()
   196         self.CreateApplication()
   193         self.ShowSplashScreen()
   197         self.ShowSplashScreen()
   194         self.BackgroundInitialization()
   198         self.BackgroundInitialization()
       
   199         self.CreateUI()
       
   200         self.CloseSplash()
   195 
   201 
   196     def MainLoop(self):
   202     def MainLoop(self):
   197         self.app.MainLoop()
   203         self.app.MainLoop()
   198 
   204 
   199     def Start(self,**kwargs):
   205     def Start(self):
   200         self.PreStart()
   206         self.PreStart()
   201         self.CreateUI(**kwargs)
       
   202         self.ShowUI()
   207         self.ShowUI()
   203         self.MainLoop()
   208         self.MainLoop()
   204 
   209 
   205 
   210 
   206 if __name__ == '__main__':
   211 if __name__ == '__main__':