Skip to content

Commit

Permalink
PICARD-2680: Modal first use and save confirmation dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
phw committed Jul 7, 2023
1 parent c2e7cf9 commit 1105142
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions picard/ui/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ def save(self):
config = get_config()
if config.setting["file_save_warning"]:
count = len(self.tagger.get_files_from_objects(self.selected_objects))
msg = SaveWarningDialog(count)
msg = SaveWarningDialog(self, count)
proceed_with_save, disable_warning = msg.show()
config.setting["file_save_warning"] = not disable_warning
else:
Expand Down Expand Up @@ -1989,7 +1989,7 @@ def update_profile_selection(self, profile_id):
def show_new_user_dialog(self):
config = get_config()
if config.setting["show_new_user_dialog"]:
msg = NewUserDialog()
msg = NewUserDialog(self)
config.setting["show_new_user_dialog"] = msg.show()


Expand Down
10 changes: 7 additions & 3 deletions picard/ui/newuserdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


from PyQt5 import QtWidgets
from PyQt5 import (
QtCore,
QtWidgets,
)

from picard.const import PICARD_URLS


class NewUserDialog():

def __init__(self):
def __init__(self, parent):

dialog_text = _(
"<h2 align=center>READ THIS BEFORE USING PICARD</h2>"
Expand All @@ -50,10 +53,11 @@ def __init__(self):
self.show_again = True
show_again_text = _("Show this message again the next time you start Picard.")

self.msg = QtWidgets.QMessageBox()
self.msg = QtWidgets.QMessageBox(parent)
self.msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
self.msg.setText(dialog_text)
self.msg.setWindowTitle(_("New User Information"))
self.msg.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)

self.cb = QtWidgets.QCheckBox(show_again_text)
self.cb.setChecked(self.show_again)
Expand Down
10 changes: 7 additions & 3 deletions picard/ui/savewarningdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


from PyQt5 import QtWidgets
from PyQt5 import (
QtCore,
QtWidgets,
)

from picard.config import get_config


class SaveWarningDialog():

def __init__(self, file_count=None):
def __init__(self, parent, file_count=None):

actions = []
config = get_config()
Expand Down Expand Up @@ -56,10 +59,11 @@ def __init__(self, file_count=None):
disable_text = _("Don't show this warning again.")

self.disable = False
self.msg = QtWidgets.QMessageBox()
self.msg = QtWidgets.QMessageBox(parent)
self.msg.setIcon(QtWidgets.QMessageBox.Icon.Warning)
self.msg.setText(warning_text)
self.msg.setWindowTitle(_("File Save Warning"))
self.msg.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)

self.cb = QtWidgets.QCheckBox(disable_text)
self.cb.setChecked(False)
Expand Down

0 comments on commit 1105142

Please sign in to comment.