diff options
Diffstat (limited to 'src/ui.py')
-rw-r--r-- | src/ui.py | 49 |
1 files changed, 47 insertions, 2 deletions
@@ -1,8 +1,43 @@ -from PyQt4 import QtCore, QtGui - +from common import * from editorui import * +class KPLayerList(QtGui.QWidget): + class LayerModel(QtCore.QAbstractListModel): + def headerData(self, section, orientation, role = Qt.DisplayRole): + return 'Layer' + + def rowCount(self, parent): + print globals().keys() + return len(KP.map.layers) + + def data(self, index, role = Qt.DisplayRole): + try: + if role == Qt.DisplayRole and index.isValid(): + return KP.map.layers[index.row()].name + except IndexError: + pass + + return QVariant() + + + def __init__(self): + QtGui.QWidget.__init__(self) + + self.layout = QtGui.QVBoxLayout() + + self.model = KPLayerList.LayerModel() + + self.listWidget = QtGui.QListView() + self.listWidget.setModel(self.model) + self.layout.addWidget(self.listWidget) + + self.toolbar = QtGui.QToolBar() + self.layout.addWidget(self.toolbar) + + self.setLayout(self.layout) + + class KPMainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) @@ -11,6 +46,8 @@ class KPMainWindow(QtGui.QMainWindow): self.setCentralWidget(self.editor) self.setupMenuBar() + + self.setupDocks() def setupMenuBar(self): @@ -18,6 +55,14 @@ class KPMainWindow(QtGui.QMainWindow): m = mb.addMenu('&File') # ... + + + def setupDocks(self): + self.layerList = KPLayerList() + self.layerListDock = QtGui.QDockWidget('Layers') + self.layerListDock.setWidget(self.layerList) + + self.addDockWidget(Qt.RightDockWidgetArea, self.layerListDock) |