53
53
54
54
55
55
APP_NAME = 'Python Easy Chess GUI'
56
- APP_VERSION = 'v0.73 '
56
+ APP_VERSION = 'v0.74 '
57
57
BOX_TITLE = '{} {}' .format (APP_NAME , APP_VERSION )
58
58
59
59
@@ -953,6 +953,7 @@ def play_game(self, engine_id_name, board):
953
953
]
954
954
955
955
w = sg .Window (BOX_TITLE , layout )
956
+ self .window .Disable ()
956
957
957
958
while True :
958
959
e , v = w .Read (timeout = 10 )
@@ -978,11 +979,9 @@ def play_game(self, engine_id_name, board):
978
979
self .is_random_book = v ['random_move_k' ]
979
980
logging .info ('Book setting is OK' )
980
981
break
981
-
982
+
983
+ self .window .Enable ()
982
984
w .Close ()
983
- while True :
984
- button , value = self .window .Read (timeout = 50 )
985
- break
986
985
continue
987
986
988
987
if button == 'New::new_game_k' :
@@ -1031,6 +1030,7 @@ def play_game(self, engine_id_name, board):
1031
1030
]
1032
1031
1033
1032
w = sg .Window ('Engine Settings' , layout )
1033
+ self .window .Disable ()
1034
1034
1035
1035
while True :
1036
1036
e , v = w .Read (timeout = 10 )
@@ -1068,11 +1068,10 @@ def play_game(self, engine_id_name, board):
1068
1068
except :
1069
1069
pass
1070
1070
break
1071
-
1071
+
1072
+ self .window .Enable ()
1072
1073
w .Close ()
1073
- while True :
1074
- button , value = self .window .Read (timeout = 50 )
1075
- break
1074
+
1076
1075
self .update_labels_and_game_tags (human = 'Human' ,
1077
1076
engine_id = self .get_engine_id_name ())
1078
1077
continue
@@ -1183,6 +1182,7 @@ def play_game(self, engine_id_name, board):
1183
1182
]
1184
1183
1185
1184
w = sg .Window ('Engine Settings' , layout )
1185
+ self .window .Disable ()
1186
1186
1187
1187
while True :
1188
1188
e , v = w .Read (timeout = 10 )
@@ -1220,11 +1220,10 @@ def play_game(self, engine_id_name, board):
1220
1220
except :
1221
1221
pass
1222
1222
break
1223
-
1223
+
1224
+ self .window .Enable ()
1224
1225
w .Close ()
1225
- while True :
1226
- button , value = self .window .Read (timeout = 50 )
1227
- break
1226
+
1228
1227
self .update_labels_and_game_tags (human = 'Human' ,
1229
1228
engine_id = self .get_engine_id_name ())
1230
1229
continue
@@ -1255,6 +1254,7 @@ def play_game(self, engine_id_name, board):
1255
1254
]
1256
1255
1257
1256
w = sg .Window (BOX_TITLE , layout )
1257
+ self .window .Disable ()
1258
1258
1259
1259
while True :
1260
1260
e , v = w .Read (timeout = 10 )
@@ -1280,11 +1280,9 @@ def play_game(self, engine_id_name, board):
1280
1280
self .is_random_book = v ['random_move_k' ]
1281
1281
logging .info ('Book setting is OK' )
1282
1282
break
1283
-
1283
+
1284
+ self .window .Enable ()
1284
1285
w .Close ()
1285
- while True :
1286
- button , value = self .window .Read (timeout = 50 )
1287
- break
1288
1286
continue
1289
1287
1290
1288
if button is None :
@@ -1923,8 +1921,10 @@ def main_loop(self):
1923
1921
size = (8 , 1 ), key = 'hash_k' )],
1924
1922
[sg .OK (), sg .Cancel ()]
1925
1923
]
1926
-
1924
+
1925
+ # Create new window and disable the main window
1927
1926
w = sg .Window ('Engine Settings' , layout )
1927
+ self .window .Disable ()
1928
1928
1929
1929
while True :
1930
1930
e , v = w .Read (timeout = 10 )
@@ -1964,12 +1964,9 @@ def main_loop(self):
1964
1964
except :
1965
1965
pass
1966
1966
break
1967
-
1968
- # Close the new window and restore/unhide the main window
1969
- w .Close ()
1970
- while True :
1971
- button , value = self .window .Read (timeout = 50 )
1972
- break
1967
+
1968
+ self .window .Enable ()
1969
+ w .Close ()
1973
1970
1974
1971
# Update the player box in main window
1975
1972
self .update_labels_and_game_tags (human = 'Human' ,
@@ -2010,6 +2007,7 @@ def main_loop(self):
2010
2007
]
2011
2008
2012
2009
w = sg .Window (BOX_TITLE , layout )
2010
+ self .window .Disable ()
2013
2011
2014
2012
while True :
2015
2013
e , v = w .Read (timeout = 10 )
@@ -2035,14 +2033,9 @@ def main_loop(self):
2035
2033
self .is_random_book = v ['random_move_k' ]
2036
2034
logging .info ('Book setting is OK' )
2037
2035
break
2038
-
2039
- w .Close ()
2040
2036
2041
- # Disable any button presses by the user in the main window
2042
- # while the book setting window is active.
2043
- while True :
2044
- button , value = self .window .Read (timeout = 50 )
2045
- break
2037
+ self .window .Enable ()
2038
+ w .Close ()
2046
2039
continue
2047
2040
2048
2041
if button == 'Flip' :
0 commit comments