def _register_ops(self): """ Registers each job history operator with a batchapps_history prefix. :Returns: - A list of the names (str) of the registered job history operators. """ ops = [] ops.append( BatchAppsOps.register("history.page", "Job history", self._history)) ops.append( BatchAppsOps.register("history.first", "Beginning", self._first)) ops.append(BatchAppsOps.register("history.last", "End", self._last)) ops.append(BatchAppsOps.register("history.more", "Next", self._more)) ops.append( BatchAppsOps.register("history.less", "Previous", self._less)) ops.append( BatchAppsOps.register("history.refresh", "Refresh", self._refresh)) ops.append( BatchAppsOps.register("history.cancel", "Cancel job", self._cancel)) ops.append( BatchAppsOps.register("history.loading", "Loading job history", modal=self._loading_modal, invoke=self._loading_invoke, _timer=None)) return ops
def _register_ops(self): """ Registers the shared operators with a batchapps_shared prefix. :Returns: - A list of the names (str) of the registered operators. """ ops = [] ops.append(BatchAppsOps.register("shared.home", "Home", self._home)) ops.append( BatchAppsOps.register("shared.management_portal", "Management Portal", self._management_portal)) return ops
def _register_ops(self): """ Registers the shared operators with a batchapps_shared prefix. :Returns: - A list of the names (str) of the registered operators. """ ops = [] ops.append(BatchAppsOps.register("shared.home", "Home", self._home)) ops.append(BatchAppsOps.register("shared.management_portal", "Management Portal", self._management_portal)) return ops
def _start(self, op, context, *args): """ The execute method for the submission.start operator. Sets the functions to be performed by the job submission thread and updates the session page to "PROCESSING" while the thread executes. :Args: - op (:class:`bpy.types.Operator`): An instance of the current operator class. - context (:class:`bpy.types.Context`): The current blender context. :Returns: - Blender-specific value {'FINISHED'} to indicate the operator has completed its action. """ submit_thread = lambda: BatchAppsOps.session(self.submit_job) self.props.thread = threading.Thread(name="SubmitThread", target=submit_thread) bpy.ops.batchapps_submission.processing('INVOKE_DEFAULT') if context.scene.batchapps_session.page == "SUBMIT": context.scene.batchapps_session.page = "PROCESSING" return {'FINISHED'}
def register_pool(self, pool, index): """ Register a pool as an operator class for dispaly in the UI. :Args: - pool (:class:`batchapps.jobs.SubmittedJob`): The pool to register. - index (int): The index of the job in list currently displayed. :Returns: - The newly registered operator name (str). """ name = "pools.{0}".format(pool.id.replace("-", "_")) label = "Pool: {0}".format(pool.id) index_prop = bpy.props.IntProperty(default=index) def execute(self): session = bpy.context.scene.batchapps_pools bpy.context.scene.batchapps_session.log.debug( "Pool details opened: {0}, selected: {1}, index {2}".format( self.enabled, session.selected, self.ui_index)) if self.enabled and session.selected == self.ui_index: session.selected = -1 else: session.selected = self.ui_index bpy.context.scene.batchapps_session.log.debug( "Registering {0}".format(name)) return BatchAppsOps.register_expanding(name, label, execute, ui_index=index_prop)
def _login(self, op, context, *args): """ The execute method for the auth.login operator. Sets the functions to per performed by the authentication thread and updates the session page to "REDIRECT" while the thread executes. :Args: - op (:class:`bpy.types.Operator`): An instance of the current operator class. - context (:class:`bpy.types.Context`): The current blender context. :Returns: - Blender-specific value {'FINISHED'} to indicate the operator has completed its action. """ auth_thread = lambda: BatchAppsOps.session(self.web_authentication) self.props.thread = threading.Thread(name="AuthThread", target=auth_thread) bpy.ops.batchapps_auth.redirect('INVOKE_DEFAULT') if context.scene.batchapps_session.page == "LOGIN": context.scene.batchapps_session.page = "REDIRECT" return {'FINISHED'}
def _history(self, op, context, *args): """ The execute method for the history.page operator. Sets the functions to be performed by the job data retrieval thread and updates the session page to "LOADING" while the thread executes. Also resets the job display paging controls. :Args: - op (:class:`bpy.types.Operator`): An instance of the current operator class. - context (:class:`bpy.types.Context`): The current blender context. :Returns: - Blender-specific value {'FINISHED'} to indicate the operator has completed its action. """ self.props.display = context.scene.batchapps_history self.props.display.selected = -1 self.props.display.index = 0 self.props.display.total_count = 0 history_thread = lambda: BatchAppsOps.session(self.get_job_list) self.props.thread = threading.Thread(name="HistoryThread", target=history_thread) bpy.ops.batchapps_history.loading('INVOKE_DEFAULT') if context.scene.batchapps_session.page == "HOME": context.scene.batchapps_session.page = "LOADING" return {'FINISHED'}
def _register_ops(self): """ Registers each auth operator with a batchapps_auth prefix. :Returns: - A list of the names (str) of the registered auth operators. """ ops = [] ops.append(BatchAppsOps.register("auth.login", "Login", self._login)) ops.append(BatchAppsOps.register("auth.logout", "Logout", self._logout)) ops.append( BatchAppsOps.register("auth.redirect", "Redirecting authentication", modal=self._redirect_modal, invoke=self._redirect_invoke, _timer=None)) return ops
def _register_ops(self): """ Registers each pool operator with a batchapps_pools prefix. :Returns: - A list of the names (str) of the registered pool operators. """ ops = [] ops.append( BatchAppsOps.register("pools.page", "Running pools", self._pools)) ops.append( BatchAppsOps.register("pools.start", "Start new pool", self._start)) ops.append( BatchAppsOps.register("pools.delete", "Delete pool", self._delete)) ops.append( BatchAppsOps.register_expanding("pools.create", "Create pool", self._create)) return ops
def _register_ops(self): """ Registers each auth operator with a batchapps_auth prefix. :Returns: - A list of the names (str) of the registered auth operators. """ ops = [] ops.append(BatchAppsOps.register("auth.login", "Login", self._login)) ops.append(BatchAppsOps.register("auth.logout", "Logout", self._logout)) ops.append(BatchAppsOps.register("auth.redirect", "Redirecting authentication", modal=self._redirect_modal, invoke=self._redirect_invoke, _timer=None)) return ops
def _register_ops(self): """ Registers each pool operator with a batchapps_pools prefix. :Returns: - A list of the names (str) of the registered pool operators. """ ops = [] ops.append(BatchAppsOps.register("pools.page", "Running pools", self._pools)) ops.append(BatchAppsOps.register("pools.start", "Start new pool", self._start)) ops.append(BatchAppsOps.register("pools.delete", "Delete pool", self._delete)) ops.append(BatchAppsOps.register_expanding("pools.create", "Create pool", self._create)) return ops
def _register_ops(self): """ Registers each job submission operator with a batchapps_submission prefix. :Returns: - A list of the names (str) of the registered job submission operators. """ ops = [] ops.append(BatchAppsOps.register("submission.page", "Create new job", self._submission)) ops.append(BatchAppsOps.register("submission.start", "Submit job", self._start)) ops.append(BatchAppsOps.register("submission.processing", "Submitting new job", modal=self._processing_modal, invoke=self._processing_invoke, _timer=None)) return ops
def _register_ops(self): """ Registers each asset operator with a batchapps_assets prefix. :Returns: - A list of the names (str) of the registered asset operators. """ ops = [] ops.append(BatchAppsOps.register("assets.page", "Scene assets", self._assets)) ops.append(BatchAppsOps.register("assets.refresh", "Refresh assets", self._refresh)) ops.append(BatchAppsOps.register("assets.upload", "Upload selected assets", self._upload)) ops.append(BatchAppsOps.register("assets.remove", "Remove asset", invoke=self._remove)) ops.append( BatchAppsOps.register( "assets.add", "Add asset", self._add_execute, invoke=self._add_invoke, filepath=bpy.props.StringProperty(subtype="FILE_PATH"), ) ) return ops
def _register_ops(self): """ Registers each job submission operator with a batchapps_submission prefix. :Returns: - A list of the names (str) of the registered job submission operators. """ ops = [] ops.append( BatchAppsOps.register("submission.page", "Create new job", self._submission)) ops.append( BatchAppsOps.register("submission.start", "Submit job", self._start)) ops.append( BatchAppsOps.register("submission.processing", "Submitting new job", modal=self._processing_modal, invoke=self._processing_invoke, _timer=None)) return ops
def _register_ops(self): """ Registers each job history operator with a batchapps_history prefix. :Returns: - A list of the names (str) of the registered job history operators. """ ops = [] ops.append(BatchAppsOps.register("history.page", "Job history", self._history)) ops.append(BatchAppsOps.register("history.first", "Beginning", self._first)) ops.append(BatchAppsOps.register("history.last", "End", self._last)) ops.append(BatchAppsOps.register("history.more", "Next", self._more)) ops.append(BatchAppsOps.register("history.less", "Previous", self._less)) ops.append(BatchAppsOps.register("history.refresh", "Refresh", self._refresh)) ops.append(BatchAppsOps.register("history.cancel", "Cancel job", self._cancel)) ops.append(BatchAppsOps.register("history.loading", "Loading job history", modal=self._loading_modal, invoke=self._loading_invoke, _timer=None)) return ops