Пример #1
0
    def __init__(self):
        super(StatusWidget, self).__init__()

        self.button_weird = QtWidgets.QPushButton(' ready')
        self.button_weird.setObjectName('linkbutton')
        self.spin_icon = qta.icon('fa.spinner',
                                  color='red',
                                  animation=qta.Spin(self.button_weird))
        self.button_weird.setIcon(self.spin_icon)

        self.label = QtWidgets.QLabel('busy')
        self.label.setObjectName('small')
        self.label.setStyleSheet('color: {0};'.format(
            COLOR_PALETTE['primary']))
        self.label_mov = QtWidgets.QLabel()
        self.movie = QtGui.QMovie('gui/icons/loader-ring.gif')
        self.movie.setScaledSize(QtCore.QSize(20, 20))
        self.label_mov.setMovie(self.movie)
        self.movie.start()
        self.label_mov.hide()

        status_layout = QtWidgets.QHBoxLayout()
        status_layout.addWidget(self.label_mov)
        status_layout.addWidget(self.label)

        self.setLayout(status_layout)

        self.active_identities = dict(root=(0, 'ready'))
        self.last_identity = 'root'
Пример #2
0
    def on_push_button_test_released(self):
        self.line_edit_username.setEnabled(False)
        self.line_edit_password.setEnabled(False)
        self.line_edit_server_address.setEnabled(False)
        self.push_button_test.setEnabled(False)
        self.push_button_test.setText('Testing')
        self.push_button_test.setIcon(
            qta.icon('fa.spinner', animation=qta.Spin(self.push_button_test)))
        self.push_button_start.setEnabled(False)
        self.push_button_start.setIcon(QIcon())

        self.verify_account_thread = QThread()
        self.verify_account_thread_worker = AccountVerificationThreadWorker(
            self.line_edit_username.text(), self.line_edit_password.text(),
            self.line_edit_server_address.text())

        self.verify_account_thread.started.connect(
            self.verify_account_thread_worker.run)
        self.verify_account_thread_worker.finished.connect(
            self.account_test_finished)
        self.verify_account_thread_worker.finished.connect(
            self.verify_account_thread.quit)

        self.verify_account_thread_worker.moveToThread(
            self.verify_account_thread)
        self.verify_account_thread.start()
Пример #3
0
def change_icon_button(widget, icon_str=None, spin=False):
    if spin == True:
        icon = qta.icon('fa.spinner', animation=qta.Spin(widget))
    else:
        icon = qta.icon(icon_str)
    widget.setIcon(icon)
    # widget.setIconSize(QtCore.QSize(24, 24))
Пример #4
0
 def __start_spinning(self):
     self.__process_spinner = qta.Spin(self.processFiles)
     spin_icon = qta.icon('fa5s.spinner',
                          color='green',
                          animation=self.__process_spinner)
     self.processFiles.setIcon(spin_icon)
     self.processFiles.setEnabled(False)
Пример #5
0
 def _handle_cmdsts_buttons_enbl(self, new_sts):
     if new_sts == _Const.InjSysCmdSts.On:
         self._pb_on.setEnabled(False)
         self._pb_on.setIcon(
             qta.icon('fa5s.spinner', animation=qta.Spin(self._pb_on)))
         self._pb_off.setEnabled(False)
     elif new_sts == _Const.InjSysCmdSts.Off:
         self._pb_on.setEnabled(False)
         self._pb_off.setEnabled(False)
         self._pb_off.setIcon(
             qta.icon('fa5s.spinner', animation=qta.Spin(self._pb_off)))
     else:
         if not self._pb_on.isEnabled():
             self._pb_on.setEnabled(True)
             self._pb_off.setEnabled(True)
             self._pb_on.setIcon(self._icon_on)
             self._pb_off.setIcon(self._icon_off)
Пример #6
0
 def __start_spinning(self):
     self.__tmdb_spinner = qta.Spin(self.tmdbButton)
     spin_icon = qta.icon('fa5s.spinner',
                          color='green',
                          animation=self.__tmdb_spinner)
     self.tmdbButton.setIcon(spin_icon)
     self.tmdbButton.setText('Loading...')
     self.tmdbButton.setEnabled(False)
