-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataOut.py
More file actions
82 lines (65 loc) · 2.57 KB
/
Copy pathDataOut.py
File metadata and controls
82 lines (65 loc) · 2.57 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import wx
class DataOutPut(wx.Dialog):
def __init__(self, parent, Flows):
super().__init__(parent,
title="Data Completed",
style=wx.DEFAULT_FRAME_STYLE)
'''
style=wx.DEFAULT_FRAME_STYLE &
~(wx.RESIZE_BORDER |
wx.MAXIMIZE_BOX |
wx.MINIMIZE_BOX))'''
self.parent = parent
self.Flows = Flows
self.InitUI()
def InitUI(self):
# self.EnableLayoutAdaptation(True)
self.sizer = wx.BoxSizer(wx.VERTICAL)
col1 = list(self.Flows.keys())
col2 = list(self.Flows.values())
col1.insert(0,'Line\nLabel')
col2.insert(0,'Flow\nft^3/s')
grd = wx.FlexGridSizer(len(col1)+1, 2, 10, 10)
n = 0
for itm in col1:
line=wx.StaticText(self, label=itm)
if n > 0:
col2[n] = round(col2[n],3)
flow=wx.StaticText(self, label=str(col2[n]))
n += 1
grd.AddMany([(line, 1, wx.EXPAND), (flow, 1, wx.EXPAND)])
sve = wx.Button(self, -1, "Save Results")
xit = wx.Button(self, -1, "Exit")
grd.AddMany([(sve), (xit)])
# bind the button events to handlers
self.Bind(wx.EVT_BUTTON, self.OnSave, sve)
self.Bind(wx.EVT_BUTTON, self.OnExit, xit)
note_sizer = wx.BoxSizer(wx.VERTICAL)
msg1 = 'The printed information includes;'
msg2 = '\n\t-pump data\n\t-control valve data'
msg3 = '\n\t-system data covering: \n\t\tflow,\n\t\tvelocity,'
msg4 = '\n\t\theadloss,\n\t\tReynolds,'
msg5 = '\n\t\tnode pressure\n\t\tetc.'
msg = msg1 + msg2 + msg3 + msg4 + msg5
note1 = wx.StaticText(self, label=msg)
msg6 = 'The pdf report file will be saved in'
msg7 = '\nthe same location as the database,\n'
msg8 = 'using the database file name.'
msg = msg6 + msg7 + msg8
note2 = wx.StaticText(self, label=msg)
note_sizer.Add(note1, 1, wx.ALIGN_CENTER)
note_sizer.Add((300,20))
note_sizer.Add(note2, 1, wx.ALIGN_CENTER)
self.SetSize(350,(250+45*len(col1)))
self.sizer.Add(grd, 0, wx.ALIGN_CENTER|wx.TOP, 10)
self.sizer.Add((10,25))
self.sizer.Add(note_sizer, 0, wx.ALIGN_CENTER)
self.SetSizer(self.sizer)
# self.Centre()
self.Show()
def OnExit(self, evt):
self.EndModal(False)
self.Destroy()
def OnSave(self, evt):
self.EndModal(True)
self.Destroy()