Skip to content

Commit 4eb45ea

Browse files
committed
Fix R-Click in list controls
1 parent 328db88 commit 4eb45ea

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

docs/src/markdown/about/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- **NEW**: Drop Python 3.8 support.
66
- **NEW**: Upgrade dependencies to pick up bug fixes.
77
- **FIX**: Custom focus is not needed to focus the app from macOS dock anymore.
8+
- **FIX**: Fix some issues with context menu right click selection in list controls.
89

910
## 4.21.2
1011

rummage/lib/gui/controls/result_lists.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
COPY_CONTENT = 2
6161

6262

63+
def display_menu(obj, m, p):
64+
"""Display menu."""
65+
66+
obj.PopupMenu(m, p)
67+
m.Destroy()
68+
69+
6370
class ContextMenu(wx.Menu):
6471
"""Context Menu."""
6572

@@ -490,10 +497,9 @@ def on_rclick(self, event):
490497
# Select if not already
491498
if not selected:
492499
s = self.GetFirstSelected()
493-
while s != -1:
494-
if s != item:
495-
self.Select(s, False)
496-
s = self.GetNextSelected(s)
500+
if s == -1:
501+
self.Select(item, True)
502+
497503
if target is not None:
498504
if not enabled:
499505
item = -1
@@ -522,8 +528,8 @@ def on_rclick(self, event):
522528
)
523529
]
524530
)
525-
self.PopupMenu(menu, pos)
526-
menu.Destroy()
531+
532+
wx.CallLater(1, lambda obj=self, m=menu, p=pos: display_menu(obj, m, p))
527533
event.Skip()
528534

529535

@@ -807,10 +813,9 @@ def on_rclick(self, event):
807813
# Select if not already
808814
if not selected:
809815
s = self.GetFirstSelected()
810-
while s != -1:
811-
if s != item:
812-
self.Select(s, False)
813-
s = self.GetNextSelected(s)
816+
if s == -1:
817+
self.Select(item, True)
818+
814819
if target is not None:
815820
if not enabled:
816821
item = -1
@@ -840,6 +845,5 @@ def on_rclick(self, event):
840845
)
841846
]
842847
)
843-
self.PopupMenu(menu, pos)
844-
menu.Destroy()
848+
wx.CallLater(1, lambda obj=self, m=menu, p=pos: display_menu(obj, m, p))
845849
event.Skip()

rummage/lib/gui/data/docs/.dochash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0090421356720261e08b802a9c5f44a9
1+
373dd3370b7e5a84494d1b170b10d294

rummage/lib/gui/data/docs/about/changelog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ <h2 id="422">4.22</h2>
3030
<li><strong>NEW</strong>: Drop Python 3.8 support.</li>
3131
<li><strong>NEW</strong>: Upgrade dependencies to pick up bug fixes.</li>
3232
<li><strong>FIX</strong>: Custom focus is not needed to focus the app from macOS dock anymore.</li>
33+
<li><strong>FIX</strong>: Fix some issues with context menu right click selection in list controls.</li>
3334
</ul>
3435
<h2 id="4212">4.21.2</h2>
3536
<ul>

rummage/lib/gui/dialogs/delete_dialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def on_idle(self, event):
198198
if self.processing and not self.handling:
199199
self.handling = True
200200
count = self.thread.count
201-
ratio = float(count) / float(self.total)
201+
ratio = (float(count) / float(self.total)) if self.total else 0
202202
percent = int(ratio * 100)
203203
self.m_progress.SetValue(percent)
204204
self.m_progress_label.SetLabel(self.message % (count, self.total))

0 commit comments

Comments
 (0)