|
62 | 62 |
|
63 | 63 |
|
64 | 64 | APP_NAME = 'Python Easy Chess GUI' |
65 | | -APP_VERSION = 'v1.17' |
| 65 | +APP_VERSION = 'v1.18' |
66 | 66 | BOX_TITLE = '{} {}'.format(APP_NAME, APP_VERSION) |
67 | 67 |
|
68 | 68 |
|
@@ -2924,45 +2924,51 @@ def main_loop(self): |
2924 | 2924 | break |
2925 | 2925 | if e1 == 'Get Id Name': |
2926 | 2926 | new_engine_path_file = v1['engine_path_file_k'] |
2927 | | - if not new_engine_path_file: |
2928 | | - sg.Popup('Please input engine id name. Field was empty', |
2929 | | - title=button_title + '/Get Id name') |
2930 | | - is_cancel_add_win = True |
2931 | | - break |
2932 | | - que = queue.Queue() |
2933 | | - t = threading.Thread(target=self.get_engine_id_name, |
2934 | | - args=(new_engine_path_file, que,), |
2935 | | - daemon=True) |
2936 | | - t.start() |
2937 | | - is_update_list = False |
2938 | | - while True: |
2939 | | - try: |
2940 | | - msg = que.get_nowait() |
| 2927 | + |
| 2928 | + # We can only get the engine id name if the engine is defined. |
| 2929 | + if new_engine_path_file: |
| 2930 | + que = queue.Queue() |
| 2931 | + t = threading.Thread( |
| 2932 | + target=self.get_engine_id_name, |
| 2933 | + args=(new_engine_path_file, que,), |
| 2934 | + daemon=True |
| 2935 | + ) |
| 2936 | + t.start() |
| 2937 | + is_update_list = False |
| 2938 | + while True: |
| 2939 | + try: |
| 2940 | + msg = que.get_nowait() |
| 2941 | + break |
| 2942 | + except Exception: |
| 2943 | + pass |
| 2944 | + t.join() |
| 2945 | + |
| 2946 | + if msg[0] == 'Done' and msg[1] is not None: |
| 2947 | + is_update_list = True |
| 2948 | + new_engine_id_name = msg[1] |
| 2949 | + else: |
| 2950 | + is_cancel_add_win = True |
| 2951 | + sg.Popup( |
| 2952 | + 'This engine cannot be ' |
| 2953 | + 'installed. Please select ' |
| 2954 | + 'another engine. It should be uci ' |
| 2955 | + 'engine.', |
| 2956 | + title=button_title + '/Get Id name') |
| 2957 | + |
| 2958 | + if is_update_list: |
| 2959 | + add_win.Element('engine_id_name_k').Update( |
| 2960 | + new_engine_id_name) |
| 2961 | + |
| 2962 | + # If we fail to install the engine, we exit |
| 2963 | + # the install window |
| 2964 | + if is_cancel_add_win: |
2941 | 2965 | break |
2942 | | - except Exception: |
2943 | | - pass |
2944 | | - t.join() |
2945 | 2966 |
|
2946 | | - if msg[0] == 'Done' and msg[1] is not None: |
2947 | | - is_update_list = True |
2948 | | - new_engine_id_name = msg[1] |
2949 | 2967 | else: |
2950 | | - is_cancel_add_win = True |
2951 | 2968 | sg.Popup( |
2952 | | - 'This engine cannot be ' |
2953 | | - 'installed. Please select ' |
2954 | | - 'another engine. It should be uci ' |
2955 | | - 'engine.', |
2956 | | - title=button_title + '/Get Id name') |
2957 | | - |
2958 | | - if is_update_list: |
2959 | | - add_win.Element('engine_id_name_k').Update( |
2960 | | - new_engine_id_name) |
2961 | | - |
2962 | | - # If we fail to install the engine, we exit |
2963 | | - # the install window |
2964 | | - if is_cancel_add_win: |
2965 | | - break |
| 2969 | + 'Please define the engine or browse to the location of the engine file first.', |
| 2970 | + title=button_title + '/Get Id name' |
| 2971 | + ) |
2966 | 2972 |
|
2967 | 2973 | if e1 == 'OK': |
2968 | 2974 | try: |
|
0 commit comments