1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The molmol user function GUI elements."""
25
26
27 from os import sep
28 import wx
29
30
31 from base import UF_base, UF_page
32 from gui.paths import WIZARD_IMAGE_PATH
33 from gui.misc import gui_to_bool, gui_to_float, gui_to_int, gui_to_str, str_to_gui
34
35
36
38 """The container class for holding all GUI elements."""
39
40 - def clear_history(self):
41 """The molmol.clear_history user function."""
42
43
44 wizard = self.create_wizard(size_x=600, size_y=300, name='molmol.clear_history', uf_page=Clear_history_page, apply_button=False)
45 wizard.run()
46
47
54
55
62
63
80
81
88
89
96
97
104
105
112
113
114
115 -class Clear_history_page(UF_page):
116 """The molmol.clear_history() user function page."""
117
118
119 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
120 uf_path = ['molmol', 'clear_history']
121
122 - def add_contents(self, sizer):
123 """Add the specific GUI elements.
124
125 @param sizer: A sizer object.
126 @type sizer: wx.Sizer instance
127 """
128
129
130 - def on_execute(self):
131 """Execute the user function."""
132
133
134 self.execute('molmol.clear_history')
135
136
137
138 -class Command_page(UF_page):
139 """The molmol.command() user function page."""
140
141
142 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
143 uf_path = ['molmol', 'command']
144
145 - def add_contents(self, sizer):
146 """Add the specific GUI elements.
147
148 @param sizer: A sizer object.
149 @type sizer: wx.Sizer instance
150 """
151
152
153 self.command = self.input_field(sizer, "The Molmol command:", tooltip=self.uf._doc_args_dict['command'])
154
155
156 - def on_execute(self):
157 """Execute the user function."""
158
159
160 command = gui_to_str(self.command.GetValue())
161
162
163 self.execute('molmol.command', command=command)
164
165
166
167 -class Macro_apply_page(UF_page):
168 """The molmol.macro_apply() user function page."""
169
170
171 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
172 uf_path = ['molmol', 'macro_apply']
173 height_desc = 450
174
175 - def add_contents(self, sizer):
176 """Add the specific GUI elements.
177
178 @param sizer: A sizer object.
179 @type sizer: wx.Sizer instance
180 """
181
182
183 self.data_type = self.combo_box(sizer, "The data type:", choices=['s2', 's2f', 's2s', 'amp_fast', 'amp_slow', 'te', 'tf', 'ts', 'time_fast', 'time_slow', 'rex'], tooltip=self.uf._doc_args_dict['data_type'])
184
185
186 self.style = self.input_field(sizer, "The style:", tooltip=self.uf._doc_args_dict['style'])
187 self.style.SetValue(str_to_gui("classic"))
188
189
190 self.colour_start = self.input_field(sizer, "The starting colour:", tooltip=self.uf._doc_args_dict['colour_start'])
191
192
193 self.colour_end = self.input_field(sizer, "The ending colour:", tooltip=self.uf._doc_args_dict['colour_end'])
194
195
196 self.colour_list = self.input_field(sizer, "The colour list:", tooltip=self.uf._doc_args_dict['colour_list'])
197
198
199 - def on_execute(self):
200 """Execute the user function."""
201
202
203 data_type = gui_to_str(self.data_type.GetValue())
204 style = gui_to_str(self.style.GetValue())
205 colour_start = gui_to_str(self.colour_start.GetValue())
206 colour_end = gui_to_str(self.colour_end.GetValue())
207 colour_list = gui_to_str(self.colour_list.GetValue())
208
209
210 self.execute('molmol.macro_apply', data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list)
211
212
213
214 -class Macro_run_page(UF_page):
215 """The molmol.macro_run() user function page."""
216
217
218 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
219 uf_path = ['molmol', 'macro_run']
220
221 - def add_contents(self, sizer):
222 """Add the specific GUI elements.
223
224 @param sizer: A sizer object.
225 @type sizer: wx.Sizer instance
226 """
227
228
229 self.file = self.file_selection(sizer, "The macro file:", message="Molmol macro file selection", wildcard="Molmol macro files (*.mac)|*.mac;*.MAC", style=wx.FD_OPEN, tooltip=self.uf._doc_args_dict['file'])
230
231
232 - def on_execute(self):
233 """Execute the user function."""
234
235
236 file = gui_to_str(self.file.GetValue())
237 if not file:
238 return
239
240
241 self.execute('molmol.macro_run', file=file, dir=None)
242
243
244
245 -class Macro_write_page(UF_page):
246 """The molmol.macro_write() user function page."""
247
248
249 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
250 uf_path = ['molmol', 'macro_write']
251 height_desc = 400
252
253 - def add_contents(self, sizer):
254 """Add the specific GUI elements.
255
256 @param sizer: A sizer object.
257 @type sizer: wx.Sizer instance
258 """
259
260
261 self.file = self.file_selection(sizer, "The macro file:", message="Molmol macro file selection", wildcard="Molmol macro files (*.mac)|*.mac;*.MAC", style=wx.FD_SAVE, tooltip=self.uf._doc_args_dict['file'])
262
263
264 self.force = self.boolean_selector(sizer, "Force flag:", tooltip=self.uf._doc_args_dict['force'], default=True)
265
266
267 self.data_type = self.combo_box(sizer, "The data type:", choices=['s2', 's2f', 's2s', 'amp_fast', 'amp_slow', 'te', 'tf', 'ts', ' time_fast', 'time_slow', 'rex'], tooltip=self.uf._doc_args_dict['data_type'])
268
269
270 self.style = self.input_field(sizer, "The style:", tooltip=self.uf._doc_args_dict['style'])
271 self.style.SetValue(str_to_gui("classic"))
272
273
274 self.colour_start = self.input_field(sizer, "The starting colour:", tooltip=self.uf._doc_args_dict['colour_start'])
275
276
277 self.colour_end = self.input_field(sizer, "The ending colour:", tooltip=self.uf._doc_args_dict['colour_end'])
278
279
280 self.colour_list = self.input_field(sizer, "The colour list:", tooltip=self.uf._doc_args_dict['colour_list'])
281
282
283 - def on_execute(self):
284 """Execute the user function."""
285
286
287 file = gui_to_str(self.file.GetValue())
288 if not file:
289 return
290
291
292 force = gui_to_bool(self.force.GetValue())
293
294
295 data_type = gui_to_str(self.data_type.GetValue())
296 style = gui_to_str(self.style.GetValue())
297 colour_start = gui_to_str(self.colour_start.GetValue())
298 colour_end = gui_to_str(self.colour_end.GetValue())
299 colour_list = gui_to_str(self.colour_list.GetValue())
300
301
302 self.execute('molmol.macro_write', data_type=data_type, style=style, colour_start=colour_start, colour_end=colour_end, colour_list=colour_list, file=file, dir=None, force=force)
303
304
305
306 -class Ribbon_page(UF_page):
307 """The molmol.ribbon() user function page."""
308
309
310 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
311 uf_path = ['molmol', 'ribbon']
312
313 - def add_contents(self, sizer):
314 """Add the specific GUI elements.
315
316 @param sizer: A sizer object.
317 @type sizer: wx.Sizer instance
318 """
319
320
321 - def on_execute(self):
322 """Execute the user function."""
323
324
325 self.execute('molmol.ribbon')
326
327
328
329 -class Tensor_pdb_page(UF_page):
330 """The molmol.tensor_pdb() user function page."""
331
332
333 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
334 uf_path = ['molmol', 'tensor_pdb']
335 height_desc = 450
336
337 - def add_contents(self, sizer):
338 """Add the specific GUI elements.
339
340 @param sizer: A sizer object.
341 @type sizer: wx.Sizer instance
342 """
343
344
345 self.file = self.file_selection(sizer, "The tensor PDB file:", message="Tensor PDB file selection", wildcard="PDB files (*.pdb)|*.pdb;*.PDB", style=wx.FD_OPEN, tooltip=self.uf._doc_args_dict['file'])
346
347
348 - def on_execute(self):
349 """Execute the user function."""
350
351
352 file = gui_to_str(self.file.GetValue())
353
354
355 if not file:
356 return
357
358
359 self.execute('molmol.tensor_pdb', file=file)
360
361
362
363 -class View_page(UF_page):
364 """The molmol.view() user function page."""
365
366
367 image_path = WIZARD_IMAGE_PATH + 'molmol' + sep + 'molmol_logo.png'
368 uf_path = ['molmol', 'view']
369
370 - def add_contents(self, sizer):
371 """Add the specific GUI elements.
372
373 @param sizer: A sizer object.
374 @type sizer: wx.Sizer instance
375 """
376
377
378 - def on_execute(self):
379 """Execute the user function."""
380
381
382 self.execute('molmol.view')
383