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