|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import validators, os
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
from PyQt5 import QtWidgets
|
|
|
|
|
from PyQt5.QtCore import Qt, QSize, QUrl
|
|
|
|
@ -650,7 +651,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
elif a0.key() == Qt.Key_Right:
|
|
|
|
|
self.on_next_clicked()
|
|
|
|
|
elif a0.key() == Qt.Key_Return:
|
|
|
|
|
print("Pressed Enter!")
|
|
|
|
|
logging.debug("Pressed Enter!")
|
|
|
|
|
if self.__showing_video:
|
|
|
|
|
s = self.__player.state()
|
|
|
|
|
if self.__player.state() == QtMultimedia.QMediaPlayer.PlayingState:
|
|
|
|
@ -684,7 +685,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
self.set_tag_list(self.curr_tags) # update relevant lists
|
|
|
|
|
self.set_tag_search_result_list([item_data[0]])
|
|
|
|
|
print(item_data)
|
|
|
|
|
logging.debug(item_data)
|
|
|
|
|
|
|
|
|
|
def on_movie_player_state_changed(self, state: int):
|
|
|
|
|
self.__image_resize()
|
|
|
|
@ -702,12 +703,12 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.__pixmap.setPaused(True)
|
|
|
|
|
|
|
|
|
|
def on_save_clicked(self):
|
|
|
|
|
print("Clicked Save!")
|
|
|
|
|
logging.info("Clicked Save!")
|
|
|
|
|
self.set_image_title_link()
|
|
|
|
|
self.save_changes()
|
|
|
|
|
|
|
|
|
|
def on_import_tags_clicked(self):
|
|
|
|
|
print("Clicked Import!")
|
|
|
|
|
logging.info("Clicked Import!")
|
|
|
|
|
dialog = TagImportDialog(self)
|
|
|
|
|
if len(self.get_image_link_from_line()) == 0 or self.get_image_link_from_line() == '(Unknown)':
|
|
|
|
|
url = LinkGenerator.get_instance().construct_link(self.curr_file_name,
|
|
|
|
@ -765,7 +766,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.set_tag_list(self.curr_tags)
|
|
|
|
|
|
|
|
|
|
def on_next_clicked(self):
|
|
|
|
|
print("Clicked Next!")
|
|
|
|
|
logging.info("Clicked Next!")
|
|
|
|
|
if not self.check_save_changes():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -783,7 +784,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.curr_image_title = self.ui.image_title_line.text()
|
|
|
|
|
|
|
|
|
|
def on_previous_clicked(self):
|
|
|
|
|
print("Clicked previous!")
|
|
|
|
|
logging.info("Clicked previous!")
|
|
|
|
|
if not self.check_save_changes():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -798,14 +799,15 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.on_tag_search_change()
|
|
|
|
|
|
|
|
|
|
def toggle_presence_docker(self):
|
|
|
|
|
print("Clicked presence docker button!")
|
|
|
|
|
if not self.presence_docker_open:
|
|
|
|
|
logging.info("Opened presence docker!")
|
|
|
|
|
self.presence_docker = PresenceDocker(self)
|
|
|
|
|
self.ui.presence_docker_layout.addWidget(self.presence_docker)
|
|
|
|
|
self.presence_docker.set_selected_presences_list(self.get_current_presences())
|
|
|
|
|
self.ui.presence_docker_button.setText(">")
|
|
|
|
|
self.presence_docker_open = True
|
|
|
|
|
else:
|
|
|
|
|
logging.info("Closed presence docker!")
|
|
|
|
|
self.presence_docker.setParent(None)
|
|
|
|
|
self.ui.presence_docker_button.setText("<")
|
|
|
|
|
|
|
|
|
@ -814,7 +816,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.presence_docker_open = False
|
|
|
|
|
|
|
|
|
|
def on_artnet_root_change_clicked(self):
|
|
|
|
|
print("Clicked changing ArtNet root!")
|
|
|
|
|
logging.info("Clicked changing ArtNet root!")
|
|
|
|
|
dialog = QtWidgets.QFileDialog(self, 'Choose new ArtNet root:')
|
|
|
|
|
dialog.setFileMode(QtWidgets.QFileDialog.Directory)
|
|
|
|
|
dialog.setOptions(QtWidgets.QFileDialog.ShowDirsOnly)
|
|
|
|
@ -823,7 +825,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.__main.change_root(directory)
|
|
|
|
|
|
|
|
|
|
def on_db_connection_change_clicked(self):
|
|
|
|
|
print("Clicked db connection change!")
|
|
|
|
|
logging.info("Clicked db connection change!")
|
|
|
|
|
dialog = DBDialog(self)
|
|
|
|
|
prev_db_data = self.__main.get_db_connection_details()
|
|
|
|
|
dialog.ui.user_line_edit.setText(prev_db_data["user"])
|
|
|
|
@ -840,11 +842,11 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
database=db_data["database"])
|
|
|
|
|
|
|
|
|
|
def on_tag_creation_clicked(self):
|
|
|
|
|
print("Clicked Tag Creation!")
|
|
|
|
|
logging.info("Clicked Tag Creation!")
|
|
|
|
|
dialog = TagModifyDialog(self, create_tag=True)
|
|
|
|
|
|
|
|
|
|
tag_data: dict = dialog.exec_()
|
|
|
|
|
print("Got Tag data", tag_data)
|
|
|
|
|
logging.debug("Got Tag data", tag_data)
|
|
|
|
|
if tag_data is None or len(tag_data.keys()) == 0: # got canceled?
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -858,11 +860,11 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.on_tag_search_change()
|
|
|
|
|
|
|
|
|
|
def on_tag_deletion_clicked(self):
|
|
|
|
|
print("Clicked Tag Deletion!")
|
|
|
|
|
logging.info("Clicked Tag Deletion!")
|
|
|
|
|
dialog = TagSelectDialog(self, delete_tag=True)
|
|
|
|
|
|
|
|
|
|
tag = dialog.exec_()
|
|
|
|
|
print("Got Tag", tag)
|
|
|
|
|
logging.debug("Got Tag", tag)
|
|
|
|
|
if tag is None or len(tag) == 0:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -889,7 +891,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
edit_dialog.set_all_categories()
|
|
|
|
|
|
|
|
|
|
tag_data = edit_dialog.exec_()
|
|
|
|
|
print("Got Tag data", tag_data)
|
|
|
|
|
logging.debug("Got Tag data", tag_data)
|
|
|
|
|
if tag_data is None or len(tag_data.keys()) == 0:
|
|
|
|
|
return None
|
|
|
|
|
if len(tag_data["category"]) == 0:
|
|
|
|
@ -909,7 +911,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
return tag_data
|
|
|
|
|
|
|
|
|
|
def on_tag_edit_clicked(self):
|
|
|
|
|
print("Clicked Tag Editing!")
|
|
|
|
|
logging.info("Clicked Tag Editing!")
|
|
|
|
|
select_dialog = TagSelectDialog(self, delete_tag=False)
|
|
|
|
|
|
|
|
|
|
tag = select_dialog.exec_()
|
|
|
|
@ -930,7 +932,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
edit_dialog.set_all_categories()
|
|
|
|
|
|
|
|
|
|
tag_data = edit_dialog.exec_()
|
|
|
|
|
print("Got Tag data", tag_data)
|
|
|
|
|
logging.debug("Got Tag data", tag_data)
|
|
|
|
|
if tag_data is None or len(tag_data.keys()) == 0:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
@ -954,7 +956,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.set_tag_list(self.curr_tags)
|
|
|
|
|
|
|
|
|
|
def on_tag_item_changed(self, item: QStandardItem):
|
|
|
|
|
print("Item {0} has changed!".format(item.text()))
|
|
|
|
|
logging.debug("Item {0} has changed!".format(item.text()))
|
|
|
|
|
if item.checkState() == Qt.Unchecked:
|
|
|
|
|
if item.text() in self.curr_tags:
|
|
|
|
|
self.curr_tags.remove(item.text())
|
|
|
|
@ -995,7 +997,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
def on_prev_unknown_image_clicked(self):
|
|
|
|
|
unknown_image_index = self.__main.get_prev_unknown_image()
|
|
|
|
|
print("Previous unknown image clicked!")
|
|
|
|
|
logging.info("Previous unknown image clicked!")
|
|
|
|
|
|
|
|
|
|
result = QtWidgets.QMessageBox.question(self, "Switch Image?",
|
|
|
|
|
"Do you really want to skip to image #{1} \"{0}\"?"
|
|
|
|
@ -1007,7 +1009,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
def on_next_unknown_image_clicked(self):
|
|
|
|
|
unknown_image_index = self.__main.get_next_unknown_image()
|
|
|
|
|
print("Next unknown image clicked!")
|
|
|
|
|
logging.info("Next unknown image clicked!")
|
|
|
|
|
|
|
|
|
|
result = QtWidgets.QMessageBox.question(self, "Switch Image?",
|
|
|
|
|
"Do you really want to skip to image #{1} \"{0}\"?"
|
|
|
|
@ -1019,7 +1021,7 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
def on_image_id_spinbox_changed(self, v: int):
|
|
|
|
|
if self.__tmp_imageid_spinbox == v:
|
|
|
|
|
print("SpinBox change detected!")
|
|
|
|
|
logging.info("SpinBox change detected!")
|
|
|
|
|
result = QtWidgets.QMessageBox.question(self, "Switch Image?",
|
|
|
|
|
"Do you really want to skip to image #{1} \"{0}\"?"
|
|
|
|
|
.format(self.__main.all_images[v],
|
|
|
|
@ -1031,26 +1033,26 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.__tmp_imageid_spinbox: int = v
|
|
|
|
|
|
|
|
|
|
def on_delete_image_clicked(self):
|
|
|
|
|
print("Delete clicked!")
|
|
|
|
|
logging.info("Delete clicked!")
|
|
|
|
|
art_hash = self.__main.get_md5_of_image(self.curr_art_path)
|
|
|
|
|
if self.__main.db_connection.get_art_by_hash(art_hash) is not None:
|
|
|
|
|
print("Delete on known image")
|
|
|
|
|
logging.debug("Delete on known image")
|
|
|
|
|
confirm_result = QtWidgets.QMessageBox.question(self, "Delete data?", "Do you really wish to delete all "
|
|
|
|
|
"data from the DB about this image?")
|
|
|
|
|
|
|
|
|
|
if confirm_result == QtWidgets.QMessageBox.Yes:
|
|
|
|
|
print(f"deleting image data of \"{self.curr_image_title}\"")
|
|
|
|
|
logging.info(f"deleting image data of \"{self.curr_image_title}\"")
|
|
|
|
|
self.__main.db_connection.remove_image(art_hash)
|
|
|
|
|
else:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
print("Delete on unknown image")
|
|
|
|
|
logging.debug("Delete on unknown image")
|
|
|
|
|
confirm_result = QtWidgets.QMessageBox.question(self, "Delete image?", "Do you really wish to delete this "
|
|
|
|
|
"image?")
|
|
|
|
|
|
|
|
|
|
if confirm_result == QtWidgets.QMessageBox.Yes:
|
|
|
|
|
print("deleting image file")
|
|
|
|
|
logging.info(f"deleting image file {self.curr_art_path}")
|
|
|
|
|
self.__main.delete_image(self.curr_art_path)
|
|
|
|
|
else:
|
|
|
|
|
return
|
|
|
|
@ -1058,11 +1060,11 @@ class Window(QtWidgets.QMainWindow):
|
|
|
|
|
self.__main.refresh_shown_image()
|
|
|
|
|
|
|
|
|
|
def on_link_label_activated(self, link: str):
|
|
|
|
|
print("Source link activated!", link)
|
|
|
|
|
logging.debug("Source link activated!", link)
|
|
|
|
|
QDesktopServices.openUrl(QUrl(link))
|
|
|
|
|
|
|
|
|
|
def on_image_author_label_activated(self, link: str):
|
|
|
|
|
print("Image author link activated!", link)
|
|
|
|
|
logging.debug("Image author link activated!", link)
|
|
|
|
|
QDesktopServices.openUrl(QUrl(link))
|
|
|
|
|
|
|
|
|
|
def on_description_change(self):
|
|
|
|
|