Przeglądaj źródła

- 添加了测试backlog用来记录未处理的异常
- 改了改流程

NandHyf 1 rok temu
rodzic
commit
9a5fd27d09

+ 3 - 0
.vscode/settings.json

@@ -0,0 +1,3 @@
+{
+    "python.pythonPath": "b:\\Load\\py3-11-4\\Scripts\\python.exe"
+}

+ 13 - 7
Controller.py

@@ -16,21 +16,18 @@ class Client():
         dbType = rl[2]
         dbPath = rl[3]
 
-        global commands
-        commands = []
-
 
     def get_help():
         print(Stateful.matchTomlKey("config.toml", lang, "command-help"))
 
 
     def TransitCommand():
-        # current path as a var instead↓ of input text
-        app_command = input("        ~/: ").split(" ")
+        # do while or for (1)
+        app_command = input(currentPath).split(" ")
 
 
-        app_command.append(dbType)
         app_command.append(dbPath)
+        app_command.append(dbType)
         Stateful.TransitHandler(app_command)
 
 
@@ -38,7 +35,16 @@ class Client():
         # 1. get config
         Client.get_config()
 
-        # test code
+        global currentPath
+        currentPath = "/: "
+        # ↓↓↓ test code here ↓↓↓
+
+
+        # ↑↑↑ test code here ↑↑↑
+
+        # Normalized Start Process
+        startState = Stateful.TransitHandler(['list', 'board', dbPath, dbType])
+        
         Client.TransitCommand()
 
 

+ 1 - 1
Stateful.py

@@ -75,7 +75,7 @@ def operate_sqlite3(dbPath, command):
     cur = con.cursor()
 
     # 
-    cur.execute()
+    # cur.execute()
     
     cur.close()
 

BIN
__pycache__/Alt.cpython-311.pyc


BIN
__pycache__/Exceptions.cpython-311.pyc


BIN
__pycache__/Stateful.cpython-311.pyc


BIN
__pycache__/View.cpython-311.pyc


+ 15 - 0
clean_config.toml

@@ -0,0 +1,15 @@
+# ----- App Configuration -----
+lang = "en"
+listStyle = "tree"
+
+DBType = "sqlite3"
+DBPath = "test.db"
+
+displayTime = "utc+8"
+
+# ----- App Command to DB Syntax Translation -----
+[sqlite3]
+list = "SELECT"
+add = "INSERT INTO"
+edit = "UPDATE"
+delete = "UPDATE" # change stauts to "deleted"

+ 10 - 0
debug_backlog.txt

@@ -0,0 +1,10 @@
+# ----- config.toml -----
+1. DBPath 是否支持填写路径/绝对路径/相对路径
+
+# ----- Controller.py -----
+1. app_command 输入不合法字符的异常处理
+
+# ----- Stateful.py -----
+1. 读取toml文件时候没有匹配到键的异常处理 
+
+# ----- Alt.py -----

+ 36 - 0
t.toml

@@ -0,0 +1,36 @@
+# Choose between: zh-s/zh-f/en
+# zh-s == 简体中文; zh-f == 繁体中文(暫未支持)
+lang = "en"
+
+# tree/expand
+listStyle = "tree"
+
+# >>>need some guidance here<<<
+EnableGlobalCommand = false
+
+DBType = "sqlite3"
+DBPath = "test.db"
+
+# Choose between: sqlite3/toml/md/csv/mongodb
+# However toml/md/csv/mongodb are not supported in v1.0
+[Database]
+type = "sqlite3"
+path = "test.db"
+
+
+# ----- helps -----
+# 难道用asicⅡ然后根据系统语言转换?
+# 或者是单独的.toml/.txt 文本文件也行
+[command-help]
+en = """
+Help texts in en
+"""
+
+zh-s = """
+Help texts in zh-s
+"""
+
+[could-not-find]
+en = "could not find"
+zh-s = "找不到"
+