Skip to content

Commit 41a4ae2

Browse files
committed
Use Hide()/UnHide() instead of Disable()/Enable()
1 parent 8e87148 commit 41a4ae2

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

python_easy_chess_gui.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363

6464
APP_NAME = 'Python Easy Chess GUI'
65-
APP_VERSION = 'v1.15'
65+
APP_VERSION = 'v1.16'
6666
BOX_TITLE = '{} {}'.format(APP_NAME, APP_VERSION)
6767

6868

@@ -740,7 +740,7 @@ def create_new_window(self, window, flip=False):
740740
""" Close the window param just before turning the new window """
741741

742742
loc = window.CurrentLocation()
743-
window.Disable()
743+
window.Hide()
744744
if flip:
745745
self.is_user_white = not self.is_user_white
746746

@@ -2619,7 +2619,7 @@ def main_loop(self):
26192619
[sg.Button('Delete Player'), sg.Cancel()]
26202620
]
26212621

2622-
window.Disable()
2622+
window.Hide()
26232623
w = sg.Window(win_title, layout,
26242624
icon=ico_path[platform]['pecg'])
26252625
while True:
@@ -2706,7 +2706,7 @@ def main_loop(self):
27062706
w.Element('player_k').Update(sorted(player_list))
27072707

27082708
w.Close()
2709-
window.Enable()
2709+
window.UnHide()
27102710
continue
27112711

27122712
# Mode: Neutral, Set User time control
@@ -2731,7 +2731,7 @@ def main_loop(self):
27312731
[sg.OK(), sg.Cancel()]
27322732
]
27332733

2734-
window.Disable()
2734+
window.Hide()
27352735
w = sg.Window(win_title, layout,
27362736
icon=ico_path[platform]['pecg'])
27372737
while True:
@@ -2757,7 +2757,7 @@ def main_loop(self):
27572757
self.human_tc_type = tc_type
27582758
break
27592759
w.Close()
2760-
window.Enable()
2760+
window.UnHide()
27612761
continue
27622762

27632763
# Mode: Neutral, Set engine time control
@@ -2786,7 +2786,7 @@ def main_loop(self):
27862786
[sg.OK(), sg.Cancel()]
27872787
]
27882788

2789-
window.Disable()
2789+
window.Hide()
27902790
w = sg.Window(win_title, layout,
27912791
icon=ico_path[platform]['pecg'])
27922792
while True:
@@ -2813,7 +2813,7 @@ def main_loop(self):
28132813
self.engine_tc_type = tc_type
28142814
break
28152815
w.Close()
2816-
window.Enable()
2816+
window.UnHide()
28172817
continue
28182818

28192819
# Mode: Neutral, set username
@@ -2826,7 +2826,7 @@ def main_loop(self):
28262826
self.username, key='username_k', size=(32,1))],
28272827
[sg.OK(), sg.Cancel()]
28282828
]
2829-
window.Disable()
2829+
window.Hide()
28302830
w = sg.Window(win_title, layout,
28312831
icon=ico_path[platform]['pecg'])
28322832
while True:
@@ -2843,7 +2843,7 @@ def main_loop(self):
28432843
self.update_user_config_file(username)
28442844
break
28452845
w.Close()
2846-
window.Enable()
2846+
window.UnHide()
28472847
self.update_labels_and_game_tags(window, human=self.username)
28482848
continue
28492849

@@ -2859,7 +2859,7 @@ def main_loop(self):
28592859
[sg.Button('Add'), sg.Button('Cancel')]
28602860
]
28612861

2862-
window.Disable()
2862+
window.Hide()
28632863
install_win = sg.Window(title=button_title,
28642864
layout=install_layout,
28652865
icon=ico_path[platform]['pecg'])
@@ -2880,7 +2880,7 @@ def main_loop(self):
28802880
sg.Button('Get Id Name')],
28812881
[sg.OK(), sg.Cancel()]]
28822882

2883-
install_win.Disable()
2883+
install_win.Hide()
28842884
add_win = sg.Window(button_title, add_layout)
28852885
is_cancel_add_win = False
28862886
while True:
@@ -2960,7 +2960,7 @@ def main_loop(self):
29602960

29612961
# Outside add window while loop
29622962
add_win.Close()
2963-
install_win.Enable()
2963+
install_win.UnHide()
29642964

29652965
# Save the new configured engine to pecg_engines.json.
29662966
if not is_cancel_add_win:
@@ -2989,7 +2989,7 @@ def main_loop(self):
29892989
break
29902990

29912991
install_win.Close()
2992-
window.Enable()
2992+
window.UnHide()
29932993

