def __init__(self): """ An action that can be bound to a keypress or mouse button click, drag, or movement with the bound key or button held. """ super(ViewAction, self).__init__() if self.settingsKey is not None: settings = Settings() prefix = "keybindings/" try: modifiers = int( settings.value(prefix + self.settingsKey + "/modifiers", self.modifiers)) button = int( settings.value(prefix + self.settingsKey + "/button", self.button)) key = int( settings.value(prefix + self.settingsKey + "/key", self.key)) except Exception as e: log.error("Error while reading key binding:") else: self.modifiers = modifiers self.button = button self.key = key
def loadSettings(self): settings = Settings() state = settings.value("mainwindow/state", None) if state: self.restoreState(state) geometry = settings.value("mainwindow/geometry", None) if geometry: self.restoreGeometry(geometry)
def loadSettings(self): settings = Settings() state = settings.value("mainwindow/state", None) if state: self.restoreState(state) geometry = settings.value("mainwindow/geometry", None) if geometry: self.restoreGeometry(geometry)
def __init__(self): """ An action that can be bound to a keypress or mouse button click, drag, or movement with the bound key or button held. """ super(ViewAction, self).__init__() if self.settingsKey is not None: settings = Settings() prefix = "keybindings/" try: modifiers = int(settings.value(prefix + self.settingsKey + "/modifiers", self.modifiers)) button = int(settings.value(prefix + self.settingsKey + "/button", self.button)) key = int(settings.value(prefix + self.settingsKey + "/key", self.key)) except Exception as e: log.error("Error while reading key binding:") else: self.modifiers = modifiers self.button = button self.key = key
def __init__(self, editorSession): """ :type editorSession: mcedit2.editorsession.EditorSession :rtype: EditorTab """ settings = Settings() QtGui.QWidget.__init__(self) self.setContentsMargins(0, 0, 0, 0) self.editorSession = editorSession self.editorSession.dimensionChanged.connect(self.dimensionDidChange) self.debugLastCenters = [] self.viewButtonGroup = QtGui.QButtonGroup(self) self.viewButtonToolbar = QtGui.QToolBar() self.viewButtons = {} self.viewFrames = [] self.views = [] for name, handler in ( ("2D", self.showCutawayView), ("Over", self.showOverheadView), # ("Iso", self.showIsoView), ("Cam", self.showCameraView), # ("4-up", self.showFourUpView), ): button = QtGui.QToolButton(text=name, checkable=True) button.clicked.connect(handler) self.viewButtonGroup.addButton(button) self.viewButtonToolbar.addWidget(button) self.viewButtons[name] = button self.viewStack = QtGui.QStackedWidget() self.miniMap = MinimapWorldView(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache) self.miniMapDockWidget = QtGui.QDockWidget("Minimap", objectName="MinimapWidget", floating=True) self.miniMapDockWidget.setWidget(self.miniMap) self.miniMapDockWidget.setFixedSize(256, 256) self.viewFrames.append(self.miniMap) self.toolOptionsArea = QtGui.QScrollArea() self.toolOptionsArea.setWidgetResizable(True) self.toolOptionsDockWidget = QtGui.QDockWidget( "Tool Options", objectName="ToolOptionsWidget", floating=True) self.toolOptionsDockWidget.setWidget(self.toolOptionsArea) editorSession.dockWidgets.append( (Qt.LeftDockWidgetArea, self.miniMapDockWidget)) editorSession.dockWidgets.append( (Qt.LeftDockWidgetArea, self.toolOptionsDockWidget)) editorSession.loader.addClient(self.miniMap) self.overheadViewFrame = OverheadWorldViewFrame( editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) self.overheadViewFrame.worldView.viewID = "Over" self._addView(self.overheadViewFrame) self.cutawayViewFrame = CutawayWorldViewFrame( editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) self.cutawayViewFrame.worldView.viewID = "2D" self._addView(self.cutawayViewFrame) # # self.fourUpViewFrame = FourUpWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) # self.fourUpViewFrame.worldView.viewID = "4-up" # self._addView(self.fourUpViewFrame) self.cameraViewFrame = CameraWorldViewFrame( editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) self.cameraViewFrame.worldView.viewID = "Cam" self.cameraView = self.cameraViewFrame.worldView self._addView(self.cameraViewFrame) self.viewStack.currentChanged.connect(self._viewChanged) self.viewChanged.connect(self.viewDidChange) self.setLayout( Column(self.viewButtonToolbar, Row(self.viewStack, margin=0), margin=0)) currentViewName = settings.value("mainwindow/currentview", "Cam") if currentViewName not in self.viewButtons: currentViewName = "Cam" self.viewButtons[currentViewName].click()
def __init__(self, editorSession): """ :type editorSession: mcedit2.editorsession.EditorSession :rtype: EditorTab """ settings = Settings() QtGui.QWidget.__init__(self) self.setContentsMargins(0, 0, 0, 0) self.editorSession = editorSession self.editorSession.dimensionChanged.connect(self.dimensionDidChange) self.debugLastCenters = [] self.viewButtonGroup = QtGui.QButtonGroup(self) self.viewButtonToolbar = QtGui.QToolBar() self.viewButtons = {} self.viewFrames = [] self.views = [] for name, handler in ( ("2D", self.showCutawayView), ("Over", self.showOverheadView), # ("Iso", self.showIsoView), ("Cam", self.showCameraView), # ("4-up", self.showFourUpView), ): button = QtGui.QToolButton(text=name, checkable=True) button.clicked.connect(handler) self.viewButtonGroup.addButton(button) self.viewButtonToolbar.addWidget(button) self.viewButtons[name] = button self.viewStack = QtGui.QStackedWidget() self.miniMap = MinimapWorldView(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache) self.miniMapDockWidget = QtGui.QDockWidget("Minimap", objectName="MinimapWidget", floating=True) self.miniMapDockWidget.setWidget(self.miniMap) self.miniMapDockWidget.setFixedSize(256, 256) self.viewFrames.append(self.miniMap) self.toolOptionsArea = QtGui.QScrollArea() self.toolOptionsArea.setWidgetResizable(True) self.toolOptionsDockWidget = QtGui.QDockWidget("Tool Options", objectName="ToolOptionsWidget", floating=True) self.toolOptionsDockWidget.setWidget(self.toolOptionsArea) editorSession.dockWidgets.append((Qt.LeftDockWidgetArea, self.miniMapDockWidget)) editorSession.dockWidgets.append((Qt.LeftDockWidgetArea, self.toolOptionsDockWidget)) editorSession.loader.addClient(self.miniMap) self.overheadViewFrame = OverheadWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) self.overheadViewFrame.worldView.viewID = "Over" self._addView(self.overheadViewFrame) self.cutawayViewFrame = CutawayWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) self.cutawayViewFrame.worldView.viewID = "2D" self._addView(self.cutawayViewFrame) # # self.fourUpViewFrame = FourUpWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) # self.fourUpViewFrame.worldView.viewID = "4-up" # self._addView(self.fourUpViewFrame) self.cameraViewFrame = CameraWorldViewFrame(editorSession.currentDimension, editorSession.textureAtlas, editorSession.geometryCache, self.miniMap) self.cameraViewFrame.worldView.viewID = "Cam" self.cameraView = self.cameraViewFrame.worldView self._addView(self.cameraViewFrame) self.viewStack.currentChanged.connect(self._viewChanged) self.viewChanged.connect(self.viewDidChange) self.setLayout(Column(self.viewButtonToolbar, Row(self.viewStack, margin=0), margin=0)) currentViewName = settings.value("mainwindow/currentview", "Cam") if currentViewName not in self.viewButtons: currentViewName = "Cam" self.viewButtons[currentViewName].click()