More changes in Launcher. Modules to be loaded in the background are given in a list, and assigned as object attributes. Also splitted CreateUI into CloseSplashScreen and CreatueUI.
authorEdouard Tisserant
Fri, 02 Feb 2018 16:24:56 +0100
changeset 1924 fc67b02d44e0
parent 1923 65edbc03fdbf
child 1925 ecc53c5e6817
More changes in Launcher. Modules to be loaded in the background are given in a list, and assigned as object attributes. Also splitted CreateUI into CloseSplashScreen and CreatueUI.
Beremiz.py
--- a/Beremiz.py	Fri Feb 02 16:22:25 2018 +0100
+++ b/Beremiz.py	Fri Feb 02 16:24:56 2018 +0100
@@ -47,6 +47,7 @@
         self.buildpath = None
         self.splash = None
         self.splashPath = self.Bpath("images", "splash.png")
+        self.modules= ["BeremizIDE"]
 
     def Bpath(self, *args):
         return os.path.join(self.app_dir, *args)
@@ -171,20 +172,23 @@
             self.splash.SetText(text=self.updateinfo)
 
     def ImportModules(self):
-        import BeremizIDE
-        self.frame_class = BeremizIDE.Beremiz
+        for modname in self.modules:
+            mod = __import__(modname)
+            setattr(self, modname, mod)
 
     def InstallExceptionHandler(self):
         import version
         import util.ExceptionHandler
         util.ExceptionHandler.AddExceptHook(version.app_version)
 
-    def CreateUI(self,**kwargs):
-        self.frame = self.frame_class(None, self.projectOpen, self.buildpath, **kwargs)
-
-    def ShowUI(self):
+    def CreateUI(self):
+        self.frame = self.BeremizIDE.Beremiz(None, self.projectOpen, self.buildpath)
+
+    def CloseSplash(self):
         if self.splash:
             self.splash.Close()
+
+    def ShowUI(self):
         self.frame.Show()
 
     def PreStart(self):
@@ -192,13 +196,14 @@
         self.CreateApplication()
         self.ShowSplashScreen()
         self.BackgroundInitialization()
+        self.CreateUI()
+        self.CloseSplash()
 
     def MainLoop(self):
         self.app.MainLoop()
 
-    def Start(self,**kwargs):
+    def Start(self):
         self.PreStart()
-        self.CreateUI(**kwargs)
         self.ShowUI()
         self.MainLoop()