Added context menu on image

Added a context menu on the image label to copy the file URL into the clipboard.
dev
Peery 2 years ago
parent 7fc5bf349c
commit a66c601410

@ -1,12 +1,12 @@
import validators
import os
import platform
import logging
import re
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt, QSize, QUrl
from PyQt5.QtGui import QPixmap, QResizeEvent, QKeyEvent, QStandardItemModel, QStandardItem, QMovie, QDesktopServices, QIcon
from PyQt5.QtGui import QPixmap, QResizeEvent, QKeyEvent, QStandardItemModel, QStandardItem, QMovie, QDesktopServices, \
QIcon, QCursor
from PyQt5 import QtMultimedia
from PyQt5.QtMultimediaWidgets import QVideoWidget
@ -94,6 +94,9 @@ class ImporterWindow(ArtnetMainWindow):
self.ui.description_edit.setReadOnly(False)
self.ui.image_label.setContextMenuPolicy(Qt.CustomContextMenu)
self.ui.image_label.customContextMenuRequested.connect(self.on_custom_context_menu_requested)
self.on_tag_search_change()
self.center()
@ -1085,6 +1088,24 @@ class ImporterWindow(ArtnetMainWindow):
def on_collection_button_clicked(self):
logging.debug("Clicked on collection button!")
QtWidgets.QMessageBox.information(self, "Not Implemented", "This feature has not been implemented yet!")
# TODO open dialog with collection selection and buttons for edit, creation and deletion
# TODO allow editing of the rank string
# TODO make collection inspectable (a list of all entries with their rank string would suffice)
selected_collections = CollectionSelectDialog(self).exec_(self.curr_collections)
selected_collections = [self.get_collection(collection_id=c[0]) for c in selected_collections] # TODO verify that it returns the art-collection details if there are any
for selected_collection in selected_collections: # allow editing the collection rankings
result = CollectionModDialog(self, db_connection=self.main.db_connection, edit_collection=False)\
.exec_(selected_collection)
print()
self.set_current_collections(list(set(list(self.curr_collections + selected_collections))))
def on_custom_context_menu_requested(self):
action = QtWidgets.QAction('Copy URL to clipboard')
action.triggered.connect(self.on_copy_url_to_clipboard)
menu = QtWidgets.QMenu()
menu.addAction(action)
menu.exec_(QCursor.pos())
def on_copy_url_to_clipboard(self):
QtWidgets.QApplication.clipboard().setText(os.path.join(self.main.config.data['file_root'], self.curr_art_path))

Loading…
Cancel
Save