1 | """ |
---|
2 | This software was developed by the University of Tennessee as part of the |
---|
3 | Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
4 | project funded by the US National Science Foundation. |
---|
5 | |
---|
6 | See the license text in license.txt |
---|
7 | |
---|
8 | copyright 2009, University of Tennessee |
---|
9 | """ |
---|
10 | import wx |
---|
11 | from sans.guiframe import gui_manager |
---|
12 | from welcome_panel import WelcomePanel |
---|
13 | # For py2exe, import config here |
---|
14 | import local_config |
---|
15 | import logging |
---|
16 | |
---|
17 | # Application dimensions |
---|
18 | APP_HEIGHT = 800 |
---|
19 | APP_WIDTH = 1000 |
---|
20 | |
---|
21 | class SansViewApp(gui_manager.ViewApp): |
---|
22 | def OnInit(self): |
---|
23 | #from gui_manager import ViewerFrame |
---|
24 | self.frame = gui_manager.ViewerFrame(None, -1, local_config.__appname__, |
---|
25 | window_height=APP_HEIGHT, window_width=APP_WIDTH) |
---|
26 | self.frame.Show(True) |
---|
27 | |
---|
28 | if hasattr(self.frame, 'special'): |
---|
29 | self.frame.special.SetCurrent() |
---|
30 | self.SetTopWindow(self.frame) |
---|
31 | return True |
---|
32 | |
---|
33 | class SansView(): |
---|
34 | |
---|
35 | def __init__(self): |
---|
36 | """ |
---|
37 | |
---|
38 | """ |
---|
39 | #from gui_manager import ViewApp |
---|
40 | self.gui = SansViewApp(0) |
---|
41 | |
---|
42 | # Add perspectives to the basic application |
---|
43 | # Additional perspectives can still be loaded |
---|
44 | # dynamically |
---|
45 | # Note: py2exe can't find dynamically loaded |
---|
46 | # modules. We load the fitting module here |
---|
47 | # to ensure a complete Windows executable build. |
---|
48 | |
---|
49 | # P(r) perspective |
---|
50 | try: |
---|
51 | import sans.perspectives.pr as module |
---|
52 | fitting_plug = module.Plugin(standalone=False) |
---|
53 | self.gui.add_perspective(fitting_plug) |
---|
54 | except: |
---|
55 | logging.error("SansView: could not find P(r) plug-in module") |
---|
56 | |
---|
57 | # Fitting perspective |
---|
58 | import perspectives.fitting as module |
---|
59 | fitting_plug = module.Plugin() |
---|
60 | self.gui.add_perspective(fitting_plug) |
---|
61 | |
---|
62 | # Add welcome page |
---|
63 | self.gui.set_welcome_panel(WelcomePanel) |
---|
64 | |
---|
65 | # Build the GUI |
---|
66 | self.gui.build_gui() |
---|
67 | |
---|
68 | # Set the application manager for the GUI |
---|
69 | self.gui.set_manager(self) |
---|
70 | |
---|
71 | # Start the main loop |
---|
72 | self.gui.MainLoop() |
---|
73 | |
---|
74 | |
---|
75 | if __name__ == "__main__": |
---|
76 | sansview = SansView() |
---|