diff options
author | Treeki <treeki@gmail.com> | 2011-11-03 05:16:37 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-11-03 05:16:37 +0100 |
commit | 870cf5ad6f121e3a0f69c7f1645dad59eded416b (patch) | |
tree | c040c4b02c43341831f2da24030e7ab9d7128249 /src/ui.py | |
parent | 549e682e0f8b3c0b758c2aaf1ae66c5ca9128f5b (diff) | |
download | koopatlas-870cf5ad6f121e3a0f69c7f1645dad59eded416b.tar.gz koopatlas-870cf5ad6f121e3a0f69c7f1645dad59eded416b.zip |
current broken progress
Diffstat (limited to '')
-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) |