Browse Source

思路卡住了...

NandHyf 1 year ago
parent
commit
90e762398e
8 changed files with 166 additions and 192 deletions
  1. 101 23
      Controller.py
  2. 14 1
      README.md
  3. 16 88
      Stateful.py
  4. 0 2
      config.md
  5. 9 0
      config.toml
  6. 26 26
      export_examples/export_example.toml
  7. 0 48
      export_examples/export_example.txt
  8. 0 4
      help.toml

+ 101 - 23
Controller.py

@@ -1,36 +1,67 @@
-# @author:nandHyf
-import Stateful
+# @author: nandHyf
 
-class Command:
-    def __init__(self, obj, command) -> None:
-        self.obj = obj
-        self.Command = command
-        self.focusMode = False
+import os
+# import Stateful
+import tomlkit, sqlite3
+import base64, datetime
 
 
-    def app_help():
+class client():
+    def __init__(self) -> None:
+        pass
+
+    def get_config():
+        pass
+
+    def excute():
+        pass
+
+    def start():
+        pass
+
+
+class User:
+    def __init__(self, command, obj0=[], tag0=None, content=[], tag1=None, obj1=None) -> None:
+        self.enableGlobalCommand = False
+        self.command = command
+        self.obj0 = obj0
+        self.tag0 = tag0
+        self.content = content
+        self.tag1 = tag1
+        self.obj1 = obj1
+
+
+    def command_help():
         pass
+        # try:
+        #     with open("help.txt","r") as help:
+        #         helpText = help.read()
+        #         if helpText == '':
+        #             print("could not find correct'help.txt'")
+        #         else:
+        #           print(helpText)
+        # except:
+        #     print("could not find correct'help.txt'")
 
 
-    def app_exit():
-        exit()
+    # def command_exit():
+    #     exit()
 
 
-    def app_export(self):
+    def command_export():
         pass
 
     
-    def list_board(self):
+    def list_board():
         pass
     
 
-    def list_event(self):
+    def list_event():
         pass
 
 
-    def select_board(self):
-        print(self.obj + "is selected")
-        self.focusMode = True
+    def select_board():
+        pass
 
 
     def Command_add():
@@ -65,16 +96,63 @@ class Command:
         pass
 
 
+class Board(User):
+    pass
+
+
+class Event(User):
+    pass
+
+
 class Trigger():
-    def __init__(self) -> None:
+    def __init__(self, T_obj) -> None:
+        self.T_obj = T_obj
+
+
+    def generate_uid(T_obj):
+        dt_now = str(datetime.datetime.now(datetime.timezone.utc))
+        genText = str.encode(T_obj + "_" + dt_now)
+        uid = base64.b64encode(genText)
+        
+        return(uid)
+
+
+# ----- functions binding command to model -----
+class WithTxt():
+    pass
+    
+class WithToml():
+    pass
+
+class WithSqlite3():
+    def __init__():
+        pass    
+
+    
+    def list_():
+        pass
+    
+    def add_insert():
         pass
 
+    def edit_update():
+        pass
 
-class Board(Command):
-    def __init__(self) -> None:
-        super().__init__()
+    def del_delete():
+        pass
+    
+    con = sqlite3.connect("KanbanCore.db")
+    cur = con.cursor
 
+# class WithMd():
 
-class Event(Command):
-    def __init__(self) -> None:
-        super().__init__()
+
+# class WithCsv():
+
+
+# class WithMongo():
+
+
+if __name__ == "__main__":
+    
+    command = input()

+ 14 - 1
README.md

