diff --git a/cuegui/cuegui/Constants.py b/cuegui/cuegui/Constants.py index b25ae0e50..13b511317 100644 --- a/cuegui/cuegui/Constants.py +++ b/cuegui/cuegui/Constants.py @@ -137,8 +137,6 @@ def __packaged_version(): EMAIL_BODY_PREFIX = __config.get('email.body_prefix') EMAIL_BODY_SUFFIX = __config.get('email.body_suffix') EMAIL_DOMAIN = __config.get('email.domain') -USER_CONFIRM_RESTART = "You must restart for this action to take effect, close window?: " -USER_INTERACTION_PERMISSIONS = "You do not have permissions to {0} {1} owned by {2}" GITHUB_CREATE_ISSUE_URL = __config.get('links.issue.create') URL_USERGUIDE = __config.get('links.user_guide') diff --git a/cuegui/cuegui/MainWindow.py b/cuegui/cuegui/MainWindow.py index 1cbb7cd6b..e9b4bc9a3 100644 --- a/cuegui/cuegui/MainWindow.py +++ b/cuegui/cuegui/MainWindow.py @@ -46,6 +46,9 @@ class MainWindow(QtWidgets.QMainWindow): """The main window of the application. Multiple windows may exist.""" + # Message to be displayed when a change requires an application restart + USER_CONFIRM_RESTART = "You must restart for this action to take effect, close window?: " + windows = [] windows_names = [] windows_titles = {} @@ -469,7 +472,7 @@ def __revertLayout(self): result = QtWidgets.QMessageBox.question( self, "Restart required ", - cuegui.Constants.USER_CONFIRM_RESTART, + MainWindow.USER_CONFIRM_RESTART, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) if result == QtWidgets.QMessageBox.Yes: @@ -481,7 +484,7 @@ def __enableJobInteraction(self): result = QtWidgets.QMessageBox.question( self, "Job Interaction Settings ", - cuegui.Constants.USER_CONFIRM_RESTART, + MainWindow.USER_CONFIRM_RESTART, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) if result == QtWidgets.QMessageBox.Yes: diff --git a/cuegui/cuegui/MenuActions.py b/cuegui/cuegui/MenuActions.py index 30b5c9d8e..70cddc770 100644 --- a/cuegui/cuegui/MenuActions.py +++ b/cuegui/cuegui/MenuActions.py @@ -214,6 +214,9 @@ def getText(self, title, body, default): class JobActions(AbstractActions): """Actions for jobs.""" + # Template for permission alert messages + USER_INTERACTION_PERMISSIONS = "You do not have permissions to {0} {1} owned by {2}" + def __init__(self, *args): AbstractActions.__init__(self, *args) @@ -384,9 +387,9 @@ def kill(self, rpcObjects=None): for job in jobs: # check permissions if not cuegui.Utils.isPermissible(job): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("kill", - "job(s)", - job.username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("kill", + "job(s)", + job.username()) cuegui.Utils.showErrorMessageBox(msg) else: job.kill(reason=DEFAULT_JOB_KILL_REASON) @@ -465,9 +468,9 @@ def eatDead(self, rpcObjects=None): for job in jobs: # check permissions if not cuegui.Utils.isPermissible(job): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("eat dead", - "job", - job.username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("eat dead", + "job", + job.username()) cuegui.Utils.showErrorMessageBox(msg) else: job.eatFrames(state=[opencue.compiled_proto.job_pb2.DEAD]) @@ -503,9 +506,9 @@ def retryDead(self, rpcObjects=None): [job.data.name for job in jobs]): for job in jobs: if not cuegui.Utils.isPermissible(job): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("retry dead", - "job", - job.username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("retry dead", + "job", + job.username()) cuegui.showErrorMessageBox(msg) else: job.retryFrames( @@ -804,9 +807,9 @@ def kill(self, rpcObjects=None): if layers: #check permissions if not cuegui.Utils.isPermissible(self._getSource()): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("kill", - "layers", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("kill", + "layers", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(self._caller, "Confirm", @@ -822,9 +825,9 @@ def eat(self, rpcObjects=None): layers = self._getOnlyLayerObjects(rpcObjects) if layers: if not cuegui.Utils.isPermissible(self._getSource()): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("eat", - "layers", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("eat", + "layers", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(self._caller, "Confirm", @@ -840,9 +843,9 @@ def retry(self, rpcObjects=None): layers = self._getOnlyLayerObjects(rpcObjects) if layers: if not cuegui.Utils.isPermissible(self._getSource()): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("retry", - "layers", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("retry", + "layers", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(self._caller, "Confirm", @@ -858,9 +861,9 @@ def retryDead(self, rpcObjects=None): layers = self._getOnlyLayerObjects(rpcObjects) if layers: if not cuegui.Utils.isPermissible(self._getSource()): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("retry dead", - "layers", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("retry dead", + "layers", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(self._caller, "Confirm", @@ -1093,9 +1096,9 @@ def retry(self, rpcObjects=None): job = self._getSource() # check permissions if not cuegui.Utils.isPermissible(job): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("retry", - "frames", - job.username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("retry", + "frames", + job.username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo( @@ -1138,9 +1141,9 @@ def eat(self, rpcObjects=None): #check permissions print(self._getSource()) if not cuegui.Utils.isPermissible(self._getSource()): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("eat", - "frames", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("eat", + "frames", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(self._caller, "Confirm", @@ -1155,9 +1158,9 @@ def kill(self, rpcObjects=None): names = [frame.data.name for frame in self._getOnlyFrameObjects(rpcObjects)] if names: if not cuegui.Utils.isPermissible(self._getSource(), self): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("kill", - "frames", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("kill", + "frames", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(self._caller, "Confirm", @@ -1271,9 +1274,9 @@ def eatandmarkdone(self, rpcObjects=None): frameNames = [frame.data.name for frame in frames] #check permissions if not cuegui.Utils.isPermissible(self._getSource(), self): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("eat and mark done", - "frames", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("eat and mark done", + "frames", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo( @@ -1750,9 +1753,9 @@ def kill(self, rpcObjects=None): if procs: print(self._getSource()) if not cuegui.Utils.isPermissible(self._getSource(), self): - msg = cuegui.Constants.USER_INTERACTION_PERMISSIONS.format("eat and mark done", - "frames", - self._getSource().username()) + msg = JobActions.USER_INTERACTION_PERMISSIONS.format("eat and mark done", + "frames", + self._getSource().username()) cuegui.Utils.showErrorMessageBox(msg) else: if cuegui.Utils.questionBoxYesNo(