From 41e1c1fa5bbe5e0205701f1dddc1849b8ab672b8 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 14 Oct 2013 22:19:26 +0200 Subject: gui: Show chip maintainer Signed-off-by: Michael Buesch --- toprammer-gui | 74 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/toprammer-gui b/toprammer-gui index 1596923..010a65d 100755 --- a/toprammer-gui +++ b/toprammer-gui @@ -1509,50 +1509,28 @@ class InfoBufferWidget(BufferWidget): font.setFamily("monospace") font.setPointSize(7) self.zifLayout.setFont(font) - self.layout().addWidget(self.zifLayout, 0, 0, 5, 1) - - l = QLabel("Chip name:", self) - l.setAlignment(Qt.AlignTop | Qt.AlignLeft) - self.layout().addWidget(l, 0, 1) - self.chipName = QLabel(self) - self.chipName.setAlignment(Qt.AlignTop | Qt.AlignLeft) - font = self.chipName.font() - font.setBold(True) - self.chipName.setFont(font) - self.layout().addWidget(self.chipName, 0, 2) - - l = QLabel("Comment:", self) - l.setAlignment(Qt.AlignTop | Qt.AlignLeft) - self.layout().addWidget(l, 1, 1) - self.comment = QLabel(self) - self.comment.setAlignment(Qt.AlignTop | Qt.AlignLeft) - font = self.comment.font() - font.setBold(True) - self.comment.setFont(font) - self.layout().addWidget(self.comment, 1, 2) - - l = QLabel("Packages:", self) - l.setAlignment(Qt.AlignTop | Qt.AlignLeft) - self.layout().addWidget(l, 2, 1) - self.packages = QLabel(self) - self.packages.setAlignment(Qt.AlignTop | Qt.AlignLeft) - font = self.packages.font() - font.setBold(True) - self.packages.setFont(font) - self.layout().addWidget(self.packages, 2, 2) - - l = QLabel("Chip signature bytes:", self) - l.setAlignment(Qt.AlignTop | Qt.AlignLeft) - self.layout().addWidget(l, 3, 1) - self.chipSig = QLabel(self) - self.chipSig.setAlignment(Qt.AlignTop | Qt.AlignLeft) - font = self.chipSig.font() - font.setBold(True) - self.chipSig.setFont(font) - self.layout().addWidget(self.chipSig, 3, 2) + self.layout().addWidget(self.zifLayout, 0, 0, 6, 1) + + def addLabel(name, y): + l = QLabel(name, self) + l.setAlignment(Qt.AlignTop | Qt.AlignLeft) + self.layout().addWidget(l, y, 1) + label = QLabel(self) + label.setAlignment(Qt.AlignTop | Qt.AlignLeft) + font = label.font() + font.setBold(True) + label.setFont(font) + self.layout().addWidget(label, y, 2) + return label + + self.chipName = addLabel("Chip name:", 0) + self.comment = addLabel("Comment:", 1) + self.packages = addLabel("Packages:", 2) + self.chipSig = addLabel("Chip signature bytes:", 3) + self.maintainer = addLabel("Chip maintainer:", 4) self.layout().setColumnStretch(3, 99) - self.layout().setRowStretch(4, 99) + self.layout().setRowStretch(5, 99) self.clear() @@ -1562,6 +1540,7 @@ class InfoBufferWidget(BufferWidget): self.setChipSignature(None) self.setChipLayout(None) self.setPackages(None) + self.setMaintainer(None) def setChipSignature(self, bindata): if bindata: @@ -1589,10 +1568,21 @@ class InfoBufferWidget(BufferWidget): else: self.packages.setText("Unknown") + def setMaintainer(self, maintainer): + if maintainer: + # Remove email address + idx = maintainer.find("<") + if idx >= 0: + maintainer = maintainer[:idx] + self.maintainer.setText(maintainer.strip()) + else: + self.maintainer.setText("None") + def setupDescription(self, chipDescription): self.chipName.setText(chipDescription.description) self.setComment(chipDescription.comment) self.setPackages(chipDescription.packages) + self.setMaintainer(chipDescription.maintainer) def setChipLayout(self, asciiArtLayout): if asciiArtLayout: -- cgit v1.2.3