[eaeb13e] | 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 | # For py2exe, import config here |
---|
| 13 | import local_config |
---|
| 14 | import logging |
---|
| 15 | |
---|
| 16 | # Application dimensions |
---|
| 17 | APP_HEIGHT = 800 |
---|
| 18 | APP_WIDTH = 1000 |
---|
| 19 | |
---|
| 20 | class SansViewApp(gui_manager.ViewApp): |
---|
| 21 | def OnInit(self): |
---|
| 22 | screen_size = wx.GetDisplaySize() |
---|
| 23 | app_height = APP_HEIGHT if screen_size[1]>APP_HEIGHT else screen_size[1]-50 |
---|
| 24 | app_width = APP_WIDTH if screen_size[0]>APP_WIDTH else screen_size[0]-50 |
---|
| 25 | |
---|
| 26 | self.frame = gui_manager.ViewerFrame(None, -1, local_config.__appname__, |
---|
| 27 | window_height=app_height, window_width=app_width) |
---|
| 28 | self.frame.Show(True) |
---|
| 29 | |
---|
| 30 | if hasattr(self.frame, 'special'): |
---|
| 31 | self.frame.special.SetCurrent() |
---|
| 32 | self.SetTopWindow(self.frame) |
---|
| 33 | return True |
---|
| 34 | |
---|
| 35 | class SansView(): |
---|
| 36 | |
---|
| 37 | def __init__(self): |
---|
| 38 | """ |
---|
| 39 | Initialize application |
---|
| 40 | """ |
---|
| 41 | #from gui_manager import ViewApp |
---|
| 42 | self.gui = SansViewApp(0) |
---|
| 43 | |
---|
| 44 | # Add perspectives to the basic application |
---|
| 45 | # Additional perspectives can still be loaded |
---|
| 46 | # dynamically |
---|
| 47 | # Note: py2exe can't find dynamically loaded |
---|
| 48 | # modules. We load the fitting module here |
---|
| 49 | # to ensure a complete Windows executable build. |
---|
| 50 | |
---|
| 51 | # Simulation perspective |
---|
| 52 | #import perspectives.simulation as module |
---|
| 53 | #self.gui.add_perspective(module.Plugin()) |
---|
| 54 | |
---|
| 55 | # Build the GUI |
---|
| 56 | self.gui.build_gui() |
---|
| 57 | |
---|
| 58 | # Set the application manager for the GUI |
---|
| 59 | self.gui.set_manager(self) |
---|
| 60 | |
---|
| 61 | # Start the main loop |
---|
| 62 | self.gui.MainLoop() |
---|
| 63 | |
---|
| 64 | if __name__ == "__main__": |
---|
| 65 | sansview = SansView() |
---|