diff options
Diffstat (limited to 'src/ui.py')
-rw-r--r-- | src/ui.py | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -112,6 +112,7 @@ class KPObjectSelector(QtGui.QWidget): # Borrowed the signals and junk from Reggie, figure we'll need em' + # Some more signals are set in setModel self.listView.clicked.connect(self.handleObjReplace) self.sorterMenu.aboutToShow.connect(self.fixUpMenuSize) self.sorterMenu.triggered.connect(self.toggleTopLevel) @@ -154,6 +155,9 @@ class KPObjectSelector(QtGui.QWidget): # a Quick Fix self.listView.setRowHidden(0, True) + # set up signals + self.listView.selectionModel().currentRowChanged.connect(self.handleRowChanged) + def toggleTopLevel(self, action): """Changes the top level group in the list view.""" @@ -175,7 +179,7 @@ class KPObjectSelector(QtGui.QWidget): @QtCore.pyqtSlot(QtCore.QModelIndex, QtCore.QModelIndex) - def currentChanged(self, current, previous): + def handleRowChanged(self, current, previous): """Throws a signal emitting the current object when changed""" i = current.row() object, depth = self.model.groupItem().getItem(i) @@ -230,7 +234,9 @@ class KPMainWindow(QtGui.QMainWindow): self.layerList.selectedLayerChanged.connect(self.scene.setCurrentLayer) self.objectSelector = KPObjectSelector() + self.objectSelector.objChanged.connect(self.handleSelectedObjectChanged) self.updateObjectSelector() + self.objectSelectorDock = QtGui.QDockWidget('Objects') self.objectSelectorDock.setWidget(self.objectSelector) @@ -246,6 +252,13 @@ class KPMainWindow(QtGui.QMainWindow): except IOError: tileset = KPTileset.loadFromArc('/home/me/Dropbox/NEWERsmbw/Test3.arc') self.objectSelector.setModel(tileset.getModel()) + + + @QtCore.pyqtSlot(int, KPTileObject) + def handleSelectedObjectChanged(self, index, obj): + print("New obj: %d, %r" % (index, obj)) + self.editor.paintNext = obj + self.editor.paintNextID = index |