Skip to content

Commit 14e3545

Browse files
committed
Standardize dialogs update & shortcuts list
1 parent ff5dd2d commit 14e3545

File tree

10 files changed

+59
-69
lines changed

10 files changed

+59
-69
lines changed

dialogs/bookmark_list_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def on_delete(self, event):
120120
bookmark_title = self.bookmark_list.GetItemText(selected_index)
121121

122122
msg = _("Are you sure you want to delete bookmark '{0}'?").format(bookmark_title)
123-
if wx.MessageBox(msg, _("Confirm Delete"), wx.YES_NO | wx.ICON_WARNING) == wx.YES:
123+
if wx.MessageBox(msg, _("Confirm Delete"), wx.YES_NO | wx.CANCEL | wx.ICON_WARNING | wx.YES_DEFAULT) == wx.YES:
124124
try:
125125
db_manager.delete_bookmark(bookmark_id)
126126
speak(_("Bookmark deleted."), LEVEL_CRITICAL)

dialogs/confirm_dialog.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class CheckboxConfirmDialog(wx.Dialog):
99
def __init__(self, parent, title, message, check_label, button_label):
1010
super().__init__(parent, title=title, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
1111

12+
wx.Bell()
13+
1214
self.panel = wx.Panel(self)
1315
vbox = wx.BoxSizer(wx.VERTICAL)
1416

dialogs/shortcuts_dialog.py

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77

88

99
class ShortcutsDialog(wx.Dialog):
10-
"""
11-
Displays a dialog listing all available keyboard shortcuts in a ListCtrl.
12-
"""
13-
1410
def __init__(self, parent):
15-
super(ShortcutsDialog, self).__init__(parent, title=_("Keyboard Shortcuts"), size=(600, 500))
11+
super(ShortcutsDialog, self).__init__(parent, title=_("Keyboard Shortcuts"), size=(650, 600))
1612

1713
self.panel = wx.Panel(self)
1814
main_sizer = wx.BoxSizer(wx.VERTICAL)
@@ -21,8 +17,8 @@ def __init__(self, parent):
2117
main_sizer.Add(info_lbl, 0, wx.ALL, 10)
2218

2319
self.list_ctrl = wx.ListCtrl(self.panel, style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
24-
self.list_ctrl.InsertColumn(0, _("Action"), width=350)
25-
self.list_ctrl.InsertColumn(1, _("Shortcut"), width=180)
20+
self.list_ctrl.InsertColumn(0, _("Action"), width=400)
21+
self.list_ctrl.InsertColumn(1, _("Shortcut"), width=200)
2622

2723
self._populate_list()
2824

@@ -42,72 +38,74 @@ def __init__(self, parent):
4238
self.SetDefaultItem(close_btn)
4339

4440
def _add_item(self, action, shortcut):
45-
"""Adds a single shortcut item to the list."""
4641
idx = self.list_ctrl.GetItemCount()
4742
self.list_ctrl.InsertItem(idx, action)
4843
self.list_ctrl.SetItem(idx, 1, shortcut)
4944

5045
def _add_header(self, title):
51-
"""Adds a separator/header row to the list."""
5246
idx = self.list_ctrl.GetItemCount()
5347
self.list_ctrl.InsertItem(idx, f"--- {title} ---")
5448
self.list_ctrl.SetItem(idx, 1, "")
5549

5650
def _populate_list(self):
57-
"""Populates the list control with all defined shortcuts."""
58-
# General
5951
self._add_header(_("General & Library"))
6052
self._add_item(_("Add Book Folder"), "Ctrl + O")
6153
self._add_item(_("Add Single File"), "Ctrl + Shift + O")
54+
self._add_item(_("Paste Book from Clipboard"), "Ctrl + V")
6255
self._add_item(_("Create New Shelf"), "Ctrl + N")
6356
self._add_item(_("Refresh Library"), "F5")
57+
self._add_item(_("Rename Item"), "F2")
58+
self._add_item(_("Delete Item"), "Delete")
59+
self._add_item(_("Permanent Delete"), "Shift + Delete")
60+
self._add_item(_("Properties"), "Alt + Enter")
61+
self._add_item(_("Go Back / Up Level"), "Backspace / Alt + Left")
62+
self._add_item(_("Go Forward"), "Alt + Right")
6463
self._add_item(_("Settings"), "Ctrl + Shift + S")
6564
self._add_item(_("Cycle Verbosity"), "Ctrl + Shift + V")
6665
self._add_item(_("Search"), "Ctrl + F")
6766
self._add_item(_("Select All"), "Ctrl + A")
68-
self._add_item(_("Context Menu"), "Apps Key / Right Click")
67+
self._add_item(_("Context Menu"), _("Apps Key / Right Click"))
6968

70-
# Navigation
7169
self._add_header(_("Navigation"))
7270
self._add_item(_("Focus Library List"), "Ctrl + B")
7371
self._add_item(_("Focus History List"), "Ctrl + H")
7472
self._add_item(_("Play Last Book"), "Ctrl + L")
7573
self._add_item(_("Toggle Pin (Selected)"), "Ctrl + P")
7674
self._add_item(_("Jump to All Books"), "Alt + 0")
7775
self._add_item(_("Jump to Default Shelf"), "Alt + 1")
78-
self._add_item(_("Jump to Pinned Books"), "Alt + P")
76+
self._add_item(_("Jump to Custom Shelves"), "Alt + 2..8")
7977
self._add_item(_("Jump to Finished Books"), "Alt + 9")
80-
self._add_item(_("Jump to Shelf 2..8"), "Alt + 2..8")
78+
self._add_item(_("Jump to Pinned Books"), "Alt + P")
8179
self._add_item(_("Previous Shelf"), "Alt + PageUp")
8280
self._add_item(_("Next Shelf"), "Alt + PageDown")
8381

84-
# Player: Playback
8582
self._add_header(_("Player: Playback"))
8683
self._add_item(_("Play / Pause"), "Space")
8784
self._add_item(_("Stop (Reset to start)"), "Shift + Space")
8885
self._add_item(_("Previous File"), "PageUp")
8986
self._add_item(_("Next File"), "PageDown")
9087
self._add_item(_("Previous Book"), "Ctrl + PageUp")
9188
self._add_item(_("Next Book"), "Ctrl + PageDown")
89+
self._add_item(_("Previous Bookmark"), "Shift + PageUp")
90+
self._add_item(_("Next Bookmark"), "Shift + PageDown")
9291
self._add_item(_("Play Pinned Book (1-9)"), "Ctrl + 1..9")
9392

94-
# Player: Seeking
9593
self._add_header(_("Player: Seeking"))
96-
self._add_item(_("Seek Forward (Short)"), "Right Arrow")
97-
self._add_item(_("Seek Backward (Short)"), "Left Arrow")
98-
self._add_item(_("Seek Forward (Long)"), "Ctrl + Right Arrow")
99-
self._add_item(_("Seek Backward (Long)"), "Ctrl + Left Arrow")
100-
self._add_item(_("Restart File"), "Backspace")
94+
self._add_item(_("Seek Forward (Short)"), _("Right Arrow"))
95+
self._add_item(_("Seek Backward (Short)"), _("Left Arrow"))
96+
self._add_item(_("Seek Forward (Long)"), _("Ctrl + Right Arrow"))
97+
self._add_item(_("Seek Backward (Long)"), _("Ctrl + Left Arrow"))
98+
self._add_item(_("Restart File"), "Home / Backspace")
99+
self._add_item(_("Go to End of File"), "End")
101100
self._add_item(_("Go to 50% of File"), "Ctrl + Backspace")
102101
self._add_item(_("Go to 30s before End"), "Shift + Backspace")
103102
self._add_item(_("Go To Time..."), "G")
104103
self._add_item(_("Show File List"), "F")
105-
self._add_item(_("Go To File Number..."), "Ctrl + F")
104+
self._add_item(_("Go To File Number..."), "Shift + F")
106105

107-
# Player: Audio
108106
self._add_header(_("Player: Audio"))
109-
self._add_item(_("Volume Up"), "Up Arrow")
110-
self._add_item(_("Volume Down"), "Down Arrow")
107+
self._add_item(_("Volume Up"), _("Up Arrow"))
108+
self._add_item(_("Volume Down"), _("Down Arrow"))
111109
self._add_item(_("Mute Toggle"), "M")
112110
self._add_item(_("Increase Speed (+0.1)"), "J")
113111
self._add_item(_("Decrease Speed (-0.1)"), "H")
@@ -117,7 +115,6 @@ def _populate_list(self):
117115
self._add_item(_("Toggle Equalizer"), "E")
118116
self._add_item(_("Open Equalizer"), "Ctrl + E")
119117

120-
# Player: Tools
121118
self._add_header(_("Player: Tools"))
122119
self._add_item(_("Add Quick Bookmark"), "B")
123120
self._add_item(_("Add Bookmark (Dialog)"), "Shift + B")
@@ -127,19 +124,17 @@ def _populate_list(self):
127124
self._add_item(_("Clear Loop"), "D")
128125
self._add_item(_("Toggle File Repeat"), "R")
129126

130-
# Player: Sleep Timer
131127
self._add_header(_("Player: Sleep Timer"))
132128
self._add_item(_("Start Quick Timer"), "T")
133129
self._add_item(_("Open Timer Dialog"), "Ctrl + T")
134130
self._add_item(_("Cancel Timer"), "Shift + T")
135131
self._add_item(_("Announce Timer"), "Alt + T")
136132

137-
# Player: Info
138133
self._add_header(_("Player: Info Announcements"))
139134
self._add_item(_("Announce Current Time"), "I")
140-
self._add_item(_("Announce File Name"), "Ctrl + I")
135+
self._add_item(_("Copy Current Time"), "Ctrl + I")
141136
self._add_item(_("Time Remaining (File)"), "Alt + I")
142-
self._add_item(_("Time Remaining (File, Speed adj)"), "Shift + I")
137+
self._add_item(_("Time Remaining (File, Speed Adjusted)"), "Shift + I")
143138
self._add_item(_("Total Elapsed / Duration"), "O")
144139
self._add_item(_("Total Remaining"), "Alt + O")
145-
self._add_item(_("Total Remaining (Speed adj)"), "Shift + O")
140+
self._add_item(_("Total Remaining (Speed Adjusted)"), "Shift + O")

frames/library/actions/book_actions.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ def on_context_update_location(frame, event, source='library'):
155155

156156

157157
def on_context_delete_book(frame, event, source='library'):
158-
skip_confirm = wx.GetKeyState(wx.WXK_SHIFT)
159158
books_to_delete = action_utils.get_selected_book_data_list(frame, source)
160159

161160
if not books_to_delete:
@@ -166,18 +165,15 @@ def on_context_delete_book(frame, event, source='library'):
166165
return
167166

168167
count = len(books_to_delete)
169-
if not skip_confirm:
170-
if count == 1:
171-
msg = _("Are you sure you want to remove '{0}' from your library? (Files will NOT be deleted)").format(
172-
books_to_delete[0][1])
173-
else:
174-
msg = _("Are you sure you want to remove {0} books from your library? (Files will NOT be deleted)").format(
175-
count)
176-
177-
if wx.MessageBox(msg, _("Confirm Remove"), wx.YES_NO | wx.ICON_WARNING | wx.NO_DEFAULT, parent=frame) != wx.YES:
178-
return
168+
if count == 1:
169+
msg = _("Are you sure you want to remove '{0}' from your library? (Files will NOT be deleted)").format(
170+
books_to_delete[0][1])
179171
else:
180-
logging.info(f"Quick Delete (Shift+Delete) activated for {count} books.")
172+
msg = _("Are you sure you want to remove {0} books from your library? (Files will NOT be deleted)").format(
173+
count)
174+
175+
if wx.MessageBox(msg, _("Confirm Remove"), wx.YES_NO | wx.CANCEL | wx.ICON_WARNING | wx.YES_DEFAULT, parent=frame) != wx.YES:
176+
return
181177

182178
try:
183179
for (book_id, book_title) in books_to_delete:

frames/library/actions/shelf_actions.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,9 @@ def on_context_rename_shelf(frame, event, source='library'):
101101

102102

103103
def on_context_delete_shelf(frame, event, source='library'):
104-
"""
105-
Deletes selected shelf/shelves. Only empty shelves can be deleted.
106-
Hold Shift to skip confirmation dialog (Quick Delete).
107-
"""
108104
if source != 'library':
109105
return
110106

111-
skip_confirm = wx.GetKeyState(wx.WXK_SHIFT)
112107
shelves_to_delete = action_utils.get_selected_shelf_data_list(frame)
113108

114109
if not shelves_to_delete:
@@ -129,17 +124,14 @@ def on_context_delete_shelf(frame, event, source='library'):
129124
return
130125

131126
count = len(valid_shelves)
132-
if not skip_confirm:
133-
if count == 1:
134-
msg = _("Are you sure you want to delete shelf '{0}'? This only works if the shelf is empty.").format(
135-
valid_shelves[0][1])
136-
else:
137-
msg = _("Are you sure you want to delete {0} shelves? Only empty shelves will be deleted.").format(count)
138-
139-
if wx.MessageBox(msg, _("Confirm Delete"), wx.YES_NO | wx.ICON_WARNING | wx.NO_DEFAULT, parent=frame) != wx.YES:
140-
return
127+
if count == 1:
128+
msg = _("Are you sure you want to delete shelf '{0}'? This only works if the shelf is empty.").format(
129+
valid_shelves[0][1])
141130
else:
142-
logging.info(f"Quick Delete (Shift+Delete) activated for {count} shelves.")
131+
msg = _("Are you sure you want to delete {0} shelves? Only empty shelves will be deleted.").format(count)
132+
133+
if wx.MessageBox(msg, _("Confirm Delete"), wx.YES_NO | wx.CANCEL | wx.ICON_WARNING | wx.YES_DEFAULT, parent=frame) != wx.YES:
134+
return
143135

144136
deleted_count = 0
145137
failed_count = 0
@@ -150,7 +142,7 @@ def on_context_delete_shelf(frame, event, source='library'):
150142
db_manager.shelf_repo.delete_shelf(sid)
151143
deleted_count += 1
152144
except sqlite3.IntegrityError:
153-
failed_count += 1 # Not empty
145+
failed_count += 1
154146
except Exception as e:
155147
logging.error(f"Error deleting shelf {sid}: {e}")
156148
failed_count += 1
@@ -168,4 +160,4 @@ def on_context_delete_shelf(frame, event, source='library'):
168160

169161
except Exception as e:
170162
logging.error(f"Error during shelf deletion: {e}", exc_info=True)
171-
speak(_("Error deleting shelves."), LEVEL_CRITICAL)
163+
speak(_("Error deleting shelves."), LEVEL_CRITICAL)

frames/library/list_manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def on_list_char_hook(self, frame, event: wx.KeyEvent):
395395
keycode = event.GetKeyCode()
396396
ctrl_down = event.ControlDown()
397397
alt_down = event.AltDown()
398+
shift_down = event.ShiftDown()
398399

399400
if alt_down and keycode in (wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER):
400401
context_actions.on_context_properties(frame, None, source='library')
@@ -457,7 +458,10 @@ def on_list_char_hook(self, frame, event: wx.KeyEvent):
457458
if item_data:
458459
item_type, item_id = item_data
459460
if item_type == 'book':
460-
context_actions.on_context_delete_book(frame, None, source='library')
461+
if shift_down:
462+
context_actions.on_context_delete_computer(frame, None, source='library')
463+
else:
464+
context_actions.on_context_delete_book(frame, None, source='library')
461465
elif item_type == 'shelf':
462466
context_actions.on_context_delete_shelf(frame, None, source='library')
463467
return

frames/library/menu_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def on_import_database(frame, event):
160160
"The application will close immediately after import.\n"
161161
"Do you want to continue?")
162162

163-
if wx.MessageBox(msg, _("Confirm Import"), wx.YES_NO | wx.ICON_WARNING) != wx.YES:
163+
if wx.MessageBox(msg, _("Confirm Import"), wx.YES_NO | wx.CANCEL | wx.ICON_WARNING | wx.YES_DEFAULT) != wx.YES:
164164
return
165165

166166
dlg = wx.FileDialog(

frames/library/task_handlers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,7 @@ def on_missing_books_result(frame, event):
480480
titles = "\n - ".join([b[1] for b in missing_books])
481481
msg += "\n\n - " + titles
482482

483-
if wx.MessageBox(msg, _("Clear Missing Books"), wx.YES_NO | wx.ICON_QUESTION | wx.NO_DEFAULT,
484-
parent=frame) == wx.YES:
483+
if wx.MessageBox(msg, _("Clear Missing Books"), wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION | wx.YES_DEFAULT, parent=frame) == wx.YES:
485484

486485
speak(_("Removing missing books..."), LEVEL_CRITICAL)
487486
wx.BeginBusyCursor()

frames/library_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def on_update_result(self, event):
457457
if event.success and event.has_update:
458458
msg = _("A new version ({0}) is available.\nDo you want to download and install it now?").format(
459459
event.latest_version)
460-
if wx.MessageBox(msg, _("Update Available"), wx.YES_NO | wx.ICON_INFORMATION, parent=self) == wx.YES:
460+
if wx.MessageBox(msg, _("Update Available"), wx.YES_NO | wx.CANCEL | wx.ICON_INFORMATION, parent=self) == wx.YES:
461461
self.update_manager.download_and_install(event.download_url)
462462
elif not event.success and not event.silent:
463463
wx.MessageBox(_("Update check failed.\nError: {0}").format(event.error_msg), _("Error"),

frames/player/equalizer_frame.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def __init__(self,
6262

6363
# Bind ESC key to close
6464
accel_tbl = wx.AcceleratorTable([
65-
(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, wx.ID_CLOSE)
65+
(wx.ACCEL_NORMAL, wx.WXK_ESCAPE, wx.ID_CLOSE),
66+
(wx.ACCEL_NORMAL, wx.WXK_DELETE, ID_DELETE_PRESET)
6667
])
6768
self.SetAcceleratorTable(accel_tbl)
6869
self.Bind(wx.EVT_MENU, self.on_close, id=wx.ID_CLOSE)
@@ -175,6 +176,7 @@ def _bind_events(self):
175176
self.preset_choice.Bind(wx.EVT_CHOICE, self.on_preset_select)
176177
self.save_button.Bind(wx.EVT_BUTTON, self.on_save_preset)
177178
self.delete_button.Bind(wx.EVT_BUTTON, self.on_delete_preset)
179+
self.Bind(wx.EVT_MENU, self.on_delete_preset, id=ID_DELETE_PRESET)
178180

179181
for slider in self.sliders:
180182
slider.Bind(wx.EVT_SCROLL_CHANGED, self.on_slider_change)
@@ -288,7 +290,7 @@ def on_delete_preset(self, event: wx.CommandEvent):
288290
return
289291

290292
msg = _("Are you sure you want to delete preset '{0}'?").format(preset_name)
291-
if wx.MessageBox(msg, _("Confirm Delete"), wx.YES_NO | wx.ICON_WARNING) == wx.YES:
293+
if wx.MessageBox(msg, _("Confirm Delete"), wx.YES_NO | wx.CANCEL | wx.ICON_WARNING | wx.YES_DEFAULT) == wx.YES:
292294
try:
293295
db_manager.delete_eq_preset(preset_id)
294296
speak(_("Preset deleted."), LEVEL_CRITICAL)

0 commit comments

Comments
 (0)