Browse Source

- 修改了config中对中文的缩写
- Controller中移除了View的引入
- 异常处理中添加了一种方法,还缺少从config中调用的功能
- Stateful暂时改回原来的input报错形式

nandHyf 1 year ago
parent
commit
5ff091258c
5 changed files with 19 additions and 7 deletions
  1. 1 1
      Controller.py
  2. 10 1
      Exceptions.py
  3. 5 3
      Stateful.py
  4. 3 2
      config.toml
  5. 0 0
      lang_zh_s.toml

+ 1 - 1
Controller.py

@@ -1,5 +1,5 @@
 import Exceptions
-import Stateful, View
+import Stateful
 
 
 class Client():

+ 10 - 1
Exceptions.py

@@ -1,2 +1,11 @@
+# ----- Pre notes
 # err 0: correct config not found
-# err 1: correct DB not found
+# err 1: correct DB not found
+# -----
+import Stateful
+
+def Err(errCode, lang):
+    pass
+    errText = ""
+    input("error ", errCode, errText)
+    exit()

+ 5 - 3
Stateful.py

@@ -21,12 +21,14 @@ def getTomlDoc(tomlName):
             doc = tomlkit.load(t)
 
             if doc == {}:
-                Exceptions.err0()
+                input("error 0: could not found correct config file") 
+                exit()
 
             return doc
         
     except:
-        Exceptions.err0()
+        input("error 0: could not found correct config file") 
+        exit()
     
 
 def matchTomlKey(tomlName, key, table=None) -> str:
@@ -109,6 +111,6 @@ def TransitHandler(transit_command):
         pass
 
     else:
-        input("err 1: correct db not found")
+        input("error 1: could not found correct Data Base")
         exit()
 

+ 3 - 2
config.toml

@@ -1,5 +1,5 @@
-# Choose between: zh-s/zh-f/en
-# zh-s == 简体中文; zh-f == 繁体中文(暫未支持)
+# Choose between: zh_s/zh_f/en
+# zh_s == 简体中文; zh_f == 繁体中文(暫未支持)
 lang = "en"
 
 # tree/expand
@@ -24,6 +24,7 @@ displayTime = "UTC+8"
 list = "SELECT"
 add = "INSERT INTO"
 edit = "UPDATE"
+delete = "UPDATE" # change stauts to "deleted"
 
 
 [csv]

+ 0 - 0
lang_zh-s.toml → lang_zh_s.toml