1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Package for the Bieri GUI interface for relax.
24
25 This GUI was announced in the post at http://www.nmr-relax.com/mail.gna.org/public/relax-devel/2009-11/msg00005.html.
26 """
27
28
29 import dep_check
30
31
32 import sys
33 from time import sleep
34 if dep_check.wx_module:
35 import wx
36
37
38 import generic_fns
39 from graphics import IMAGE_PATH
40 from relax_errors import RelaxError
41 from status import Status; status = Status()
42
43
44 from gui import relax_gui
45 from gui.uf_objects import Uf_storage; uf_store = Uf_storage()
46
47
48 __all__ = ['about',
49 'base_classes',
50 'controller',
51 'derived_wx_classes',
52 'errors',
53 'filedialog',
54 'fonts',
55 'icons',
56 'interpreter',
57 'menu',
58 'message',
59 'misc',
60 'paths',
61 'pipe_editor',
62 'references',
63 'relax_gui',
64 'relax_prompt',
65 'settings',
66 'wizard']
67
68
69
71 """The relax GUI wx application."""
72
73 - def __init__(self, script_file=None, redirect=False, filename=None, useBestVisual=False, clearSigInt=True):
74 """Initialise the wx.App.
75
76 @keyword redirect: Should sys.stdout and sys.stderr be redirected? Defaults to True on Windows and Mac, False otherwise. If filename is None then output will be redirected to a window that pops up as needed. (You can control what kind of window is created for the output by resetting the class variable outputWindowClass to a class of your choosing.)
77 @type redirect: bool
78 @keyword filename: The name of a file to redirect output to, if redirect is True.
79 @type filename: file object
80 @keyword useBestVisual: Should the app try to use the best available visual provided by the system (only relevant on systems that have more than one visual.) This parameter must be used instead of calling SetUseBestVisual later on because it must be set before the underlying GUI toolkit is initialized.
81 @type useBestVisual: bool
82 @keyword clearSigInt: Should SIGINT be cleared? This allows the app to terminate upon a Ctrl-C in the console like other GUI apps will.
83 @type clearSigInt: bool
84 @keyword script_file: The path of a relax script to execute.
85 @type script_file: str
86 """
87
88
89 if script_file:
90 generic_fns.script.script(script_file)
91
92
93 super(App, self).__init__(redirect=redirect, filename=filename, useBestVisual=useBestVisual, clearSigInt=clearSigInt)
94
95
97 """Build the application, showing a splash screen first."""
98
99
100 self.show_splash()
101
102
103 self.gui = relax_gui.Main(parent=None, id=-1, title="")
104
105
106 self.SetTopWindow(self.gui)
107
108
109 if status.show_gui:
110
111 sleep(1)
112
113
114 self.gui.Show()
115
116
117 return True
118
119
121 """Build and show the splash screen."""
122
123
124 bmp = wx.Bitmap(IMAGE_PATH+'relaxGUI_splash.png', wx.BITMAP_TYPE_ANY)
125
126
127 timeout = 2500
128
129
130 screen = wx.SplashScreen(bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, timeout, None, -1)
131