|
1 | 1 | # 左侧计时器 |
2 | | -import configparser |
3 | 2 | import minesweeper_master as mm |
4 | 3 | from ui.ui_score_board import Ui_Form |
5 | 4 | from ui.uiComponents import RoundQWidget |
@@ -90,10 +89,6 @@ def __init__(self, r_path, score_board_setting, game_setting, pix_size, parent): |
90 | 89 | self.initialized = False |
91 | 90 | self.game_setting = game_setting |
92 | 91 | self.score_board_setting = score_board_setting |
93 | | - # self.score_board_setting.beginGroup('DEFAULT') |
94 | | - # _score_board_items = self.score_board_setting.allKeys() |
95 | | - # config_score_board = configparser.ConfigParser() |
96 | | - # if not _score_board_items: |
97 | 92 | default_config = [ |
98 | 93 | ("游戏模式", "mode"), |
99 | 94 | ("RTime", "f'{time:.3f}'"), |
@@ -126,6 +121,8 @@ def __init__(self, r_path, score_board_setting, game_setting, pix_size, parent): |
126 | 121 | self.ui.QWidget.closeEvent_.connect(self.close) |
127 | 122 | QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return), self.ui.QWidget).\ |
128 | 123 | activated.connect(self.__table_ok) |
| 124 | + self.ui.QWidget.move(game_setting.value("DEFAULT/scoreboardtop", 100, int), |
| 125 | + game_setting.value("DEFAULT/scoreboardleft", 200, int)) |
129 | 126 | self.editing_row = -1 # -1不在编辑状态,-2不能编辑(正在游戏) |
130 | 127 | self.editing_column = -1 |
131 | 128 |
|
@@ -160,7 +157,7 @@ def reset(self): |
160 | 157 | ... |
161 | 158 |
|
162 | 159 | def cal_index_value(self, ms_board, index_type): |
163 | | - # 原地修改指标数值 |
| 160 | + # 原地修改指标数值 |
164 | 161 | self.update_namespace(ms_board, index_type) |
165 | 162 | index_value = [] |
166 | 163 | # for (idx, (_, expression), _type) in enumerate(zip(self.score_board_items, self.score_board_items_type)): |
@@ -338,22 +335,9 @@ def __add_blank_line(self): |
338 | 335 | def close(self): |
339 | 336 | self.score_board_setting.set_section("DEFAULT", self.score_board_items) |
340 | 337 | self.score_board_setting.sync() |
341 | | - # config = configparser.ConfigParser() |
342 | | - # config["DEFAULT"] = dict(filter(lambda x: x[0], self.score_board_items)) |
343 | | - # config.write(open(self.score_board_path, "w")) |
344 | | - # conf = configparser.ConfigParser() |
345 | | - # conf.read(self.game_setting_path, encoding='utf-8') |
346 | | - # conf.set("DEFAULT", "scoreBoardTop", str(self.ui.QWidget.x())) |
347 | | - # conf.set("DEFAULT", "scoreBoardLeft", str(self.ui.QWidget.y())) |
348 | | - # conf.write(open(self.game_setting_path, "w", encoding='utf-8')) |
349 | | - # self.ui.QWidget.close() |
350 | | - |
351 | | - |
352 | | - |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
| 338 | + self.game_setting.set_value("DEFAULT/scoreboardtop", self.ui.QWidget.x()) |
| 339 | + self.game_setting.set_value("DEFAULT/scoreboardleft", self.ui.QWidget.y()) |
| 340 | + self.game_setting.sync() |
357 | 341 |
|
358 | 342 |
|
359 | 343 |
|
|
0 commit comments