def initMenuBar(self): openFile = QtGui.QAction(QtGui.QIcon('open.png'), '&Open', self) openFile.setShortcut('Ctrl+O') openFile.setStatusTip('Open new File') self.connect(openFile, qsignal('triggered()'), self.showDialog) fileMenu = self.menuBar().addMenu('&File') fileMenu.addAction(openFile)
def initListView(self): self.before = QtGui.QLabel() self.before.setMaximumHeight(20) self.after = QtGui.QLabel() self.after.setMaximumHeight(20) self.go = QtGui.QPushButton('Go!') self.go.width = 40 self.connect(self.go, qsignal('clicked()'), logic.goClicked) self.list = QtGui.QListWidget() self.connect(self.list, qsignal('itemClicked (QListWidgetItem *)'), self.listItemClicked) self.createTable() splitter = QtGui.QSplitter(Qt.Horizontal) splitter.addWidget(self.list) splitter.addWidget(self.table) splitter.setSizes([1, 200]) mainbox = QtGui.QHBoxLayout() mainbox.setSizeConstraint(QtGui.QHBoxLayout.SetNoConstraint) mainbox.addWidget(splitter) tophbox = QtGui.QHBoxLayout() tophbox.setSizeConstraint(QtGui.QHBoxLayout.SetNoConstraint) topvbox = QtGui.QVBoxLayout() topvbox.addWidget(self.before) topvbox.addWidget(self.after) topgbox = QtGui.QGroupBox() topgbox.setLayout(topvbox) tophbox.addWidget(topgbox) tophbox.addWidget(self.go) vbox = QtGui.QVBoxLayout(self.container) vbox.setSizeConstraint(QtGui.QVBoxLayout.SetNoConstraint) vbox.addLayout(tophbox) vbox.addLayout(mainbox)
def createTable(self): self.table = QtGui.QTableWidget() self.table.setColumnCount(6) self.table.horizontalHeader().setVisible(False) self.table.verticalHeader().setVisible(False) self.connect(self.table, qsignal('itemClicked (QTableWidgetItem *)'), self.tableItemClicked)