-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlegitymizatorlib.py
377 lines (282 loc) · 15.2 KB
/
legitymizatorlib.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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 1.0.5 on Sun Oct 6 12:56:47 2024
#
import wx
# begin wxGlade: dependencies
import wx.adv
# end wxGlade
# begin wxGlade: extracode
import wx.lib.pdfviewer
# end wxGlade
class Legitymizator(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: Legitymizator.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE | wx.MAXIMIZE | wx.MINIMIZE
wx.Frame.__init__(self, *args, **kwds)
self.SetTitle("Legitymizator")
self.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Ubuntu"))
# Menu Bar
self.frame_menubar = wx.MenuBar()
wxglade_tmp_menu = wx.Menu()
item = wxglade_tmp_menu.Append(wx.ID_ANY, "&Nowa baza danych", "")
self.Bind(wx.EVT_MENU, self.onNewDb, item)
item = wxglade_tmp_menu.Append(wx.ID_ANY, u"&Otwórz istniejącą bazę danych", "")
self.Bind(wx.EVT_MENU, self.onOpenDb, item)
item = wxglade_tmp_menu.Append(wx.ID_ANY, "&Ustawienia bazy danych", "")
self.Bind(wx.EVT_MENU, self.onDbSettings, item)
self.frame_menubar.Append(wxglade_tmp_menu, "&Plik")
self.SetMenuBar(self.frame_menubar)
# Menu Bar end
self.statusbar = self.CreateStatusBar(1)
self.statusbar.SetStatusWidths([-1])
# statusbar fields
statusbar_fields = ["Legitymizator v0.1"]
for i in range(len(statusbar_fields)):
self.statusbar.SetStatusText(statusbar_fields[i], i)
self.mainPanel = wx.Panel(self, wx.ID_ANY)
self.mainPanel.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Ubuntu"))
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(sizer_3, 0, wx.EXPAND, 0)
label_9 = wx.StaticText(self.mainPanel, wx.ID_ANY, "Baza danych")
sizer_3.Add(label_9, 0, wx.ALL, 1)
self.dbNameStaticText = wx.StaticText(self.mainPanel, wx.ID_ANY, "-")
sizer_3.Add(self.dbNameStaticText, 0, wx.ALL, 1)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
self.documentListCtrl = wx.ListCtrl(self.mainPanel, wx.ID_ANY, style=wx.LC_HRULES | wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_VRULES)
self.documentListCtrl.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, 0, "Ubuntu"))
self.documentListCtrl.AppendColumn("Numer legitymacji", format=wx.LIST_FORMAT_LEFT, width=150)
self.documentListCtrl.AppendColumn("Imiona i nazwisko", format=wx.LIST_FORMAT_LEFT, width=300)
self.documentListCtrl.AppendColumn("PESEL", format=wx.LIST_FORMAT_LEFT, width=150)
self.documentListCtrl.AppendColumn("Blankiet", format=wx.LIST_FORMAT_LEFT, width=150)
sizer_2.Add(self.documentListCtrl, 1, wx.EXPAND, 0)
self.documentFormSizer = wx.BoxSizer(wx.VERTICAL)
sizer_2.Add(self.documentFormSizer, 2, wx.ALL | wx.EXPAND, 4)
grid_sizer_1 = wx.FlexGridSizer(10, 2, 2, 2)
self.documentFormSizer.Add(grid_sizer_1, 2, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 0)
label_1 = wx.StaticText(self.mainPanel, wx.ID_ANY, "Imiona i nazwisko")
grid_sizer_1.Add(label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fStudentName = wx.TextCtrl(self.mainPanel, wx.ID_ANY, "")
self.fStudentName.SetMinSize((300, 30))
grid_sizer_1.Add(self.fStudentName, 1, wx.ALIGN_CENTER | wx.ALL, 2)
label_8 = wx.StaticText(self.mainPanel, wx.ID_ANY, "PESEL")
grid_sizer_1.Add(label_8, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fPESEL = wx.TextCtrl(self.mainPanel, wx.ID_ANY, "", style=wx.TE_RIGHT)
self.fPESEL.SetMinSize((300, 30))
self.fPESEL.SetBackgroundColour(wx.Colour(255, 127, 0))
grid_sizer_1.Add(self.fPESEL, 1, wx.ALIGN_CENTER | wx.ALL, 2)
label_2 = wx.StaticText(self.mainPanel, wx.ID_ANY, "Data urodzenia")
label_2.SetMinSize((92, 16))
grid_sizer_1.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fBirthDate = wx.adv.GenericCalendarCtrl(self.mainPanel, wx.ID_ANY)
grid_sizer_1.Add(self.fBirthDate, 2, wx.ALIGN_CENTER | wx.ALL, 2)
label_4 = wx.StaticText(self.mainPanel, wx.ID_ANY, u"Nazwa i adres szkoły")
grid_sizer_1.Add(label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fSchool = wx.TextCtrl(self.mainPanel, wx.ID_ANY, "", style=wx.TE_MULTILINE)
self.fSchool.SetMinSize((300, 100))
grid_sizer_1.Add(self.fSchool, 2, wx.ALIGN_CENTER | wx.ALL, 2)
label_5 = wx.StaticText(self.mainPanel, wx.ID_ANY, u"Dyrektor szkoły")
grid_sizer_1.Add(label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fPrincipal = wx.TextCtrl(self.mainPanel, wx.ID_ANY, "")
self.fPrincipal.SetMinSize((300, 30))
grid_sizer_1.Add(self.fPrincipal, 1, wx.ALIGN_CENTER | wx.ALL, 2)
label_6 = wx.StaticText(self.mainPanel, wx.ID_ANY, "Data wydania")
label_6.SetMinSize((97, 19))
grid_sizer_1.Add(label_6, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fIssueDate = wx.adv.GenericCalendarCtrl(self.mainPanel, wx.ID_ANY)
grid_sizer_1.Add(self.fIssueDate, 2, wx.ALIGN_CENTER | wx.ALL, 2)
label_10 = wx.StaticText(self.mainPanel, wx.ID_ANY, "Numer legitymacji")
grid_sizer_1.Add(label_10, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.fIdNumber = wx.TextCtrl(self.mainPanel, wx.ID_ANY, "", style=wx.TE_RIGHT)
self.fIdNumber.SetMinSize((300, 30))
grid_sizer_1.Add(self.fIdNumber, 1, wx.ALIGN_CENTER | wx.ALL, 2)
label_11 = wx.StaticText(self.mainPanel, wx.ID_ANY, "Numer blankietu")
grid_sizer_1.Add(label_11, 0, 0, 0)
self.fCardNumber = wx.TextCtrl(self.mainPanel, wx.ID_ANY, "")
self.fCardNumber.SetMinSize((300, 30))
grid_sizer_1.Add(self.fCardNumber, 0, wx.ALIGN_CENTER, 0)
self.RecordChangeIndicator = wx.StaticText(self.mainPanel, wx.ID_ANY, "Niezapisane zmiany", style=wx.ALIGN_CENTER_HORIZONTAL)
self.RecordChangeIndicator.SetBackgroundColour(wx.Colour(255, 127, 0))
self.RecordChangeIndicator.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, 0, ""))
self.RecordChangeIndicator.Hide()
grid_sizer_1.Add(self.RecordChangeIndicator, 0, wx.ALIGN_CENTER | wx.ALL, 5)
grid_sizer_1.Add((20, 20), 1, wx.EXPAND, 0)
sizer_4 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1.Add(sizer_4, 1, wx.EXPAND, 0)
self.GenerateFileButton = wx.Button(self.mainPanel, wx.ID_ANY, "Generuj plik PDF")
sizer_4.Add(self.GenerateFileButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 2)
self.PrintButton = wx.Button(self.mainPanel, wx.ID_ANY, u"Wyślij PDF do druku")
sizer_4.Add(self.PrintButton, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.SaveRecordButton = wx.Button(self.mainPanel, wx.ID_ANY, "Zapisz rekord w bazie danych")
sizer_4.Add(self.SaveRecordButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 2)
self.NewRecordButton = wx.Button(self.mainPanel, wx.ID_ANY, "Nowy rekord")
sizer_4.Add(self.NewRecordButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 2)
grid_sizer_1.Add((20, 20), 1, wx.EXPAND, 0)
sizer_8 = wx.BoxSizer(wx.VERTICAL)
sizer_2.Add(sizer_8, 1, wx.ALL | wx.EXPAND, 2)
label_7 = wx.StaticText(self.mainPanel, wx.ID_ANY, u"Zdjęcie")
sizer_8.Add(label_7, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.photo = wx.StaticBitmap(self.mainPanel, wx.ID_ANY, wx.Bitmap(225, 307))
self.photo.SetMinSize((225, 307))
sizer_8.Add(self.photo, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 0)
self.editPhotoSwitch = wx.ToggleButton(self.mainPanel, wx.ID_ANY, u"Modyfikacja zdjęcia")
self.editPhotoSwitch.Enable(False)
sizer_8.Add(self.editPhotoSwitch, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 3)
self.loadFileButton = wx.Button(self.mainPanel, wx.ID_ANY, u"Załaduj zdjęcie")
sizer_8.Add(self.loadFileButton, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
static_line_1 = wx.StaticLine(self.mainPanel, wx.ID_ANY)
sizer_8.Add(static_line_1, 0, wx.ALL | wx.EXPAND, 4)
label_3 = wx.StaticText(self.mainPanel, wx.ID_ANY, u"Podgląd legitymacji")
sizer_8.Add(label_3, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.IDView = wx.StaticBitmap(self.mainPanel, wx.ID_ANY, wx.Bitmap(400, 253))
self.IDView.SetMinSize((400, 253))
sizer_8.Add(self.IDView, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 4)
self.pdfViewer = wx.lib.pdfviewer.pdfViewer(self.mainPanel, wx.ID_ANY, pos=(-1,-1), size=(-1,-1), style=0)
self.pdfViewer.SetMinSize((400, 253))
self.pdfViewer.Hide()
sizer_8.Add(self.pdfViewer, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.viewGenerateButton = wx.Button(self.mainPanel, wx.ID_ANY, u"Generuj podgląd")
sizer_8.Add(self.viewGenerateButton, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
self.mainPanel.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
self.Centre()
self.Bind(wx.EVT_MOUSEWHEEL, self.photoMouseWheel, self.mainPanel)
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.onDocumentListCtrlRightClick, self.documentListCtrl)
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onDocumentListCtrlSelect, self.documentListCtrl)
self.Bind(wx.EVT_TEXT, self.onFStudentNameEnter, self.fStudentName)
self.Bind(wx.EVT_TEXT, self.onfPESELEnter, self.fPESEL)
self.Bind(wx.adv.EVT_CALENDAR_SEL_CHANGED, self.onFBirthDateChange, self.fBirthDate)
self.Bind(wx.EVT_TEXT, self.onFSchoolEnter, self.fSchool)
self.Bind(wx.EVT_TEXT, self.onFPrincipalEnter, self.fPrincipal)
self.Bind(wx.adv.EVT_CALENDAR_SEL_CHANGED, self.onFIssueDateChange, self.fIssueDate)
self.Bind(wx.EVT_TEXT, self.onFIdNumberEnter, self.fIdNumber)
self.Bind(wx.EVT_TEXT, self.onFCardNumberEnter, self.fCardNumber)
self.Bind(wx.EVT_BUTTON, self.onGenerateFileButton, self.GenerateFileButton)
self.Bind(wx.EVT_BUTTON, self.onPrintButton, self.PrintButton)
self.Bind(wx.EVT_BUTTON, self.onSaveRecordButton, self.SaveRecordButton)
self.Bind(wx.EVT_BUTTON, self.onNewRecordButton, self.NewRecordButton)
self.Bind(wx.EVT_LEFT_DOWN, self.photoMouseDown, self.photo)
self.Bind(wx.EVT_LEFT_UP, self.photoMouseUp, self.photo)
self.Bind(wx.EVT_MOTION, self.photoMotion, self.photo)
self.Bind(wx.EVT_MOUSEWHEEL, self.photoMouseWheel, self.photo)
self.Bind(wx.EVT_BUTTON, self.openPhotoFileSelector, self.loadFileButton)
self.Bind(wx.EVT_BUTTON, self.onViewGenerateButton, self.viewGenerateButton)
self.Bind(wx.EVT_CLOSE, self.onFrameClose, self)
# end wxGlade
def onNewDb(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onNewDb' not implemented!")
event.Skip()
def onOpenDb(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onOpenDb' not implemented!")
event.Skip()
def onDbSettings(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onDbSettings' not implemented!")
event.Skip()
def photoMouseWheel(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'photoMouseWheel' not implemented!")
event.Skip()
def onDocumentListCtrlRightClick(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onDocumentListCtrlRightClick' not implemented!")
event.Skip()
def onDocumentListCtrlSelect(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onDocumentListCtrlSelect' not implemented!")
event.Skip()
def onFStudentNameEnter(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFStudentNameEnter' not implemented!")
event.Skip()
def onfPESELEnter(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onfPESELEnter' not implemented!")
event.Skip()
def onFBirthDateChange(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFBirthDateChange' not implemented!")
event.Skip()
def onFSchoolEnter(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFSchoolEnter' not implemented!")
event.Skip()
def onFPrincipalEnter(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFPrincipalEnter' not implemented!")
event.Skip()
def onFIssueDateChange(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFIssueDateChange' not implemented!")
event.Skip()
def onFIdNumberEnter(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFIdNumberEnter' not implemented!")
event.Skip()
def onFCardNumberEnter(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFCardNumberEnter' not implemented!")
event.Skip()
def onGenerateFileButton(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onGenerateFileButton' not implemented!")
event.Skip()
def onPrintButton(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onPrintButton' not implemented!")
event.Skip()
def onSaveRecordButton(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onSaveRecordButton' not implemented!")
event.Skip()
def onNewRecordButton(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onNewRecordButton' not implemented!")
event.Skip()
def photoMouseDown(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'photoMouseDown' not implemented!")
event.Skip()
def photoMouseUp(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'photoMouseUp' not implemented!")
event.Skip()
def photoMotion(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'photoMotion' not implemented!")
event.Skip()
def openPhotoFileSelector(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'openPhotoFileSelector' not implemented!")
event.Skip()
def onViewGenerateButton(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onViewGenerateButton' not implemented!")
event.Skip()
def onFrameClose(self, event): # wxGlade: Legitymizator.<event_handler>
print("Event handler 'onFrameClose' not implemented!")
event.Skip()
# end of class Legitymizator
class DBSettings(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: DBSettings.__init__
kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.SetSize((436, 244))
self.SetTitle("Ustawienia bazy danych")
self.panel_1 = wx.Panel(self, wx.ID_ANY)
sizer_1 = wx.FlexGridSizer(3, 2, 0, 0)
label_1 = wx.StaticText(self.panel_1, wx.ID_ANY, u"Nazwa szkoły")
sizer_1.Add(label_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.schoolNameCtrl = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_MULTILINE)
self.schoolNameCtrl.SetMinSize((300, 130))
sizer_1.Add(self.schoolNameCtrl, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 2)
label_2 = wx.StaticText(self.panel_1, wx.ID_ANY, u"Dyrektor szkoły")
sizer_1.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
self.principalCtrl = wx.TextCtrl(self.panel_1, wx.ID_ANY, "")
self.principalCtrl.SetMinSize((300, 30))
sizer_1.Add(self.principalCtrl, 0, wx.ALIGN_CENTER | wx.ALL, 2)
sizer_1.Add((20, 20), 0, wx.EXPAND, 0)
self.settingsSaveButton = wx.Button(self.panel_1, wx.ID_ANY, "Zapisz zmiany")
sizer_1.Add(self.settingsSaveButton, 0, wx.ALIGN_CENTER, 0)
self.panel_1.SetSizer(sizer_1)
self.Layout()
self.Bind(wx.EVT_BUTTON, self.onSettingsSaveButton, self.settingsSaveButton)
# end wxGlade
def onSettingsSaveButton(self, event): # wxGlade: DBSettings.<event_handler>
print("Event handler 'onSettingsSaveButton' not implemented!")
event.Skip()
# end of class DBSettings
class LegitymizatorApp(wx.App):
def OnInit(self):
self.frame = Legitymizator(None, wx.ID_ANY, "")
self.SetTopWindow(self.frame)
self.frame.Show()
return True
# end of class LegitymizatorApp
if __name__ == "__main__":
Legitymizator = LegitymizatorApp(0)
Legitymizator.MainLoop()