Browse Source

Automatically focus canvas view if changing to canvas tab; Misc

tags/1.9.5
falkTX 10 years ago
parent
commit
09156303ff
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      source/carla_host.py

+ 13
- 0
source/carla_host.py View File

@@ -362,6 +362,8 @@ class HostWindow(QMainWindow):

self.ui.miniCanvasPreview.miniCanvasMoved.connect(self.slot_miniCanvasMoved)

self.ui.tabWidget.currentChanged.connect(self.slot_tabChanged)

self.scene.scaleChanged.connect(self.slot_canvasScaleChanged)
self.scene.sceneGroupMoved.connect(self.slot_canvasItemMoved)
self.scene.pluginSelected.connect(self.slot_canvasPluginSelected)
@@ -400,8 +402,10 @@ class HostWindow(QMainWindow):
self.setProperWindowTitle()

# Qt needs this so it properly creates & resizes the canvas
self.ui.tabWidget.blockSignals(True)
self.ui.tabWidget.setCurrentIndex(1)
self.ui.tabWidget.setCurrentIndex(0)
self.ui.tabWidget.blockSignals(False)

# Plugin needs to have timers always running so it receives messages
if self.host.isPlugin:
@@ -1449,10 +1453,12 @@ class HostWindow(QMainWindow):
width = self.ui.graphicsView.width()
height = self.ui.graphicsView.height()
else:
self.ui.tabWidget.blockSignals(True)
self.ui.tabWidget.setCurrentIndex(1)
width = self.ui.graphicsView.width()
height = self.ui.graphicsView.height()
self.ui.tabWidget.setCurrentIndex(0)
self.ui.tabWidget.blockSignals(False)

self.ui.miniCanvasPreview.setViewSize(float(width)/self.fCanvasWidth, float(height)/self.fCanvasHeight)

@@ -1513,6 +1519,13 @@ class HostWindow(QMainWindow):
# --------------------------------------------------------------------------------------------------------
# Misc

@pyqtSlot(int)
def slot_tabChanged(self, index):
if index != 1:
return

self.ui.graphicsView.setFocus()

@pyqtSlot(int)
def slot_handleReloadAllCallback(self, pluginId):
if pluginId >= self.fPluginCount:


Loading…
Cancel
Save