コード例 #1
0
 def RefreshAllStaticData(self):
     Logger.LogInfo('Refreshing all static data')
     self.DayViews = self.blVwD.GetAll()
     self.ActiveProjects = self.blPr.GetAll(False)
     self.AllProjects = self.blPr.GetAll()
     self.RecordTypes = self.blRt.GetAll()
     Logger.LogInfo('Done refreshing all static data')
コード例 #2
0
 def __init__(self, conn):
     Logger.LogInfo('Cache: Initializing Cache')
     self.blTrv = BLTimeRecordView.BLTimeRecordView(conn)
     self.blVwD = BLDayView.BLDayView(conn)
     self.blPr = BLProject.BLProject(conn)
     self.blRt = BLRecordType.BLRecordType(conn)
     self.blTr = BLTimeRecord.BLTimeRecord(conn)
     self.DayViews = self.blVwD.GetAll()
     self.ActiveProjects = self.blPr.GetAll(False)
     self.AllProjects = self.blPr.GetAll()
     self.RecordTypes = self.blRt.GetAll()
     self.TimeRecordViews = []
     self.TimeRecords = []
     Logger.LogInfo('Cache: Cache initialized')
コード例 #3
0
 def __init__(self):
     config = configparser.ConfigParser()
     config.read('config.ini')
     try:
         self.Connection = sqlite3.connect(
             config['DEFAULT']['DataBaseName'])
         Logger.LogInfo('DataBase Connection Established')
     except Exception as e:
         Logger.LogError(str(e))
コード例 #4
0
 def CloseConnection(self):
     Logger.LogInfo('DataBase Connection Closed')
     self.Connection.close()
コード例 #5
0
    def __init__(self, master, connection):
        #Reset Database if necessary
        Globals.ClearUserTables(connection)
        self.Config = configparser.ConfigParser()
        self.Config.read('config.ini')

        #Main Window
        self.Master = master
        self.Master.title("Hour Registration")

        #Database connection
        self.dbConnection = connection

        #Initialize Cache
        self.Cache = Cache.Cache(connection)

        #Initialize String Vars
        self.RecordTypeValue = StringVar()
        self.ProjectValue = StringVar()
        self.DescriptionValue = StringVar()
        self.LastLogon = StringVar()
        self.LastLogon.set(Globals.GetLastLogon())

        #Designer
        self.DaysCombo = ttk.Combobox(master)
        self.DaysCombo.grid(row=0, column=0, sticky='NSEW', columnspan=3)

        self.RecordButton = Button(master,
                                   text="Start Recording",
                                   command=self.StartRecording)
        self.RecordButton.grid(row=1, column=0, sticky='NSEW')
        self.RecordIcon = PhotoImage(file=".\\Resources\\add.png")
        self.RecordButton.config(image=self.RecordIcon,
                                 width="32",
                                 height="32")

        self.DeleteRecordButton = Button(master,
                                         text="Delete Record",
                                         command=self.DeleteRecord)
        self.DeleteRecordButton.grid(row=1, column=1, sticky='NSEW')
        self.DeleteRecordIcon = PhotoImage(file=".\\Resources\\delete.png")
        self.DeleteRecordButton.config(image=self.DeleteRecordIcon,
                                       width="32",
                                       height="32")

        self.StopRecordButton = Button(master,
                                       text="Stop Recording",
                                       command=self.StopRecording)
        self.StopRecordButton.grid(row=1, column=2, sticky='NSEW')
        self.StopRecordIcon = PhotoImage(file=".\\Resources\\stop.png")
        self.StopRecordButton.config(image=self.StopRecordIcon,
                                     width="32",
                                     height="32")

        self.CopyToCodexButton = Button(master,
                                        text="Copy To Codex",
                                        command=self.CopyToCodex)
        self.CopyToCodexButton.grid(row=2, column=0, sticky='NSEW')
        self.CopyIcon = PhotoImage(file=".\\Resources\\copyCodex.png")
        self.CopyToCodexButton.config(image=self.CopyIcon,
                                      width="32",
                                      height="32")

        self.ExcelButton = Button(master,
                                  text="Export",
                                  command=self.ExportToExcel)
        self.ExcelButton.grid(row=2, column=1, sticky='NSEW')
        self.ExcelIcon = PhotoImage(file=".\\Resources\\excel.png")
        self.ExcelButton.config(image=self.ExcelIcon, width="32", height="32")

        self.ProjectButton = Button(master,
                                    text="Project",
                                    command=self.OpenProjectListForm)
        self.ProjectButton.grid(row=2, column=2, sticky='NSEW')
        self.ProjectIcon = PhotoImage(file=".\\Resources\\add_project.png")
        self.ProjectButton.config(image=self.ProjectIcon,
                                  width="32",
                                  height="32")

        self.CopyRecordButton = Button(master,
                                       text="CopyRecord",
                                       command=self.CopyRecord)
        self.CopyRecordButton.grid(row=3, column=0, sticky='NSEW')
        self.CopyRecordIcon = PhotoImage(file=".\\Resources\\copy.png")
        self.CopyRecordButton.config(image=self.CopyRecordIcon,
                                     width="32",
                                     height="32")

        self.OneNoteButton = Button(master,
                                    text="OneNote",
                                    command=self.OpenInOneNote)
        self.OneNoteButton.grid(row=3, column=1, sticky='NSEW')
        self.OneNoteIcon = PhotoImage(file=".\\Resources\\onenote.png")
        self.OneNoteButton.config(image=self.OneNoteIcon,
                                  width="32",
                                  height="32")

        self.AddTimeRecordButton = Button(master,
                                          text="AddTimeRecordButton",
                                          command=self.ShowNewEditForm)
        self.AddTimeRecordButton.grid(row=3, column=2, sticky="NSEW")
        self.AddTimeRecordIcon = PhotoImage(
            file=".\\Resources\\application_add.png")
        self.AddTimeRecordButton.config(image=self.AddTimeRecordIcon,
                                        width="32",
                                        height="32")

        self.BackupButton = Button(master,
                                   text="BackupButton",
                                   command=self.DatabaseBackup)
        self.BackupButton.grid(row=4, column=0, sticky="NSEW")
        self.BackupButtonIcon = PhotoImage(file=".\\Resources\\angel.png")
        self.BackupButton.config(image=self.BackupButtonIcon,
                                 width="32",
                                 height="32")

        self.RecordTypeButton = Button(master,
                                       text="RecordType",
                                       command=self.OpenRecordTypeListForm)
        self.RecordTypeButton.grid(row=4, column=1, sticky="NSEW")
        self.RecordTypeButtonIcon = PhotoImage(
            file=".\\Resources\\recordType.png")
        self.RecordTypeButton.config(image=self.RecordTypeButtonIcon,
                                     width="32",
                                     height="32")

        self.ExportToGraphsButton = Button(master,
                                           text="ExportToGraphs",
                                           command=self.ExportToGraph)
        self.ExportToGraphsButton.grid(row=4, column=2, sticky="NSEW")
        self.ExportToGraphsButtonIcon = PhotoImage(
            file=".\\Resources\\chart.png")
        self.ExportToGraphsButton.config(image=self.ExportToGraphsButtonIcon,
                                         width="32",
                                         height="32")

        self.ProjectsCombo = ttk.Combobox(master,
                                          textvariable=self.ProjectValue)
        self.ProjectsCombo.grid(row=0, column=3, columnspan=2, sticky='NSEW')

        self.RecordTypeCombo = ttk.Combobox(master,
                                            textvariable=self.RecordTypeValue)
        self.RecordTypeCombo.grid(row=1, column=3, columnspan=2, sticky='NSEW')

        self.DescriptionTextBox = Entry(master,
                                        textvariable=self.DescriptionValue)
        self.DescriptionTextBox.grid(row=2,
                                     column=3,
                                     columnspan=2,
                                     sticky='NSEW')

        self.RecordsListBox = Listbox(master, width=50)
        self.RecordsListBox.grid(row=3,
                                 column=3,
                                 rowspan=7,
                                 columnspan=1,
                                 sticky='NSEW')

        self.CommentListBox = Listbox(master, width=70)
        self.CommentListBox.grid(row=3,
                                 column=4,
                                 rowspan=7,
                                 columnspan=2,
                                 sticky='NSEW')
        self.CommentListBox.bindtags((self.CommentListBox, master, "all"))

        self.EventLogExplanationLabel = Label(master,
                                              text="Laatst aangemeld op: ")
        self.EventLogExplanationLabel.grid(row=0, column=5)

        self.EventLogLabel = Label(master, textvariable=self.LastLogon)
        self.EventLogLabel.grid(row=1, column=5)

        self.DaysCombo.bind("<<ComboboxSelected>>",
                            self.DaysCombo_SelectedItemChanged)
        self.RecordsListBox.bind("<<ListboxSelect>>",
                                 self.RecordsListBox_SelectedItemChanged)
        self.RecordsListBox.bind('<Double-1>', lambda x: self.ShowEditForm())
        #End Designer

        #Set Form Controls
        self.FillCombos()
        self.SetButtonsEnabled()

        self.Queue = queue.Queue(10)
        self.KillEvent = threading.Event()
        self.ControllerThread = threading.Thread(target=self.ctrl,
                                                 args=(self.Queue,
                                                       self.KillEvent))
        self.ControllerThread.start()
        Logger.LogInfo(self.ControllerThread.getName() + ' started.')

        self.CheckForUpdatesFromController()
