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 | |
parent | 549e682e0f8b3c0b758c2aaf1ae66c5ca9128f5b (diff) | |
download | koopatlas-870cf5ad6f121e3a0f69c7f1645dad59eded416b.tar.gz koopatlas-870cf5ad6f121e3a0f69c7f1645dad59eded416b.zip |
current broken progress
-rwxr-xr-x | koopatlas.py | 4 | ||||
-rw-r--r-- | src/common.py | 8 | ||||
-rw-r--r-- | src/editorui.py | 3 | ||||
-rw-r--r-- | src/main.py | 27 | ||||
-rw-r--r-- | src/mapdata.py | 6 | ||||
-rw-r--r-- | src/ui.py | 49 |
6 files changed, 78 insertions, 19 deletions
diff --git a/koopatlas.py b/koopatlas.py index 475611c..423df0a 100755 --- a/koopatlas.py +++ b/koopatlas.py @@ -7,8 +7,8 @@ import os.path, sys sys.path.append(os.path.join(os.path.dirname(__file__), 'src')) -from main import * +from common import * if __name__ == '__main__': - run_koopatlas() + KP.run() diff --git a/src/common.py b/src/common.py new file mode 100644 index 0000000..b106ab5 --- /dev/null +++ b/src/common.py @@ -0,0 +1,8 @@ +import sys +from PyQt4 import QtCore, QtGui +from PyQt4.QtCore import Qt + +from mapdata import * + +from main import KP + diff --git a/src/editorui.py b/src/editorui.py index d53deb7..5055f69 100644 --- a/src/editorui.py +++ b/src/editorui.py @@ -1,4 +1,5 @@ -from PyQt4 import QtCore, QtGui +from common import * + class KPEditorWidget(QtGui.QGraphicsView): pass diff --git a/src/main.py b/src/main.py index ba1ff2c..927c970 100644 --- a/src/main.py +++ b/src/main.py @@ -1,16 +1,19 @@ -from PyQt4 import QtCore, QtGui -import sys - +from common import * from ui import KPMainWindow -def run_koopatlas(): - global Koopatlas - Koopatlas = KPApplication(sys.argv) - Koopatlas.run() +class KP: + @staticmethod + def newMap(): + KP.map = KPMap() + + @staticmethod + def run(): + KP.app = QtGui.QApplication(sys.argv) + + KP.newMap() + + KP.mainWindow = KPMainWindow() + KP.mainWindow.show() -class KPApplication(QtGui.QApplication): - def run(self): - self.mainWindow = KPMainWindow() - self.mainWindow.show() - self.exec_() + KP.app.exec_() diff --git a/src/mapdata.py b/src/mapdata.py index 8ecb33c..b453172 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -25,8 +25,8 @@ class KPPathSegment(object): class KPPath(object): def __init__(self): - self.start_node = None - self.end_node = None + self.startNode = None + self.endNode = None self.segments = [] @@ -44,3 +44,5 @@ class KPMap(object): self.paths = [] self.doodads = [] + self.nextLayerNumber = 1 + @@ -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) |