def makeInterface(self): self.setWindowTitle("Warehouse") self.setWindowIcon(Icon(Icon.window)) self.hideButton = makeButton("", Icon(Icon.arrowLeft), self.hideShow) self.prefButton = makeButton("", Icon(Icon.preferences), self.preferences.setPreferences) showInFolderBut = makeButton('', Icon(Icon.openFolder), self.editorPanel.getAction('show in folder')) gbox = QtGui.QGridLayout() # Button Panel vboxLeft = QtGui.QVBoxLayout() vboxLeft.addWidget(self.hideButton) vboxLeft.addWidget(self.prefButton) if showInFolderBut: vboxLeft.addWidget(showInFolderBut) vboxLeft.insertStretch(-1) gbox.addLayout(vboxLeft, 0, 0) # Tree and editor panel self.spliter = QtGui.QSplitter() self.spliter.addWidget(self.treePanel) self.spliter.addWidget((self.editorPanel)) vboxRight = QtGui.QVBoxLayout() vboxRight.addWidget(self.spliter) gbox.addLayout(vboxRight, 0, 1) self.setLayout(gbox) self.showMaximized()
def addCloseButton(self, vbox): closeBut = makeButton("close", func=self.hide) hbox = QtGui.QHBoxLayout() hbox.addStretch() hbox.addWidget(closeBut) vbox.addLayout(hbox)
def makeButton(self, name, text, listener): return self.buttons.setdefault(name, makeButton(text, func=listener))