Cat
gui.py
Go to the documentation of this file.
1 #----------------------------------------------------------------------------
2 # Name:
3 # Purpose:
4 #
5 # Author:
6 #
7 # Created:
8 #----------------------------------------------------------------------------
9 
10 # FIXME List:
11 # *
12 # *
13 # *
14 # TODO List:
15 # *
16 # *
17 # *
18 # *
19 
20 import sys, os, time, traceback, types
21 
22 # Used to guarantee to use at least Wx2.8
23 import wxversion
24 wxversion.ensureMinimal('2.8')
25 
26 import wx # This module uses the new wx namespace
27 import wx.aui
28 import wx.html
29 import wx.xrc as xrc
30 
31 import arguments
32 import shell
33 
34 from AppFrame import *
35 from libCatKernel import *
36 
37 from tools import *
38 
39 #import matplotlib as mpl
40 #import matplotlib.pyplot as plt
41 #from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
42 #from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar
43 
44 #---------------------------------------------------------------------------
45 class SplashScreen(wx.SplashScreen):
46  def __init__(self, file):
47  bmp = wx.Bitmap(file)
48  wx.SplashScreen.__init__(self, bmp,
49  wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
50  5000, None, -1)
51  self.Bind(wx.EVT_CLOSE, self.OnClose)
52  # self.fc = wx.FutureCall(2000, gui.ShowMain())
53 
54  def OnClose(self, evt):
55  # Make sure the default handler runs too so this window gets
56  # destroyed
57  evt.Skip()
58  self.Hide()
59  # if the timer is still running then go ahead and show the
60  # main frame now
61  if self.fc.IsRunning():
62  self.fc.Stop()
63  gui.ShowMain()
64  if self.fc.IsRunning():
65  self.Raise()
66  gui.ShowTips()
67 
68 #---------------------------------------------------------------------------
69 class Gui(wx.App):
70  def OnInit(self, app=None):
71  """
72  Create and show the splash screen.
73  It will then create and show the main frame when it is time to do so.
74  """
75  self.appFrame=AppFrame(cat, None, "CAT Application")
76  self.SetTopWindow(self.appFrame)
77  return True
78  def Start(self):
79  if args.banner:
80  splash = SplashScreen(os.path.join(os.environ.get("CATPYTHONROOT"),
81  "python/images/cat.bmp"))
82  splash.Show()
83  else:
84  self.ShowMain()
85  #ShowTip()
86  def ShowMain(self):
87  self.appFrame.Show()
88  def ShowTips(self):
89  wx.CallAfter(self.appFrame.ShowTip)
90 
91 #---------------------------------------------------------------------------
92 # main
93 def main( argsCat=None ):
94 
99  global args
100  global cat
101  global gui
102 
103  args = argsCat
105  shell( cat, args )
106 # plt.ioff()
107  gui=Gui()
108  gui.Start()
109  gui.MainLoop()
110 
111 #---------------------------------------------------------------------------
112 mainOverview = """<html><body>
113 <h2>CAT Application</h2>
114 
115 <p> CAT is an application to perform
116 """
117 #----------------------------------------------------------------------------
118 #----------------------------------------------------------------------------
119 if __name__ == '__main__':
120  __name__ = 'Main'
121  main()
122 #----------------------------------------------------------------------------
123 
def ShowMain(self)
Definition: gui.py:86
def OnInit(self, app=None)
Definition: gui.py:70
Definition: gui.py:69
def Start(self)
Definition: gui.py:78
appFrame
Definition: gui.py:75
def main(argsCat=None)
Definition: gui.py:93
Definition: shell.py:1
def OnClose(self, evt)
Definition: gui.py:54
def __init__(self, file)
Definition: gui.py:46
def ShowTips(self)
Definition: gui.py:88