29942994
# Define default engine opponent and adviser
29952995
if engine_id_name is None:
@@ -3016,7 +3016,7 @@ def main_loop(self):
30163016
[sg.Button('Modify'), sg.Button('Cancel')]
30173017
]
30183018

3019-
window.Disable()
3019+
window.Hide()
30203020
edit_win = sg.Window(button_title, layout=edit_layout,
30213021
icon=ico_path[platform]['pecg'])
30223022
is_cancel_edit_win = False
@@ -3165,7 +3165,7 @@ def main_loop(self):
31653165
else:
31663166
modify_layout = option_layout
31673167

3168-
edit_win.Disable()
3168+
edit_win.Hide()
31693169
modify_win = sg.Window(button_title,
31703170
layout=modify_layout,
31713171
icon=ico_path[platform]['pecg'])
@@ -3182,7 +3182,7 @@ def main_loop(self):
31823182
ret_opt_name.append(d)
31833183
break
31843184

3185-
edit_win.Enable()
3185+
edit_win.UnHide()
31863186
modify_win.Close()
31873187
break # Get out of edit_win loop
31883188

@@ -3196,7 +3196,7 @@ def main_loop(self):
31963196
self.engine_id_name_list = self.get_engine_id_name_list()
31973197

31983198
edit_win.Close()
3199-
window.Enable()
3199+
window.UnHide()
32003200
continue
32013201

32023202
# Mode: Neutral
@@ -3208,7 +3208,7 @@ def main_loop(self):
32083208
key='engine_id_name_k')],
32093209
[sg.Button('Delete'), sg.Cancel()]
32103210
]
3211-
window.Disable()
3211+
window.Hide()
32123212
delete_win = sg.Window(button_title, layout=delete_layout,
32133213
icon=ico_path[platform]['pecg'])
32143214
is_cancel = False
@@ -3246,7 +3246,7 @@ def main_loop(self):
32463246
self.engine_id_name_list = self.get_engine_id_name_list()
32473247

32483248
delete_win.Close()
3249-
window.Enable()
3249+
window.UnHide()
32503250

32513251
continue
32523252

@@ -3270,7 +3270,7 @@ def main_loop(self):
32703270
# Create new window and disable the main window
32713271
w = sg.Window(BOX_TITLE + '/Select opponent', layout,
32723272
icon=ico_path[platform]['enemy'])
3273-
window.Disable()
3273+
window.Hide()
32743274

32753275
while True:
32763276
e, v = w.Read(timeout=10)
@@ -3304,7 +3304,7 @@ def main_loop(self):
33043304
'}.'.format(self.opp_id_name))
33053305
break
33063306

3307-
window.Enable()
3307+
window.UnHide()
33083308
w.Close()
33093309

33103310
# Update the player box in main window
@@ -3331,7 +3331,7 @@ def main_loop(self):
33313331
# Create new window and disable the main window
33323332
w = sg.Window(BOX_TITLE + '/Select Adviser', layout,
33333333
icon=ico_path[platform]['adviser'])
3334-
window.Disable()
3334+
window.Hide()
33353335

33363336
while True:
33373337
e, v = w.Read(timeout=10)
@@ -3356,7 +3356,7 @@ def main_loop(self):
33563356
logging.exception('Failed to set engine.')
33573357
break
33583358

3359-
window.Enable()
3359+
window.UnHide()
33603360
w.Close()
33613361
continue
33623362

@@ -3394,7 +3394,7 @@ def main_loop(self):
33943394

33953395
w = sg.Window(BOX_TITLE + '/Set Book', layout,
33963396
icon=ico_path[platform]['pecg'])
3397-
window.Disable()
3397+
window.Hide()
33983398

33993399
while True:
34003400
e, v = w.Read(timeout=10)
@@ -3421,7 +3421,7 @@ def main_loop(self):
34213421
logging.info('Book setting is OK')
34223422
break
34233423

3424-
window.Enable()
3424+
window.UnHide()
34253425
w.Close()
34263426
continue
34273427

@@ -3440,7 +3440,7 @@ def main_loop(self):
34403440

34413441
w = sg.Window(win_title, layout,
34423442
icon=ico_path[platform]['pecg'])
3443-
window.Disable()
3443+
window.Hide()
34443444

34453445
while True:
34463446
e, v = w.Read(timeout=10)
@@ -3450,7 +3450,7 @@ def main_loop(self):
34503450
self.is_save_time_left = v['save_time_left_k']
34513451
break
34523452

3453-
window.Enable()
3453+
window.UnHide()
34543454
w.Close()
34553455
continue
34563456

0 commit comments

Comments
 (0)