source:
sasview/prview/PrView.py
@
8f20419d
Last change on this file since 8f20419d was 43db4a8, checked in by Mathieu Doucet <doucetm@…>, 14 years ago | |
---|---|
|
|
File size: 1.9 KB |
Rev | Line | |
---|---|---|
[aa4b8379] | 1 | import wx |
[f3d51f6] | 2 | #import gui_manager |
3 | from sans.guiframe import gui_manager | |
[4a5de6f] | 4 | |
5 | # For py2exe, import config here | |
6 | import local_config | |
[0fdcd1e] | 7 | import sys |
[aa4b8379] | 8 | from perspectives.pr.pr import NewPrFileEvent |
9 | ||
[0fdcd1e] | 10 | # Application dimensions |
11 | APP_HEIGHT = 780 | |
12 | APP_WIDTH = 850 | |
[4318af7f] | 13 | |
[aa4b8379] | 14 | class PrFrame(gui_manager.ViewerFrame): |
[7116b6e0] | 15 | """ |
16 | """ | |
[aa4b8379] | 17 | def _on_open(self, event): |
[7116b6e0] | 18 | """ |
19 | """ | |
[aa4b8379] | 20 | wx.PostEvent(self, NewPrFileEvent()) |
21 | ||
22 | class PrApp(gui_manager.ViewApp): | |
[7116b6e0] | 23 | """ |
24 | """ | |
[aa4b8379] | 25 | def OnInit(self): |
[7116b6e0] | 26 | """ |
27 | """ | |
[4d5005e] | 28 | # Check the size of the screen |
29 | # Add some padding to make sure to clear any OS tool bar | |
30 | screen_size = wx.GetDisplaySize() | |
31 | app_height = APP_HEIGHT if screen_size[1]>APP_HEIGHT else screen_size[1]-50 | |
32 | app_width = APP_WIDTH if screen_size[0]>APP_WIDTH else screen_size[0]-50 | |
33 | ||
[2a92852] | 34 | self.frame = PrFrame(None, -1, local_config.__appname__, |
[4d5005e] | 35 | window_height=app_height, window_width=app_width) |
[aa4b8379] | 36 | self.frame.Show(True) |
[4a5de6f] | 37 | |
[aa4b8379] | 38 | if hasattr(self.frame, 'special'): |
39 | self.frame.special.SetCurrent() | |
40 | self.SetTopWindow(self.frame) | |
41 | return True | |
42 | ||
[f3d51f6] | 43 | class SansView(): |
[7116b6e0] | 44 | """ |
45 | """ | |
[f3d51f6] | 46 | def __init__(self): |
47 | """ | |
48 | """ | |
49 | #from gui_manager import ViewApp | |
[aa4b8379] | 50 | #self.gui = gui_manager.ViewApp(0) |
51 | self.gui = PrApp(0) | |
[f3d51f6] | 52 | |
[4a5de6f] | 53 | # Add perspectives to the basic application |
54 | # Additional perspectives can still be loaded | |
55 | # dynamically | |
56 | import perspectives.pr as module | |
[ee6f84c] | 57 | self.pr_plug = module.Plugin(standalone=True) |
[aa4b8379] | 58 | self.gui.add_perspective(self.pr_plug) |
[4a5de6f] | 59 | |
60 | # Build the GUI | |
61 | self.gui.build_gui() | |
62 | ||
[f3d51f6] | 63 | # Set the application manager for the GUI |
64 | self.gui.set_manager(self) | |
65 | ||
66 | # Start the main loop | |
67 | self.gui.MainLoop() | |
[aa4b8379] | 68 | |
[f3d51f6] | 69 | |
70 | if __name__ == "__main__": | |
71 | sansview = SansView() |
Note: See TracBrowser
for help on using the repository browser.