-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathStartWindow.py
42 lines (34 loc) · 1.76 KB
/
StartWindow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
from traits.api import HasTraits, Bool, Button, File, Property
from traitsui.api import View, Item, Group, FileEditor, Handler, UItem, ListEditor
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'
class ClosingHandler(Handler):
def object_cont_changed(self, info):
info.ui.dispose()
tmpfile = open('tmpfile', 'w')
tmpfile.write(str(info.object.new_file)+'\n')
if info.object.new_file == False:
tmpfile.write(str(info.object.existing_file))
tmpfile.close()
os._exit(0)
class Start_File(HasTraits):
new_file = Bool
existing_file = File(False, editor = FileEditor(filter = ['*.pkl']))
cont = Button('Continue')
view2 = View(
Group(
Item(name = 'new_file', springy = False,
tooltip = "Clicking this button, followed by \"Continue\" will bring up a blank interface to start a new material."),
Item(name = 'existing_file', style = 'custom', height = -500, springy = False,
tooltip = "Use this file browser to find a previously saved .pkl file. Click on the file, followed by \"Continue\" to "\
"resume the calculation from the previously saved state."),
UItem('cont',
tooltip = "Click this button to proceed to the next window.",
enabled_when = '(existing_file) or (new_file)')
),
scrollable = True, resizable = True, width = 1000, height = 800, title = 'MatMCNP', handler=ClosingHandler(),
)
if __name__ == '__main__':
Begin = Start_File()
Begin.configure_traits(view=view2)