|
@@ -7,7 +7,8 @@ from sqlalchemy.orm import sessionmaker
|
|
from time_recoder.time_recoder_gui.time_recorder_gui_config import PAUSE_BUTTON_TEXT, START_BUTTON_TEXT, \
|
|
from time_recoder.time_recoder_gui.time_recorder_gui_config import PAUSE_BUTTON_TEXT, START_BUTTON_TEXT, \
|
|
STOP_BUTTON_TEXT, \
|
|
STOP_BUTTON_TEXT, \
|
|
STOP_BUTTON_INTRODUCTION_TEXT, PAUSE_BUTTON_INTRODUCTION_TEXT, WINDOW_SIZE, SELECT_TASK_INTRODUCTION_TEXT, \
|
|
STOP_BUTTON_INTRODUCTION_TEXT, PAUSE_BUTTON_INTRODUCTION_TEXT, WINDOW_SIZE, SELECT_TASK_INTRODUCTION_TEXT, \
|
|
- ADD_TASK_INTRODUCTION_TEXT, ADD_TASK_BUTTON_TEXT, NEW_TASK_TEXT_KEY, TASK_TREE_COMBO_NAME, TIMER_KEY
|
|
|
|
|
|
+ ADD_TASK_INTRODUCTION_TEXT, ADD_TASK_BUTTON_TEXT, NEW_TASK_TEXT_KEY, TASK_TREE_COMBO_NAME, TIMER_KEY, \
|
|
|
|
+ TOTAL_TIMER_KEY
|
|
from time_recoder import save_recorded_time_in_table
|
|
from time_recoder import save_recorded_time_in_table
|
|
from time_recoder.time_recoder_gui.time_recorder_task_handler import TaskHandler
|
|
from time_recoder.time_recoder_gui.time_recorder_task_handler import TaskHandler
|
|
from time_recoder.time_recoder_gui.time_recorder_timer import Timer
|
|
from time_recoder.time_recoder_gui.time_recorder_timer import Timer
|
|
@@ -25,7 +26,10 @@ def create_layout():
|
|
[PySimpleGUI.Button(START_BUTTON_TEXT),
|
|
[PySimpleGUI.Button(START_BUTTON_TEXT),
|
|
PySimpleGUI.Button(PAUSE_BUTTON_TEXT),
|
|
PySimpleGUI.Button(PAUSE_BUTTON_TEXT),
|
|
PySimpleGUI.Button(STOP_BUTTON_TEXT)],
|
|
PySimpleGUI.Button(STOP_BUTTON_TEXT)],
|
|
- [PySimpleGUI.Text('', size=(8, 1), font=('Helvetica', 20), justification='center', key=TIMER_KEY)],
|
|
|
|
|
|
+ [PySimpleGUI.Text('Total Time', size=(10, 1), font=('Helvetica', 20), justification='center'),
|
|
|
|
+ PySimpleGUI.Text('Task Time', size=(10, 1), font=('Helvetica', 20), justification='center')],
|
|
|
|
+ [PySimpleGUI.Text('', size=(10, 1), font=('Helvetica', 20), justification='center', key=TOTAL_TIMER_KEY),
|
|
|
|
+ PySimpleGUI.Text('', size=(10, 1), font=('Helvetica', 20), justification='center', key=TIMER_KEY)],
|
|
[PySimpleGUI.Text(SELECT_TASK_INTRODUCTION_TEXT),
|
|
[PySimpleGUI.Text(SELECT_TASK_INTRODUCTION_TEXT),
|
|
PySimpleGUI.Combo(taskHandler.get_task_tree_name_strings(taskHandler.root_task),
|
|
PySimpleGUI.Combo(taskHandler.get_task_tree_name_strings(taskHandler.root_task),
|
|
size=(30, 1),
|
|
size=(30, 1),
|
|
@@ -64,7 +68,8 @@ def add_sub_task_button_is_pushed(event):
|
|
def event_loop(window):
|
|
def event_loop(window):
|
|
while True:
|
|
while True:
|
|
event, values = window.read(timeout=10)
|
|
event, values = window.read(timeout=10)
|
|
- window[TIMER_KEY].update(timer.get_value_string())
|
|
|
|
|
|
+ window[TIMER_KEY].update(timer.get_task_value_string())
|
|
|
|
+ window[TOTAL_TIMER_KEY].update(timer.get_total_value_string())
|
|
if window_is_closed(event):
|
|
if window_is_closed(event):
|
|
break
|
|
break
|
|
if start_button_is_pushed(event):
|
|
if start_button_is_pushed(event):
|
|
@@ -76,7 +81,7 @@ def event_loop(window):
|
|
timer.pause()
|
|
timer.pause()
|
|
|
|
|
|
if stop_button_is_pushed(event):
|
|
if stop_button_is_pushed(event):
|
|
- worked_time_in_minutes = timer.get_passed_time() / 60
|
|
|
|
|
|
+ worked_time_in_minutes = timer.get_passed_task_time() / 60
|
|
selected_task_name = window.Element(TASK_TREE_COMBO_NAME).get()
|
|
selected_task_name = window.Element(TASK_TREE_COMBO_NAME).get()
|
|
if selected_task_name:
|
|
if selected_task_name:
|
|
current_task = taskHandler.get_task_by_id(taskHandler.get_task_id(selected_task_name))
|
|
current_task = taskHandler.get_task_by_id(taskHandler.get_task_id(selected_task_name))
|