Skip to content

Commit 1fb3784

Browse files
committed
Make clicking error count in status bar open error log
If there are no errors, the button is disabled, and clicking does nothing. The menu option or hotkey still works to open the log, however.
1 parent 5fba534 commit 1fb3784

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

backdrop.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def update_file_detail_lists(list_name, filename):
117117

118118
# Update counter in status bar
119119
FAILED_FILE_COUNT = len(file_detail_list['fail']) + len(file_detail_list['deleteFail'])
120-
statusbar_counter.configure(text=f"{FAILED_FILE_COUNT} failed", fg=uicolor.DANGER if FAILED_FILE_COUNT > 0 else uicolor.FADED)
120+
statusbar_counter_btn.configure(text=f"{FAILED_FILE_COUNT} failed", state='normal' if FAILED_FILE_COUNT > 0 else 'disabled')
121121

122122
# HACK: The scroll yview won't see the label instantly after it's packed.
123123
# Sleeping for a brief time fixes that. This is acceptable as long as it's
@@ -581,7 +581,7 @@ def start_backup_analysis():
581581
# CAVEAT: This requires some way to have the @analysis @thread itself check for the kill flag and break if it's set.
582582
if (not backup or not backup.is_running()) and not verification_running and (CLI_MODE or source_avail_drive_list):
583583
backup_reset_ui()
584-
statusbar_counter.configure(text='0 failed', fg=uicolor.FADED)
584+
statusbar_counter_btn.configure(text='0 failed', state='disabled')
585585
statusbar_details.configure(text='')
586586

587587
if not CLI_MODE:
@@ -1372,7 +1372,7 @@ def start_backup():
13721372
global TREE_SELECTION_LOCKED
13731373

13741374
if backup and not verification_running:
1375-
statusbar_counter.configure(text='0 failed', fg=uicolor.FADED)
1375+
statusbar_counter_btn.configure(text='0 failed', state='disabled')
13761376
statusbar_details.configure(text='')
13771377

13781378
# Reset UI
@@ -1510,7 +1510,7 @@ def recurse_for_hash(path, drive, hash_file_path):
15101510
# Update UI counter
15111511
verification_failed_list.append(entry.path)
15121512
if not CLI_MODE:
1513-
statusbar_counter.configure(text=f"{len(verification_failed_list)} failed", fg=uicolor.DANGER)
1513+
statusbar_counter_btn.configure(text=f"{len(verification_failed_list)} failed", state='normal')
15141514
else:
15151515
print(f"{bcolor.FAIL}File data mismatch{bcolor.ENDC}")
15161516

@@ -1546,7 +1546,7 @@ def recurse_for_hash(path, drive, hash_file_path):
15461546
if not CLI_MODE:
15471547
update_status_bar_action(Status.VERIFICATION_RUNNING)
15481548
progress.start_indeterminate()
1549-
statusbar_counter.configure(text='0 failed', fg=uicolor.FADED)
1549+
statusbar_counter_btn.configure(text='0 failed', state='disabled')
15501550
statusbar_details.configure(text='')
15511551

15521552
halt_verification_btn.pack(side='left', padx=4)
@@ -1637,7 +1637,7 @@ def recurse_for_hash(path, drive, hash_file_path):
16371637
# Update UI counter
16381638
verification_failed_list.append(filename)
16391639
if not CLI_MODE:
1640-
statusbar_counter.configure(text=f"{len(verification_failed_list)} failed", fg=uicolor.DANGER)
1640+
statusbar_counter_btn.configure(text=f"{len(verification_failed_list)} failed", state='normal')
16411641
else:
16421642
print(f"{bcolor.FAIL}File data mismatch{bcolor.ENDC}")
16431643

@@ -3349,8 +3349,8 @@ def resource_path(relative_path):
33493349
statusbar_action = tk.Label(statusbar_frame, bg=uicolor.STATUS_BAR)
33503350
statusbar_action.grid(row=0, column=1, padx=6)
33513351
update_status_bar_action(Status.IDLE)
3352-
statusbar_counter = tk.Label(statusbar_frame, text='0 failed', fg=uicolor.FADED, bg=uicolor.STATUS_BAR)
3353-
statusbar_counter.grid(row=0, column=2, padx=6)
3352+
statusbar_counter_btn = ttk.Button(statusbar_frame, text='0 failed', width=0, command=show_backup_error_log, state='disabled', style='danger.statusbar.TButton')
3353+
statusbar_counter_btn.grid(row=0, column=2, ipadx=3, padx=3)
33543354
statusbar_details = tk.Label(statusbar_frame, bg=uicolor.STATUS_BAR)
33553355
statusbar_details.grid(row=0, column=3, padx=6)
33563356

@@ -3411,9 +3411,16 @@ def resource_path(relative_path):
34113411
background=[('pressed', '!disabled', '#900'), ('active', '!disabled', '#c00'), ('disabled', DANGER_BUTTON_DISABLED_COLOR)],
34123412
foreground=[('disabled', DANGER_BUTTON_DISABLED_TEXT_COLOR)]
34133413
)
3414+
tk_style.map(
3415+
'statusbar.TButton',
3416+
background=[('pressed', '!disabled', uicolor.STATUS_BAR), ('active', '!disabled', uicolor.STATUS_BAR), ('disabled', uicolor.STATUS_BAR)],
3417+
foreground=[('disabled', uicolor.FADED)]
3418+
)
34143419
tk_style.configure('TButton', background=BUTTON_NORMAL_COLOR, foreground=BUTTON_TEXT_COLOR, bordercolor=BUTTON_NORMAL_COLOR, borderwidth=0, padding=(6, 4))
34153420
tk_style.configure('danger.TButton', background='#b00', foreground='#fff', bordercolor='#b00', borderwidth=0)
34163421
tk_style.configure('slim.TButton', padding=(2, 2))
3422+
tk_style.configure('statusbar.TButton', padding=(3, 0), background=uicolor.STATUS_BAR, foreground=uicolor.FG)
3423+
tk_style.configure('danger.statusbar.TButton', foreground=uicolor.DANGER)
34173424

34183425
tk_style.configure('tooltip.TLabel', background=uicolor.BG, foreground=uicolor.TOOLTIP)
34193426
tk_style.configure('on.toggle.TLabel', background=uicolor.BG, foreground=uicolor.GREEN)

0 commit comments

Comments
 (0)