-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathGenInfoManager.py
More file actions
152 lines (102 loc) · 4.09 KB
/
Copy pathGenInfoManager.py
File metadata and controls
152 lines (102 loc) · 4.09 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# All works in this code have been curated by ECCC and licensed under the GNU General Public License v3.0.
# Read more: https://www.gnu.org/licenses/gpl-3.0.en.html
from GenInfoPanel import *
class GenInfoManager(object):
def __init__(self, mode, gui, manager=None):
self.gui = gui
self.gui.manager = self
self.manager = manager
self.fieldMissingTitle = "Mandatory Field Missing"
self.stnNameMissingMessage = "Station Name is missing"
self.stnNumMissingMessage = "Station Number at the Front Page of eHSN is missing"
# self.stnNumMatchingMessage = "The station ID in the file you selected({0}) does not match the station ID of eHSN({1})."
self.stnNumMatchingMessage = "The Station Numbers don't match: \n\neHSN:\t{1}\nQ-mmt File:\t{0}"
self.stnNumMatchingTitle = "Station Number is not matching"
self.stnDateMatchingMessage = "The Measurement Dates don't match: \n\neHSN: {1}\nQ-mmt File: {0}\n\nContinue anyway?"
self.stnDateMatchingTitle = "Date is not matching"
self.mode = mode
self.Init()
def Init(self):
if self.mode == "DEBUG":
print("GenInfoControl")
def updateNumbers(self, items):
self.stnNumCmboPopup = ComboCtrlPopup()
self.gui.stnNumCmbo.SetPopupControl(self.stnNumCmboPopup)
self.stnNumCmboPopup.AddItems(items)
self.gui.vbox.Layout()
self.gui.Update()
#vbox sizer
def GetVbox(self):
return self.gui.GetVbox()
#Station Number Ctrl
@property
def stnNumCmbo(self):
return self.gui.GetStnNumCmbo()
@stnNumCmbo.setter
def stnNumCmbo(self, stnNumCmbo):
self.gui.SetStnNumCmbo(stnNumCmbo)
#Date Ctrl
@property
def datePicker(self):
return self.gui.GetDatePicker()
@datePicker.setter
def datePicker(self, datePicker):
self.gui.SetDatePicker(datePicker)
#Station Name Ctrl
@property
def stnName(self):
return self.gui.GetStnName()
@stnName.setter
def stnName(self, stnName):
self.gui.SetStnName(stnName)
def GetStnNameCtrl(self):
return self.gui.stnNameCtrl
#Time Zone ComboBox
@property
def tzCmbo(self):
return self.gui.GetTzCmbo()
@tzCmbo.setter
def tzCmbo(self, tzCmbo):
self.gui.SetTzCmbo(tzCmbo)
def mandatoryChecking(self):
if (self.stnNumCmbo == ""):
empty = wx.MessageDialog(None, self.stnNumMissingMessage, self.fieldMissingTitle, wx.OK | wx.ICON_ERROR)
empty.SetOKLabel("Close")
empty.ShowModal()
return True
# elif (self.stnNameCtrl == ""):
# empty = wx.MessageDialog(None, self.stnNameMissingMessage, self.fieldMissingTitle, wx.OK)
# empty.ShowModal()
# return True
else:
return False
def matchStation(self, stnId):
if (self.stnNumCmbo != stnId):
dlg = wx.MessageDialog(None, self.stnNumMatchingMessage.format(stnId, self.stnNumCmbo), self.stnNumMatchingTitle, wx.OK | wx.ICON_ERROR)
dlg.SetOKLabel("Close")
dlg.ShowModal()
return True
else:
return False
def matchDate(self, date):
if (self.datePicker != date):
dlg = wx.MessageDialog(None, self.stnDateMatchingMessage.format(date, self.datePicker), self.stnDateMatchingTitle, wx.YES_NO | wx.ICON_EXCLAMATION)
dlg.SetYesNoLabels("&Yes", "&No")
res = dlg.ShowModal()
return res
def GetStnNumCmboCtrl(self):
return self.gui.GetStnNumCmboCtrl()
def GetStnNumCmboCtrl(self):
return self.gui.GetStnNumCmboCtrl()
def GetStnNumCmboCtrl(self):
return self.gui.GetStnNumCmboCtrl()
def GetStnNumCmboCtrl(self):
return self.gui.GetStnNumCmboCtrl()
def main():
app = wx.App()
frame = wx.Frame(None)
GenInfoManager("DEBUG", GenInfoPanel("DEBUG", frame))
frame.Show()
app.MainLoop()
if __name__ == '__main__':
main()