|
62 | 62 |
|
63 | 63 |
|
64 | 64 | APP_NAME = 'Python Easy Chess GUI'
|
65 |
| -APP_VERSION = 'v1.18' |
66 |
| -BOX_TITLE = '{} {}'.format(APP_NAME, APP_VERSION) |
| 65 | +APP_VERSION = 'v1.18.1' |
| 66 | +BOX_TITLE = f'{APP_NAME} {APP_VERSION}' |
67 | 67 |
|
68 | 68 |
|
69 | 69 | platform = sys.platform
|
@@ -1302,11 +1302,12 @@ def update_text_box(self, window, msg, is_hide):
|
1302 | 1302 | best_move = chess.Move.from_uci(msg.split()[1])
|
1303 | 1303 | except Exception:
|
1304 | 1304 | logging.exception('Engine sent {}.'.format(best_move))
|
1305 |
| - sg.Popup('Engine error, it sent a {} bestmove.\n'.format( |
1306 |
| - best_move) + 'Back to Neutral mode, it is better to ' |
1307 |
| - 'change engine {}.'.format( |
1308 |
| - self.opp_id_name), icon=ico_path[platform]['pecg'], |
1309 |
| - title=BOX_TITLE) |
| 1305 | + sg.Popup( |
| 1306 | + f'Engine error, it sent a {best_move} bestmove.\n \ |
| 1307 | + Back to Neutral mode, it is better to change engine {self.opp_id_name}.', |
| 1308 | + icon=ico_path[platform]['pecg'], |
| 1309 | + title=BOX_TITLE |
| 1310 | + ) |
1310 | 1311 |
|
1311 | 1312 | return best_move
|
1312 | 1313 |
|
@@ -1640,9 +1641,10 @@ def get_promo_piece(self, move, stm, human):
|
1640 | 1641 | def set_depth_limit(self):
|
1641 | 1642 | """ Returns max depth based from user setting """
|
1642 | 1643 | user_depth = sg.PopupGetText(
|
1643 |
| - 'Current depth is {}\n\nInput depth [{} to {}]'.format( |
1644 |
| - self.max_depth, MIN_DEPTH, MAX_DEPTH), title=BOX_TITLE, |
1645 |
| - icon=ico_path[platform]['pecg']) |
| 1644 | + f'Current depth is {self.max_depth}\n\nInput depth [{MIN_DEPTH} to {MAX_DEPTH}]', |
| 1645 | + title=BOX_TITLE, |
| 1646 | + icon=ico_path[platform]['pecg'] |
| 1647 | + ) |
1646 | 1648 |
|
1647 | 1649 | try:
|
1648 | 1650 | user_depth = int(user_depth)
|
@@ -1871,12 +1873,13 @@ def play_game(self, window, engine_id_name, board):
|
1871 | 1873 | window.Element('advise_info_k').Update(msg_line)
|
1872 | 1874 | except Exception:
|
1873 | 1875 | logging.exception('Adviser engine error')
|
1874 |
| - sg.Popup('Adviser engine {} error.\n'.format( |
1875 |
| - self.adviser_id_name) + \ |
1876 |
| - 'It is better to change this engine.\n' + |
1877 |
| - 'Change to Neutral mode first.', |
1878 |
| - icon=ico_path[platform]['pecg'], |
1879 |
| - title=BOX_TITLE) |
| 1876 | + sg.Popup( |
| 1877 | + f'Adviser engine {self.adviser_id_name} error.\n \ |
| 1878 | + It is better to change this engine.\n \ |
| 1879 | + Change to Neutral mode first.', |
| 1880 | + icon=ico_path[platform]['pecg'], |
| 1881 | + title=BOX_TITLE |
| 1882 | + ) |
1880 | 1883 | break
|
1881 | 1884 |
|
1882 | 1885 | search.join()
|
@@ -2661,11 +2664,12 @@ def main_loop(self):
|
2661 | 2664 | pgn = v['pgn_k']
|
2662 | 2665 | if pgn == '':
|
2663 | 2666 | logging.info('Missing pgn file.')
|
2664 |
| - sg.Popup('Please locate your pgn file by pressing ' |
2665 |
| - 'the Browse button followed by Display ' |
2666 |
| - 'Players.', |
2667 |
| - title=win_title, |
2668 |
| - icon=ico_path[platform]['pecg']) |
| 2667 | + sg.Popup( |
| 2668 | + 'Please locate your pgn file by pressing \ |
| 2669 | + the Browse button followed by Display Players.', |
| 2670 | + title=win_title, |
| 2671 | + icon=ico_path[platform]['pecg'] |
| 2672 | + ) |
2669 | 2673 | break
|
2670 | 2674 |
|
2671 | 2675 | t1 = time.perf_counter()
|
@@ -2977,16 +2981,13 @@ def main_loop(self):
|
2977 | 2981 | new_engine_id_name = v1['engine_id_name_k']
|
2978 | 2982 | if new_engine_id_name != '':
|
2979 | 2983 | # Check if new_engine_id_name is already existing
|
2980 |
| - if self.is_name_exists( |
2981 |
| - new_engine_id_name): |
| 2984 | + if self.is_name_exists(new_engine_id_name): |
2982 | 2985 | sg.Popup(
|
2983 |
| - '{} is existing. Please ' |
2984 |
| - 'modify the name! You can ' |
2985 |
| - 'modify the config later thru ' |
2986 |
| - 'Engine->Manage->Edit'.format( |
2987 |
| - new_engine_id_name), |
2988 |
| - title=button_title, |
2989 |
| - icon=ico_path[platform]['pecg']) |
| 2986 | + f'{new_engine_id_name} is existing. Please modify the name! \ |
| 2987 | + You can modify the config later thru Engine->Manage->Edit', |
| 2988 | + title=button_title, |
| 2989 | + icon=ico_path[platform]['pecg'] |
| 2990 | + ) |
2990 | 2991 | continue
|
2991 | 2992 | break
|
2992 | 2993 | else:
|
@@ -3020,10 +3021,11 @@ def main_loop(self):
|
3020 | 3021 | t.join()
|
3021 | 3022 |
|
3022 | 3023 | if msg == 'Failure':
|
3023 |
| - sg.Popup('Failed to add {} in config ' |
3024 |
| - 'file!'.format(new_engine_id_name), |
3025 |
| - title=button_title, |
3026 |
| - icon=ico_path[platform]['pecg']) |
| 3024 | + sg.Popup( |
| 3025 | + f'Failed to add {new_engine_id_name} in config file!', |
| 3026 | + title=button_title, |
| 3027 | + icon=ico_path[platform]['pecg'] |
| 3028 | + ) |
3027 | 3029 |
|
3028 | 3030 | self.engine_id_name_list = \
|
3029 | 3031 | self.get_engine_id_name_list()
|
|
0 commit comments