-
Notifications
You must be signed in to change notification settings - Fork 0
/
berater.py
102 lines (75 loc) · 2.85 KB
/
berater.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
#!/usr/bin/python
# -*- coding: utf-8- -*-
"""
This Project is for calculating bils
"""
import sys
from PyQt4 import QtGui,QtCore
import editpref
import monthlist
import newmonth
import settings
import editmonth
class beraterApp(QtGui.QWidget):
def __init__(self,berater):
super(beraterApp, self).__init__()
self.berater = berater
self.initUI()
### Init The Window
def initUI(self):
self.setWindowTitle('XBerater') #
# self.setWindowIcon(QtGui.QIcon('icon.png')) # set Icon (not yet)
### Statusbar
# self.statusBar().showMessage('')
### Menubar
exitAction = QtGui.QAction(QtGui.QIcon('exit.png'),'&Beenden',self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip('Programm Beenden')
exitAction.triggered.connect(QtGui.qApp.quit)
# menubar = self.menuBar()
# fileMenu = menubar.addMenu('&Datei')
# fileMenu.addAction(exitAction)
### Add COntainer
vbox = QtGui.QVBoxLayout()
vbox.addStretch(1)
### Add Buttons of Main-Window
btnOpenMonth = QtGui.QPushButton(u"Monat öffnen")
btnOpenMonth.clicked.connect(self.monthList)
btnNewMonth = QtGui.QPushButton('Neuer Monat')
btnNewMonth.setToolTip('einen neuen Monat anlegen')
btnNewMonth.clicked.connect(self.newMonth)
vbox.addWidget(btnOpenMonth)
vbox.addWidget(btnNewMonth)
btnEditPref = QtGui.QPushButton(u"Beraterdaten")
btnEditPref.clicked.connect(self.editPref)
vbox.addWidget(btnEditPref)
btnQuit = QtGui.QPushButton('Beenden') # Exit Button
btnQuit.clicked.connect(QtCore.QCoreApplication.instance().quit ) # Exit function
vbox.addWidget(btnQuit)
self.setLayout(vbox)
self.show()
def closeEvent(self, event):
reply = QtGui.QMessageBox.question(self,'Beenden','Wirklich beenden?',QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
event.accept()
else:
event.ignore()
def monthList(self):
self.frmMonthList = monthlist.monthList(self.berater)
def newMonth(self):
self.frmNewMonth = newmonth.newMonth()
def editPref(self):
# print("Hallo welt")
self.frmPrefs = editpref.prefWindow(self.berater)
def main():
app = QtGui.QApplication(sys.argv) # Create new QT4 app
global beraterdata
beraterdata = settings.beraterData() # load settings and personal information
# window = beraterApp(berater) # create MainMenu
window = editmonth.monthWindow(beraterdata)
if (not beraterdata.saved):
QtGui.QMessageBox.critical(window,'Bitte Beraterdaten Eingeben','Konnte Beraterdaten nicht laden.\nBitte geben Sie die Beraterdaten ein.')
sys.exit(app.exec_())
if __name__ == '__main__' :
main()