@@ -1 +1,14 @@
-# Kanban Core
+# Kanban Core
+
+[简体中文](#简体中文)
+[en](#en)
+
+# 简体中文
+
+# 项目背景
+
+
+# 设计模式
+
+# en
+(to be completed...)

+ 16 - 88
Stateful.py

@@ -1,97 +1,21 @@
 # @author:hyf
-import sqlite3, tomlkit
+import tomlkit, sqlite3
 
-# ----- "Controller" part which can be separate into "Controller.py" if there are too many codes to handle the statements ------
-class UserCommand:
-    def __init__(self, obj, command) -> None:
-        self.focusMode = False
-        self.obj = obj
-        self.command = command
-
-
-    def app_help():
-        pass
-
-
-    def app_exit():
-        exit()
-
-
-    def app_export(self):
-        pass
-
-    
-    def list_board(self):
-        pass
+# ----- functions binding command to model -----
+class WithTxt():
+    pass
     
+class WithToml():
+    pass
 
-    def list_event(self):
-        pass
-
-
-    def select_board(self):
-        print(self.obj + "is selected")
-        self.focusMode = True
-
-
-    def Command_add():
-        pass
-
-
-    def Command_edit():
-        pass
-
-
-    def Command_move():
-        pass
-
-
-    def Command_delete():
-        pass
+class WithSqlite3():
+    def __init__():
+        pass    
 
-
-    def Command_archive():
-        pass
-
-
-    def Command_back2home():
-        pass
-
-
-    def Command_get_info():
-        pass
     
-
-    def Command_get_num():
-        pass
-
-
-class Trigger():
-    def __init__(self) -> None:
+    def list_():
         pass
-
-
-class Board(UserCommand):
-    def __init__(self) -> None:
-        super().__init__()
-
-
-class Event(UserCommand):
-    def __init__(self) -> None:
-        super().__init__()
-
-
-# ----- functions binding command to model -----
-class WithToml(UserCommand):
-    def __init__(self, obj, command):
-        super().__init__(obj, command)
-
-
-class WithSqlite3(UserCommand):
-    def __init__(self, obj, command):
-        super().__init__(obj, command)
     
-
     def add_insert():
         pass
 
@@ -100,10 +24,14 @@ class WithSqlite3(UserCommand):
 
     def del_delete():
         pass
-
+    
+    con = sqlite3.connect("KanbanCore.db")
+    cur = con.cursor
 
 # class WithMd():
 
+
 # class WithCsv():
 
-# class WithMysql():
+
+# class WithMongo():

+ 0 - 2
config.md

@@ -1,2 +0,0 @@
-[basic]
-lang = "zh-cn"

+ 9 - 0
config.toml

@@ -0,0 +1,9 @@
+# Choose between sqlite3/toml/md/csv/mongodb
+# However toml/md/csv/mongodb will not be supported  in v1.0
+defaultDB = "sqlite3"
+
+# >>>need some guidance here<<<
+EnableGlobalCommand = false
+
+# tree/expand
+listBoardStyle = "tree"

+ 26 - 26
export_examples/export_example.toml

@@ -13,35 +13,35 @@ boardUid.archivedNum = 4
 
 
 # <eventName1>
-tag0.eventUid.name = ""
-tag0.eventUid.description = ""
-# tag0.eventUid.creator = ""
-tag0.eventUid.createdTime = 2023-09-20T05:14:44Z
-tag0.eventUid.createdTag = ""
-# tag0.eventUid.ddlTime = ""
-# tag0.eventUid.alarmTime = ""
-tag0.eventUid.currentTag = ""
-# tag0.eventUid.stackingTime =
-# tag0.eventUid.workingTime = 
-tag0.eventUid.stuckedTime = 2023-09-20T05:16:23Z
-tag0.eventUid.doneTime = 2023-09-20T05:17:47Z
-tag0.eventUid.archivedTime = 2023-09-20T05:18:34Z
+class0.eventUid.name = ""
+class0.eventUid.description = ""
+# class0.eventUid.creator = ""
+class0.eventUid.createdTime = 2023-09-20T05:14:44Z
+class0.eventUid.createdClass = ""
+# class0.eventUid.ddlTime = ""
+# class0.eventUid.alarmTime = ""
+class0.eventUid.currentClass = ""
+# class0.eventUid.stackingTime =
+# class0.eventUid.workingTime = 
+class0.eventUid.stuckedTime = 2023-09-20T05:16:23Z
+class0.eventUid.doneTime = 2023-09-20T05:17:47Z
+class0.eventUid.archivedTime = 2023-09-20T05:18:34Z
 
 
 # <evnetName2>
-tag1.eventUid.name = ""
-tag1.eventUid.description = ""
-# tag1.eventUid.creator = ""
-tag1.eventUid.createdTime = 2023-09-20T05:19:44Z
-tag1.eventUid.createdTag = ""
-# tag1.eventUid.ddlTime = ""
-# tag1.eventUid.alarmTime = ""
-tag1.eventUid.currentTag = ""
-# tag1.eventUid.stackingTime =
-# tag1.eventUid.workingTime = 
-tag1.eventUid.stuckedTime = 2023-09-20T05:21:23Z
-tag1.eventUid.doneTime = 2023-09-20T05:22:47Z
-tag1.eventUid.archivedTime = 2023-09-20T05:23:34Z
+class1.eventUid.name = ""
+class1.eventUid.description = ""
+# class1.eventUid.creator = ""
+class1.eventUid.createdTime = 2023-09-20T05:19:44Z
+class1.eventUid.createdClass = ""
+# class1.eventUid.ddlTime = ""
+# class1.eventUid.alarmTime = ""
+class1.eventUid.currentClass = ""
+# class1.eventUid.stackingTime =
+# class1.eventUid.workingTime = 
+class1.eventUid.stuckedTime = 2023-09-20T05:21:23Z
+class1.eventUid.doneTime = 2023-09-20T05:22:47Z
+class1.eventUid.archivedTime = 2023-09-20T05:23:34Z
 
 
 [boardName_boardUid2]

+ 0 - 48
export_examples/export_example.txt

@@ -1,48 +0,0 @@
-[boardUid_1]
-boardUid.boardName = ''
-boardUid.description = ''
-# boardUid.creator = ''
-boardUid.createdTime = 2023-09-20T03:42:27Z
-
-boardUid.includedNum = 10
-boardUid.stackingNum = 1
-boardUid.workingNum = 2
-boardUid.stuckedNum = 0
-boardUid.doneNum = 3
-boardUid.archivedNum = 4
-
-
-# <eventName1>
-tag0.eventUid.name = ''
-tag0.eventUid.description = ''
-# tag0.eventUid.creator = ''
-tag0.eventUid.createdTime = 2023-09-20T05:14:44Z
-tag0.eventUid.createdTag = ''
-# tag0.eventUid.ddlTime = ''
-# tag0.eventUid.alarmTime = ''
-tag0.eventUid.currentTag = ''
-# tag0.eventUid.stackingTime =
-# tag0.eventUid.workingTime = 
-tag0.eventUid.stuckedTime = 2023-09-20T05:16:23Z
-tag0.eventUid.doneTime = 2023-09-20T05:17:47Z
-tag0.eventUid.archivedTime = 2023-09-20T05:18:34Z
-
-
-# <evnetName2>
-tag1.eventUid.name = ''
-tag1.eventUid.description = ''
-# tag1.eventUid.creator = ''
-tag1.eventUid.createdTime = 2023-09-20T05:19:44Z
-tag1.eventUid.createdTag = ''
-# tag1.eventUid.ddlTime = ''
-# tag1.eventUid.alarmTime = ''
-tag1.eventUid.currentTag = ''
-# tag1.eventUid.stackingTime =
-# tag1.eventUid.workingTime = 
-tag1.eventUid.stuckedTime = 2023-09-20T05:21:23Z
-tag1.eventUid.doneTime = 2023-09-20T05:22:47Z
-tag1.eventUid.archivedTime = 2023-09-20T05:23:34Z
-
-
-[boardUid_2]
-# etc...

+ 0 - 4
help.toml

@@ -1,4 +0,0 @@
-[zh_smpf]
-
-
-[en]