mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 16:15:52 +08:00
Remove central messageBox in favour of local box
The profile import/export was the only place where it was used, in our code base. Contributes to issue CURA-8687.
This commit is contained in:
parent
9a3cab1ec2
commit
7f8591718d
@ -675,22 +675,6 @@ class CuraApplication(QtApplication):
|
|||||||
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine..."))
|
self._setLoadingHint(self._i18n_catalog.i18nc("@info:progress", "Initializing Active Machine..."))
|
||||||
super().setGlobalContainerStack(stack)
|
super().setGlobalContainerStack(stack)
|
||||||
|
|
||||||
showMessageBox = pyqtSignal(str,str, str, str, int, int,
|
|
||||||
arguments = ["title", "text", "informativeText", "detailedText","buttons", "icon"])
|
|
||||||
"""A reusable dialogbox"""
|
|
||||||
|
|
||||||
def messageBox(self, title, text,
|
|
||||||
informativeText = "",
|
|
||||||
detailedText = "",
|
|
||||||
buttons = QMessageBox.Ok,
|
|
||||||
icon = QMessageBox.NoIcon,
|
|
||||||
callback = None,
|
|
||||||
callback_arguments = []
|
|
||||||
):
|
|
||||||
self._message_box_callback = callback
|
|
||||||
self._message_box_callback_arguments = callback_arguments
|
|
||||||
self.showMessageBox.emit(title, text, informativeText, detailedText, buttons, icon)
|
|
||||||
|
|
||||||
showDiscardOrKeepProfileChanges = pyqtSignal()
|
showDiscardOrKeepProfileChanges = pyqtSignal()
|
||||||
|
|
||||||
def discardOrKeepProfileChanges(self) -> bool:
|
def discardOrKeepProfileChanges(self) -> bool:
|
||||||
|
@ -813,35 +813,6 @@ UM.MainWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog
|
|
||||||
{
|
|
||||||
id: messageDialog
|
|
||||||
modality: Qt.ApplicationModal
|
|
||||||
onAccepted: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onApply: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onDiscard: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onHelp: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onNo: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onRejected: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onReset: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
onYes: CuraApplication.messageBoxClosed(clickedButton)
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: CuraApplication
|
|
||||||
function onShowMessageBox(title, text, informativeText, detailedText, buttons, icon)
|
|
||||||
{
|
|
||||||
messageDialog.title = title
|
|
||||||
messageDialog.text = text
|
|
||||||
messageDialog.informativeText = informativeText
|
|
||||||
messageDialog.detailedText = detailedText
|
|
||||||
messageDialog.standardButtons = buttons
|
|
||||||
messageDialog.icon = icon
|
|
||||||
messageDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component
|
Component
|
||||||
{
|
{
|
||||||
id: discardOrKeepProfileChangesDialogComponent
|
id: discardOrKeepProfileChangesDialogComponent
|
||||||
|
@ -311,19 +311,8 @@ Item
|
|||||||
onAccepted:
|
onAccepted:
|
||||||
{
|
{
|
||||||
var result = Cura.ContainerManager.importProfile(fileUrl);
|
var result = Cura.ContainerManager.importProfile(fileUrl);
|
||||||
|
messageDialog.title = catalog.i18nc("@title:window", "Import Profile")
|
||||||
messageDialog.text = result.message;
|
messageDialog.text = result.message;
|
||||||
if (result.status == "ok")
|
|
||||||
{
|
|
||||||
messageDialog.icon = StandardIcon.Information;
|
|
||||||
}
|
|
||||||
else if (result.status == "warning" || result.status == "duplicate")
|
|
||||||
{
|
|
||||||
messageDialog.icon = StandardIcon.Warning;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
messageDialog.icon = StandardIcon.Critical;
|
|
||||||
}
|
|
||||||
messageDialog.open();
|
messageDialog.open();
|
||||||
CuraApplication.setDefaultPath("dialog_profile_path", folder);
|
CuraApplication.setDefaultPath("dialog_profile_path", folder);
|
||||||
}
|
}
|
||||||
@ -344,7 +333,7 @@ Item
|
|||||||
|
|
||||||
if (result && result.status == "error")
|
if (result && result.status == "error")
|
||||||
{
|
{
|
||||||
messageDialog.icon = StandardIcon.Critical;
|
messageDialog.title = catalog.i18nc("@title:window", "Export Profile")
|
||||||
messageDialog.text = result.message;
|
messageDialog.text = result.message;
|
||||||
messageDialog.open();
|
messageDialog.open();
|
||||||
}
|
}
|
||||||
@ -354,6 +343,13 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Dialogue box for showing the result of importing or exporting profiles.
|
||||||
|
UM.MessageDialog
|
||||||
|
{
|
||||||
|
id: messageDialog
|
||||||
|
standardButtons: Dialog.Ok
|
||||||
|
}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: contentsItem
|
id: contentsItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user