def __init__(self, db): self.data_def = ddl.DataDefinitionLanguage(db) self.notes_facade = facade_notes.NotesFacade(db) self.tasks_facade = facade_tasks.TasksFacade(db) self.interface_tm = interface_time_management.InterfaceTM( self.notes_facade, self.tasks_facade, dml.DataManipulationLanguage(db) ) self.interface_maint = interface_maintenance.InterfaceMaintenance( self.notes_facade, self.tasks_facade, self.data_def ) self.interface_lytics = interface_analytics.InterfaceAnalytics( self.notes_facade, self.tasks_facade ) self.interface_study = interface_study.InterfaceStudy(self.notes_facade) self.__menu_map = { "1": functools.partial(self.__run_tm, self.interface_tm.run_menu_loop_tm), "2": functools.partial( self.__run_analytics, self.interface_lytics.run_menu_loop_analytics ), "3": functools.partial( self.__run_maint, self.interface_maint.run_menu_loop_maintenance ), "4": functools.partial( self.__run_study, self.interface_study.run_menu_loop_study ), "5": functools.partial(interface_common.quit_program, self.notes_facade), }
def __init__(self, db): self.data_def = ddl.DataDefinitionLanguage(db) self.notes_facade = facade_notes.NotesFacade(db) self.tasks_facade = facade_tasks.TasksFacade(db) self.interface_tm = interface_time_management.InterfaceTM( self.notes_facade, self.tasks_facade) self.interface_maint = interface_maintenance.InterfaceMaintenance( self.notes_facade, self.tasks_facade, self.data_def) self.interface_lytics = interface_analytics.InterfaceAnalytics( self.notes_facade, self.tasks_facade)
def setUp(self) -> None: self.db = sqlitedb.SQLiteDatabase() self.data_def = ddl.DataDefinitionLanguage(self.db) self.data_man = dml.DataManipulationLanguage(self.db) self.data_def.create_table( "notes", ddl.DataDefinitionLanguage.parse_json( "time_management/table_schemas/notes.json"), ) self.notes_facade = facade_notes.NotesFacade(self.db) self.notes_facade.insert_note("THIS IS A NOTE")
def setUp(self) -> None: self.db = sqlitedb.SQLiteDatabase() self.data_def = ddl.DataDefinitionLanguage(self.db) self.data_man = dml.DataManipulationLanguage(self.db) self.data_def.create_table( "tasks", ddl.DataDefinitionLanguage.parse_json( "time_management/table_schemas/tasks.json"), ) self.notes_facade = facade_tasks.TasksFacade(self.db) self.notes_facade.insert_task("DO THIS", 1) self.notes_facade.insert_task("DO THAT", 2)
def __init__(self, database): self.db = database self.ddl = ddl.DataDefinitionLanguage(database) self.dml = dml.DataManipulationLanguage(database) self.table_name = "tasks" TasksFacade.__rows_in_table = self.count_rows() try: self.schema = ddl.DataDefinitionLanguage.parse_json( os.path.join( os.path.dirname(__file__), "table_schemas/" + self.table_name + ".json", )) except ValueError: logging.error("Unable to parse schema")
def setUp(self) -> None: self.db = sqlitedb.SQLiteDatabase() self.data_def = ddl.DataDefinitionLanguage(self.db) self.data_def.create_table( "tasks", ddl.DataDefinitionLanguage.parse_json( "time_management/table_schemas/tasks.json"), ) self.data_def.create_table( "notes", ddl.DataDefinitionLanguage.parse_json( "time_management/table_schemas/notes.json"), ) self.notes_facade = facade_notes.NotesFacade(self.db) self.tasks_facade = facade_tasks.TasksFacade(self.db) self.tasks_facade.insert_task("DO THIS", 1) self.notes_facade.insert_note("A NOTE") self.interface_tm = interface_time_management.InterfaceTM( self.notes_facade, self.tasks_facade)
def on_startup(): # Initialize database db_v1 = sqlitedb.SQLiteDatabase(os.path.join(os.path.dirname(__file__), "TM_v1.db")) # Scan for and create tables data_def = ddl.DataDefinitionLanguage(db_v1) data_def.create_all_tables() # Create launch message tasks_facade = facade_tasks.TasksFacade(db_v1) time_of_day = kronos.get_time_of_day() user = getpass.getuser() number_of_overdue_items = len(tasks_facade.get_overdue_tasks()) welcome_statement = f"\nGood {time_of_day} {user}. You have {number_of_overdue_items} overdue items.\n" print(welcome_statement) # Launch MODE interface mode = interface_mode.InterfaceMode(db_v1) mode.run_menu_loop_mode()
def setUp(self) -> None: self.db = sqlitedb.SQLiteDatabase() self.data_def = ddl.DataDefinitionLanguage(self.db) self.data_def.create_all_tables()