def setActiveHandler(self, handler_type): if handler_type in self._handlers: handler = self._handlers[handler_type] if self._active_handler is not None and handler != self._active_handler: action = self._handler_map[handler] current_action = self._handler_map[self._active_handler] current_handler = self._active_handler c = CommandChangeViewHandler(current_handler, current_action, handler, action) c.setSetChangeHandlerMethod(self._changeHandler) self._undo_redo_stack.push(c)
def _toolbarAction(self, action): new_handler = self._action_map[action] if new_handler == self._active_handler: action.blockSignals(True) action.setChecked(True) action.blockSignals(False) else: current_action = self._handler_map[self._active_handler] current_handler = self._active_handler c = CommandChangeViewHandler(current_handler, current_action, new_handler, action) c.setSetChangeHandlerMethod(self._changeHandler) self._undo_redo_stack.push(c)