Python PySide2.QtGui.QIcon() Examples
The following are 30
code examples of PySide2.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
PySide2.QtGui
, or try the search function
.
Example #1
Source File: ControlsWidget.py From debugger with MIT License | 6 votes |
def load_icon(fname_icon): path_this_file = os.path.abspath(__file__) path_this_dir = os.path.dirname(path_this_file) path_icons = os.path.join(path_this_dir, '..', 'media', 'icons') path_icon = os.path.join(path_icons, fname_icon) pixmap = QtGui.QPixmap(path_icon) #pixmap.fill(QtGui.QColor('red')) #pixmap.setMask(pixmap.createMaskFromColor(QtGui.QColor('black'), QtGui.Qt.MaskOutColor)) icon = QtGui.QIcon() icon.addPixmap(pixmap, QtGui.QIcon.Normal) icon.addPixmap(pixmap, QtGui.QIcon.Disabled) return icon
Example #2
Source File: MenusTools.py From PyAero with MIT License | 6 votes |
def createTools(self): """create the toolbar and populate it automatically from method toolData """ # create a tool bar self.toolbar = self.parent.addToolBar('Toolbar') for tip, icon, handler in self.getToolbarData(): if len(tip) == 0: self.toolbar.addSeparator() continue icon = QtGui.QIcon(ICONS_L + icon) action = QtWidgets.QAction( icon, tip, self.parent, triggered=eval( 'self.parent.slots.' + handler)) self.toolbar.addAction(action)
Example #3
Source File: MenusTools.py From PyAero with MIT License | 6 votes |
def createPullDown(self, menu, eachPullDown): """create the submenu structure to method createMenus""" for name, tip, short, icon, handler in eachPullDown: if len(name) == 0: menu.addSeparator() continue icon = QtGui.QIcon(ICONS_S + icon) logger.debug('HANDLER: {}'.format(handler)) if 'aboutQt' not in handler: handler = 'self.parent.slots.' + handler action = QtWidgets.QAction(icon, name, self.parent, shortcut=short, statusTip=tip, triggered=eval(handler)) menu.addAction(action)
Example #4
Source File: blender_application.py From bqt with Mozilla Public License 2.0 | 6 votes |
def _get_application_icon() -> QIcon: """ This finds the running blender process, extracts the blender icon from the blender.exe file on disk and saves it to the user's temp folder. It then creates a QIcon with that data and returns it. Returns QIcon: Application Icon """ icon_filepath = Path(__file__).parent / ".." / "blender_icon_16.png" icon = QIcon() if icon_filepath.exists(): image = QImage(str(icon_filepath)) if not image.isNull(): icon = QIcon(QPixmap().fromImage(image)) return icon
Example #5
Source File: tileGAN_client.py From tileGAN with GNU General Public License v3.0 | 6 votes |
def __init__(self, widget): QMainWindow.__init__(self) #self.setWindowFlags(QtCore.Qt.CustomizeWindowHint) self.setWindowTitle("TileGAN") app_icon = QtGui.QIcon() app_icon.addFile(iconFolder + '/icon_tilegan_16x16.png', QtCore.QSize(16, 16)) app_icon.addFile(iconFolder + '/icon_tilegan_24x24.png', QtCore.QSize(24, 24)) app_icon.addFile(iconFolder + '/icon_tilegan_32x32.png', QtCore.QSize(32, 32)) app_icon.addFile(iconFolder + '/icon_tilegan_48x48.png', QtCore.QSize(48, 48)) app_icon.addFile(iconFolder + '/icon_tilegan_64x64.png', QtCore.QSize(64, 64)) self.setWindowIcon(app_icon) ## Exit Action exit_action = QAction("Exit", self) exit_action.setShortcut(QtGui.QKeySequence("Ctrl+Q"))#) exit_action.triggered.connect(self.exit_app) # Window dimensions self.setCentralWidget(widget) geometry = app.desktop().availableGeometry(self) self.resize(int(geometry.height() * 0.85), int(geometry.height() * 0.75))
Example #6
Source File: file_toolbar.py From angr-management with BSD 2-Clause "Simplified" License | 6 votes |
def __init__(self, main_window): super(FileToolbar, self).__init__(main_window, 'File') self.actions = [ ToolbarAction(QIcon(os.path.join(IMG_LOCATION, 'toolbar-file-open.ico')), "Open File", "Open a new file for analysis", main_window.open_file_button, ), ToolbarAction(QIcon(os.path.join(IMG_LOCATION, 'toolbar-docker-open.png')), "Open Docker Target", "Open a file located within a docker image for analysis", main_window.open_docker_button, ), ToolbarAction(QIcon(os.path.join(IMG_LOCATION, 'toolbar-file-save.png')), "Save", "Save angr database", main_window.save_database, ), ]
Example #7
Source File: __main__.py From pyside2-boilerplate with MIT License | 6 votes |
def main(): app = QApplication(sys.argv) app.setWindowIcon(QIcon(':/icons/app.svg')) fontDB = QFontDatabase() fontDB.addApplicationFont(':/fonts/Roboto-Regular.ttf') app.setFont(QFont('Roboto')) f = QFile(':/style.qss') f.open(QFile.ReadOnly | QFile.Text) app.setStyleSheet(QTextStream(f).readAll()) f.close() translator = QTranslator() translator.load(':/translations/' + QLocale.system().name() + '.qm') app.installTranslator(translator) mw = MainWindow() mw.show() sys.exit(app.exec_())
Example #8
Source File: universal_tool_template_1115.py From universal_tool_template.py with MIT License | 5 votes |
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None): self.uiList[ui_name] = QtWidgets.QAction(title, self) if icon!=None: self.uiList[ui_name].setIcon(QtGui.QIcon(icon)) if tip !=None: self.uiList[ui_name].setStatusTip(tip) if key != None: self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key)) if parent !=None: if isinstance(parent, (str, unicode)) and parent in self.uiList.keys(): self.uiList[parent].addAction(self.uiList[ui_name]) elif isinstance(parent, QtWidgets.QMenu): parent.addAction(self.uiList[ui_name]) return ui_name
Example #9
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 5 votes |
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None): self.uiList[ui_name] = QtWidgets.QAction(title, self) if icon!=None: self.uiList[ui_name].setIcon(QtGui.QIcon(icon)) if tip !=None: self.uiList[ui_name].setStatusTip(tip) if key != None: self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key)) if parent !=None: if isinstance(parent, (str, unicode)) and parent in self.uiList.keys(): self.uiList[parent].addAction(self.uiList[ui_name]) elif isinstance(parent, QtWidgets.QMenu): parent.addAction(self.uiList[ui_name]) return ui_name
Example #10
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 5 votes |
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None): self.uiList[ui_name] = QtWidgets.QAction(title, self) if icon!=None: self.uiList[ui_name].setIcon(QtGui.QIcon(icon)) if tip !=None: self.uiList[ui_name].setStatusTip(tip) if key != None: self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key)) if parent !=None: if isinstance(parent, (str, unicode)) and parent in self.uiList.keys(): self.uiList[parent].addAction(self.uiList[ui_name]) elif isinstance(parent, QtWidgets.QMenu): parent.addAction(self.uiList[ui_name]) return ui_name
Example #11
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 5 votes |
def qui_atn(self, ui_name, title, tip=None, icon=None, parent=None, key=None): self.uiList[ui_name] = QtWidgets.QAction(title, self) if icon!=None: self.uiList[ui_name].setIcon(QtGui.QIcon(icon)) if tip !=None: self.uiList[ui_name].setStatusTip(tip) if key != None: self.uiList[ui_name].setShortcut(QtGui.QKeySequence(key)) if parent !=None: if isinstance(parent, (str, unicode)) and parent in self.uiList.keys(): self.uiList[parent].addAction(self.uiList[ui_name]) elif isinstance(parent, QtWidgets.QMenu): parent.addAction(self.uiList[ui_name]) return ui_name
Example #12
Source File: universal_tool_template_0903.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #13
Source File: universal_tool_template_0803.py From universal_tool_template.py with MIT License | 5 votes |
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version="0.1" self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file." self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__ self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) # Custom user variable #------------------------------ # initial data #------------------------------ self.memoData['data']=[] self.setupStyle() if isinstance(self, QtWidgets.QMainWindow): self.setupMenu() self.setupWin() self.setupUI() self.Establish_Connections() self.loadData() self.loadLang()
Example #14
Source File: universal_tool_template_0803.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #15
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 votes |
def __init__(self, parent=None, mode=0): super_class.__init__(self, parent) #------------------------------ # class variables #------------------------------ self.version="0.1" self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file." self.uiList={} # for ui obj storage self.memoData = {} # key based variable data storage self.location = "" if getattr(sys, 'frozen', False): # frozen - cx_freeze self.location = sys.executable else: # unfrozen self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__) self.name = self.__class__.__name__ self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png') self.iconPix = QtGui.QPixmap(self.iconPath) self.icon = QtGui.QIcon(self.iconPath) self.fileType='.{0}_EXT'.format(self.name) #------------------------------ # core function variable #------------------------------ self.qui_core_dict = { 'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout', 'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget', 'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox', 'txt': 'QTextEdit', 'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget', 'space': 'QSpacerItem', } self.qui_user_dict = {} #------------------------------
Example #16
Source File: utils.py From pivy with ISC License | 5 votes |
def add_marker_from_svg(file_path, marker_name, pixel_x=10, pixel_y=None, isLSBFirst=False, isUpToDown=False): """adds a new marker bitmap from a vector graphic (svg)""" # get an icon from the svg rendered with the given pixel from PySide2 import QtCore, QtGui pixel_y = pixel_y or pixel_x icon = QtGui.QIcon(file_path) icon = QtGui.QBitmap(icon.pixmap(pixel_x, pixel_y)) # create a XMP-icon buffer=QtCore.QBuffer() buffer.open(buffer.WriteOnly) icon.save(buffer,"XPM") buffer.close() # get a string from the XMP-icon ary = str(buffer.buffer(), "utf8") ary = ary.split("\n", 1)[1] ary = ary.replace('\n', "").replace('"', "").replace(";", "") ary = ary.replace("}", "").replace("#", "x").replace(".", " ") string = str.join("", ary.split(",")[3:]) # add the new marker style setattr(coin.SoMarkerSet, marker_name, coin.SoMarkerSet.getNumDefinedMarkers()) coin.SoMarkerSet.addMarker(getattr(coin.SoMarkerSet, marker_name), coin.SbVec2s([pixel_x, pixel_y]), string, isLSBFirst, isUpToDown)
Example #17
Source File: UITranslator.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #18
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #19
Source File: universal_tool_template_1000.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #20
Source File: universal_tool_template_v8.1.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #21
Source File: universal_tool_template_1010.py From universal_tool_template.py with MIT License | 5 votes |
def quickMenuAction(self, objName, title, tip, icon, menuObj): self.uiList[objName] = QtWidgets.QAction(QtGui.QIcon(icon), title, self) self.uiList[objName].setStatusTip(tip) menuObj.addAction(self.uiList[objName])
Example #22
Source File: darwin_blender_application.py From bqt with Mozilla Public License 2.0 | 5 votes |
def _get_application_icon() -> QIcon: """ This finds the running blender process, extracts the blender icon from the blender.exe file on disk and saves it to the user's temp folder. It then creates a QIcon with that data and returns it. Returns QIcon: Application Icon """ blender_path = bpy.app.binary_path contents_path = Path(blender_path).resolve().parent.parent icon_path = contents_path / "Resources" / "blender icon.icns" return QIcon(str(icon_path))
Example #23
Source File: common_qt_lib.py From randovania with GNU General Public License v3.0 | 5 votes |
def set_default_window_icon(window: QWidget): """ Sets the window icon for the given widget to the default icon :param window: :return: """ window.setWindowIcon(QIcon(str(get_data_path().joinpath("icons", "sky_temple_key_NqN_icon.ico"))))
Example #24
Source File: about.py From angr-management with BSD 2-Clause "Simplified" License | 5 votes |
def __init__(self): super(LoadAboutDialog, self).__init__() self.setWindowFlags(Qt.WindowTitleHint | Qt.WindowCloseButtonHint) self.setWindowTitle('About') #mdiIcon angr_icon_location = os.path.join(IMG_LOCATION, 'angr.png') self.setWindowIcon(QIcon(angr_icon_location)) self._init_widgets()
Example #25
Source File: function_table_toolbar.py From angr-management with BSD 2-Clause "Simplified" License | 5 votes |
def __init__(self, function_table): super().__init__(function_table, 'Function table options') # TODO: An icon would be great self._alignment_action = ToolbarAction(QIcon(os.path.join(IMG_LOCATION, 'toolbar-show-alignment.png')), "Show alignment functions", "Display alignment function stubs.", function_table.toggle_show_alignment_functions, checkable=True) self.actions = [ self._alignment_action, ]
Example #26
Source File: gui.py From GridCal with GNU General Public License v3.0 | 5 votes |
def setupUi(self, GisWindow): GisWindow.setObjectName("GisWindow") GisWindow.resize(938, 577) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/icons/icons/map.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) GisWindow.setWindowIcon(icon) self.centralwidget = QtWidgets.QWidget(GisWindow) self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") self.webFrame = QtWidgets.QFrame(self.centralwidget) self.webFrame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.webFrame.setFrameShadow(QtWidgets.QFrame.Raised) self.webFrame.setObjectName("webFrame") self.verticalLayout.addWidget(self.webFrame) GisWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(GisWindow) self.statusbar.setObjectName("statusbar") GisWindow.setStatusBar(self.statusbar) self.toolBar = QtWidgets.QToolBar(GisWindow) self.toolBar.setMovable(False) self.toolBar.setFloatable(False) self.toolBar.setObjectName("toolBar") GisWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar) self.actionSave_map = QtWidgets.QAction(GisWindow) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/icons/icons/savec.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.actionSave_map.setIcon(icon1) self.actionSave_map.setObjectName("actionSave_map") self.toolBar.addAction(self.actionSave_map) self.retranslateUi(GisWindow) QtCore.QMetaObject.connectSlotsByName(GisWindow)
Example #27
Source File: masking_by_color_dialog.py From metashape-scripts with MIT License | 5 votes |
def changeColor(self): color = QtWidgets.QColorDialog.getColor() self.color = color red, green, blue = color.red(), color.green(), color.blue() if red < 16: red = "0" + hex(red)[2:] else: red = hex(red)[2:] if green < 16: green = "0" + hex(green)[2:] else: green = hex(green)[2:] if blue < 16: blue = "0" + hex(blue)[2:] else: blue = hex(blue)[2:] strColor = red + green + blue self.btnCol.setText(strColor) pix = QtGui.QPixmap(10, 10) pix.fill(self.color) icon = QtGui.QIcon() icon.addPixmap(pix) self.btnCol.setIcon(icon) palette = self.btnCol.palette() palette.setColor(QtGui.QPalette.Button, self.color) self.btnCol.setPalette(palette) self.btnCol.setAutoFillBackground(True) return True
Example #28
Source File: Rush.py From rush with MIT License | 5 votes |
def createHistoryData(self): """ Create data for history list """ # History model self.historyList = self.history.read() self.historyModel = QtGui.QStandardItemModel() for command in self.historyList: # Capitalize the first letter of the command displayName = command[:1].capitalize() + command[1:] # If a command dosen't exist in the history list, # for some reason(eg. command renamed), do nothing. if displayName not in self.cmdDict: continue item = QtGui.QStandardItem(displayName) if os.path.isabs(self.cmdDict[displayName]['icon']) is True: iconPath = os.path.normpath(self.cmdDict[displayName]['icon']) item.setIcon(QtGui.QIcon(iconPath)) else: item.setIcon( QtGui.QIcon(":%s" % self.cmdDict[displayName]['icon'])) module = QtGui.QStandardItem("History") module.setTextAlignment( QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) font = module.font() font.setItalic(True) font.setPointSize(11) module.setFont(font) item.setEditable(False) module.setEditable(False) self.historyModel.appendRow([item, module]) # Store the model(model) into the sortFilterProxy model self.historyFilteredModel = QtCore.QSortFilterProxyModel(self) self.historyFilteredModel.setFilterCaseSensitivity( QtCore.Qt.CaseInsensitive) self.historyFilteredModel.setSourceModel(self.historyModel)
Example #29
Source File: gui.py From streamdeck-ui with MIT License | 5 votes |
def redraw_buttons(ui) -> None: deck_id = _deck_id(ui) current_tab = ui.pages.currentWidget() buttons = current_tab.findChildren(QtWidgets.QToolButton) for button in buttons: button.setText(api.get_button_text(deck_id, _page(ui), button.index)) button.setIcon(QIcon(api.get_button_icon(deck_id, _page(ui), button.index)))
Example #30
Source File: Rush.py From rush with MIT License | 5 votes |
def createCommandData(self): """ Crete data for standard commands """ model = QtGui.QStandardItemModel() # Add all command names and icon paths to the the model(model) for command in self.cmdDict: item = QtGui.QStandardItem(command) if os.path.isabs(self.cmdDict[command]['icon']) is True: iconPath = os.path.normpath(self.cmdDict[command]['icon']) item.setIcon(QtGui.QIcon(iconPath)) else: item.setIcon( QtGui.QIcon(":%s" % self.cmdDict[command]['icon'])) module = QtGui.QStandardItem(self.cmdDict[command]['module']) module.setTextAlignment( QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) font = module.font() font.setItalic(True) font.setPointSize(11) module.setFont(font) item.setEditable(False) module.setEditable(False) model.appendRow([item, module]) # Store the model(model) into the sortFilterProxy model self.filteredModel = QtCore.QSortFilterProxyModel(self) self.filteredModel.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive) self.filteredModel.setSourceModel(model)