From ccf73671a33f3ed792b589d8766d6a93c5217ee1 Mon Sep 17 00:00:00 2001 From: pur1fy <2274916027@qq.com> Date: Tue, 20 Feb 2024 12:03:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gui/components/expand/featureSwitch.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/gui/components/expand/featureSwitch.py b/gui/components/expand/featureSwitch.py index 939f03a5e..ca52c2619 100644 --- a/gui/components/expand/featureSwitch.py +++ b/gui/components/expand/featureSwitch.py @@ -7,7 +7,6 @@ from PyQt5.QtWidgets import QWidget, QLabel, QHBoxLayout, QHeaderView, QVBoxLayout, QPushButton from qfluentwidgets import CheckBox, TableWidget, LineEdit, PushButton, ComboBox import threading -lock = threading.Lock() class Layout(QWidget): @@ -83,16 +82,15 @@ def _init_components(self, config_list): self.check_boxes.append(t_cbx) def _read_config(self): - with lock: - with open('./config/' + self.config.config_dir + '/event.json', 'r', encoding='utf-8') as f: - print(f) - self._event_config = json.load(f) - print(self._event_config) + with open('./config/' + self.config.config_dir + '/event.json', 'r', encoding='utf-8') as f: + s = f.read() + if s == '': + return + self._event_config = json.loads(s) def _save_config(self): - with lock: - with open('./config/' + self.config.config_dir + '/event.json', 'w', encoding='utf-8') as f: - json.dump(self._event_config, f, ensure_ascii=False, indent=2) + with open('./config/' + self.config.config_dir + '/event.json', 'w', encoding='utf-8') as f: + json.dump(self._event_config, f, ensure_ascii=False, indent=2) def _sort(self): temp = deepcopy(self._event_config)