def __init__(self, parent=None, mainView=None): super(CameraPanel, self).__init__(parent=parent) self.view = QGLViewer.QGLView() if mainView is not None: self.view.cameras = mainView.cameras self.view.camera = mainView.cameras[0] # self.view.primitives = mainView.primitives self.view.primitives2D = mainView.primitives2D camPanel = QGLPanel(self.view, parent=mainView) self.layout().addWidget(camPanel) self.view.updateGL()
def __init__(self): QtGui.QMainWindow.__init__(self) global app assert(app is None) app = self self.value_is_adjusting = False self.dirtyCB = None self.filename = None self.menus = {} self.move(0,0) self.resize(640, 480) self.setWindowTitle(State.appName()) self.setFocusPolicy(QtCore.Qt.StrongFocus) # get keyboard events self.blockUpdate = False self.set_widget = {} self.trigger_calls = {} self.preLoadCB = None self.loadCB = None self.saveCB = None self.addMenuItem({'menu':'&File','item':'&New','tip':'New scene','cmd':self.new}) self.addMenuItem({'menu':'&File','item':'&Open','shortcut':'Ctrl+O','tip':'Open state','cmd':self.load}) self.addMenuItem({'menu':'&File','item':'&Save','shortcut':'Ctrl+S','tip':'Save state','cmd':self.save}) self.addMenuItem({'menu':'&File','item':'Save &As','tip':'Save state as','cmd':self.saveAs}) self.addMenuItem({'menu':'&File','item':'&Quit','shortcut':'Ctrl+Q','tip':'Exit application','cmd':self.quit}) self.undoItem = self.addMenuItem({'menu':'&Edit','item':'&Undo','shortcut':'Ctrl+Z','tip':'Undo last command','cmd':self.undo}) self.redoItem = self.addMenuItem({'menu':'&Edit','item':'Re&do','shortcut':'Ctrl+Shift+Z','tip':'Redo last command','cmd':self.redo}) self.clearUndoItem = self.addMenuItem({'menu':'&Edit','item':'&Clear undo','tip':'Clear the undo stack','cmd':self.clearUndo}) self.getOrCreateMenu('&View') #self.addMenuItem({'menu':'&Create','item':'&Image','tip':'Create image','cmd':self.loadImage}) self.qglview = QGLViewer.QGLView() self.qview = QGLPanel(self.qglview, parent=self) self.qfields = QFields.QFieldsEditor(self) self.qoutliner = QStateTreeView.QStateTreeView() self.qoutliner.selectionModel().currentChanged.connect(functools.partial(self.selectCB2, caller=self.qoutliner)) # Add Ops list self.qnodes = UI.QCore.QNodeWidget(parent=self) self.qnodes.item_selected.connect(functools.partial(self.selectCB, caller=self.qnodes)) self.qnodes.data_changed.connect(self.dataChangedCB) self.runtime = None self.cameraPanels = None # Add Python Console self.qpython = UI.QCore.PythonConsole() #self.qlayers = Qlayers.Qlayers(self) self.qtimeline = UI.QTimeline(self) self.setCentralWidget(self.qview) ar = (QtCore.Qt.LeftDockWidgetArea | QtCore.Qt.RightDockWidgetArea | QtCore.Qt.BottomDockWidgetArea | QtCore.Qt.TopDockWidgetArea) self.attributeEditor = self.addDock('Attribute Editor', self.qfields, ar, QtCore.Qt.RightDockWidgetArea) # Add docks and tab the Ops, outliner, and script together self.opNodes = self.addDock('Ops', self.qnodes, ar, QtCore.Qt.RightDockWidgetArea) self.outliner = self.addDock('Outliner', self.qoutliner, ar, QtCore.Qt.RightDockWidgetArea) self.pythonDock = self.addDock('Console', self.qpython, ar, QtCore.Qt.BottomDockWidgetArea) self.tabifyDockWidget(self.opNodes, self.outliner) self.tabifyDockWidget(self.outliner, self.pythonDock) self.timelineDock = self.addDock('Timeline', self.qtimeline, ar, QtCore.Qt.BottomDockWidgetArea) self.setTabPosition(QtCore.Qt.TopDockWidgetArea, QtGui.QTabWidget.North) self.setTabPosition(QtCore.Qt.RightDockWidgetArea,QtGui.QTabWidget.East ) self.setTabPosition(QtCore.Qt.LeftDockWidgetArea, QtGui.QTabWidget.West ) self.setTabPosition(QtCore.Qt.BottomDockWidgetArea, QtGui.QTabWidget.North) self.updateMenus() # Set the ops dock as the default visible one (enable this when everyone is happy to proceed) self.opNodes.show() self.opNodes.raise_() # self.outliner.show() # self.outliner.raise_() self.setAcceptDrops(True)