Python PyQt5.QtGui.QIcon() Examples
The following are 30
code examples of PyQt5.QtGui.QIcon().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example #1
Source File: angrysearch.py From ANGRYsearch with GNU General Public License v2.0 | 11 votes |
def get_tray_icon(self): base64_data = '''iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHN CSVQICAgIfAhkiAAAAQNJREFUOI3t1M9KAlEcxfHPmP0xU6Ogo G0teoCiHjAIfIOIepvKRUE9R0G0KNApfy0c8hqKKUMrD9zVGc4 9nPtlsgp5n6qSVSk7cBG8CJ6sEX63UEcXz4jE20YNPbygPy25Q o6oE+fEPXFF7A5yA9Eg2sQDcU3sJd6k89O4iiMcYKVol3rH2Mc a1meZ4hMdNPCIj+SjHHfFZU94/0Nwlv4rWoY7vhrdeLNoO86bG lym/ge3lsHDdI2fojbBG6sUtzOiQ1wQOwk6GwWKHeJyHtxOcFi 0TpFaxmnhNcyIW45bQ6RS3Hq4MeB7Ltyahki9Gd2xidWiwG9va nCZqi7xlZGVHfwN6+5nU/ccBUYAAAAASUVORK5CYII=''' pm = Qg.QPixmap() pm.loadFromData(base64.b64decode(base64_data)) i = Qg.QIcon() i.addPixmap(pm) return i # OFF BY DEFAULT # 0.2 SEC DELAY TO LET USER FINISH TYPING BEFORE INPUT BECOMES A DB QUERY
Example #2
Source File: postinstall_simnibs.py From simnibs with GNU General Public License v3.0 | 7 votes |
def __init__(self): super().__init__() button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) mainLayout = QtWidgets.QVBoxLayout() mainLayout.addWidget( QtWidgets.QLabel( f'SimNIBS version {__version__} will be uninstalled. ' 'Are you sure?')) mainLayout.addWidget(button_box) self.setLayout(mainLayout) self.setWindowTitle('SimNIBS Uninstaller') gui_icon = os.path.join(SIMNIBSDIR,'resources', 'gui_icon.ico') self.setWindowIcon(QtGui.QIcon(gui_icon))
Example #3
Source File: table.py From dunya-desktop with GNU General Public License v3.0 | 6 votes |
def _add_item(self, metadata): self.insertRow(self.rowCount()) # add play button play_button = QToolButton(self) play_button.setIcon(QIcon(PLAY_ICON)) self.setItem(self.rowCount()-1, 0, self._make_item(str(self.rowCount()))) self.setCellWidget(self.rowCount()-1, 1, play_button) self.setItem(self.rowCount()-1, 2, self._make_item(metadata['title'])) self.setItem(self.rowCount()-1, 3, self._make_item(metadata['artists'])) self.setColumnWidth(0, 23) self.setColumnWidth(1, 28)
Example #4
Source File: part-3.py From Writer-Tutorial with MIT License | 6 votes |
def initUI(self): self.text = QtWidgets.QTextEdit(self) # Set the tab stop width to around 33 pixels which is # more or less 8 spaces self.text.setTabStopWidth(33) self.initToolbar() self.initFormatbar() self.initMenubar() self.setCentralWidget(self.text) # Initialize a statusbar for the window self.statusbar = self.statusBar() # If the cursor position changes, call the function that displays # the line and column number self.text.cursorPositionChanged.connect(self.cursorPosition) self.setGeometry(100,100,1030,800) self.setWindowTitle("Writer") self.setWindowIcon(QtGui.QIcon("icons/icon.png"))
Example #5
Source File: angrysearch.py From ANGRYsearch with GNU General Public License v2.0 | 6 votes |
def get_mime_icons(self): file_icon = self.style().standardIcon(Qw.QStyle.SP_FileIcon) icon_dic = {'folder': self.style().standardIcon(Qw.QStyle.SP_DirIcon), 'file': file_icon, 'image': file_icon, 'audio': file_icon, 'video': file_icon, 'text': file_icon, 'pdf': file_icon, 'archive': file_icon} # QT RESOURCE FILE WITH MIME ICONS AND DARK GUI THEME ICONS # IF NOT AVAILABLE ONLY 2 ICONS REPRESENTING FILE & DIRECTORY ARE USED try: import resource_file for key in icon_dic: icon = ':/mimeicons/{}/{}.png'.format( self.setting_params['icon_theme'], key) icon_dic[key] = Qg.QIcon(icon) except ImportError: pass return icon_dic
Example #6
Source File: uamodeler.py From opcua-modeler with GNU General Public License v3.0 | 6 votes |
def _fix_icons(self): # fix icon stuff self.ui.actionNew.setIcon(QIcon(":/new.svg")) self.ui.actionOpen.setIcon(QIcon(":/open.svg")) self.ui.actionCopy.setIcon(QIcon(":/copy.svg")) self.ui.actionPaste.setIcon(QIcon(":/paste.svg")) self.ui.actionDelete.setIcon(QIcon(":/delete.svg")) self.ui.actionSave.setIcon(QIcon(":/save.svg")) self.ui.actionAddFolder.setIcon(QIcon(":/folder.svg")) self.ui.actionAddObject.setIcon(QIcon(":/object.svg")) self.ui.actionAddMethod.setIcon(QIcon(":/method.svg")) self.ui.actionAddObjectType.setIcon(QIcon(":/object_type.svg")) self.ui.actionAddProperty.setIcon(QIcon(":/property.svg")) self.ui.actionAddVariable.setIcon(QIcon(":/variable.svg")) self.ui.actionAddVariableType.setIcon(QIcon(":/variable_type.svg")) self.ui.actionAddDataType.setIcon(QIcon(":/data_type.svg")) self.ui.actionAddReferenceType.setIcon(QIcon(":/reference_type.svg"))
Example #7
Source File: main.py From csb with GNU Affero General Public License v3.0 | 6 votes |
def __init__(self): QtWidgets.QWidget.__init__(self) self.ui = uic.loadUi(getLoc('GUIS/SelectConfig.ui'), self) self.setWindowIcon(QtGui.QIcon(getLoc('GUIS/icon.png'))) self.ui.label.setText('<a href="http://www.csb.center"><img src="' + getLoc('GUIS/title.png') + '"></a>') self.ui.label.setOpenExternalLinks(True) self.ui.donate.setText('<a href="https://www.paypal.me/supportcsb"><img src="' + getLoc('GUIS/donate.png') + '"></a>') self.ui.donate.setOpenExternalLinks(True) p = self.palette() p.setColor(self.backgroundRole(), QtCore.Qt.white) self.setPalette(p) self.ui.use_conf.clicked.connect(self.useConfig) self.ui.new_conf.clicked.connect(self.newConfig) self.ui.ASIA_btn.setEnabled(False) self.findFiles() u = update.updateManager('https://github.com/danielyc/csb', '3.0.12') if u.update: QtWidgets.QMessageBox.about(self, 'Update available', 'There is an update available, please download the latest version from the website.')
Example #8
Source File: gui.py From minesweeper with MIT License | 6 votes |
def update_grid(self): """Update grid according to info map.""" info_map = self.ms_game.get_info_map() for i in xrange(self.ms_game.board_height): for j in xrange(self.ms_game.board_width): self.grid_wgs[(i, j)].info_label(info_map[i, j]) self.ctrl_wg.move_counter.display(self.ms_game.num_moves) if self.ms_game.game_status == 2: self.ctrl_wg.reset_button.setIcon(QtGui.QIcon(CONTINUE_PATH)) elif self.ms_game.game_status == 1: self.ctrl_wg.reset_button.setIcon(QtGui.QIcon(WIN_PATH)) self.timer.stop() elif self.ms_game.game_status == 0: self.ctrl_wg.reset_button.setIcon(QtGui.QIcon(LOSE_PATH)) self.timer.stop()
Example #9
Source File: main_win.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 6 votes |
def update_systray(self): if self.tray_icon is None: return settings = mc.model.SettingsM.get() # Icon self.tray_icon.setIcon(QtGui.QIcon(self.get_app_systray_icon_path())) # self.tray_icon.show() # Menu self.sys_tray.update_breathing_checked(settings.breathing_reminder_active_bool) self.sys_tray.update_rest_checked(settings.rest_reminder_active) self.sys_tray.update_rest_progress_bar( mc.mc_global.rest_reminder_minutes_passed_int, mc.model.SettingsM.get().rest_reminder_interval_int )
Example #10
Source File: status_bar.py From CHATIMUSMAXIMUS with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None): super(StatusBar, self).__init__(parent) file_dir = os.path.dirname(__file__) resource_dir = os.path.join(file_dir, 'resources', 'buttons') red_button = os.path.join(resource_dir, 'red_button.png') green_button = os.path.join(resource_dir, 'green_button.png') self._red_icon = QtGui.QIcon(red_button) self._green_icon = QtGui.QIcon(green_button) self.time_label = QtWidgets.QLabel() self.time_label.setStyleSheet('color: white;') self.addPermanentWidget(self.time_label) # set up the status widgets self._status_widgets = {}
Example #11
Source File: text_queue.py From persepolis with GNU General Public License v3.0 | 6 votes |
def queueChanged(self, combo): if str(self.add_queue_comboBox.currentText()) == 'Create new queue': # if user want to create new queue, then call createQueue method from mainwindow(parent) new_queue = self.parent.createQueue(combo) if new_queue: # clear comboBox self.add_queue_comboBox.clear() # load queue list again! queues_list = self.parent.persepolis_db.categoriesList() for queue in queues_list: if queue != 'All Downloads': self.add_queue_comboBox.addItem(queue) self.add_queue_comboBox.addItem( QIcon(icons + 'add_queue'), 'Create new queue') # finding index of new_queue and setting comboBox for it index = self.add_queue_comboBox.findText(str(new_queue)) self.add_queue_comboBox.setCurrentIndex(index) else: self.add_queue_comboBox.setCurrentIndex(0) # activate frames if checkBoxes checked
Example #12
Source File: pie_chart.py From Lector with GNU General Public License v3.0 | 6 votes |
def pixmapper(position_percent, temp_dir, consider_read_at, size): # A current_chapter of -1 implies the files does not exist # position_percent and consider_read_at are expected as a <1 decimal value return_pixmap = None consider_read_at = consider_read_at / 100 if position_percent == -1: return_pixmap = QtGui.QIcon(':/images/error.svg').pixmap(size) return return_pixmap if position_percent >= consider_read_at: # Consider book read @ this progress return_pixmap = QtGui.QIcon(':/images/checkmark.svg').pixmap(size) else: # TODO # See if saving the svg to disk can be avoided # Maybe make the alignment a little more uniform across emblems generate_pie(int(position_percent * 100), temp_dir) svg_path = os.path.join(temp_dir, 'lector_progress.svg') return_pixmap = QtGui.QIcon(svg_path).pixmap(size - 4) ## The -4 looks more proportional return return_pixmap
Example #13
Source File: table.py From dunya-desktop with GNU General Public License v3.0 | 6 votes |
def set_status(self, raw, exist=None): item = QLabel() item.setAlignment(Qt.AlignCenter) if exist is 0: icon = QPixmap(QUEUE_ICON).scaled(20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation) item.setPixmap(icon) item.setToolTip('Waiting in the download queue...') if exist is 1: icon = QPixmap(CHECK_ICON).scaled(20, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation) item.setPixmap(icon) item.setToolTip('All the features are downloaded...') if exist is 2: item = QPushButton(self) item.setToolTip('Download') item.setIcon(QIcon(DOWNLOAD_ICON)) item.clicked.connect(self.download_clicked) self.setCellWidget(raw, 0, item)
Example #14
Source File: main.py From csb with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self): QtWidgets.QWidget.__init__(self) self.ui = uic.loadUi(getLoc('GUIS/PDConfig.ui'), self) self.setWindowIcon(QtGui.QIcon(getLoc('GUIS/icon.png'))) self.logo.setPixmap(QtGui.QPixmap(getLoc('GUIS/title.png'))) self.cc = True p = self.palette() p.setColor(self.backgroundRole(), QtCore.Qt.white) self.setPalette(p) self.updateRegion() self.populateCC() self.ui.continue_btn.clicked.connect(self.cont) self.ui.save_btn.clicked.connect(self.saveConfig) self.loadToolTips()
Example #15
Source File: part-2.py From Writer-Tutorial with MIT License | 5 votes |
def initUI(self): self.text = QtWidgets.QTextEdit(self) self.initToolbar() self.initFormatbar() self.initMenubar() # Set the tab stop width to around 33 pixels which is # about 8 spaces self.text.setTabStopWidth(33) self.setCentralWidget(self.text) # Initialize a statusbar for the window self.statusbar = self.statusBar() # If the cursor position changes, call the function that displays # the line and column number self.text.cursorPositionChanged.connect(self.cursorPosition) # x and y coordinates on the screen, width, height self.setGeometry(100,100,1030,800) self.setWindowTitle("Writer") self.setWindowIcon(QtGui.QIcon("icons/icon.png"))
Example #16
Source File: progress.py From persepolis with GNU General Public License v3.0 | 5 votes |
def changeIcon(self, icons): icons = ':/' + str(icons) + '/' self.resume_pushButton.setIcon(QIcon(icons + 'play')) self.pause_pushButton.setIcon(QIcon(icons + 'pause')) self.stop_pushButton.setIcon(QIcon(icons + 'stop'))
Example #17
Source File: browser_plugin_queue.py From persepolis with GNU General Public License v3.0 | 5 votes |
def changeIcon(self, icons): icons = ':/' + str(icons) + '/' self.folder_pushButton.setIcon(QIcon(icons + 'folder')) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) self.cancel_pushButton.setIcon(QIcon(icons + 'remove'))
Example #18
Source File: browser_plugin_queue.py From persepolis with GNU General Public License v3.0 | 5 votes |
def queueChanged(self, combo): if str(self.add_queue_comboBox.currentText()) == 'Create new queue': # if user want to create new queue, then call createQueue method from mainwindow(parent) new_queue = self.parent.createQueue(combo) if new_queue: # clear comboBox self.add_queue_comboBox.clear() # load queue list again! queues_list = self.parent.persepolis_db.categoriesList() for queue in queues_list: if queue != 'All Downloads': self.add_queue_comboBox.addItem(queue) self.add_queue_comboBox.addItem( QIcon(icons + 'add_queue'), 'Create new queue') # finding index of new_queue and setting comboBox for it index = self.add_queue_comboBox.findText(str(new_queue)) self.add_queue_comboBox.setCurrentIndex(index) else: self.add_queue_comboBox.setCurrentIndex(0) # activate frames if checkBoxes checked
Example #19
Source File: properties.py From persepolis with GNU General Public License v3.0 | 5 votes |
def changeIcon(self, icons): icons = ':/' + str(icons) + '/' self.folder_pushButton.setIcon(QIcon(icons + 'folder')) self.download_later_pushButton.setIcon(QIcon(icons + 'stop')) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) self.ok_pushButton.setIcon(QIcon(icons + 'ok'))
Example #20
Source File: part-1.py From Writer-Tutorial with MIT License | 5 votes |
def initUI(self): self.text = QtWidgets.QTextEdit(self) self.initToolbar() self.initFormatbar() self.initMenubar() # Set the tab stop width to around 33 pixels which is # about 8 spaces self.text.setTabStopWidth(33) self.setCentralWidget(self.text) # Initialize a statusbar for the window self.statusbar = self.statusBar() # If the cursor position changes, call the function that displays # the line and column number self.text.cursorPositionChanged.connect(self.cursorPosition) # x and y coordinates on the screen, width, height self.setGeometry(100,100,1030,800) self.setWindowTitle("Writer") self.setWindowIcon(QtGui.QIcon("icons/icon.png"))
Example #21
Source File: detection.py From detection with GNU General Public License v2.0 | 5 votes |
def main(): app = QApplication(sys.argv) app.setStyle(QtWidgets.QStyleFactory.create("Fusion")) p = app.palette() p.setColor(QPalette.Base, QColor(40, 40, 40)) p.setColor(QPalette.Window, QColor(55, 55, 55)) p.setColor(QPalette.Button, QColor(49, 49, 49)) p.setColor(QPalette.Highlight, QColor(135, 135, 135)) p.setColor(QPalette.ButtonText, QColor(155, 155, 155)) p.setColor(QPalette.WindowText, QColor(155, 155, 155)) p.setColor(QPalette.Text, QColor(155, 155, 155)) p.setColor(QPalette.Disabled, QPalette.Base, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.Text, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Button, QColor(42, 42, 42)) p.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(90, 90, 90)) p.setColor(QPalette.Disabled, QPalette.Window, QColor(49, 49, 49)) p.setColor(QPalette.Disabled, QPalette.WindowText, QColor(90, 90, 90)) app.setPalette(p) QApplication.addLibraryPath(QApplication.applicationDirPath() + "/../PlugIns") main = Window() main.setWindowTitle('Detection') main.setWindowIcon(QtGui.QIcon('assets/icon.png')) main.show() try: sys.exit(app.exec_()) except KeyboardInterrupt: pass
Example #22
Source File: detection.py From detection with GNU General Public License v2.0 | 5 votes |
def togglePlayButton(self, play=True): """Switch between play and pause icons. """ if play is True: self.playButton.setIcon(QIcon('assets/pause.png')) else: self.playButton.setIcon(QIcon('assets/play.png')) ######################################################## # Signals handlers
Example #23
Source File: detection.py From detection with GNU General Public License v2.0 | 5 votes |
def getIcon(self, color): """Returns a colored icon. """ pixmap = QPixmap(14, 14) pixmap.fill(color) return QIcon(pixmap)
Example #24
Source File: gui_code.py From attack_monitor with GNU General Public License v3.0 | 5 votes |
def initialize_system_tray(self): self.trayIcon = SystemTrayIcon(QtGui.QIcon("icon\\attack_156413_1280_aMk_icon.ico"), self.some_widget, self, self.LEARNING_MODE) self.trayIcon.show()
Example #25
Source File: combobox.py From dunya-desktop with GNU General Public License v3.0 | 5 votes |
def _set_cancel_button(self): self.cancel_button = QToolButton(self) self.cancel_button.setIcon(QIcon(ICON_PATH_CANCEL)) self.cancel_button.setVisible(False)
Example #26
Source File: application.py From restatic with GNU General Public License v3.0 | 5 votes |
def backup_cancelled_event_response(self): icon = QIcon(get_asset("icons/hdd-o.png")) self.tray.setIcon(icon)
Example #27
Source File: application.py From restatic with GNU General Public License v3.0 | 5 votes |
def backup_finished_event_response(self): icon = QIcon(get_asset("icons/hdd-o.png")) self.tray.setIcon(icon) self.main_window.scheduleTab._draw_next_scheduled_backup()
Example #28
Source File: application.py From restatic with GNU General Public License v3.0 | 5 votes |
def backup_started_event_response(self): icon = QIcon(get_asset("icons/hdd-o-active.png")) self.tray.setIcon(icon)
Example #29
Source File: tray_menu.py From restatic with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): icon = QIcon(get_asset("icons/hdd-o.png")) QSystemTrayIcon.__init__(self, icon, parent) self.app = parent menu = QMenu() self.status = menu.addAction(self.app.scheduler.next_job) self.status.setEnabled(False) self.profile_menu = menu.addMenu("Backup Now") for profile in BackupProfileModel.select(): new_item = self.profile_menu.addAction(profile.name) new_item.setData(profile.id) new_item.triggered.connect( lambda profile_id=profile.id: self.app.create_backup_action(profile_id) ) self.cancel_action = menu.addAction("Cancel Backup") self.cancel_action.triggered.connect(self.app.backup_cancelled_event.emit) self.cancel_action.setVisible(False) settings_action = menu.addAction("Settings") settings_action.triggered.connect(self.app.open_main_window_action) menu.addSeparator() exit_action = menu.addAction("Exit") exit_action.triggered.connect(self.app.quit) self.activated.connect(self.on_user_click) self.setContextMenu(menu) self.setVisible(True) self.show()
Example #30
Source File: PyQt5.py From fbs with GNU General Public License v3.0 | 5 votes |
def _qt_binding(self): return _QtBinding(QApplication, QIcon, QAbstractSocket)