Example #1
0
 def createMonth(self):
     monat = month.lsthvmonth(self.beraterdata)                    # create new Month-Object
     monat.data["month"] =  self.monthselector.currentIndex()+1    # examine Month-Number from ComboBox
     monat.data["year"] = self.edtyear.value()                     # examine year from SpinBox
     monat.determineFee() 
     self.monthWin = editmonth.monthWindow(self.beraterdata,monat) # open new Month in editmonth-Window
     self.close()
Example #2
0
 def findMonths(self):
     fileList = os.listdir(".")  		# list of all Files
     fileList.sort() 			# sort files by name
     for filename in sorted(fileList) : 		# iterate through all files
         if filename.find("monat.yaml") != -1:   # only continue with month-yaml-files
             monat = month.lsthvmonth(self.beraterdata)
             if (monat.open(filename)): 	# Only append to , if valid month
                 self.monthlist.append(monat)
             else:
                 print("rejecting %s" %(filename))
Example #3
0
    def __init__(self,berater,monat=None):
        super(monthWindow,self).__init__()
        global beraterdata
        beraterdata = berater
        if (monat == None):
            monat = month.lsthvmonth(beraterdata)
            monthlist=['']
            fileList = os.listdir(".")                  # list of all Files
            fileList.sort()                         # sort files by name
            for filename in sorted(fileList) :                 # iterate through all files
                if filename.find("monat.yaml") != -1:   # only continue with month-yaml-files
                    monatfile = month.lsthvmonth(beraterdata)
                    if (monatfile.open(filename)):         # Only append to , if valid month
                        monthlist.append(filename)
            lastmonth = date.fromtimestamp(time.time() - (30 * 24 * 60 * 60))
            lastmonthfilename = "%4i%02imonat.yaml" %(int(lastmonth.year),int(lastmonth.month))
            if (lastmonthfilename in set(monthlist)):
                monat.open(lastmonthfilename)
            else:
                monat.data["month"] =   lastmonth.month        # examine Month-Number from ComboBox
                monat.data["year"] =    lastmonth.year                         # examine year from SpinBox
                monat.fee = monat.determineFee()

        self.monthwidget = monthWidget(beraterdata,monat)
        self.setWindowTitle('XBerater - Monat bearbeiten')                 #
        self.setCentralWidget(self.monthwidget)
        self.resize(840, 400)
        self.show()

        #Undo Stack
        self.undoStack = QtGui.QUndoStack()
        undoAction = self.monthwidget.undoStack.createUndoAction(self,self.tr("&Undo"))
   #     undoAction.setShortcuts(QtGui.QKeySequence.Undo)
        redoAction = self.monthwidget.undoStack.createRedoAction(self,self.tr("&Redo"))
   #     redoAction.setShortcuts(QtGui.QKeySequence.Redo)

        # Create Menubar
        menubar = self.menuBar()
        filemenu = menubar.addMenu("&Datei")
        editmenu = menubar.addMenu("&Bearbeiten")
        settingsmenu = menubar.addMenu("&Einstellungen")
        menubar.addSeparator()
        helpmenu = menubar.addMenu("&Hilfe")

        exitAction = QtGui.QAction(u"Schließen", self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Programm Beenden')
        exitAction.triggered.connect(self.close)
        saveAction = QtGui.QAction('Speichern', self)
        saveAction.setShortcut('Ctrl+S')
        saveAction.setStatusTip('Aktuellen Monat speichern')
        saveAction.triggered.connect(self.monthwidget.save)

        printAction = QtGui.QAction('Drucken', self)
        printAction.setShortcut('Ctrl+P')
        printAction.setStatusTip('Aktuellen Monat drucken')
        printAction.triggered.connect(self.monthwidget.handlePrint)

        previewAction = QtGui.QAction('Druckvorschau', self)
        previewAction.setShortcut('Ctrl+Shift+P')
        previewAction.setStatusTip(u"Druckvorschau für den aktuellen Monat")
        previewAction.triggered.connect(self.monthwidget.printPreview)

        addAction = QtGui.QAction(u"Neue Zeile einfügen", self)
        addAction.setShortcut('Ctrl++')
        addAction.setStatusTip(u'Fügt eine neue Zeile ein')
        addAction.triggered.connect(self.monthwidget.addEntry)

        removeAction = QtGui.QAction(u"Zeile löschen", self)
        removeAction.setShortcut('Ctrl+-')
        removeAction.setStatusTip('Entfernt die Markierte Zeile')
        removeAction.triggered.connect(self.monthwidget.delEntry)

        editMiscAction = QtGui.QAction(u"sonstige Einnahmen", self)
        editMiscAction.setStatusTip(u"Bearbeiten von sonstigen vereinnahmten Beträgen")
        editMiscAction.triggered.connect(self.monthwidget.editMisc)

        openAction = QtGui.QAction(u"Monat öffnen", self)
        openAction.setShortcut('Ctrl+o')
        openAction.setStatusTip(u"Einen anderen Monat öffnen")
        openAction.triggered.connect(self.openMonth)

        createAction = QtGui.QAction(u"Neuer Monat", self)
        createAction.setShortcut('Ctrl+n')
        createAction.setStatusTip(u"Einen neuen Monat anlegen")
        createAction.triggered.connect(self.createMonth)

        aboutAction =  QtGui.QAction(u"Version",self)
        aboutAction.setStatusTip(u"Informationen über die Programmversion")
        aboutAction.triggered.connect(self.about)

        openPref = QtGui.QAction(u"Beraterdaten", self)
        openPref.setStatusTip(u"Persönliche Beraterdaten bearbeiten")
        openPref.triggered.connect(self.openPrefs)

        filemenu.addAction(createAction)
        filemenu.addAction(openAction)
        filemenu.addAction(saveAction)
        filemenu.addSeparator()
        filemenu.addAction(printAction)
        filemenu.addAction(previewAction)
        filemenu.addSeparator()
        filemenu.addAction(exitAction)
        editmenu.addAction(addAction)
        editmenu.addAction(removeAction)
        editmenu.addAction(editMiscAction)
       # editmenu.addAction(undoAction)
       # editmenu.addAction(redoAction)
        settingsmenu.addAction(openPref)
        helpmenu.addAction(aboutAction)

        # Create StatusBar
        self.monthwidget.setStatusBar(self.statusBar())