Commit cef887d7c5d7a954c87f67ef4293ae5d462c052a

Authored by tatiana
1 parent b8fe1117

ADD: First version of splash window (#51)

Showing 1 changed file with 42 additions and 12 deletions   Show diff stats
invesalius/invesalius.py
... ... @@ -41,16 +41,50 @@ from control import Controller
41 41 from project import Project
42 42 from session import Session
43 43  
44   -class InVesalius(wx.App):
45   - def OnInit(self):
  44 +class SplashScreen(wx.SplashScreen):
  45 + def __init__(self):
  46 + bmp = wx.Image("../icons/splash_en.png").ConvertToBitmap()
  47 + wx.SplashScreen.__init__(self, bmp,
  48 + wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
  49 + 1500, None, -1)
  50 + self.Bind(wx.EVT_CLOSE, self.OnClose)
  51 +
46 52 self.main = Frame(None)
47 53 self.control = Controller(self.main)
  54 + self.fc = wx.FutureCall(1000, self.ShowMain)
  55 +
  56 + def OnClose(self, evt):
  57 + # Make sure the default handler runs too so this window gets
  58 + # destroyed
  59 + evt.Skip()
  60 + self.Hide()
  61 +
  62 + # if the timer is still running then go ahead and show the
  63 + # main frame now
  64 + if self.fc.IsRunning():
  65 + self.fc.Stop()
  66 + self.ShowMain()
  67 +
  68 +
  69 + def ShowMain(self):
  70 + self.main.Show()
  71 +
  72 + if self.fc.IsRunning():
  73 + self.Raise()
  74 +
  75 +class InVesalius(wx.App):
  76 + def OnInit(self):
  77 + #self.main = Frame(None)
  78 + #self.control = Controller(self.main)
48 79 self.SetAppName("InVesalius 3")
  80 + splash = SplashScreen()
  81 + splash.Show()
  82 +
49 83 return True
50 84  
51   - def ShowFrame(self):
52   - self.main.Show()
53   - self.SetTopWindow(self.main)
  85 + #def ShowFrame(self):
  86 + # self.main.Show()
  87 + # self.SetTopWindow(self.main)
54 88  
55 89 def parse_comand_line():
56 90 """
... ... @@ -64,8 +98,6 @@ def parse_comand_line():
64 98 parser.add_option("-i", "--import", action="store", dest="dicom_dir")
65 99  
66 100 options, args = parser.parse_args()
67   - print "opt", options
68   - print "arg", args
69 101  
70 102 if options.debug:
71 103 # The user passed the debug option?
... ... @@ -102,21 +134,19 @@ def print_events(data):
102 134 def main():
103 135 application = InVesalius(0)
104 136 parse_comand_line()
105   - application.ShowFrame()
  137 + #application.ShowFrame()
106 138 application.MainLoop()
107 139  
108 140 if __name__ == '__main__':
109 141  
110   - #Necessary in case run from executable
  142 + # Needed in win 32 exe
111 143 if hasattr(sys,"frozen") and sys.frozen == "windows_exe":
112 144 multiprocessing.freeze_support()
113 145  
114   - #Remove wxPython log
  146 + # wxPython log
115 147 #sys.stdout = open("stdout.log" ,"w")
116 148 sys.stderr = open("stderr.log", "w")
117 149  
118   - print "Executavel...."
119   -
120 150 # Add current directory to PYTHONPATH
121 151 sys.path.append(".")
122 152  
... ...