Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
# 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,
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))
def __init__(self):
super(StatusWidget, self).__init__()
self.button_weird = QtGui.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 = QtGui.QLabel('busy')
self.label.setObjectName('small')
self.label.setStyleSheet('color: {0};'.format(COLOR_PALETTE['primary']))
self.label_mov = QtGui.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 = QtGui.QHBoxLayout()
status_layout.addWidget(self.label_mov)
status_layout.addWidget(self.label)
{'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)