Пример #7
0
 def _setup_search_button(self):
     if self.pb_search.text() == 'Abort':
         self.pb_search.setIcon(qta.icon('fa5s.search'))
         self.pb_search.setText('Search')
     else:
         self.pb_search.setIcon(
             qta.icon('fa5s.spinner', animation=qta.Spin(self.pb_search)))
         self.pb_search.setText('Abort')
Пример #8
0
    def makeDomainItemWidget(self, idx, domain, status=None, ip=None, ms=None):
        widget = QtWidgets.QWidget()
        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        no = QtWidgets.QLabel()
        # no.setStyleSheet('background-color:blue')
        no.setText(f"#{idx+1}")
        no.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(no)
        layout.setStretch(0, 1)

        name = QtWidgets.QLabel()
        name.setText(domain)
        # name.setStyleSheet('background-color:gray')
        layout.addWidget(name)
        layout.setStretch(1, 3)

        flag = QtWidgets.QPushButton()
        flag.setStyleSheet('background-color: transparent')
        flag.setFlat(True)
        if "end" == status:
            flag.setText('')
            if ip and ms < 99999:
                flag.setIcon(qta.icon('fa5.check-circle', color='green'))
                ms = "{:.3f}s".format(ms / 1000)
            else:
                flag.setIcon(qta.icon('fa5.times-circle', color='red'))
                ms = ""
        elif "begin" == status:
            flag.setText('')
            flag.setIcon(
                qta.icon('fa5s.sync', color='gray', animation=qta.Spin(self)))
            ip = ""
            ms = ""
        else:
            flag.setText('')
            ip = ""
            ms = ""
        layout.addWidget(flag)
        layout.setStretch(2, 1)

        ipLabel = QtWidgets.QLabel()
        # ipLabel.setStyleSheet('background-color:green')
        ipLabel.setText(ip)
        layout.addWidget(ipLabel)
        layout.setStretch(3, 2)

        timer = QtWidgets.QLabel()
        # timer.setStyleSheet('background-color:blue')
        timer.setText(ms)
        layout.addWidget(timer)
        layout.setStretch(4, 1)

        widget.setLayout(layout)
        return widget
Пример #9
0
 def _handle_enable_state(self, value):
     if value == _Const.RFKillBeamMon.Idle:
         self.setIcon(self.initial_icon)
         self.setEnabled(True)
     elif value == _Const.RFKillBeamMon.Kill:
         self.setEnabled(False)
         self.setIcon(
             qta.icon('fa5s.spinner', animation=qta.Spin(self)))
     else:
         raise ValueError('strange RFKillBeam-Mon value')
Пример #10
0
 def _set_loop_icon(self):
     """Set the icon for the loop audio button."""
     if self._loop.isChecked():
         loop_icon = qta.icon('fa5s.redo-alt',
                              color=self._active_color,
                              color_disabled=self._inactive_color,
                              animation=qta.Spin(self._loop))
     else:
         loop_icon = qta.icon('fa5s.redo-alt',
                              color=self._active_color,
                              color_disabled=self._inactive_color)
     self._loop.setIcon(loop_icon)
Пример #11
0
    def on_pushButtonDownloadTLEs_clicked(self):
        """Slot triggered when the button is clicked.

            calls self.load_tles() to start the
            the method that gets the TLEs from
            celestrak.com/NORAD.
            """

        spin_icon = qta.icon('fa.spinner',
                             color='red',
                             animation=qta.Spin(self.pushButtonDownloadTLEs))
        self.pushButtonDownloadTLEs.setIcon(spin_icon)

        # self.repaint()
        self.update()

        self.display_on_upcoming_passes()  # blank line
        self.load_tles()
        download_icon = qta.icon('fa.download', color='blue')
        self.pushButtonDownloadTLEs.setIcon(download_icon)
        # self.repaint()
        self.update()
