Skip to content

Dev ToDoData.py

Tarun Aditya Thurlapati edited this page Apr 24, 2020 · 3 revisions

Code Explanation - ToDoData.py

This import helps us to tap into the custom sqlite db class:

from .SQLiteDBMS import InitToDoDB, CloseToDoDB, ExecuteCommandOnToDoDB

This DataFrame is the MOST IMPORTANT object, as it is the class containing the LIST, which will be modified and read to the web page:

TF = None

ToDoFrame class

This is the class which contains the list which will be worked on while the app is running: The initiation function gets the data from the TABLE in the Database from the databse connection and read it into the list of it is of the right version type, otherwise it returns an error. It contacts SQLiteDB.py, and calls functions like:

  1. ExecuteCommandOnToDoDB
  2. InitToDoDB
class TodoFrame:
    '''Implements the todo frame'''
    todoList = []

    def InitTodoFrame(self):
        InitToDoDB()
        self.todoList.clear()
        rows = ExecuteCommandOnToDoDB('SELECT * FROM TODO')        
        if rows==[]:
            return False
        else:
            for row in rows:
                self.todoList.append(list(row))
            if self.todoList[0][3]!=-3:
                self.todolist = []
                CloseToDoDB()
                return False
            else:
                return True

init TodoFrame

This function initiates the todo frame object:

def InitTodoFrame():
    global TF
    TF = TodoFrame()
    return TF.InitTodoFrame()

Close todoFrame

This function closes the todo frame and its internal controls: It also calls the CloseToDoDB from SQLiteDB.py

def CloseToDoFrame():
    global TF
    TF = None
    CloseToDoDB()
Clone this wiki locally