コード例 #6
0
 def RefreshRecordTypes(self):
     Logger.LogInfo('Refresh RecordTypes')
     self.RecordTypes = self.blRt.GetAll()
     Logger.LogInfo('Done refreshing recordtypes')
コード例 #7
0
 def RefreshProjects(self):
     Logger.LogInfo('Refreshing Projects')
     self.ActiveProjects = self.blPr.GetAll(False)
     self.AllProjects = self.blPr.GetAll()
     Logger.LogInfo('Done refreshing projects')
コード例 #8
0
 def RefreshDayViews(self):
     Logger.LogInfo('Refreshing DayViews')
     self.DayViews = self.blVwD.GetAll()
     Logger.LogInfo('Done refreshing DayViews')
コード例 #9
0
 def RefreshTimeRecordsForDate(self, date):
     Logger.LogInfo('Refreshing TimeRecords for date: ' + date)
     self.TimeRecordViews = self.blTrv.GetAllForDate(date)
     self.TimeRecords = self.blTr.GetAllForDate(date)
     Logger.LogInfo('Done refreshing TimeRecords')
コード例 #10
0
from DataAccess.DataBaseConnection import DataBaseConnection
from BusinessEntities import *
from DataAccess.DAProject import DAProject
from DataAccess.DAController import DAController
from GUI.MainScreen import MainScreen
from DataAccess.Log import Logger
from tkinter import Tk, ttk

#Handle Project Initialisations
root = Tk()
databaseConnection = DataBaseConnection()
mainScreen = MainScreen(root, databaseConnection)
try:
    Logger.LogInfo('Application Starting...')
    mainScreen.Show()
except Exception as e:
    Logger.LogError(str(e), True)
finally:
    mainScreen.KillEvent.set()
    mainScreen.ControllerThread.join()
    Logger.LogInfo('Application Stopping...')
    databaseConnection.CloseConnection()