Path: Change action to warning with option for action.
This commit is contained in:
@@ -1572,15 +1572,37 @@ class TaskPanel:
|
||||
|
||||
def _jobIntegrityCheck(self):
|
||||
"""_jobIntegrityCheck() ... Check Job object for existence of Model and Tools
|
||||
If either Model or Tools is empty, change GUI tab and open appropriate selection window."""
|
||||
If either Model or Tools is empty, change GUI tab, issue appropriate warning,
|
||||
and offer chance to add appropriate item."""
|
||||
|
||||
def _displayWarningWindow(msg):
|
||||
"""Display window with warning message and Add action button.
|
||||
Return action state."""
|
||||
txtHeader = translate("Path_Job", "Warning")
|
||||
txtPleaseAddOne = translate("Path_Job", "Please add one.")
|
||||
txtOk = translate("Path_Job", "Ok")
|
||||
txtAdd = translate("Path_Job", "Add")
|
||||
|
||||
msgbox = QtGui.QMessageBox(
|
||||
QtGui.QMessageBox.Warning, txtHeader, msg + " " + txtPleaseAddOne
|
||||
)
|
||||
msgbox.addButton(txtOk, QtGui.QMessageBox.AcceptRole) # Add 'Ok' button
|
||||
msgbox.addButton(txtAdd, QtGui.QMessageBox.ActionRole) # Add 'Add' button
|
||||
return msgbox.exec_()
|
||||
|
||||
# Check if at least on base model is present
|
||||
if len(self.obj.Model.Group) == 0:
|
||||
PathLog.info(translate("Path_Job", "Please select a model for this job."))
|
||||
self.form.setCurrentIndex(0) # Change tab to General tab
|
||||
self.jobModelEdit()
|
||||
no_model_txt = translate("Path_Job", "This job has no base model.")
|
||||
if _displayWarningWindow(no_model_txt) == 1:
|
||||
self.jobModelEdit()
|
||||
|
||||
# Check if at least one tool is present
|
||||
if len(self.obj.Tools.Group) == 0:
|
||||
PathLog.info(translate("Path_Job", "Please add a tool to this job."))
|
||||
self.form.setCurrentIndex(3) # Change tab to Tools tab
|
||||
self.toolControllerAdd()
|
||||
no_tool_txt = translate("Path_Job", "This job has no tool.")
|
||||
if _displayWarningWindow(no_tool_txt) == 1:
|
||||
self.toolControllerAdd()
|
||||
|
||||
# SelectionObserver interface
|
||||
def addSelection(self, doc, obj, sub, pnt):
|
||||
|
||||
Reference in New Issue
Block a user