Skip to content

Commit

Permalink
support ctrl+c copy to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
xinntao committed Jul 16, 2022
1 parent 3501f10 commit 7bf1b6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion handyview/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ def keyPressEvent(self, event):
for qview in self.qviews:
qview.set_zoom(1)
elif event.key() == QtCore.Qt.Key_C:
self.compare_folders(1)
if modifiers == QtCore.Qt.ControlModifier:
# copy image to clipboard
clipboard = QApplication.clipboard()
mime_data = QtCore.QMimeData()
full_path = os.path.abspath(self.img_path)
mime_data.setUrls([QtCore.QUrl(f'file:///{full_path}')])
clipboard.setMimeData(mime_data)
else:
self.compare_folders(1)
elif event.key() == QtCore.Qt.Key_V:
self.compare_folders(-1)

Expand Down Expand Up @@ -231,6 +239,7 @@ def show_image(self, init=False):
md5_0, phash_0 = self.db.get_fingerprint(fidx=self.db.fidx)

qimg = QImage(img_path)
self.img_path = img_path
if idx == 0:
# for HVView, HVScene show_mouse_color.
# only work on the first qimg (main canvas mode)
Expand Down
2 changes: 2 additions & 0 deletions handyview/instruction_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
C and V are a pair, similar to Direction key ← →, but switch among folders
Z: Auto zoom
Shift + Z: Cancel auto zoom
Ctrl + C: Copy image, can be pasted in directory
Space: Next image
Backspace: Previous image
Tab: Switch the focused views
Expand Down Expand Up @@ -55,6 +56,7 @@
C和V是一对, 类似左右方向键切换, 只是在多个folder间切换
Z: 自动缩放
Shift + Z: 取消自动缩放
Ctrl + C: 复制图像 (可在目录中直接粘贴)
Space: 图像切换, 下一张图像
Backspace: 图像切换, 上一张图像
Tab: 改变激活的图片查看窗口
Expand Down

0 comments on commit 7bf1b6f

Please sign in to comment.