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 pymol 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 pymol.clear_history user function."""
42
43
44 wizard = self.create_wizard(size_x=600, size_y=300, name='pymol.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 pymol.clear_history() user function page."""
117
118
119 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
120 uf_path = ['pymol', '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('pymol.clear_history')
135
136
137
138 -class Command_page(UF_page):
139 """The pymol.command() user function page."""
140
141
142 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
143 uf_path = ['pymol', '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 PyMOL 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('pymol.command', command=command)
164
165
166
167 -class Macro_apply_page(UF_page):
168 """The pymol.macro_apply() user function page."""
169
170
171 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
172 uf_path = ['pymol', '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('pymol.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 Ribbon_page(UF_page):
215 """The pymol.ribbon() user function page."""
216
217
218 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
219 uf_path = ['pymol', 'ribbon']
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 - def on_execute(self):
230 """Execute the user function."""
231
232
233 self.execute('pymol.ribbon')
234
235
236
237 -class Macro_run_page(UF_page):
238 """The pymol.macro_run() user function page."""
239
240
241 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
242 uf_path = ['pymol', 'macro_run']
243
244 - def add_contents(self, sizer):
245 """Add the specific GUI elements.
246
247 @param sizer: A sizer object.
248 @type sizer: wx.Sizer instance
249 """
250
251
252 self.file = self.file_selection(sizer, "The macro file:", message="PyMOL macro file selection", wildcard="PyMOL macro files (*.pml)|*.pml;*.PML", style=wx.FD_OPEN, tooltip=self.uf._doc_args_dict['file'])
253
254
255 - def on_execute(self):
256 """Execute the user function."""
257
258
259 file = gui_to_str(self.file.GetValue())
260 if not file:
261 return
262
263
264 self.execute('pymol.macro_run', file=file, dir=None)
265
266
267
268 -class Macro_write_page(UF_page):
269 """The pymol.macro_write() user function page."""
270
271
272 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
273 uf_path = ['pymol', 'macro_write']
274 height_desc = 400
275
276 - def add_contents(self, sizer):
277 """Add the specific GUI elements.
278
279 @param sizer: A sizer object.
280 @type sizer: wx.Sizer instance
281 """
282
283
284 self.file = self.file_selection(sizer, "The macro file:", message="PyMOL macro file selection", wildcard="PyMOL macro files (*.pml)|*.pml;*.PML", style=wx.FD_SAVE, tooltip=self.uf._doc_args_dict['file'])
285
286
287 self.force = self.boolean_selector(sizer, "Force flag:", tooltip=self.uf._doc_args_dict['force'], default=True)
288
289
290 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'])
291
292
293 self.style = self.input_field(sizer, "The style:", tooltip=self.uf._doc_args_dict['style'])
294 self.style.SetValue(str_to_gui("classic"))
295
296
297 self.colour_start = self.input_field(sizer, "The starting colour:", tooltip=self.uf._doc_args_dict['colour_start'])
298
299
300 self.colour_end = self.input_field(sizer, "The ending colour:", tooltip=self.uf._doc_args_dict['colour_end'])
301
302
303 self.colour_list = self.input_field(sizer, "The colour list:", tooltip=self.uf._doc_args_dict['colour_list'])
304
305
306 - def on_execute(self):
307 """Execute the user function."""
308
309
310 file = gui_to_str(self.file.GetValue())
311
312
313 force = gui_to_bool(self.force.GetValue())
314
315
316 data_type = gui_to_str(self.data_type.GetValue())
317 style = gui_to_str(self.style.GetValue())
318 colour_start = gui_to_str(self.colour_start.GetValue())
319 colour_end = gui_to_str(self.colour_end.GetValue())
320 colour_list = gui_to_str(self.colour_list.GetValue())
321
322
323 self.execute('pymol.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)
324
325
326
327 -class Tensor_pdb_page(UF_page):
328 """The pymol.tensor_pdb() user function page."""
329
330
331 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
332 uf_path = ['pymol', 'tensor_pdb']
333 height_desc = 450
334
335 - def add_contents(self, sizer):
336 """Add the specific GUI elements.
337
338 @param sizer: A sizer object.
339 @type sizer: wx.Sizer instance
340 """
341
342
343 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'])
344
345
346 - def on_execute(self):
347 """Execute the user function."""
348
349
350 file = gui_to_str(self.file.GetValue())
351
352
353 if not file:
354 return
355
356
357 self.execute('pymol.tensor_pdb', file=file)
358
359
360
361 -class View_page(UF_page):
362 """The pymol.view() user function page."""
363
364
365 image_path = WIZARD_IMAGE_PATH + 'pymol' + sep + 'pymol.png'
366 uf_path = ['pymol', 'view']
367
368 - def add_contents(self, sizer):
369 """Add the specific GUI elements.
370
371 @param sizer: A sizer object.
372 @type sizer: wx.Sizer instance
373 """
374
375
376 - def on_execute(self):
377 """Execute the user function."""
378
379
380 self.execute('pymol.view')
381