Skip to content

Commit c160a5b

Browse files
Copilotfsmosca
andauthored
Replace deprecated Popup calls (#68)
Agent-Logs-Url: https://github.com/fsmosca/Python-Easy-Chess-GUI/sessions/a24390d9-5805-462e-94de-70eb01379203 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fsmosca <22366935+fsmosca@users.noreply.github.com>
1 parent 12371eb commit c160a5b

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

python_easy_chess_gui.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ def update_text_box(self, window, msg, is_hide):
14611461
best_move = chess.Move.from_uci(msg.split()[1])
14621462
except Exception:
14631463
logging.exception(f'Engine sent {best_move}')
1464-
sg.Popup(
1464+
sg.popup(
14651465
f'Engine error, it sent a {best_move} bestmove.\n \
14661466
Back to Neutral mode, it is better to change engine {self.opp_id_name}.',
14671467
icon=ico_path[platform]['pecg'],
@@ -2041,7 +2041,7 @@ def play_game(self, window: sg.Window, board: chess.Board):
20412041
if (self.is_time_forfeit_enabled and
20422042
human_timer.elapse >= human_timer.base):
20432043
color = 'white' if self.is_user_white else 'black'
2044-
sg.Popup(
2044+
sg.popup(
20452045
'{} loses on time!'.format(color.capitalize()),
20462046
title=BOX_TITLE,
20472047
icon=ico_path[platform]['pecg'])
@@ -2100,7 +2100,7 @@ def play_game(self, window: sg.Window, board: chess.Board):
21002100
window.Element('advise_info_k').Update(msg_line)
21012101
except Exception:
21022102
logging.exception('Adviser engine error')
2103-
sg.Popup(
2103+
sg.popup(
21042104
f'Adviser engine {self.adviser_id_name} error.\n \
21052105
It is better to change this engine.\n \
21062106
Change to Neutral mode first.',
@@ -2186,7 +2186,7 @@ def play_game(self, window: sg.Window, board: chess.Board):
21862186
logging.info('User resigns')
21872187

21882188
# Verify resign
2189-
reply = sg.Popup('Do you really want to resign?',
2189+
reply = sg.popup('Do you really want to resign?',
21902190
button_type=sg.POPUP_BUTTONS_YES_NO,
21912191
title=BOX_TITLE,
21922192
icon=ico_path[platform]['pecg'])
@@ -2236,7 +2236,7 @@ def play_game(self, window: sg.Window, board: chess.Board):
22362236
if button == 'Paste':
22372237
# Pasting fen is only allowed before the game starts.
22382238
if len(self.game.variations):
2239-
sg.Popup('Press Game->New then paste your fen.',
2239+
sg.popup('Press Game->New then paste your fen.',
22402240
title='Mode Play')
22412241
continue
22422242
try:
@@ -2705,7 +2705,7 @@ def play_game(self, window: sg.Window, board: chess.Board):
27052705
self.save_game()
27062706

27072707
if board.is_game_over(claim_draw=True):
2708-
sg.Popup('Game is over.', title=BOX_TITLE,
2708+
sg.popup('Game is over.', title=BOX_TITLE,
27092709
icon=ico_path[platform]['pecg'])
27102710

27112711
if is_exit_app:
@@ -3780,7 +3780,7 @@ def main_loop(self):
37803780
pgn = v['pgn_k']
37813781
if pgn == '':
37823782
logging.info('Missing pgn file.')
3783-
sg.Popup(
3783+
sg.popup(
37843784
'Please locate your pgn file by pressing \
37853785
the Browse button followed by Display Players.',
37863786
title=win_title,
@@ -3820,7 +3820,7 @@ def main_loop(self):
38203820
player_name = v['player_k'][0]
38213821
except IndexError as e:
38223822
logging.info(e)
3823-
sg.Popup('Please locate your pgn file by '
3823+
sg.popup('Please locate your pgn file by '
38243824
'pressing the Browse button followed by Display Players.',
38253825
title=win_title,
38263826
icon=ico_path[platform]['pecg'])
@@ -4072,7 +4072,7 @@ def main_loop(self):
40724072
new_engine_id_name = msg[1]
40734073
else:
40744074
is_cancel_add_win = True
4075-
sg.Popup(
4075+
sg.popup(
40764076
'This engine cannot be '
40774077
'installed. Please select '
40784078
'another engine. It should be uci '
@@ -4089,7 +4089,7 @@ def main_loop(self):
40894089
break
40904090

40914091
else:
4092-
sg.Popup(
4092+
sg.popup(
40934093
'Please define the engine or browse to the location of the engine file first.',
40944094
title=button_title + '/Get Id name'
40954095
)
@@ -4102,7 +4102,7 @@ def main_loop(self):
41024102
if new_engine_id_name != '':
41034103
# Check if new_engine_id_name is already existing
41044104
if self.is_name_exists(new_engine_id_name):
4105-
sg.Popup(
4105+
sg.popup(
41064106
f'{new_engine_id_name} is existing. Please modify the name! \
41074107
You can modify the config later thru Engine->Manage->Edit',
41084108
title=button_title,
@@ -4111,7 +4111,7 @@ def main_loop(self):
41114111
continue
41124112
break
41134113
else:
4114-
sg.Popup(
4114+
sg.popup(
41154115
'Please input engine id name, or press Get Id Name button.',
41164116
title=button_title,
41174117
icon=ico_path[platform]['pecg']
@@ -4141,7 +4141,7 @@ def main_loop(self):
41414141
t.join()
41424142

41434143
if msg == 'Failure':
4144-
sg.Popup(
4144+
sg.popup(
41454145
f'Failed to add {new_engine_id_name} in config file!',
41464146
title=button_title,
41474147
icon=ico_path[platform]['pecg']
@@ -4204,7 +4204,7 @@ def main_loop(self):
42044204
try:
42054205
orig_idname = engine_id_name = v['engine_id_name_k'][0]
42064206
except Exception:
4207-
sg.Popup('Please select an engine to modify.',
4207+
sg.popup('Please select an engine to modify.',
42084208
title='/Edit/Modify',
42094209
icon=ico_path[platform]['pecg'])
42104210
continue
@@ -4396,7 +4396,7 @@ def main_loop(self):
43964396
try:
43974397
engine_id_name = v['engine_id_name_k'][0]
43984398
except Exception:
4399-
sg.Popup('Please select an engine to delete.',
4399+
sg.popup('Please select an engine to delete.',
44004400
title=button_title,
44014401
icon=ico_path[platform]['pecg'])
44024402
continue
@@ -4782,7 +4782,7 @@ def main_loop(self):
47824782
if button == 'Play':
47834783
if engine_id_name is None:
47844784
logging.warning('Install engine first!')
4785-
sg.Popup('Install engine first! in Engine/Manage/Install',
4785+
sg.popup('Install engine first! in Engine/Manage/Install',
47864786
icon=ico_path[platform]['pecg'], title='Mode')
47874787
continue
47884788

0 commit comments

Comments
 (0)