Browse Source

我已经完全搞(不)懂了!

NandHyf 1 year ago
parent
commit
8ed63de2df
3 changed files with 44 additions and 6 deletions
  1. 12 2
      Controller.py
  2. 1 0
      README.md
  3. 31 4
      Stateful.py

+ 12 - 2
Controller.py

@@ -30,19 +30,29 @@ class Client():
 
     def get_config():
         # T-B-C...
-        configs = ['lang', 'listStyle']
+        configs = ['lang', 'listStyle', 'DBType', 'DBPath']
         # rl == 'r'eturn 'l'ist
         rl = Stateful.matchTomlKeys("config.toml", configs)
         
-        global lang, listStyle
+        global lang, listStyle, dbType, dbPath
         lang = rl[0]
         listStyle = rl[1]
+        dbType = rl[2]
+        dbPath = rl[3]
+
+        global commands
+        commands = []
+
 
 
     def get_help():
         print(Stateful.matchTomlKey("config.toml", lang, "command-help"))
 
 
+    def handleCommand():
+        pass
+
+
     def start():
         # 1. get config
         Client.get_config()

+ 1 - 0
README.md

@@ -1,6 +1,7 @@
 # Kanban Core
 
 [简体中文](#简体中文)
+
 [en](#en)
 
 # 简体中文

+ 31 - 4
Stateful.py

@@ -1,5 +1,5 @@
 # @author:hyf
-import os
+
 import base64, datetime
 import tomlkit, sqlite3
 
@@ -22,13 +22,13 @@ def getTomlDoc(tomlName):
             doc = tomlkit.load(t)
 
             if doc == {}:
-                print("Error 0: Could not find correct 'config.toml'")
+                input("Error 0: Could not find correct 'config.toml'")
                 exit()
 
             return doc
         
     except:
-        print("Error 0: Could not find correct 'config.toml'")
+        input("Error 0: Could not find correct 'config.toml'")
         exit()
     
 
@@ -55,6 +55,7 @@ def matchTomlKeys(tomlName, keys, table=None) -> list:
 
         return rl
     
+
     elif table != None:
         rl = []
         d = doc.unwrap()
@@ -67,7 +68,33 @@ def matchTomlKeys(tomlName, keys, table=None) -> list:
 
 
 # Sqlite3
-    
+def connect_sqlite3(dbPath):
+    con = sqlite3.connect(dbPath)
+
+    cur = con.cursor()
+
+    cur.close()
+
+def closeConnect():
+    pass
+
+def list_SELECT():
+    pass
+
+def add_CREATE():
+    pass
+
+def add_INSERT_INTO():
+    pass
+
+def edit_UPDATE():
+    pass
+
+def delete_DELELTE():
+    pass
+
+def delete_DROP():
+    pass
 
 # Markdown