Пример #12
0
 def __on_send_filter_event(self, code: int, btn: QPushButton):
     if code == FilterPublisherSignals.ON_START:
         self.__process_spinner = qta.Spin(btn)
         spin_icon = qta.icon('fa5s.spinner',
                              color='green',
                              animation=self.__process_spinner)
         btn.setIcon(spin_icon)
         btn.setEnabled(False)
         pass
     elif code == FilterPublisherSignals.ON_COMPLETE:
         from model.batch import stop_spinner
         stop_spinner(self.__process_spinner, btn)
         self.__process_spinner = None
         btn.setIcon(qta.icon('fa5s.check', color='green'))
         btn.setEnabled(True)
     elif code == FilterPublisherSignals.ON_ERROR:
         from model.batch import stop_spinner
         stop_spinner(self.__process_spinner, btn)
         self.__process_spinner = None
         btn.setIcon(qta.icon('fa5s.times', color='red'))
         btn.setEnabled(True)
     else:
         logger.warning(
             f"Unknown code received from FilterPublisher - {code}")
Пример #13
0
    def __init__(self):
        super(AwesomeExample, self).__init__()

        # Get icons by name.
        fa_icon = qta.icon('fa.flag')
        fa_button = QtWidgets.QPushButton(fa_icon, 'Font Awesome!')

        asl_icon = qta.icon('ei.asl')
        elusive_button = QtWidgets.QPushButton(asl_icon, 'Elusive Icons!')

        # Styling
        styling_icon = qta.icon('fa.music',
                                active='fa.legal',
                                color='blue',
                                color_active='orange')
        music_button = QtWidgets.QPushButton(styling_icon, 'Styling')

        # Toggle
        toggle_icon = qta.icon('fa.home',
                               selected='fa.legal',
                               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)

        # Render a label with this font
        label = QtWidgets.QLabel(unichr(0xf19c) + ' ' + 'Label')
        label.setFont(qta.font('fa', 16))

        # Stack icons
        camera_ban = qta.icon('fa.camera',
                              'fa.ban',
                              options=[{
                                  'scale_factor': 0.5,
                                  'active': 'fa.legal'
                              }, {
                                  'color': 'red',
                                  'opacity': 0.7
                              }])
        stack_button = QtWidgets.QPushButton(camera_ban, 'Stack')
        stack_button.setIconSize(QtCore.QSize(32, 32))

        # Spin icons
        spin_button = QtWidgets.QPushButton(' Spinning icon')
        spin_icon = qta.icon('fa.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('fa.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', 'fa.square-o', options=options)
        stack_spin_button.setIcon(stack_spin_icon)
        stack_spin_button.setIconSize(QtCore.QSize(32, 32))

        # Stack and offset icons
        saveall = qta.icon('fa.save',
                           'fa.save',
                           options=[{
                               'scale_factor': 0.8,
                               'offset': (0.2, 0.2),
                               'color': 'gray'
                           }, {
                               'scale_factor': 0.8
                           }])
        saveall_button = QtWidgets.QPushButton(saveall, 'Stack, offset')

        # Layout
        vbox = QtWidgets.QVBoxLayout()
        widgets = [
            fa_button, elusive_button, music_button, toggle_button,
            stack_button, saveall_button, spin_button, pulse_button,
            stack_spin_button, label
        ]

        for w in widgets:
            vbox.addWidget(w)

        self.setLayout(vbox)
        self.setWindowTitle('Awesome')
        self.show()
Пример #14
0
    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()
Пример #15
0
 def notes_synchronization_initiated(self):
     self.signal_statusbar_message.emit('Synchronizing with server')
     self.tool_button_toolbar_top_sync.setIcon(
         qta.icon('fa.refresh',
                  color='steelblue',
                  animation=qta.Spin(self.tool_button_toolbar_top_sync)))
Пример #16
0
    def __init__(self):
        super(AwesomeExample, self).__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)

        # 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(unichr(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,
        ]

        for w in widgets:
            vbox.addWidget(w)

        self.setLayout(vbox)
        self.setWindowTitle('Awesome')
        self.show()