@@ -1577,15 +1577,17 @@ class PlayerCtl:
1577
1577
1578
1578
# C-PC
1579
1579
def __init__(self, tauon: Tauon):
1580
- self.tauon = tauon
1581
- self.gui = self.tauon.gui
1582
- self.bag = self.tauon.bag
1583
- self.smtc: bool = self.tauon.bag.smtc
1584
- self.radiobox = self.tauon.radiobox
1585
- self.running: bool = True
1586
- self.prefs: Prefs = self.bag.prefs
1587
- self.lfm_scrobbler = LastScrob(tauon=self.tauon, pctl=self)
1588
- self.install_directory: Path = self.bag.dirs.install_directory
1580
+ self.tauon = tauon
1581
+ self.gui = self.tauon.gui
1582
+ self.bag = self.tauon.bag
1583
+ self.smtc: bool = self.tauon.bag.smtc
1584
+ self.radiobox = self.tauon.radiobox
1585
+ self.running: bool = True
1586
+ self.prefs: Prefs = self.bag.prefs
1587
+ self.lfm_scrobbler = LastScrob(tauon=self.tauon, pctl=self)
1588
+ self.install_directory: Path = self.bag.dirs.install_directory
1589
+ self.loading_in_progress: bool = False
1590
+
1589
1591
1590
1592
# Database
1591
1593
@@ -5065,6 +5067,7 @@ def __init__(self, holder: Holder, bag: Bag, strings: Strings, gui: GuiVar):
5065
5067
self.move_jobs: list = []
5066
5068
self.to_scan: list = []
5067
5069
self.after_scan: list[TrackClass] = []
5070
+ self.move_in_progress: bool = False
5068
5071
self.worker2_lock = threading.Lock()
5069
5072
#TODO(Martin) : Fix this by moving the class to root of the module
5070
5073
self.cachement: player4.Cachement | None = None
@@ -5124,7 +5127,13 @@ def __init__(self, holder: Holder, bag: Bag, strings: Strings, gui: GuiVar):
5124
5127
self.listen_alongers = {}
5125
5128
self.encode_folder_name = encode_folder_name
5126
5129
self.encode_track_name = encode_track_name
5130
+ # Create top menu
5131
+ self.x_menu = Menu(self, 190, show_icons=True)
5132
+ self.set_menu = Menu(self, 150)
5133
+ self.field_menu = Menu(self, 140)
5134
+ self.dl_menu = Menu(self, 90)
5127
5135
5136
+ self.cancel_menu = Menu(self, 100)
5128
5137
5129
5138
self.tray_lock = threading.Lock()
5130
5139
self.tray_releases = 0
@@ -13702,12 +13711,12 @@ def render(self):
13702
13711
tr = pctl.playing_object()
13703
13712
if tr:
13704
13713
album_art_gen.display(tr, (window_size[0] - gui.panelY - 1, 0), (gui.panelY, gui.panelY))
13705
- if loading_in_progress or \
13714
+ if pctl. loading_in_progress or \
13706
13715
tauon.to_scan or \
13707
13716
tauon.cm_clean_db or \
13708
13717
lastfm.scanning_friends or \
13709
- bag .after_scan or \
13710
- move_in_progress or \
13718
+ tauon .after_scan or \
13719
+ tauon. move_in_progress or \
13711
13720
plex.scanning or \
13712
13721
transcode_list or tauon.spot_ctl.launching_spotify or tauon.spot_ctl.spotify_com or subsonic.scanning or \
13713
13722
koel.scanning or gui.sync_progress or lastfm.scanning_scrobbles:
@@ -14340,20 +14349,20 @@ def render(self):
14340
14349
hit = tauon.coll(rect)
14341
14350
tauon.fields.add(rect)
14342
14351
14343
- if (x_menu.active or hit) and not tab_menu.active:
14352
+ if (tauon. x_menu.active or hit) and not tauon. tab_menu.active:
14344
14353
bg = colours.status_text_over
14345
14354
else:
14346
14355
bg = colours.status_text_normal
14347
14356
ddt.text((x, y), word, bg, 212)
14348
14357
14349
14358
if hit and inp.mouse_click:
14350
- if x_menu.active:
14351
- x_menu.active = False
14359
+ if tauon. x_menu.active:
14360
+ tauon. x_menu.active = False
14352
14361
else:
14353
14362
xx = x
14354
14363
if x > window_size[0] - (210 * gui.scale):
14355
14364
xx = window_size[0] - round(210 * gui.scale)
14356
- x_menu.activate(position=(xx + round(12 * gui.scale), gui.panelY))
14365
+ tauon. x_menu.activate(position=(xx + round(12 * gui.scale), gui.panelY))
14357
14366
view_box.activate(xx)
14358
14367
14359
14368
# if True:
@@ -14362,8 +14371,8 @@ def render(self):
14362
14371
# rect = (5 * gui.scale, gui.panelY, round(90 * gui.scale), round(25 * gui.scale))
14363
14372
#
14364
14373
14365
- dl = len(dl_mon.ready)
14366
- watching = len(dl_mon.watching)
14374
+ dl = len(tauon. dl_mon.ready)
14375
+ watching = len(tauon. dl_mon.watching)
14367
14376
14368
14377
if (dl > 0 or watching > 0) and core_timer.get() > 2 and prefs.auto_extract and prefs.monitor_downloads:
14369
14378
x += 52 * gui.scale
@@ -14376,11 +14385,11 @@ def render(self):
14376
14385
# colour = [40, 40, 40, 255]
14377
14386
if dl > 0 or watching > 0:
14378
14387
if right_click:
14379
- dl_menu.activate(position=(inp.mouse_position[0], gui.panelY))
14388
+ tauon. dl_menu.activate(position=(inp.mouse_position[0], gui.panelY))
14380
14389
if dl > 0:
14381
14390
if inp.mouse_click:
14382
14391
pln = 0
14383
- for item in dl_mon.ready:
14392
+ for item in tauon. dl_mon.ready:
14384
14393
load_order = LoadClass()
14385
14394
load_order.target = item
14386
14395
pln = pctl.active_playlist_viewing
@@ -14401,8 +14410,8 @@ def render(self):
14401
14410
14402
14411
load_orders.append(copy.deepcopy(load_order))
14403
14412
14404
- if len(dl_mon.ready) > 0:
14405
- dl_mon.ready.clear()
14413
+ if len(tauon. dl_mon.ready) > 0:
14414
+ tauon. dl_mon.ready.clear()
14406
14415
switch_playlist(pln)
14407
14416
14408
14417
pctl.playlist_view_position = len(pctl.default_playlist)
@@ -14422,7 +14431,7 @@ def render(self):
14422
14431
colour = colours.corner_button # [60, 60, 60, 255]
14423
14432
if colours.lm:
14424
14433
# colour = [180, 180, 180, 255]
14425
- if dl_mon.ready:
14434
+ if tauon. dl_mon.ready:
14426
14435
colour = colours.corner_button_active # [60, 60, 60, 255]
14427
14436
14428
14437
self.dl_button.render(x, y + 1 * gui.scale, colour)
@@ -14436,7 +14445,7 @@ def render(self):
14436
14445
self.drag_zone_start_x = x - 5 * gui.scale
14437
14446
status = True
14438
14447
14439
- if loading_in_progress:
14448
+ if pctl. loading_in_progress:
14440
14449
bg = colours.status_info_text
14441
14450
if to_got == "xspf":
14442
14451
text = _("Importing XSPF playlist")
@@ -14447,12 +14456,12 @@ def render(self):
14447
14456
else:
14448
14457
text = _("Importing... ") + str(to_got) # + "/" + str(to_get)
14449
14458
if right_click and tauon.coll([x, y, 180 * gui.scale, 18 * gui.scale]):
14450
- cancel_menu.activate(position=(x + 20 * gui.scale, y + 23 * gui.scale))
14451
- elif bag .after_scan:
14459
+ tauon. cancel_menu.activate(position=(x + 20 * gui.scale, y + 23 * gui.scale))
14460
+ elif tauon .after_scan:
14452
14461
# bg = colours.status_info_text
14453
14462
bg = [100, 200, 100, 255]
14454
- text = _("Scanning Tags... {N} remaining").format(N=str(len(bag .after_scan)))
14455
- elif move_in_progress:
14463
+ text = _("Scanning Tags... {N} remaining").format(N=str(len(tauon .after_scan)))
14464
+ elif tauon. move_in_progress:
14456
14465
text = _("File copy in progress...")
14457
14466
bg = colours.status_info_text
14458
14467
elif tauon.cm_clean_db and to_get > 0:
@@ -19454,7 +19463,7 @@ def load_img(self, artist):
19454
19463
19455
19464
def worker(self):
19456
19465
if self.load:
19457
- if bag .after_scan:
19466
+ if tauon .after_scan:
19458
19467
return
19459
19468
19460
19469
self.prep()
@@ -20128,7 +20137,7 @@ def render(self, x, y, w, h):
20128
20137
text = _("Artist threshold not met")
20129
20138
if self.load:
20130
20139
text = _("Loading Artist List...")
20131
- if loading_in_progress or transcode_list or bag .after_scan:
20140
+ if pctl. loading_in_progress or transcode_list or tauon .after_scan:
20132
20141
text = _("Busy...")
20133
20142
20134
20143
ddt.text(
@@ -27288,7 +27297,7 @@ def cancel_import():
27288
27297
if transcode_list:
27289
27298
del transcode_list[1:]
27290
27299
gui.tc_cancel = True
27291
- if loading_in_progress:
27300
+ if pctl. loading_in_progress:
27292
27301
gui.im_cancel = True
27293
27302
if gui.sync_progress:
27294
27303
gui.stop_sync = True
@@ -35232,7 +35241,6 @@ def worker2(tauon: Tauon) -> None:
35232
35241
def worker1(tauon: Tauon) -> None:
35233
35242
global cue_list
35234
35243
global home
35235
- global loading_in_progress
35236
35244
global added
35237
35245
global to_get
35238
35246
global to_got
@@ -35711,7 +35719,7 @@ def commit_track(nt):
35711
35719
if prefs.auto_sort or force_scan:
35712
35720
tag_scan(nt)
35713
35721
else:
35714
- bag .after_scan.append(nt)
35722
+ tauon .after_scan.append(nt)
35715
35723
tauon.thread_manager.ready("worker")
35716
35724
35717
35725
pctl.master_count += 1
@@ -35826,7 +35834,6 @@ def cache_paths() -> tuple[dict, dict]:
35826
35834
global album_art_gen
35827
35835
global to_got
35828
35836
global to_get
35829
- global move_in_progress
35830
35837
35831
35838
active_timer = Timer()
35832
35839
while True:
@@ -35883,7 +35890,7 @@ def cache_paths() -> tuple[dict, dict]:
35883
35890
gui.regen_single = -1
35884
35891
regenerate_playlist(target, silent=True)
35885
35892
35886
- if pctl.after_import_flag and not tauon.after_scan and not tauon.search_over.active and not loading_in_progress:
35893
+ if pctl.after_import_flag and not tauon.after_scan and not tauon.search_over.active and not pctl. loading_in_progress:
35887
35894
pctl.after_import_flag = False
35888
35895
35889
35896
for i, plist in enumerate(pctl.multi_playlist):
@@ -35902,13 +35909,13 @@ def cache_paths() -> tuple[dict, dict]:
35902
35909
35903
35910
if tauon.worker_save_state and \
35904
35911
not gui.pl_pulse and \
35905
- not loading_in_progress and \
35912
+ not pctl. loading_in_progress and \
35906
35913
not tauon.to_scan and not tauon.after_scan and \
35907
35914
not plex.scanning and \
35908
35915
not jellyfin.scanning and \
35909
35916
not tauon.cm_clean_db and \
35910
35917
not lastfm.scanning_friends and \
35911
- not move_in_progress and \
35918
+ not tauon. move_in_progress and \
35912
35919
(gui.lowered or not window_is_focused() or not gui.mouse_in_window):
35913
35920
save_state()
35914
35921
cue_list.clear()
@@ -35917,21 +35924,21 @@ def cache_paths() -> tuple[dict, dict]:
35917
35924
# Folder moving
35918
35925
if len(tauon.move_jobs) > 0:
35919
35926
gui.update += 1
35920
- move_in_progress = True
35927
+ tauon. move_in_progress = True
35921
35928
job = tauon.move_jobs[0]
35922
35929
del tauon.move_jobs[0]
35923
35930
35924
35931
if job[0].strip("\\/") == job[1].strip("\\/"):
35925
35932
show_message(_("Folder copy error."), _("The target and source are the same."), mode="info")
35926
35933
gui.update += 1
35927
- move_in_progress = False
35934
+ tauon. move_in_progress = False
35928
35935
continue
35929
35936
35930
35937
try:
35931
35938
shutil.copytree(job[0], job[1])
35932
35939
except Exception:
35933
35940
logging.exception("Failed to copy directory")
35934
- move_in_progress = False
35941
+ tauon. move_in_progress = False
35935
35942
gui.update += 1
35936
35943
show_message(_("The folder copy has failed!"), _("Some files may have been written."), mode="warning")
35937
35944
continue
@@ -35944,14 +35951,14 @@ def cache_paths() -> tuple[dict, dict]:
35944
35951
logging.exception("Failed to delete directory")
35945
35952
show_message(_("Something has gone horribly wrong!"), _("Could not delete {name}").format(name=job[0]), mode="error")
35946
35953
gui.update += 1
35947
- move_in_progress = False
35954
+ tauon. move_in_progress = False
35948
35955
return
35949
35956
35950
35957
show_message(_("Folder move complete."), _("Folder name: {name}").format(name=job[3]), mode="done")
35951
35958
else:
35952
35959
show_message(_("Folder copy complete."), _("Folder name: {name}").format(name=job[3]), mode="done")
35953
35960
35954
- move_in_progress = False
35961
+ tauon. move_in_progress = False
35955
35962
load_orders.append(job[4])
35956
35963
gui.update += 1
35957
35964
@@ -38610,7 +38617,7 @@ def save_state() -> None:
38610
38617
prefs.bg_showcase_only,
38611
38618
None, # prefs.discogs_pat,
38612
38619
prefs.mini_mode_mode,
38613
- bag .after_scan,
38620
+ tauon .after_scan,
38614
38621
gui.gallery_positions,
38615
38622
prefs.chart_bg,
38616
38623
prefs.left_panel_mode,
@@ -39549,8 +39556,6 @@ def main(holder: Holder):
39549
39556
playlist_view_position = 0
39550
39557
playlist_playing = -1
39551
39558
39552
- loading_in_progress = False
39553
-
39554
39559
core_use = 0
39555
39560
dl_use = 0
39556
39561
@@ -40043,7 +40048,7 @@ def main(holder: Holder):
40043
40048
if save[130] is not None:
40044
40049
prefs.mini_mode_mode = save[130]
40045
40050
if save[131] is not None:
40046
- bag .after_scan = save[131]
40051
+ tauon .after_scan = save[131]
40047
40052
if save[132] is not None:
40048
40053
gui.gallery_positions = save[132]
40049
40054
if save[133] is not None:
@@ -40893,7 +40898,7 @@ def update(self, force=False):
40893
40898
radio_entry_menu = Menu(tauon, 125)
40894
40899
showcase_menu = Menu(tauon, 135)
40895
40900
center_info_menu = Menu(tauon, 125)
40896
- cancel_menu = Menu( tauon, 100)
40901
+ cancel_menu = tauon.cancel_menu
40897
40902
gallery_menu = Menu(tauon, 175, show_icons=True)
40898
40903
artist_info_menu = Menu(tauon, 135)
40899
40904
queue_menu = Menu(tauon, 150)
@@ -40966,8 +40971,6 @@ def update(self, force=False):
40966
40971
40967
40972
power_bar_icon = asset_loader(bag, loaded_asset_dc, "power.png", True)
40968
40973
40969
- move_in_progress = False
40970
-
40971
40974
folder_tree_stem_menu.add(MenuItem(_("Open Folder"), open_folder_stem, pass_ref=True, icon=folder_icon))
40972
40975
folder_tree_menu.add(MenuItem(_("Open Folder"), open_folder, pass_ref=True, pass_ref_deco=True, icon=folder_icon, disable_test=open_folder_disable_test))
40973
40976
@@ -41457,16 +41460,15 @@ def update(self, force=False):
41457
41460
41458
41461
41459
41462
# Create top menu
41460
- x_menu = Menu(tauon, 190, show_icons=True)
41463
+ x_menu = tauon.x_menu
41464
+ set_menu = tauon.set_menu
41465
+ field_menu = tauon.field_menu
41466
+ dl_menu = tauon.dl_menu
41461
41467
view_menu = Menu(tauon, 170)
41462
- set_menu = Menu(tauon, 150)
41463
41468
set_menu_hidden = Menu(tauon, 100)
41464
41469
vis_menu = Menu(tauon, 140)
41465
41470
window_menu = Menu(tauon, 140)
41466
- field_menu = Menu(tauon, 140)
41467
- dl_menu = Menu(tauon, 90)
41468
41471
41469
- window_menu = Menu(tauon, 140)
41470
41472
window_menu.add(MenuItem(_("Minimize"), do_minimize_button))
41471
41473
window_menu.add(MenuItem(_("Maximize"), do_maximize_button))
41472
41474
window_menu.add(MenuItem(_("Exit"), do_exit_button))
@@ -43331,7 +43333,7 @@ def dev_mode_disable_save_state() -> None:
43331
43333
inp.media_key = ""
43332
43334
43333
43335
if len(load_orders) > 0:
43334
- loading_in_progress = True
43336
+ pctl. loading_in_progress = True
43335
43337
pctl.after_import_flag = True
43336
43338
tauon.thread_manager.ready("worker")
43337
43339
if tauon.loaderCommand == tauon.LC_None:
@@ -43371,28 +43373,28 @@ def dev_mode_disable_save_state() -> None:
43371
43373
tauon.thread_manager.ready("worker")
43372
43374
break
43373
43375
43374
- elif loading_in_progress is True:
43375
- loading_in_progress = False
43376
+ elif pctl. loading_in_progress is True:
43377
+ pctl. loading_in_progress = False
43376
43378
pctl.notify_change()
43377
43379
43378
43380
if tauon.loaderCommand == tauon.LC_Done:
43379
43381
tauon.loaderCommand = tauon.LC_None
43380
43382
gui.update += 1
43381
43383
# gui.pl_update = 1
43382
- # loading_in_progress = False
43384
+ # pctl. loading_in_progress = False
43383
43385
43384
43386
if update_layout:
43385
43387
update_layout_do(tauon=tauon)
43386
43388
update_layout = False
43387
43389
43388
43390
# if tauon.worker_save_state and\
43389
43391
# not gui.pl_pulse and\
43390
- # not loading_in_progress and\
43392
+ # not pctl. loading_in_progress and\
43391
43393
# not tauon.to_scan and\
43392
43394
# not plex.scanning and\
43393
43395
# not tauon.cm_clean_db and\
43394
43396
# not lastfm.scanning_friends and\
43395
- # not move_in_progress:
43397
+ # not tauon. move_in_progress:
43396
43398
# save_state()
43397
43399
# cue_list.clear()
43398
43400
# tauon.worker_save_state = False
@@ -44547,7 +44549,7 @@ def dev_mode_disable_save_state() -> None:
44547
44549
year_sort(target_pl)
44548
44550
44549
44551
if not load_orders:
44550
- loading_in_progress = False
44552
+ pctl. loading_in_progress = False
44551
44553
pctl.notify_change()
44552
44554
gui.auto_play_import = False
44553
44555
album_artist_dict.clear()
0 commit comments