summaryrefslogtreecommitdiff
path: root/src/ui.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.py')
-rw-r--r--src/ui.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/ui.py b/src/ui.py
index cc3d4be..a6115ed 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -13,6 +13,7 @@ class KPLayerList(QtGui.QWidget):
self.listView = QtGui.QListView()
self.listView.setModel(self.model)
+ self.listView.selectionModel().currentRowChanged.connect(self.handleRowChanged)
self.layout.addWidget(self.listView)
self.toolbar = QtGui.QToolBar()
@@ -35,6 +36,15 @@ class KPLayerList(QtGui.QWidget):
def selectedLayer(self):
return KP.map.layers[self.listView.selectionModel().currentIndex().row()]
+ selectedLayerChanged = QtCore.pyqtSignal(KPLayer, KPLayer)
+
+ @QtCore.pyqtSlot(QtCore.QModelIndex, QtCore.QModelIndex)
+ def handleRowChanged(self, current, previous):
+ self.selectedLayerChanged.emit(
+ KP.map.layers[current.row()],
+ ((previous.row() >= 0) and KP.map.layers[previous.row()]) or None
+ )
+
def addLayer(self):
KP.map.appendLayer(KP.map.createNewLayer())
@@ -162,21 +172,17 @@ class KPMainWindow(QtGui.QMainWindow):
self.layerListDock.setWidget(self.layerList)
self.objectSelector = KPObjectSelector()
- # TODO: refactor this, this is just a bit of a hack for now
- from wii.u8archive import WiiArchiveU8
- arc = WiiArchiveU8(open('/home/me/Dropbox/NEWERsmbw/Test2.arc', 'rb'))
- img = arc.resolvePath('/BG_tex/Test2_tex.bin').data
- obj = arc.resolvePath('/BG_unt/Test2.bin').data
- objm = arc.resolvePath('/BG_unt/Test2_hd.bin').data
- grp = arc.resolvePath('/BG_grp/Test2_grp.bin').data
- TestTileset = KPTileset(img, obj, objm, grp)
- self.objectSelector.setModel(TestTileset.getModel())
+ self.updateObjectSelector()
self.objectSelectorDock = QtGui.QDockWidget('Objects')
self.objectSelectorDock.setWidget(self.objectSelector)
self.addDockWidget(Qt.RightDockWidgetArea, self.layerListDock)
self.addDockWidget(Qt.RightDockWidgetArea, self.objectSelectorDock)
+
+ @QtCore.pyqtSlot()
+ def updateObjectSelector(self):
+ pass