Commit 78e76ccd78cc642e5253e090604f35dc2383f362
1 parent
8a638525
Exists in
master
and in
67 other branches
FIX: splashscreen was empty on linux
Showing
1 changed file
with
29 additions
and
20 deletions
Show diff stats
invesalius/invesalius.py
| @@ -39,13 +39,14 @@ from wx.lib.pubsub import setuparg1# as psv1 | @@ -39,13 +39,14 @@ from wx.lib.pubsub import setuparg1# as psv1 | ||
| 39 | #from wx.lib.pubsub import Publisher | 39 | #from wx.lib.pubsub import Publisher |
| 40 | #import wx.lib.pubsub as ps | 40 | #import wx.lib.pubsub as ps |
| 41 | from wx.lib.pubsub import pub as Publisher | 41 | from wx.lib.pubsub import pub as Publisher |
| 42 | -import wx.lib.agw.advancedsplash as agw | ||
| 43 | 42 | ||
| 44 | -if sys.platform == 'linux2': | ||
| 45 | - _SplashScreen = agw.AdvancedSplash | ||
| 46 | -else: | ||
| 47 | - if sys.platform != 'darwin': | ||
| 48 | - _SplashScreen = wx.SplashScreen | 43 | +#import wx.lib.agw.advancedsplash as agw |
| 44 | +#if sys.platform == 'linux2': | ||
| 45 | +# _SplashScreen = agw.AdvancedSplash | ||
| 46 | +#else: | ||
| 47 | +# if sys.platform != 'darwin': | ||
| 48 | +# _SplashScreen = wx.SplashScreen | ||
| 49 | + | ||
| 49 | 50 | ||
| 50 | import gui.language_dialog as lang_dlg | 51 | import gui.language_dialog as lang_dlg |
| 51 | import i18n | 52 | import i18n |
| @@ -63,10 +64,9 @@ class InVesalius(wx.App): | @@ -63,10 +64,9 @@ class InVesalius(wx.App): | ||
| 63 | Initialize splash screen and main frame. | 64 | Initialize splash screen and main frame. |
| 64 | """ | 65 | """ |
| 65 | self.SetAppName("InVesalius 3") | 66 | self.SetAppName("InVesalius 3") |
| 66 | - splash = SplashScreen() | ||
| 67 | - self.control = splash.control | ||
| 68 | - self.frame = splash.main | ||
| 69 | - splash.Show() | 67 | + self.splash = SplashScreen() |
| 68 | + self.splash.Show() | ||
| 69 | + wx.CallLater(1000,self.Startup2) | ||
| 70 | return True | 70 | return True |
| 71 | 71 | ||
| 72 | def MacOpenFile(self, filename): | 72 | def MacOpenFile(self, filename): |
| @@ -76,6 +76,10 @@ class InVesalius(wx.App): | @@ -76,6 +76,10 @@ class InVesalius(wx.App): | ||
| 76 | path = os.path.abspath(filename) | 76 | path = os.path.abspath(filename) |
| 77 | Publisher.sendMessage('Open project', path) | 77 | Publisher.sendMessage('Open project', path) |
| 78 | 78 | ||
| 79 | + def Startup2(self): | ||
| 80 | + self.control = self.splash.control | ||
| 81 | + self.frame = self.splash.main | ||
| 82 | + | ||
| 79 | # ------------------------------------------------------------------ | 83 | # ------------------------------------------------------------------ |
| 80 | 84 | ||
| 81 | class SplashScreen(wx.SplashScreen): | 85 | class SplashScreen(wx.SplashScreen): |
| @@ -128,8 +132,6 @@ class SplashScreen(wx.SplashScreen): | @@ -128,8 +132,6 @@ class SplashScreen(wx.SplashScreen): | ||
| 128 | shutil.rmtree(invdir) | 132 | shutil.rmtree(invdir) |
| 129 | sys.exit() | 133 | sys.exit() |
| 130 | 134 | ||
| 131 | - | ||
| 132 | - | ||
| 133 | # Session file should be created... So we set the recent | 135 | # Session file should be created... So we set the recent |
| 134 | # choosen language | 136 | # choosen language |
| 135 | if (create_session): | 137 | if (create_session): |
| @@ -139,6 +141,7 @@ class SplashScreen(wx.SplashScreen): | @@ -139,6 +141,7 @@ class SplashScreen(wx.SplashScreen): | ||
| 139 | 141 | ||
| 140 | session.SaveConfigFileBackup() | 142 | session.SaveConfigFileBackup() |
| 141 | 143 | ||
| 144 | + | ||
| 142 | # Only after language was defined, splash screen will be | 145 | # Only after language was defined, splash screen will be |
| 143 | # shown | 146 | # shown |
| 144 | if lang: | 147 | if lang: |
| @@ -160,17 +163,23 @@ class SplashScreen(wx.SplashScreen): | @@ -160,17 +163,23 @@ class SplashScreen(wx.SplashScreen): | ||
| 160 | id=-1, | 163 | id=-1, |
| 161 | parent=None) | 164 | parent=None) |
| 162 | self.Bind(wx.EVT_CLOSE, self.OnClose) | 165 | self.Bind(wx.EVT_CLOSE, self.OnClose) |
| 166 | + wx.Yield() | ||
| 167 | + wx.CallLater(200,self.Startup) | ||
| 168 | + | ||
| 163 | 169 | ||
| 164 | - # Importing takes sometime, therefore it will be done | ||
| 165 | - # while splash is being shown | ||
| 166 | - from gui.frame import Frame | ||
| 167 | - from control import Controller | ||
| 168 | - from project import Project | 170 | + def Startup(self): |
| 171 | + # Importing takes sometime, therefore it will be done | ||
| 172 | + # while splash is being shown | ||
| 173 | + from gui.frame import Frame | ||
| 174 | + from control import Controller | ||
| 175 | + from project import Project | ||
| 176 | + | ||
| 177 | + self.main = Frame(None) | ||
| 178 | + self.control = Controller(self.main) | ||
| 179 | + | ||
| 180 | + self.fc = wx.FutureCall(1, self.ShowMain) | ||
| 169 | 181 | ||
| 170 | - self.main = Frame(None) | ||
| 171 | - self.control = Controller(self.main) | ||
| 172 | 182 | ||
| 173 | - self.fc = wx.FutureCall(1, self.ShowMain) | ||
| 174 | 183 | ||
| 175 | def OnClose(self, evt): | 184 | def OnClose(self, evt): |
| 176 | # Make sure the default handler runs too so this window gets | 185 | # Make sure the default handler runs too so this window gets |