Skip to content

Commit

Permalink
fix 闪退
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Feb 20, 2024
1 parent daa2ae1 commit ccf7367
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions gui/components/expand/featureSwitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ccf7367

Please sign in to comment.