1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2024-11-10 17:59:02 +00:00
dupeguru/qt/pe/details_dialog.py

146 lines
6.2 KiB
Python
Raw Normal View History

# Copyright 2016 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
from PyQt5.QtCore import Qt, QSize, pyqtSignal, pyqtSlot
from PyQt5.QtWidgets import (
QAbstractItemView, QSizePolicy, QGridLayout, QSplitter, QFrame)
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
from PyQt5.QtGui import QResizeEvent
from hscommon.trans import trget
from ..details_dialog import DetailsDialog as DetailsDialogBase
from ..details_table import DetailsTable
from .image_viewer import (
ViewerToolBar, ScrollAreaImageViewer, ScrollAreaController)
tr = trget("ui")
class DetailsDialog(DetailsDialogBase):
def __init__(self, parent, app):
self.vController = None
self.app = app
super().__init__(parent, app)
def _setupUi(self):
self.setWindowTitle(tr("Details"))
self.resize(502, 502)
self.setMinimumSize(QSize(250, 250))
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
self.splitter = QSplitter(Qt.Vertical)
self.topFrame = EmittingFrame()
self.topFrame.setFrameShape(QFrame.StyledPanel)
self.horizontalLayout = QGridLayout()
# Minimum width for the toolbar in the middle:
self.horizontalLayout.setColumnMinimumWidth(1, 10)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setColumnStretch(0, 32)
# Smaller value for the toolbar in the middle to avoid excessive resize
self.horizontalLayout.setColumnStretch(1, 2)
self.horizontalLayout.setColumnStretch(2, 32)
# This avoids toolbar getting incorrectly partially hidden when window resizes
self.horizontalLayout.setRowStretch(0, 1)
self.horizontalLayout.setRowStretch(1, 24)
self.horizontalLayout.setRowStretch(2, 1)
self.horizontalLayout.setSpacing(1) # probably not important
self.selectedImageViewer = ScrollAreaImageViewer(self, "selectedImage")
self.horizontalLayout.addWidget(self.selectedImageViewer, 0, 0, 3, 1)
# Use a specific type of controller depending on the underlying viewer type
self.vController = ScrollAreaController(self)
self.verticalToolBar = ViewerToolBar(self, self.vController)
self.verticalToolBar.setOrientation(Qt.Orientation(Qt.Vertical))
self.horizontalLayout.addWidget(self.verticalToolBar, 1, 1, 1, 1, Qt.AlignCenter)
self.referenceImageViewer = ScrollAreaImageViewer(self, "referenceImage")
self.horizontalLayout.addWidget(self.referenceImageViewer, 0, 2, 3, 1)
self.topFrame.setLayout(self.horizontalLayout)
self.splitter.addWidget(self.topFrame)
self.splitter.setStretchFactor(0, 8)
self.tableView = DetailsTable(self)
sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
self.tableView.setSizePolicy(sizePolicy)
# self.tableView.setMinimumSize(QSize(0, 190))
# self.tableView.setMaximumSize(QSize(16777215, 190))
self.tableView.setAlternatingRowColors(True)
self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.tableView.setShowGrid(False)
self.splitter.addWidget(self.tableView)
self.splitter.setStretchFactor(1, 1)
# Late population needed here for connections to the toolbar
self.vController.setupViewers(
self.selectedImageViewer, self.referenceImageViewer)
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
# self.setCentralWidget(self.splitter) # only as QMainWindow
self.setWidget(self.splitter) # only as QDockWidget
self.topFrame.resized.connect(self.resizeEvent)
def _update(self):
if self.vController is None: # Not yet constructed!
return
if not self.app.model.selected_dupes:
# No item from the model, disable and clear everything.
self.vController.resetViewersState()
return
dupe = self.app.model.selected_dupes[0]
group = self.app.model.results.get_group_of_duplicate(dupe)
ref = group.ref
self.vController.updateView(ref, dupe, group)
# --- Override
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
@pyqtSlot(QResizeEvent)
def resizeEvent(self, event):
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
self.ensure_same_sizes()
if self.vController is None or not self.vController.bestFit:
return
# Only update the scaled down pixmaps
self.vController.updateBothImages()
def show(self):
# Give the splitter a maximum height to reach. This is assuming that
# all rows below their headers have the same height
self.tableView.setMaximumHeight(
self.tableView.rowHeight(1)
* self.tableModel.model.row_count()
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
+ self.tableView.verticalHeader().sectionSize(0)
# looks like the handle is taken into account by the splitter
+ self.splitter.handle(1).size().height())
DetailsDialogBase.show(self)
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
self.ensure_same_sizes()
self._update()
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
def ensure_same_sizes(self):
# HACK This ensures same size while shrinking.
# ReferenceViewer might be 1 pixel shorter in width
# due to the toolbar in the middle keeping the same width,
# so resizing in the GridLayout's engine leads to not enough space
# left for the panel on the right.
# This work as a QMainWindow, but doesn't work as a QDockWidget:
# resize can only grow. Might need some custom sizeHint somewhere...
# self.horizontalLayout.setColumnMinimumWidth(
# 0, self.selectedImageViewer.size().width())
# self.horizontalLayout.setColumnMinimumWidth(
# 2, self.selectedImageViewer.size().width())
# This works when expanding but it's ugly:
if self.selectedImageViewer.size().width() > self.referenceImageViewer.size().width():
self.selectedImageViewer.resize(self.referenceImageViewer.size())
# model --> view
def refresh(self):
DetailsDialogBase.refresh(self)
if self.isVisible():
self._update()
Squashed commit of the following: commit ac941037ff51158b64daa65c244df26346af10cf Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 22:21:24 2020 +0200 Fix resize of top frame not updating scaled pixmap * Also limit viewing features such as zoom levels when files have different dimensions * GraphicsViewImageViewer is still a bit buggy: the scrollbars are toggled on when the pixmap is null in the reference viewer (we do not use that class right anyway) commit 733b3b0ed4fbd6de908c968402af03879df3336f Author: glubsy <glubsy@users.noreply.github.com> Date: Thu Jul 16 01:31:24 2020 +0200 Prevent zoom for images of differing dimensions * If images are not the same size, prevent zooming features from being used by disabling the normal size button, only enable swap commit 9168d72f38faaf0a12230cd544f14190cd29fca4 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:47:32 2020 +0200 Update preferences on show(), not in constructor * If the dialog window shouldn't have a titlebar during construction, update accordingly only when showing to fix Windows displaying a window without titlebar on first show * Only save geometry if the window is floating. Otherwise geometry while docked is saved whih gives weird results on subsequent starts, since it may be floating by default anyway (at least on Linux where titlebar being disabled is allowed while floating) * Vertical title bar doesn't seem to work on Windows, add note in preferences dialog commit 75621cc816120597f493e0debc6d88e2e0bbd30a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 22:04:19 2020 +0200 Prevent Windows from floating if no decoration * Windows users cannot move a window which has no native decorations. Toggling a dock widget's titlebar off also removes native decorations on a floating window. Until we implement a replacement titlebar by overriding paintEvents, simply force the floating window to go back to docked state after we toggled the titlebar off. commit 3c816b2f11ddc66a78cdc6327ee102df46d1a552 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:43:01 2020 +0200 Fix computing and setting offset to 0 for tableview commit 85d6e05cd406b999e8f6ae421a9746a0c9f146bb Merge: 66127d02 3eddeb6a Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 21:25:44 2020 +0200 Merge branch 'dockable_windows' into details_dialog_improvements_dev commit 66127d025e9a497ee13126f955166946acdb35a8 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 20:22:13 2020 +0200 Add credit for icons used, upscale exchange icon * Jason Cho gave his express permission to use the icon (it was made 10 years ago and he doesn't have the source files anymore) * Used waifu2x to upscale the icon * Used GIMP to draw dark outline around the icon * Source files are included commit 58c675d1fa90a7247233d9887a460cf5a8e4cbf5 Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 05:25:47 2020 +0200 Add custom icons * Use custom icons on platforms which do not provide theme * Old zoom icons credits to "schollidesign" from icon pack Office and Entertainment (GPL licence). * Exchange icon credit to Jason Cho (Unknown license). * Use hack to resize viewers on first show() as well commit 95b8406c7b97aab170d127b466ff506b724def3c Author: glubsy <glubsy@users.noreply.github.com> Date: Wed Jul 15 04:14:24 2020 +0200 Fix scrollbar displayed while splitter maxed out * For some reason the table's height is a few pixel longer on Windows so we work around the issue by adding a small offset to the maximum height hint. * No idea about MacOS yet but this might need the same treatment. commit 3eddeb6aebc99126e62eb05af60333ba3bd22e82 Author: glubsy <glubsy@users.noreply.github.com> Date: Tue Jul 14 17:37:48 2020 +0200 Fix ME/SE details dialogs, add preferences * Fix ME and SE versions of details dialog not displaying their content properly after change to QDockWidget * Add option to toggle titlebar and orientation of titlebar in preferences dialog * Fix setting layout on PE details dialog window while layout already set, by removing the self (parent) reference in constructing the QSplitter commit 56912a71084415eac2f447650279d833d9857686 Author: glubsy <glubsy@users.noreply.github.com> Date: Mon Jul 13 05:06:04 2020 +0200 Make details dialog dockable
2020-07-16 20:31:54 +00:00
class EmittingFrame(QFrame):
"""Emits a signal whenever is resized"""
resized = pyqtSignal(QResizeEvent)
def resizeEvent(self, event):
self.resized.emit(event)