def __init__(self, parent, prefs, signal_model): super(SyncHTP1Dialog, self).__init__(parent) self.__preferences = prefs self.__signal_model = signal_model self.__simple_signal = None self.__filters_by_channel = {} self.__current_device_filters_by_channel = {} self.__spinner = None self.__beq_filter = None self.__signal_filter = None self.__last_requested_msoupdate = None self.__last_received_msoupdate = None self.__supports_shelf = False self.__channel_to_signal = {} self.setupUi(self) self.setWindowFlag(Qt.WindowMinimizeButtonHint) self.setWindowFlag(Qt.WindowMaximizeButtonHint) self.syncStatus = qta.IconWidget('fa5s.unlink') self.syncLayout.addWidget(self.syncStatus) self.ipAddress.setText(self.__preferences.get(HTP1_ADDRESS)) self.filterView.setSelectionBehavior(QAbstractItemView.SelectRows) self.__filters = FilterModel(self.filterView, self.__preferences) self.filterView.setModel(FilterTableModel(self.__filters)) self.filterView.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) self.filterView.selectionModel().selectionChanged.connect( self.__on_filter_selected) self.__magnitude_model = MagnitudeModel( 'preview', self.previewChart, self.__preferences, self.get_curve_data, 'Filter', db_range_calc=dBRangeCalculator(30, expand=True), fill_curves=True) self.connectButton.setIcon(qta.icon('fa5s.check')) self.disconnectButton.setIcon(qta.icon('fa5s.times')) self.resyncFilters.setIcon(qta.icon('fa5s.sync')) self.deleteFiltersButton.setIcon(qta.icon('fa5s.trash')) self.editFilterButton.setIcon(qta.icon('fa5s.edit')) self.selectBeqButton.setIcon(qta.icon('fa5s.folder-open')) self.limitsButton.setIcon(qta.icon('fa5s.arrows-alt')) self.showDetailsButton.setIcon(qta.icon('fa5s.info')) self.createPulsesButton.setIcon(qta.icon('fa5s.wave-square')) self.fullRangeButton.setIcon(qta.icon('fa5s.expand')) self.subOnlyButton.setIcon(qta.icon('fa5s.compress')) self.autoSyncButton.setIcon(qta.icon('fa5s.magic')) self.autoSyncButton.toggled.connect( lambda b: self.__preferences.set(HTP1_AUTOSYNC, b)) self.autoSyncButton.setChecked(self.__preferences.get(HTP1_AUTOSYNC)) self.__ws_client = QtWebSockets.QWebSocket( '', QtWebSockets.QWebSocketProtocol.Version13, None) self.__ws_client.error.connect(self.__on_ws_error) self.__ws_client.connected.connect(self.__on_ws_connect) self.__ws_client.disconnected.connect(self.__on_ws_disconnect) self.__ws_client.textMessageReceived.connect(self.__on_ws_message) self.__disable_on_disconnect() self.filterMapping.itemDoubleClicked.connect( self.__show_mapping_dialog) self.__restore_geometry()
def __init__(self, parent=None): super().__init__(parent=parent) self.widget = qta.IconWidget() self.widget.setAlignment(QtCore.Qt.AlignCenter) self.setLayout(QtWidgets.QGridLayout()) self.layout().addWidget(self.widget) self.widget.resize(39, 39) self.currentIconSize = QtCore.QSize(32, 32) self.widget.setIconSize(self.iconsize) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) self.widget.setSizePolicy(sizePolicy) self.widget.setMinimumSize(32, 32) if self.parent: self.parent().controlWidgets.append(self) self.animationZoomIn = QtCore.QPropertyAnimation(self, b"iconsize") self.animationZoomIn.setDuration(200) self.animationZoomIn.setStartValue(self.currentIconSize) self.animationZoomIn.setEndValue( QtCore.QSize(self.currentIconSize.width() * 1.2, self.currentIconSize.height() * 1.2)) self.animationZoomOut = QtCore.QPropertyAnimation(self, b"iconsize") self.animationZoomOut.setDuration(200) self.animationZoomOut.setStartValue( QtCore.QSize(self.currentIconSize.width() * 1.2, self.currentIconSize.height() * 1.2)) self.animationZoomOut.setEndValue(self.currentIconSize)
def __init__(self, board: dict, task: dict): super(OnOffWidget, self).__init__() self.board = board if "params" not in self.board: self.board["params"] = {} self.task = task self.is_on = False # Current button state (true=ON, false=OFF) # Construct the record button self.recordButton = QPushButton( qta.icon("mdi.record-circle-outline", color="#fff"), "Start recording") # supersizes the button: # self.recordButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.recordButton.clicked.connect(self.on) statusIcon = qta.IconWidget() statusIcon.setIconSize(QSize(42, 42)) icon_online = qta.icon("mdi.check-network", color="#4CAF50") icon_offline = qta.icon("mdi.network-off") # Construct the recorder object with minimum values: try: self.recorder = BoardRecord( board_name=self.board["board_name"], # Pass the 'params' dict as a kwargs mapping: **self.board["params"], ) except Exception as e: QMessageBox.critical(self, "Failed to create recorder object: ", str(e), QMessageBox.Ok) logging.exception("Failed to create recorder object.") return # Check the board status to see if it is reachable: self.is_online = self.recorder.ping() if self.is_online: statusIcon.setIcon(icon_online) statusLabel = QLabel("Online") else: statusIcon.setIcon(icon_offline) statusLabel = QLabel("Offline") self.recordButton.setDisabled(True) statusLabel.setBuddy(statusIcon) boardInfo = BoardInfoWidget(self) # Place controls into layouts: hbox = QHBoxLayout() hbox.addWidget(boardInfo, 3) hbox.addWidget(statusIcon, 0.5) hbox.addWidget(statusLabel, 2.5) hbox.addWidget(self.recordButton, 6) # Construct a GroupBox to render our hbox layout: groupBox = QGroupBox(self.board["board_name"]) # Set the GroupBox to render the layout and its widgets: groupBox.setLayout(hbox) vbox = QVBoxLayout() vbox.addWidget(groupBox) # Place the groupBox into a vertical box self.setLayout( vbox) # Set vbox/groupBox as the root layout for entire widget # Set initial button state self.update_button_state()
def __init__(self): super().__init__() # Label for supported fonts supported_fonts_label = QtWidgets.QLabel('Supported fonts (prefix)') supported_fonts_label.setAlignment(QtCore.Qt.AlignCenter) # Get FontAwesome 5.x icons by name in various styles by name fa5_icon = qta.icon('fa5.flag') fa5_button = QtWidgets.QPushButton(fa5_icon, 'Font Awesome regular (fa5)') fa5s_icon = qta.icon('fa5s.flag') fa5s_button = QtWidgets.QPushButton(fa5s_icon, 'Font Awesome solid (fa5s)') fa5b_icon = qta.icon('fa5b.github') fa5b_button = QtWidgets.QPushButton(fa5b_icon, 'Font Awesome brands (fa5b)') # Get Elusive icons by name asl_icon = qta.icon('ei.asl') elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons (ei)') # Get Material Design icons by name apn_icon = qta.icon('mdi6.access-point-network') mdi6_button = QtWidgets.QPushButton(apn_icon, 'Material Design (mdi, mdi6)') # Get Phosphor by name mic_icon = qta.icon('ph.microphone-fill') ph_button = QtWidgets.QPushButton(mic_icon, 'Phosphor Icons (ph)') # Get Remix Icon by name truck_icon = qta.icon('ri.truck-fill') ri_button = QtWidgets.QPushButton(truck_icon, 'Remix Icons (ri)') # Get Microsoft's Codicons by name squirrel_icon = qta.icon('msc.squirrel') msc_button = QtWidgets.QPushButton(squirrel_icon, 'Codicons (msc)') # Label for style options and animations styles_label = QtWidgets.QLabel('Styles') styles_label.setAlignment(QtCore.Qt.AlignCenter) # Rotated rot_icon = qta.icon('mdi.access-point-network', rotated=45) rot_button = QtWidgets.QPushButton(rot_icon, 'Rotated Icons') # Horizontal flip hflip_icon = qta.icon('mdi.account-alert', hflip=True) hflip_button = QtWidgets.QPushButton(hflip_icon, 'Horizontally Flipped Icons') # Vertical flip vflip_icon = qta.icon('mdi.account-alert', vflip=True) vflip_button = QtWidgets.QPushButton(vflip_icon, 'Vertically Flipped Icons') # Styling styling_icon = qta.icon('fa5s.music', active='fa5s.balance-scale', color='blue', color_active='orange') music_button = QtWidgets.QPushButton(styling_icon, 'Changing colors') # Setting an alpha of 165 to the color of this icon. Alpha must be a number # between 0 and 255. icon_with_alpha = qta.icon('mdi.heart', color=('red', 120)) heart_button = QtWidgets.QPushButton(icon_with_alpha, 'Setting alpha') # Toggle toggle_icon = qta.icon('fa5s.home', selected='fa5s.balance-scale', color_off='black', color_off_active='blue', color_on='orange', color_on_active='yellow') toggle_button = QtWidgets.QPushButton(toggle_icon, 'Toggle') toggle_button.setCheckable(True) iconwidget = qta.IconWidget() spin_icon = qta.icon('mdi.loading', color='red', animation=qta.Spin(iconwidget)) iconwidget.setIcon(spin_icon) iconwidget.setIconSize(QtCore.QSize(32, 32)) iconwidgetholder = QtWidgets.QWidget() lo = QtWidgets.QHBoxLayout() lo.addWidget(iconwidget) lo.addWidget(QtWidgets.QLabel('IconWidget')) iconwidgetholder.setLayout(lo) iconwidget2 = qta.IconWidget('mdi.web', color='blue') # Stack icons camera_ban = qta.icon('fa5s.camera', 'fa5s.ban', options=[{ 'scale_factor': 0.5, 'active': 'fa5s.balance-scale' }, { 'color': 'red', 'opacity': 0.7 }]) stack_button = QtWidgets.QPushButton(camera_ban, 'Stack') stack_button.setIconSize(QtCore.QSize(32, 32)) # Stack and offset icons saveall = qta.icon('fa5.save', 'fa5.save', options=[{ 'scale_factor': 0.8, 'offset': (0.2, 0.2), 'color': 'gray' }, { 'scale_factor': 0.8 }]) saveall_button = QtWidgets.QPushButton(saveall, 'Stack, offset') # Spin icons spin_button = QtWidgets.QPushButton(' Spinning icon') spin_icon = qta.icon('fa5s.spinner', color='red', animation=qta.Spin(spin_button)) spin_button.setIcon(spin_icon) # Pulse icons pulse_button = QtWidgets.QPushButton(' Pulsing icon') pulse_icon = qta.icon('fa5s.spinner', color='green', animation=qta.Pulse(pulse_button)) pulse_button.setIcon(pulse_icon) # Stacked spin icons stack_spin_button = QtWidgets.QPushButton('Stack spin') options = [{ 'scale_factor': 0.4, 'animation': qta.Spin(stack_spin_button) }, { 'color': 'blue' }] stack_spin_icon = qta.icon('ei.asl', 'fa5.square', options=options) stack_spin_button.setIcon(stack_spin_icon) stack_spin_button.setIconSize(QtCore.QSize(32, 32)) # Render a label with this font label = QtWidgets.QLabel(chr(0xf19c) + ' ' + 'Label') label.setFont(qta.font('fa', 16)) # Layout grid = QtWidgets.QGridLayout() fonts_widgets = [ supported_fonts_label, fa5_button, fa5s_button, fa5b_button, elusive_button, mdi6_button, ph_button, ri_button, msc_button, ] styled_widgets = [ styles_label, music_button, heart_button, rot_button, hflip_button, vflip_button, toggle_button ] animated_widgets = [ spin_button, pulse_button, stack_button, saveall_button, stack_spin_button, ] other_widgets = [label, iconwidgetholder, iconwidget2] for idx, w in enumerate(fonts_widgets): grid.addWidget(w, idx, 0) for idx, w in enumerate(styled_widgets): grid.addWidget(w, idx, 1) for idx, w in enumerate(animated_widgets): grid.addWidget(w, idx + len(styled_widgets), 1) for idx, w in enumerate(other_widgets): grid.addWidget(w, idx + len(styled_widgets) + len(animated_widgets), 1) self.setLayout(grid) self.setWindowTitle('Awesome') self.setMinimumWidth(520) self.show()
def _add_process(self): process_groupbox = QGroupBox("Process") process_groupbox.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) process_layout = QVBoxLayout() process_layout.setSpacing(0) process_groupbox.setLayout(process_layout) pbar_frame = QFrame() pbar_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) pbar_hbox = QHBoxLayout() pbar_hbox.setContentsMargins(QtCore.QMargins(0, 0, 0, 16)) pbar_hbox.setSpacing(16) # Run and stop buttons hbox = QHBoxLayout() hbox.setSpacing(8) self.run_button = QPushButton() # is only enabled when validation passes self.run_button.setEnabled(False) self.run_button.setText("Run") self.run_button.setFixedWidth(100) run_icon = qta.icon('fa.play', color='green') self.run_button.setIcon(run_icon) self.run_button.clicked.connect(self._click_run) hbox.addWidget(self.run_button) self.stop_button = QPushButton() self.stop_button.setEnabled(False) self.stop_button.setText("Stop") self.stop_button.setFixedWidth(100) stop_icon = qta.icon('fa.stop', color='red') self.stop_button.setIcon(stop_icon) self.stop_button.clicked.connect(self._click_stop) hbox.addWidget(self.stop_button) self.progress_bar = QProgressBar() self.progress_bar.setTextVisible(True) self.progress_bar.setAlignment(QtCore.Qt.AlignCenter) self.progress_bar.setValue(0) self.progress_bar.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) pbar_hbox.addLayout(hbox) pbar_hbox.addWidget(self.progress_bar) pbar_frame.setLayout(pbar_hbox) process_layout.addWidget(pbar_frame) self.warning_frame = QFrame() self.warning_frame.setVisible(False) self.warning_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) hbox = QHBoxLayout() warning_icon_widget = qta.IconWidget('fa.warning', color='red') warning_icon_widget.setIconSize(QtCore.QSize(48, 48)) warning_icon_widget.update() hbox.addWidget(warning_icon_widget) warning_label = QLabel( "Grid Transformer did not complete successfully. Please refer to " "log output.") warning_label.setStyleSheet("QLabel { color: red; }") warning_label.setWordWrap(True) warning_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) hbox.addWidget(warning_label) self.warning_frame.setLayout(hbox) process_layout.addWidget(self.warning_frame) self.success_frame = QFrame() self.success_frame.setVisible(False) self.success_frame.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) hbox = QHBoxLayout() success_icon_widget = qta.IconWidget('fa.check', color='green') success_icon_widget.setIconSize(QtCore.QSize(48, 48)) success_icon_widget.update() hbox.addWidget(success_icon_widget) success_label = QLabel("Grid Transformer completed successfully.") success_label.setStyleSheet("QLabel { color: green; }") success_label.setWordWrap(True) success_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) hbox.addWidget(success_label) self.success_frame.setLayout(hbox) process_layout.addWidget(self.success_frame) log_layout = QVBoxLayout() log_layout.setSpacing(4) log_label = QLabel("Log messages") log_label.setStyleSheet("QLabel { color: grey; }") log_layout.addWidget(log_label) self.log_messages = QPlainTextEdit() log_font = QFont("monospace") log_font.setStyleHint(QFont.TypeWriter) self.log_messages.setFont(log_font) self.log_messages.setReadOnly(True) self.log_messages.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # self.log_messages.sizePolicy.setVerticalStretch(1) log_layout.addWidget(self.log_messages) process_layout.addLayout(log_layout) self.layout.addWidget(process_groupbox)
def __init__(self, prj: QAXProject): super(ResultTab, self).__init__() self.prj = prj self.prj.qa_json_changed.connect(self._on_qa_json_changed) self.qa_group = "raw_data" self._qa_json = None # ui self.vbox = QtWidgets.QVBoxLayout() self.setLayout(self.vbox) self.set_view = None self.cur_view = 'Summary' self.set_data_level = None self.qa_group = None self.force_reload = None self.execute_all = None self.json_text_group = None self.json_viewer = None self.score_board_widget = None self.score_board_group = None self.score_board = None self.summary_widget = None self.summary_group = None self.summary_table = None self.scoreboard_details = None self.scoreboard_selected_check = None self.cross_icon = qta.icon('fa.close', color='red') self.tick_icon = qta.icon('fa.check', color='green') self.warning_icon = qta.icon('fa.warning', color='orange') self.view_names = ['Summary', 'Score Board', 'Json Text'] self.warning_groupbox = QtWidgets.QGroupBox('Warning') self.warning_groupbox.setStyleSheet( 'QGroupBox:title {color: red; top: -12px; left: 10px;} ' 'QGroupBox { border: 1px solid red; margin-top: 8px; padding: 5px;}') hbox = QtWidgets.QHBoxLayout() self.warning_groupbox.setLayout(hbox) self.warning_groupbox.setHidden(True) warning_icon_widget = qta.IconWidget('fa.warning', color='red') warning_icon_widget.setIconSize(QtCore.QSize(48, 48)) warning_icon_widget.update() hbox.addWidget(warning_icon_widget) warning_label = QtWidgets.QLabel( "QAJSON is invalid, contents shown below have not been updated. " "Please correct check parameter values on the plugins tab to " "resolve this issue.") warning_label.setWordWrap(True) warning_label.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) hbox.addWidget(warning_label) hbox.stretch(1) self.vbox.addWidget(self.warning_groupbox) gb = QtWidgets.QGroupBox('View') # gb.setFixedHeight(40) hbox = QtWidgets.QHBoxLayout() gb.setLayout(hbox) hbox_view_and_datalevel = QtWidgets.QHBoxLayout() hbox_view_and_datalevel.addWidget(gb) self.vbox.addLayout(hbox_view_and_datalevel) self.set_view = QtWidgets.QButtonGroup() self.set_view.setExclusive(True) for idx, view_name in enumerate(self.view_names): # viewRadioButton = QtWidgets.QRadioButton(view_name) viewRadioButton = QtWidgets.QPushButton(view_name) viewRadioButton.setCheckable(True) if idx == 0: viewRadioButton.setChecked(True) viewRadioButton.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Minimum) self.set_view.addButton(viewRadioButton, idx) hbox.addWidget(viewRadioButton) self.set_view.buttonReleased.connect(self._on_set_view) gb = QtWidgets.QGroupBox("Data Level") hbox = QtWidgets.QHBoxLayout() gb.setLayout(hbox) hbox_view_and_datalevel.addWidget(gb) self.set_data_level = QtWidgets.QComboBox() self.set_data_level.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Minimum) self.set_data_level.addItems(ResultTab.possible_dl_names) self.set_data_level.currentTextChanged.connect(self._on_set_data_level) # starts off disabled as the default summary view doesn't filter by # data level self.set_data_level.setDisabled(True) hbox.addWidget(self.set_data_level) self._add_summary_view() self._add_json_view() self._add_score_board_view() self._on_set_view()
def __init__(self): super().__init__() # Get FontAwesome 5.x icons by name in various styles by name fa5_icon = qta.icon('fa5.flag') fa5_button = QtWidgets.QPushButton(fa5_icon, 'Font Awesome! (regular)') fa5s_icon = qta.icon('fa5s.flag') fa5s_button = QtWidgets.QPushButton(fa5s_icon, 'Font Awesome! (solid)') fa5b_icon = qta.icon('fa5b.github') fa5b_button = QtWidgets.QPushButton(fa5b_icon, 'Font Awesome! (brands)') # Get Elusive icons by name asl_icon = qta.icon('ei.asl') elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons!') # Get Material Design icons by name apn_icon = qta.icon('mdi.access-point-network') mdi_button = QtWidgets.QPushButton(apn_icon, 'Material Design Icons!') # Rotated rot_icon = qta.icon('mdi.access-point-network', rotated=45) rot_button = QtWidgets.QPushButton(rot_icon, 'Rotated Icons!') # Horizontal flip hflip_icon = qta.icon('mdi.account-alert', hflip=True) hflip_button = QtWidgets.QPushButton(hflip_icon, 'Horizontally Flipped Icons!') # Vertical flip vflip_icon = qta.icon('mdi.account-alert', vflip=True) vflip_button = QtWidgets.QPushButton(vflip_icon, 'Vertically Flipped Icons!') # Styling styling_icon = qta.icon('fa5s.music', active='fa5s.balance-scale', color='blue', color_active='orange') music_button = QtWidgets.QPushButton(styling_icon, 'Styling') # Toggle toggle_icon = qta.icon('fa5s.home', selected='fa5s.balance-scale', color_off='black', color_off_active='blue', color_on='orange', color_on_active='yellow') toggle_button = QtWidgets.QPushButton(toggle_icon, 'Toggle') toggle_button.setCheckable(True) iconwidget = qta.IconWidget() spin_icon = qta.icon('mdi.loading', color='red', animation=qta.Spin(iconwidget)) iconwidget.setIcon(spin_icon) iconwidget.setIconSize(QtCore.QSize(32, 32)) iconwidgetholder = QtWidgets.QWidget() lo = QtWidgets.QHBoxLayout() lo.addWidget(iconwidget) lo.addWidget(QtWidgets.QLabel('IconWidget')) iconwidgetholder.setLayout(lo) iconwidget2 = qta.IconWidget('mdi.web', color='blue') # Stack icons camera_ban = qta.icon('fa5s.camera', 'fa5s.ban', options=[{ 'scale_factor': 0.5, 'active': 'fa5s.balance-scale' }, { 'color': 'red', 'opacity': 0.7 }]) stack_button = QtWidgets.QPushButton(camera_ban, 'Stack') stack_button.setIconSize(QtCore.QSize(32, 32)) # Stack and offset icons saveall = qta.icon('fa5.save', 'fa5.save', options=[{ 'scale_factor': 0.8, 'offset': (0.2, 0.2), 'color': 'gray' }, { 'scale_factor': 0.8 }]) saveall_button = QtWidgets.QPushButton(saveall, 'Stack, offset') # Spin icons spin_button = QtWidgets.QPushButton(' Spinning icon') spin_icon = qta.icon('fa5s.spinner', color='red', animation=qta.Spin(spin_button)) spin_button.setIcon(spin_icon) # Pulse icons pulse_button = QtWidgets.QPushButton(' Pulsing icon') pulse_icon = qta.icon('fa5s.spinner', color='green', animation=qta.Pulse(pulse_button)) pulse_button.setIcon(pulse_icon) # Stacked spin icons stack_spin_button = QtWidgets.QPushButton('Stack spin') options = [{ 'scale_factor': 0.4, 'animation': qta.Spin(stack_spin_button) }, { 'color': 'blue' }] stack_spin_icon = qta.icon('ei.asl', 'fa5.square', options=options) stack_spin_button.setIcon(stack_spin_icon) stack_spin_button.setIconSize(QtCore.QSize(32, 32)) # Render a label with this font label = QtWidgets.QLabel(chr(0xf19c) + ' ' + 'Label') label.setFont(qta.font('fa', 16)) # Layout vbox = QtWidgets.QVBoxLayout() widgets = [ fa5_button, fa5s_button, fa5b_button, elusive_button, mdi_button, music_button, rot_button, hflip_button, vflip_button, toggle_button, stack_button, saveall_button, spin_button, pulse_button, stack_spin_button, label, iconwidgetholder, iconwidget2 ] for w in widgets: vbox.addWidget(w) self.setLayout(vbox) self.setWindowTitle('Awesome') self.show()