source: sasview/prview/sansview.py @ 5cc847c

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 5cc847c was 5cc847c, checked in by Mathieu Doucet <doucetm@…>, 15 years ago

prview: avoid warning logging when executing and use logging module instead (helps user experience with windwos executable)

  • Property mode set to 100644
File size: 1.7 KB
Line 
1import wx
2#import gui_manager
3from sans.guiframe import gui_manager
4
5# Avoid warnings when transforming into an executable
6import warnings
7warnings.simplefilter("ignore")
8
9# For py2exe, import config here
10import local_config
11from perspectives.pr.pr import NewPrFileEvent
12
13# OS-dependent preferred height
14#TODO: refactor this
15_DEFAULT_HEIGHT=650
16import sys
17if sys.platform.count("darwin")>0:
18        _DEFAULT_HEIGHT=720
19
20class PrFrame(gui_manager.ViewerFrame):
21    def _on_open(self, event):
22        wx.PostEvent(self, NewPrFileEvent())
23
24class PrApp(gui_manager.ViewApp):
25    def OnInit(self):
26        #from gui_manager import ViewerFrame
27        self.frame = PrFrame(None, -1, local_config.__appname__, 
28                             window_height=_DEFAULT_HEIGHT, window_width=850)   
29        self.frame.Show(True)
30
31        if hasattr(self.frame, 'special'):
32            self.frame.special.SetCurrent()
33        self.SetTopWindow(self.frame)
34        return True
35   
36class SansView():
37   
38    def __init__(self):
39        """
40       
41        """
42        #from gui_manager import ViewApp
43        #self.gui = gui_manager.ViewApp(0)
44        self.gui = PrApp(0)
45       
46        # Add perspectives to the basic application
47        # Additional perspectives can still be loaded
48        # dynamically
49        import perspectives.pr as module
50        self.pr_plug = module.Plugin(standalone=True)
51        self.gui.add_perspective(self.pr_plug)
52           
53        # Build the GUI
54        self.gui.build_gui()
55       
56        # Set the application manager for the GUI
57        self.gui.set_manager(self)
58       
59        # Start the main loop
60        self.gui.MainLoop() 
61       
62
63if __name__ == "__main__": 
64    sansview = SansView()
Note: See TracBrowser for help on using the repository browser.