Skip to content

Commit

Permalink
Instead of calling setWindowFlags, made modals inherit QDialog rather…
Browse files Browse the repository at this point in the history
… than QWidget.
  • Loading branch information
ChloeZamorano committed Sep 7, 2024
1 parent 95fb657 commit ce6ccee
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tagstudio/src/qt/modals/add_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from PySide6.QtCore import Signal, Qt
from PySide6.QtWidgets import (
QWidget,
QDialog,
QVBoxLayout,
QHBoxLayout,
QLabel,
Expand All @@ -16,7 +17,7 @@
from src.core.library import Library


class AddFieldModal(QWidget):
class AddFieldModal(QDialog):
done = Signal(int)

def __init__(self, library: "Library"):
Expand All @@ -31,7 +32,6 @@ def __init__(self, library: "Library"):
self.setMinimumSize(400, 300)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.title_widget = QLabel()
self.title_widget.setObjectName("fieldTitle")
Expand Down
4 changes: 2 additions & 2 deletions tagstudio/src/qt/modals/delete_unlinked.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from PySide6.QtGui import QStandardItemModel, QStandardItem
from PySide6.QtWidgets import (
QWidget,
QDialog,
QVBoxLayout,
QHBoxLayout,
QLabel,
Expand All @@ -25,7 +26,7 @@
from src.qt.ts_qt import QtDriver


class DeleteUnlinkedEntriesModal(QWidget):
class DeleteUnlinkedEntriesModal(QDialog):
done = Signal()

def __init__(self, library: "Library", driver: "QtDriver"):
Expand All @@ -37,7 +38,6 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(500, 400)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.desc_widget = QLabel()
self.desc_widget.setObjectName("descriptionLabel")
Expand Down
2 changes: 1 addition & 1 deletion tagstudio/src/qt/modals/file_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
QVBoxLayout,
QHBoxLayout,
QWidget,
QDialog,
QPushButton,
QTableWidget,
QTableWidgetItem,
Expand Down Expand Up @@ -41,7 +42,6 @@ def __init__(self, library: "Library"):
self.setMinimumSize(240, 400)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

# Create Table Widget --------------------------------------------------
self.table = QTableWidget(len(self.lib.ext_list), 1)
Expand Down
4 changes: 2 additions & 2 deletions tagstudio/src/qt/modals/fix_dupes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QWidget,
QDialog,
QVBoxLayout,
QHBoxLayout,
QLabel,
Expand All @@ -24,7 +25,7 @@
from src.qt.ts_qt import QtDriver


class FixDupeFilesModal(QWidget):
class FixDupeFilesModal(QDialog):
# done = Signal(int)
def __init__(self, library: "Library", driver: "QtDriver"):
super().__init__()
Expand All @@ -37,7 +38,6 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(400, 300)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.desc_widget = QLabel()
self.desc_widget.setObjectName("descriptionLabel")
Expand Down
5 changes: 2 additions & 3 deletions tagstudio/src/qt/modals/fix_unlinked.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import typing

from PySide6.QtCore import Qt, QThreadPool
from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
from PySide6.QtWidgets import QWidget, QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton

from src.core.library import Library
from src.qt.helpers.function_iterator import FunctionIterator
Expand All @@ -29,7 +29,7 @@
logging.basicConfig(format="%(message)s", level=logging.INFO)


class FixUnlinkedEntriesModal(QWidget):
class FixUnlinkedEntriesModal(QDialog):
def __init__(self, library: "Library", driver: "QtDriver"):
super().__init__()
self.lib = library
Expand All @@ -41,7 +41,6 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(400, 300)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.unlinked_desc_widget = QLabel()
self.unlinked_desc_widget.setObjectName("unlinkedDescriptionLabel")
Expand Down
4 changes: 2 additions & 2 deletions tagstudio/src/qt/modals/folders_to_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QWidget,
QDialog,
QVBoxLayout,
QHBoxLayout,
QLabel,
Expand Down Expand Up @@ -157,7 +158,7 @@ def cut_branches_adding_nothing(branch: dict):
return tree


class FoldersToTagsModal(QWidget):
class FoldersToTagsModal(QDialog):
# done = Signal(int)
def __init__(self, library: "Library", driver: "QtDriver"):
super().__init__()
Expand All @@ -171,7 +172,6 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(640, 640)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.title_widget = QLabel()
self.title_widget.setObjectName("title")
Expand Down
4 changes: 2 additions & 2 deletions tagstudio/src/qt/modals/mirror_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from PySide6.QtGui import QStandardItemModel, QStandardItem
from PySide6.QtWidgets import (
QWidget,
QDialog,
QVBoxLayout,
QHBoxLayout,
QLabel,
Expand All @@ -27,7 +28,7 @@
from src.qt.ts_qt import QtDriver


class MirrorEntriesModal(QWidget):
class MirrorEntriesModal(QDialog):
done = Signal()

def __init__(self, library: "Library", driver: "QtDriver"):
Expand All @@ -39,7 +40,6 @@ def __init__(self, library: "Library", driver: "QtDriver"):
self.setMinimumSize(500, 400)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 6, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.desc_widget = QLabel()
self.desc_widget.setObjectName("descriptionLabel")
Expand Down
5 changes: 2 additions & 3 deletions tagstudio/src/qt/widgets/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from typing import Callable

from PySide6.QtCore import Signal, Qt
from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton
from PySide6.QtWidgets import QWidget, QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton


class PanelModal(QWidget):
class PanelModal(QDialog):
saved = Signal()

# TODO: Separate callbacks from the buttons you want, and just generally
Expand All @@ -33,7 +33,6 @@ def __init__(
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.root_layout = QVBoxLayout(self)
self.root_layout.setContentsMargins(6, 0, 6, 6)
self.setWindowFlags(Qt.Dialog)

self.title_widget = QLabel()
self.title_widget.setObjectName("fieldTitle")
Expand Down
5 changes: 2 additions & 3 deletions tagstudio/src/qt/widgets/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from typing import Optional

from PySide6.QtCore import Qt
from PySide6.QtWidgets import QWidget, QVBoxLayout, QProgressDialog
from PySide6.QtWidgets import QWidget, QDialog, QVBoxLayout, QProgressDialog


class ProgressWidget(QWidget):
class ProgressWidget(QDialog):
"""Prebuilt thread-safe progress bar widget."""

def __init__(
Expand All @@ -35,7 +35,6 @@ def __init__(
)
self.setWindowTitle(window_title)
self.setWindowModality(Qt.WindowModality.ApplicationModal)
self.setWindowFlags(Qt.Dialog)

def update_label(self, text: str):
self.pb.setLabelText(text)
Expand Down

0 comments on commit ce6ccee

Please sign in to comment.