ソースを参照

修复了机器学习模块的绘图bug(重名)、把画图系统封装为画图器

Huan 5 年 前
コミット
4f9d244eb6
5 ファイル変更213 行追加150 行削除
  1. 5 2
      Hello.py
  2. 1 1
      draftboard/toolbox.py
  3. 1 0
      machinelearning/gui.py
  4. 205 147
      machinelearning/template.py
  5. 1 0
      system/__init__.py

+ 5 - 2
Hello.py

@@ -105,13 +105,16 @@ class QueueController:
             in_queue.put(self.var_dict.get(var_name))
         elif value.startswith('put_eval '):
             in_queue.put(eval(value[8:]), name_space)
-        elif value.startswith('file ') and value.startswith('.py'):
+        elif value.startswith('put_file ') and value.startswith('.py'):
             try:
                 with open(value[4:], 'r') as f:
                     code_file = f.read()
                 new_name_space = name_space
                 exec(code_file, new_name_space)
-                in_queue.put(new_name_space.copy())
+                dict_index = f'var_{len(self.var_dict)}'
+                in_queue.put(list(new_name_space.keys()))
+                self.var_dict[dict_index] = new_name_space.copy()
+                self.var_from[dict_index] = 'self'
             except BaseException as e:
                 in_queue.put(str(e))
         else:

+ 1 - 1
draftboard/toolbox.py

@@ -21,7 +21,7 @@ gui_width = 20
 gui_height = 3
 span = None
 bg_color = "#FFFAFA"  # 主颜色
-botton_color = "#FFFAFA"  # 按钮颜色
+bottom_color = "#FFFAFA"  # 按钮颜色
 word_color = "#000000"  # 文字颜色
 help_doc = """
 *快捷键:

+ 1 - 0
machinelearning/gui.py

@@ -428,6 +428,7 @@ class API(UIAPI):
         learner = API.get_learner_gui(True)
         save_dir = askdirectory(title="选择保存位置")
         data = learner_controller.model_visualization(learner, save_dir)
+        print('A')
         webbrowser.open(data[0])
         webbrowser.open(data[1])  # 还可以打开文件管理器
         API.update_sheet_box_gui()

ファイルの差分が大きいため隠しています
+ 205 - 147
machinelearning/template.py


+ 1 - 0
system/__init__.py

@@ -57,6 +57,7 @@ def exception_catch(*args_catch, **kwargs_catch):
             except BaseException as e:
                 logging.error(f'{e}  {func.__name__} args:{args}  kwargs:{kwargs}'.replace('\n', '\\n'))
                 assert not func.__name__.endswith('_gui'), str(e)
+                raise
         return adorner
     return catch
 

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません