Merge lp:~ldziedziul/rapid/open-file-on-dbl-click into lp:rapid

Proposed by Łukasz Dziedziul
Status: Needs review
Proposed branch: lp:~ldziedziul/rapid/open-file-on-dbl-click
Merge into: lp:rapid
Diff against target: 75 lines (+26/-26)
1 file modified
raphodo/thumbnaildisplay.py (+26/-26)
To merge this branch: bzr merge lp:~ldziedziul/rapid/open-file-on-dbl-click
Reviewer Review Type Date Requested Status
Damon Lynch Disapprove
Review via email: mp+361267@code.launchpad.net

Commit message

open photo in the file browser on double click

To post a comment you must log in.
Revision history for this message
Damon Lynch (dlynch3) wrote :

Double clicking on a thumbnail is reserved for future full size preview in application.

review: Disapprove
Revision history for this message
Łukasz Dziedziul (ldziedziul) wrote :

Unmerged revisions

1116. By Łukasz Dziedziul

open photo in the file browser on double click

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'raphodo/thumbnaildisplay.py'
2--- raphodo/thumbnaildisplay.py 2018-09-25 14:46:02 +0000
3+++ raphodo/thumbnaildisplay.py 2018-12-23 19:15:30 +0000
4@@ -2116,9 +2116,33 @@
5
6 if (event.type() == QEvent.MouseButtonRelease or event.type() ==
7 QEvent.MouseButtonDblClick):
8+ self.clickedIndex = index
9+ # libgphoto2 needs exclusive access to the camera, so there are times when "open
10+ # in file browswer" should be disabled:
11+ # First, for all desktops, when a camera, disable when thumbnailing or
12+ # downloading.
13+ # Second, disable opening MTP devices in KDE environment,
14+ # as KDE won't release them until them the file browser is closed!
15+ # However if the file is already downloaded, we don't care, as can get it from
16+ # local source.
17+ # Finally, disable when we don't know what the default file manager is
18+
19+ active_camera = disable_kde = False
20+ have_file_manager = self.rapidApp.file_manager is not None
21+ if download_status not in Downloaded:
22+ if index.data(Roles.is_camera):
23+ scan_id = index.data(Roles.scan_id)
24+ active_camera = self.rapidApp.deviceState(scan_id) != DeviceState.idle
25+ if not active_camera:
26+ disable_kde = index.data(Roles.mtp) and get_desktop() == Desktop.kde
27+
28+ self.openInFileBrowserAct.setEnabled(
29+ not (disable_kde or active_camera) and have_file_manager
30+ )
31+ if event.type() == QEvent.MouseButtonDblClick:
32+ self.openInFileBrowserAct.trigger()
33+ return False
34 if event.button() == Qt.RightButton:
35- self.clickedIndex = index
36-
37 # Determine if user can manually mark file or files as previously downloaded
38 noSelected, noDownloaded = self.oneOrMoreNotDownloaded()
39 if noDownloaded == Plural.two_form_single:
40@@ -2141,35 +2165,11 @@
41 self.markFileDownloadedAct.setVisible(False)
42
43 globalPos = self.rapidApp.thumbnailView.viewport().mapToGlobal(event.pos())
44- # libgphoto2 needs exclusive access to the camera, so there are times when "open
45- # in file browswer" should be disabled:
46- # First, for all desktops, when a camera, disable when thumbnailing or
47- # downloading.
48- # Second, disable opening MTP devices in KDE environment,
49- # as KDE won't release them until them the file browser is closed!
50- # However if the file is already downloaded, we don't care, as can get it from
51- # local source.
52- # Finally, disable when we don't know what the default file manager is
53-
54- active_camera = disable_kde = False
55- have_file_manager = self.rapidApp.file_manager is not None
56- if download_status not in Downloaded:
57- if index.data(Roles.is_camera):
58- scan_id = index.data(Roles.scan_id)
59- active_camera = self.rapidApp.deviceState(scan_id) != DeviceState.idle
60- if not active_camera:
61- disable_kde = index.data(Roles.mtp) and get_desktop() == Desktop.kde
62-
63- self.openInFileBrowserAct.setEnabled(
64- not (disable_kde or active_camera) and have_file_manager
65- )
66 self.contextMenu.popup(globalPos)
67 return False
68 if event.button() != Qt.LeftButton or not self.getCheckBoxRect(
69 option.rect).contains(event.pos()):
70 return False
71- if event.type() == QEvent.MouseButtonDblClick:
72- return True
73 elif event.type() == QEvent.KeyPress:
74 if event.key() != Qt.Key_Space and event.key() != Qt.Key_Select:
75 return False

Subscribers

People subscribed via source and target branches