def initialise_GUI(self): """Initialises the Tab GUI. This method is called automatically by BLACS. """ self.connection_table_properties = ( self.settings["connection_table"].find_by_name( self.device_name).properties) digital_outs = {} for pin in self.connection_table_properties["out_pins"]: digital_outs[f"GPIO {pin:02d}"] = {} # Create a single digital output self.create_digital_outputs(digital_outs) # Create widgets for output objects _, _, do_widgets = self.auto_create_widgets() # and auto place the widgets in the UI self.auto_place_widgets(("Flags", do_widgets)) # Create status labels self.status_label = QtWidgets.QLabel("Status: Unknown") self.clock_status_label = QtWidgets.QLabel("Clock status: Unknown") self.get_tab_layout().addWidget(self.status_label) self.get_tab_layout().addWidget(self.clock_status_label) # Set the capabilities of this device self.supports_smart_programming(True) # Create status monitor timout self.statemachine_timeout_add(2000, self.status_monitor)
def __init__(self, imagepath): self.qapplication = QtWidgets.QApplication.instance() if self.qapplication is None: self.qapplication = QtWidgets.QApplication(sys.argv) QtWidgets.QFrame.__init__(self) self.icon = QtGui.QPixmap() self.icon.load(imagepath) if self.icon.isNull(): raise ValueError("Invalid image file: {}.\n".format(imagepath)) self.icon = self.icon.scaled(self.imwidth, self.imheight, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.text = 'Loading' self.setWindowFlags(Qt.SplashScreen) self.setWindowOpacity(self.alpha) self.label = QtWidgets.QLabel(self.text) self.setStyleSheet("background-color: %s; font-size: 10pt" % self.BG) # Frame not necessary on macos, and looks ugly. if sys.platform != 'darwin': self.setFrameShape(QtWidgets.QFrame.StyledPanel) self.label.setWordWrap(True) self.label.setAlignment(Qt.AlignCenter) self.resize(self.w, self.h) image_label = QtWidgets.QLabel() image_label.setPixmap(self.icon) image_label.setAlignment(Qt.AlignCenter) layout = QtWidgets.QVBoxLayout(self) layout.addWidget(image_label) layout.addWidget(self.label) center_point = QtWidgets.QDesktopWidget().availableGeometry().center() x0, y0 = center_point.x(), center_point.y() self.move(x0 - self.w / 2, y0 - self.h / 2) self._first_paint_complete = False