我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtGui.QIcon()。
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(867, 553) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/assets/logo.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) Form.setWindowIcon(icon) Form.setWindowOpacity(1.0) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.splitter_2 = QtGui.QSplitter(Form) self.splitter_2.setOrientation(QtCore.Qt.Vertical) self.splitter_2.setObjectName(_fromUtf8("splitter_2")) self.layoutWidget = QtGui.QWidget(self.splitter_2) self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) self.idleLayout = QtGui.QHBoxLayout(self.layoutWidget) self.idleLayout.setSpacing(0) self.idleLayout.setObjectName(_fromUtf8("idleLayout")) self.gridLayout.addWidget(self.splitter_2, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self): super(appWindow, self).__init__() # Figure out why AppWindow and self are both being passed to super() self.setGeometry(50, 50, 800, 500) self.setWindowTitle("OpenCouture") self.setWindowIcon(QtGui.QIcon('Icon.png')) ### MENU ACTIONS ### File_Quit = QtGui.QAction("&Quit Application", self) File_Quit.setShortcut("Ctrl+Q") File_Quit.setStatusTip('Exit the App') File_Quit.triggered.connect(self.exitApp) ### MENU CONFIGURATION ### self.statusBar() Menu_Main = self.menuBar() SubMenu_File = Menu_Main.addMenu('&File') SubMenu_File.addAction(File_Quit) self.home() ### PAGES (Eventually modularize these? Include them in another file?) ###
def contextMenuEvent(self, e): self.rel_pos = e.pos() self.rowClicked = self.rowAt(self.rel_pos.y()) if self.rowClicked == -1: return offset = QtCore.QPoint(self.verticalHeader().width()+3,self.horizontalHeader().height()+3) menu = QtGui.QMenu(self) if len(self.selectedIndexes())==4: if self.model().downloadlist[self.rowClicked].progress == '- - -': if self.model().downloadlist[self.rowClicked].support_resume: menu.addAction(QtGui.QIcon.fromTheme('media-playback-start'), "Resume", self.pause_resume) else: menu.addAction(QtGui.QIcon.fromTheme('view-refresh'), "Restart", self.pause_resume) else: if self.model().downloadlist[self.rowClicked].support_resume: menu.addAction(QtGui.QIcon.fromTheme('media-playback-pause'), "Pause", self.pause_resume) else: menu.addAction(QtGui.QIcon.fromTheme('process-stop'), "Stop", self.pause_resume) menu.addAction(QtGui.QIcon.fromTheme('edit-copy'), "Copy Address", self.copy_address) menu.addAction(QtGui.QIcon.fromTheme('edit-clear'), "Remove Download", self.remove_selected) menu.addAction(QtGui.QIcon.fromTheme('edit-delete'), "Delete File(s)", self.delete_selected) menu.exec_(self.mapToGlobal(self.rel_pos + offset))
def createIcon(self, nodeType): '''Create Icons for `libraryModel`. :param nodeType: Type of icon to create. ''' pixmap = QtGui.QPixmap(60, 60) pixmap.fill() painter = QtGui.QPainter(pixmap) if nodeType == "transition": painter.setBrush(QtCore.Qt.white) painter.drawRect(5, 10, 50, 30) elif nodeType == "place": painter.setBrush(QtCore.Qt.white) painter.drawEllipse(5, 10, 50, 30) elif nodeType == "token": painter.setBrush(QtCore.Qt.green) painter.drawEllipse(15, 15, 30, 30) painter.end() return QtGui.QStandardItem( QtGui.QIcon(pixmap), nodeType[0].upper() + nodeType[1:] ) #------------------------------------------------------------------------------------------------
def addExisting(self): stations = Stations() for st in stations.stations: self.view.scene()._stations.stations.append(st) self.view.scene().addStation(st) self.view.scene()._scenarios.append(['Existing', False, 'Existing stations']) try: self.fileMenu.removeAction(self.sender()) except: for act in self.fileMenu.actions(): if act.text() == self.sender().text(): self.fileMenu.removeAction(act) break subFile = QtGui.QAction(QtGui.QIcon('minus.png'), 'Existing', self) subFile.setStatusTip('Remove Scenario Existing') subFile.triggered.connect(self.removeScenario) self.subMenu.addAction(subFile) self.reshow_FloatMenu() self.reshow_FloatLegend() if self.floatstatus: self.floatstatus.emit(QtCore.SIGNAL('scenarios'), self.view.scene()._scenarios) self.view.emit(QtCore.SIGNAL('statusmsg'), 'Added Existing stations')
def show_Capacity(self): comment = 'Capacity Circles Toggled' if self.view.scene().show_capacity: self.showCapacity.setIcon(QtGui.QIcon('blank.png')) self.view.scene().show_capacity = False self.view.scene()._capacityGroup.setVisible(False) self.view.scene()._fcapacityGroup.setVisible(False) comment += ' Off' else: self.showCapacity.setIcon(QtGui.QIcon(self.check_icon)) self.view.scene().show_capacity = True self.view.scene()._capacityGroup.setVisible(True) if self.view.scene().show_fossil: self.view.scene()._fcapacityGroup.setVisible(True) comment += ' On' self.reshow_FloatLegend() self.view.emit(QtCore.SIGNAL('statusmsg'), comment)
def initGui(self): """Create the menu entries and toolbar icons inside the QGIS GUI.""" self.nofa_act = QAction(self.iface.mainWindow()) self.nofa_act.setText(self.app_name) nofa_icon = QIcon(os.path.join(self.plugin_dir, 'nofainsert.svg')) self.nofa_act.setIcon(nofa_icon) self.nofa_act.triggered.connect(self.run) self.iface.addToolBarIcon(self.nofa_act) self.iface.addPluginToMenu(self.app_name, self.nofa_act) self.con_act = QAction(self.iface.mainWindow()) self.con_act.setText(u'Connection Parameters') con_icon = QIcon( os.path.join(self.plugin_dir, 'data', 'icons', 'options.png')) self.con_act.setIcon(con_icon) self.con_act.triggered.connect(self._open_con_dlg) self.iface.addPluginToMenu(self.app_name, self.con_act) self.ins_mw = ins_mw.InsMw(self.iface, self, self.plugin_dir)
def createBackgroundCellWidget(self, text, image): button = QtGui.QToolButton() button.setText(text) button.setIcon(QtGui.QIcon(image)) button.setIconSize(QtCore.QSize(50, 50)) button.setCheckable(True) self.backgroundButtonGroup.addButton(button) layout = QtGui.QGridLayout() layout.addWidget(button, 0, 0, QtCore.Qt.AlignHCenter) layout.addWidget(QtGui.QLabel(text), 1, 0, QtCore.Qt.AlignCenter) widget = QtGui.QWidget() widget.setLayout(layout) return widget
def createCellWidget(self, text, diagramType): item = DiagramItem(diagramType, self.itemMenu) icon = QtGui.QIcon(item.image()) button = QtGui.QToolButton() button.setIcon(icon) button.setIconSize(QtCore.QSize(50, 50)) button.setCheckable(True) self.buttonGroup.addButton(button, diagramType) layout = QtGui.QGridLayout() layout.addWidget(button, 0, 0, QtCore.Qt.AlignHCenter) layout.addWidget(QtGui.QLabel(text), 1, 0, QtCore.Qt.AlignCenter) widget = QtGui.QWidget() widget.setLayout(layout) return widget
def createActions(self): #self.saveAct = QtGui.QAction(QtGui.QIcon(':/images/save.png'), #"&Save...", self, shortcut=QtGui.QKeySequence.Save, #statusTip="Save the current form letter", #triggered=self.save) self.quitAct = QtGui.QAction("&Quit", self, shortcut="Ctrl+Q", statusTip="Quit the application", triggered=self.close) self.aboutAct = QtGui.QAction("&About", self, statusTip="Show the application's About box", triggered=self.about) self.aboutQtAct = QtGui.QAction("About &Qt", self, statusTip="Show the Qt library's About box", triggered=QtGui.qApp.aboutQt)
def list_hosts(self, ip): live_hosts = [] if self._isProtected: print "protected" arping = sp.Popen(['arp-scan','--interface',self._iface,ip],stdout = sp.PIPE,shell=False) else: print "Not Protected" arping = sp.Popen(['arp-scan','--interface',self._iface,ip+'/24'],stdout = sp.PIPE,shell=False) i=1 for line in arping.stdout: if line.startswith(ip.split('.')[0]): ip = line.split()[0] mac= line.split()[1] self.table_hosts.setRowCount(i) self.table_hosts.setItem(i-1,0,QtGui.QTableWidgetItem(ip)) self.table_hosts.item(i-1,0).setIcon(QtGui.QIcon(':pix/pix/online.png')) self.table_hosts.setItem(i-1,1,QtGui.QTableWidgetItem(mac)) live_hosts.append(ip) i=i+1 self.myThread = Thread(target=self.list_hostnames,args=(live_hosts,)) self.myThread.start()
def toggleCorrectionMode(self): if not self.config.correctionMode: self.config.correctionMode = True iconDir = os.path.join( os.path.dirname(sys.argv[0]) , 'icons' ) self.correctAction.setIcon(QtGui.QIcon(os.path.join( iconDir , 'checked6_red.png' ))) else: self.config.correctionMode = False iconDir = os.path.join( os.path.dirname(sys.argv[0]) , 'icons' ) self.correctAction.setIcon(QtGui.QIcon(os.path.join( iconDir , 'checked6.png' ))) self.update() return # Switch to a selected image of the file list # Ask the user for an image # Load the image # Load its labels # Update the mouse selection # View
def __init__(self): super(MainWindow, self).__init__() self.setupUi(self) self.setWindowIcon(QtGui.QIcon('pip_gui/Resource_Files/googledev.png')) #Quiting the Application self.btnExit.clicked.connect(self.endApp) self.btnExit.setToolTip('Exit Application') self.actionExit.triggered.connect(self.endApp) self.actionExit.setStatusTip('Exit Application') self.actionExit.setShortcut('Ctrl+Q') self.actionRefresh.triggered.connect(self.refreshLists) self.actionRefresh.setToolTip('Refresh Package Lists') self.actionRefresh.setShortcut('Ctrl+R') #Binding button to radio button result self.btnNext.clicked.connect(self.radioCheck)
def __init__(self): super(UpdateWindow, self).__init__() self.setupUi(self) self.setWindowIcon(QtGui.QIcon('pip_gui/Resource_Files/googledev.png')) self.outdatedPackages = json.load(open('pip_gui/Resource_Files/outdatedPackage' + fileVersion+ '.json')) self.selectedList = list() self.btnBack.clicked.connect(self.backFn) self.btnUpdateAll.clicked.connect(self.updateAllFn) self.btnUpdate.clicked.connect(self.updateFn) global outdatedPackages if len(self.outdatedPackages): for i in self.outdatedPackages: self.item = QtGui.QListWidgetItem(i) self.listWidget.addItem(self.item) else: self.item = QtGui.QListWidgetItem('=== No Outdated Packges ===') self.listWidget.addItem(self.item) self.btnUpdate.setEnabled(False) self.btnUpdateAll.setEnabled(False)
def __init__(self): super(Ventana, self).__init__() self.ver = "0.2 Alpha" self.setWindowTitle("GUIYoutube - "+self.ver) self.setWindowIcon(QtGui.QIcon("Youtube.ico")) self.setGeometry(100, 100, 1000, 500) self.setMaximumSize(1200, 670) self.cantidad = 5 self.reproductorPreferido = "VLC" self.statusBar() self.statusBar().setStyleSheet("background-color:grey") self.setObjectName("Ventana Principal") self.reproductor = "" self.reproductorActivo = False self.format = "" self.preferedformat = "" self.link = "" self.resultados = "" self.cantidad = "" self.paginaPrincipal() #self.poblarLista()
def setupUi(self, qgpkgDlg): qgpkgDlg.setObjectName(_fromUtf8("qgpkgDlg")) qgpkgDlg.resize(456, 358) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/plugins/QgisGeopackage/about.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) qgpkgDlg.setWindowIcon(icon) self.verticalLayout = QtGui.QVBoxLayout(qgpkgDlg) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.textEdit = QtGui.QTextEdit(qgpkgDlg) self.textEdit.setReadOnly(True) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.verticalLayout.addWidget(self.textEdit) self.button_box = QtGui.QDialogButtonBox(qgpkgDlg) self.button_box.setOrientation(QtCore.Qt.Horizontal) self.button_box.setStandardButtons(QtGui.QDialogButtonBox.Close) self.button_box.setObjectName(_fromUtf8("button_box")) self.verticalLayout.addWidget(self.button_box) self.retranslateUi(qgpkgDlg) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("accepted()")), qgpkgDlg.accept) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(_fromUtf8("rejected()")), qgpkgDlg.reject) QtCore.QMetaObject.connectSlotsByName(qgpkgDlg)
def __init__(self, *args, **kwargs): # Grab the args as a list so we can edit it args = list(args) otherNode = None # Check to see if the first argument is of type NodeBase #if args and isinstance(args[0], BaseNode): if args: otherNode = args.pop(0) # Separately initiate the inherited classes QtGui.QListWidgetItem.__init__(self, *args, **kwargs) BaseNode.__init__(self) # Set all necessary attributes that come from the base class if they're present self.displayText = otherNode.displayText if otherNode else "" self.dictKey = otherNode.dictKey if otherNode else "" self.imagePath = otherNode.imagePath if otherNode else "" self.description = otherNode.description if otherNode else "" self.nodeColor = otherNode.nodeColor if otherNode else "" self.listWidgetName = otherNode.listWidgetName if otherNode else None self.setIcon(QtGui.QIcon(self.imagePath)) self.setText(self.displayText)
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.setWindowIcon(QtGui.QIcon(os.path.join(appPath, 'assets', 'images', 'icon.jpg'))) self.apps = [] self.workspaces = [] self.keyboards = [] self.modes = {} self.initConfig() self.prepareUi() self.listenButtons() self.show()
def initFrame(self): # window banner self.setWindowIcon( QtGui.QIcon( QtGui.QPixmap('resources/icons/olive.png'))) # restoring windows and toolbars geometry settings = QtCore.QSettings() if len(settings.value("overviewColumnWidths").toString()) > 0: self.restoreGeometry(settings.value("geometry").toByteArray()) self.restoreState(settings.value("windowState").toByteArray()) self.overview.setColumnWidthsFromString( settings.value("overviewColumnWidths").toString()) else: # first run self.setGeometry(32, 32, 32, 32)
def createTransformActions(self): self.transforms = [] for i, k in enumerate(Mainframe.transform_names): self.transforms.append( QtGui.QAction( QtGui.QIcon( 'resources/icons/arrow-' + Mainframe.transform_icons[i] + '.png'), Lang.value( 'MI_' + k), self)) self.transforms[-1].triggered.connect( self.createTransformsCallable(k)) self.toolbar.addAction(self.transforms[-1]) self.editMenu.addAction(self.transforms[-1])
def __init__(self, mainframeInstance): self.quickies = [ {'option': 'SetPlay', 'icon': 'setplay.png', 'lang': 'QO_SetPlay'}, {'option': 'Defence 1', 'icon': 'tries.png', 'lang': 'QO_Tries'}, {'option': 'PostKeyPlay', 'icon': 'postkeyplay.png', 'lang': 'QO_PostKeyPlay'}, {'option': 'Intelligent', 'icon': 'intelligent.png', 'lang': 'QO_IntelligentMode'} ] self.actions = [] for q in self.quickies: action = QtGui.QAction( QtGui.QIcon( 'resources/icons/' + q['icon']), Lang.value( q['lang']), mainframeInstance) action.setCheckable(True) action.triggered.connect(self.makeToggleOption(q['option'])) self.actions.append(action) Mainframe.sigWrapper.sigModelChanged.connect(self.onModelChanged) Mainframe.sigWrapper.sigLangChanged.connect(self.onLangChanged) self.skip_model_changed = False
def addItem(self, row, data): """ This function add a item on a row :param row: the row's number :param data: the information :return: None """ # state can be filtered, closed or open # data[3] is state if data[3] in ["open"]: self.tableWidget.setVerticalHeaderItem(row, QTableWidgetItem(QIcon().fromTheme('list-add'), '')) else: self.tableWidget.setVerticalHeaderItem(row, QTableWidgetItem(QIcon().fromTheme('dialog-error'), '')) for i, d in enumerate(data): item = QTableWidgetItem(d) item.setFlags(Qt.ItemIsEnabled) self.tableWidget.setItem(row, i, item)
def __init__(self): super().__init__() # Init GUI self.setWindowTitle('Picasso: ToRaw') self.resize(768, 512) this_directory = os.path.dirname(os.path.realpath(__file__)) icon_path = os.path.join(this_directory, 'icons', 'toraw.ico') icon = QtGui.QIcon(icon_path) self.setWindowIcon(icon) vbox = QtGui.QVBoxLayout() self.setLayout(vbox) vbox.addWidget(QtGui.QLabel('Files:')) self.path_edit = TextEdit() vbox.addWidget(self.path_edit) hbox = QtGui.QHBoxLayout() vbox.addLayout(hbox) self.browse_button = QtGui.QPushButton('Browse') self.browse_button.clicked.connect(self.browse) hbox.addWidget(self.browse_button) hbox.addStretch(1) to_raw_button = QtGui.QPushButton('To raw') to_raw_button.clicked.connect(self.to_raw) hbox.addWidget(to_raw_button)
def __init__(self, main_window, locs): super().__init__() self.main_window = main_window self.locs = locs self.figure = plt.Figure() self.canvas = FigureCanvasQTAgg(self.figure) self.plot() vbox = QtGui.QVBoxLayout() self.setLayout(vbox) vbox.addWidget(self.canvas) vbox.addWidget((NavigationToolbar2QT(self.canvas, self))) self.setWindowTitle('Picasso: Filter') this_directory = os.path.dirname(os.path.realpath(__file__)) icon_path = os.path.join(this_directory, 'icons', 'filter.ico') icon = QtGui.QIcon(icon_path) self.setWindowIcon(icon)
def closeDetect(self, win=None): if win: win_list = set((self.librarian, self.editor) + tuple(self.wavetable_windows_list)) win_list.discard(win) if any(win.isVisible() for win in win_list): return True if not self.library_changed(): return True msgbox = QtGui.QMessageBox( QtGui.QMessageBox.Question, 'Confirm exit', 'The library has been modified, do you want to quit anyway?', QtGui.QMessageBox.Abort|QtGui.QMessageBox.Save|QtGui.QMessageBox.Cancel, self.librarian ) buttonBox = msgbox.findChild(QtGui.QDialogButtonBox) abort_btn = buttonBox.button(QtGui.QDialogButtonBox.Abort) abort_btn.setText('Ignore and quit') abort_btn.setIcon(QtGui.QIcon.fromTheme('application-exit')) res = msgbox.exec_() if res == QtGui.QMessageBox.Cancel: return False elif res == QtGui.QMessageBox.Abort: return True self.save_library() return True
def setupWin(self): self.setWindowTitle("TMP_UniversalToolUI_TND" + " - v" + self.version) self.setGeometry(300, 300, 800, 600) # win icon setup path = os.path.join(os.path.dirname(self.location),'icons','TMP_UniversalToolUI_TND.png') self.setWindowIcon(QtGui.QIcon(path)) # initial win drag position self.drag_position=QtGui.QCursor.pos() #self.resize(250,250) # - for frameless or always on top option #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent #self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui # - for transparent and non-regular shape ui #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window #self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
def setupWin(self): self.setWindowTitle("UITranslator" + " - v" + self.version) self.setGeometry(300, 300, 300, 300) # win icon setup path = os.path.join(os.path.dirname(self.location),'icons','UITranslator.png') self.setWindowIcon(QtGui.QIcon(path)) # initial win drag position self.drag_position=QtGui.QCursor.pos() #self.resize(250,250) # - for frameless or always on top option #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent #self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear #self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui # - for transparent and non-regular shape ui #self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window #self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
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)
def __init__(self, items, label=None , parent=None): # if using the Qt4Agg backend for matplotlib, the following line needs to be comment out # app=QtGui.QApplication(sys.argv) QtGui.QDialog.__init__(self) self.ui = Ui_selectorDialogForm() self.ui.setupUi(self) self.ui.listWidget.setSelectionMode(QtGui.QListWidget.MultiSelection) if label == None: self.setWindowTitle('ChiantiPy') else: self.setWindowTitle('ChiantiPy - '+label) imagefile = os.path.join(ChiantiPy.__path__[0], "images/chianti2.png") self.setWindowIcon(QtGui.QIcon(imagefile)) for anitem in items: # print ' item = ', anitem, QtCore.QString(anitem) self.ui.listWidget.addItem(str(anitem)) self.exec_()
def __init__(self, items, label=None , parent=None): # if using the Qt4Agg backend for matplotlib, the following line needs to be comment out # app=QtGui.QApplication(sys.argv) QtGui.QDialog.__init__(self) # app=QtGui.QApplication(sys.argv) self.ui = Ui_choice2DialogForm() self.ui.setupUi(self) if label == None: self.setWindowTitle('ChiantiPy') else: self.setWindowTitle('ChiantiPy - '+label) self.setWindowIcon(QtGui.QIcon('images/chianti2.png')) for anitem in items: # print ' item = ', anitem, QtCore.QString(anitem) self.ui.numListWidget.addItem(str(anitem)) self.ui.denListWidget.addItem(str(anitem)) self.exec_() #
def retranslateUi(self, Form): Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8)) self.diffSnapLabel.setText(QtGui.QApplication.translate("Form", "Snapshot 2:", None, QtGui.QApplication.UnicodeUTF8)) self.diffButtonCompare.setText(QtGui.QApplication.translate("Form", "Compare", None, QtGui.QApplication.UnicodeUTF8)) self.diffButtonCompare.setToolTip(QtGui.QApplication.translate("Form", "Compare Snapshots", None, QtGui.QApplication.UnicodeUTF8)) icon_compare = QtGui.QIcon(":/actions/view-refresh.svg") self.diffButtonCompare.setIcon(icon_compare) self.minLabel.setText(QtGui.QApplication.translate("Form", "min:", None, QtGui.QApplication.UnicodeUTF8)) self.maxLabel.setText(QtGui.QApplication.translate("Form", "max:", None, QtGui.QApplication.UnicodeUTF8)) self.diffLabel.setText(QtGui.QApplication.translate("Form", "diff:", None, QtGui.QApplication.UnicodeUTF8)) #self.minLogo.setPixmap(QtGui.QPixmap("img/min.gif")) #self.maxLogo.setPixmap(QtGui.QPixmap("img/max.gif")) #self.diffLogo.setPixmap(QtGui.QPixmap("img/diff.gif")) self.minLogo.setStyleSheet("QLabel { background-color: rgb(255,255,0) }") self.maxLogo.setStyleSheet("QLabel { background-color: rgb(255,0,0) }") self.diffLogo.setStyleSheet("QLabel { background-color: rgb(45,150,255) }")
def fillList1(self,pos): d = self.plotList1[pos-5] self.ui.label11.setText(str(d[0])+' :'+d[1]) self.ui.label11V.setPixmap(d[2]) d = self.plotList1[pos-4] self.ui.label12.setText(d[1]) self.ui.label12V.setPixmap(d[2]) d = self.plotList1[pos-3] self.pos1ID = d[0] self.ui.label13.setText(str(d[0])+':'+d[1]) self.ui.BtnV1.setIcon(QtGui.QIcon(d[2])) d = self.plotList1[pos-2] self.ui.label14.setText(d[1]) self.ui.label14V.setPixmap(d[2]) d = self.plotList1[pos-1] self.ui.label15.setText(d[1]) self.ui.label15V.setPixmap(d[2])
def fillList2(self,pos): d = self.plotList2[pos-5] self.ui.label21.setText(d[1]) self.ui.label21V.setPixmap(d[2]) d = self.plotList2[pos-4] self.ui.label22.setText(d[1]) self.ui.label22V.setPixmap(d[2]) d = self.plotList2[pos-3] self.pos2ID = d[0] self.ui.label23.setText(d[1]) self.ui.BtnV2.setIcon(QtGui.QIcon(d[2])) d = self.plotList2[pos-2] self.ui.label24.setText(d[1]) self.ui.label24V.setPixmap(d[2]) d = self.plotList2[pos-1] self.ui.label25.setText(d[1]) self.ui.label25V.setPixmap(d[2])
def __init__(self): super(LoadingWindow, self).__init__(None, QtCore.Qt.WindowStaysOnTopHint) self.setWindowTitle(' ') self.setWindowIcon(QtGui.QIcon(ICON_FILE)) layout = QtGui.QVBoxLayout() layout.addWidget(QtGui.QLabel("Updating. Please wait...", self)) progress = QtGui.QProgressBar(self) progress.setMinimum(0) progress.setMaximum(0) layout.addWidget(progress) self.setLayout(layout) self.show() #==================== MAIN ====================#
def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) MainWindow.setWindowIcon(QtGui.QIcon('WIFI_CHEA.ico')) self.groupBox_3.setTitle(_translate("MainWindow", "??", None)) self.urlAnalysis.setText(_translate("MainWindow", "????", None)) self.groupBox.setTitle(_translate("MainWindow", "??", None)) self.usrnamefilebtn.setText(_translate("MainWindow", "???????", None)) self.pwdfilebtn.setText(_translate("MainWindow", "??????", None)) self.websiteanalysisbtn.setText(_translate("MainWindow", "????", None)) self.export.setText(_translate("MainWindow", "????", None)) self.usernamefilepath_label.setText(_translate("MainWindow", "??????", None)) self.pwdfilepath_label.setText(_translate("MainWindow", "?????", None)) self.groupBox_2.setTitle(_translate("MainWindow", "??????", None)) item = self.tableWidget.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "???", None)) item = self.tableWidget.horizontalHeaderItem(1) item.setText(_translate("MainWindow", "??", None)) item = self.tableWidget.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "??", None))
def init_ui(self): """Setup control widget UI.""" self.control_layout = QHBoxLayout() self.setLayout(self.control_layout) self.reset_button = QPushButton() self.reset_button.setFixedSize(40, 40) self.reset_button.setIcon(QtGui.QIcon(WIN_PATH)) self.game_timer = QLCDNumber() self.game_timer.setStyleSheet("QLCDNumber {color: red;}") self.game_timer.setFixedWidth(100) self.move_counter = QLCDNumber() self.move_counter.setStyleSheet("QLCDNumber {color: red;}") self.move_counter.setFixedWidth(100) self.control_layout.addWidget(self.game_timer) self.control_layout.addWidget(self.reset_button) self.control_layout.addWidget(self.move_counter)
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()
def __init__(self, pos_x,pos_y,w_wdt,w_ht,parent=None): QtGui.QMenu.__init__(self, "File", parent) self.pos_x = pos_x self.pos_y = pos_y self.w_wdt = w_wdt self.w_ht = w_ht musicMode = QtGui.QAction("&Music Mode", self) musicMode.triggered.connect(self.music) self.addAction(musicMode) videoMode = QtGui.QAction("&Default Mode", self) videoMode.triggered.connect(self.video) self.addAction(videoMode) icon = QtGui.QIcon.fromTheme("Quit") exitAction = QtGui.QAction(icon, "&Exit", self) exitAction.triggered.connect(QtGui.qApp.quit) #exitAction.triggered.connect(MainWindow.close()) self.addAction(exitAction)
def __init__(self, pos_x,pos_y,w_wdt,w_ht,parent=None): global name,home QtGui.QSystemTrayIcon.__init__(self, parent) #self.icon = QtGui.QLabel() icon_img = home+'/src/tray.png' self.right_menu = RightClickMenu(pos_x,pos_y,w_wdt,w_ht) self.setContextMenu(self.right_menu) self.activated.connect(self.onTrayIconActivated) self.p = QtGui.QPixmap(24,24) self.p.fill(QtGui.QColor("transparent")) painter = QtGui.QPainter(self.p) if os.path.exists(icon_img): self.setIcon(QtGui.QIcon(icon_img)) else: self.setIcon(QtGui.QIcon("")) self.full_scr = 1 del painter
def __init__(self): super(trayMassanger, self).__init__() self.scaning = 0 self.iconScaning = QtGui.QMovie("images/iconScaning.GIF") self.iconScaning.frameChanged.connect(self.iconUpdate) # alarm settings self.alarmWithSound = 1 self.alarmWAV = QSound("sounds/alarm2.WAV") # tray settings self.tray = QtGui.QSystemTrayIcon() self.iconScaning.jumpToFrame(0) icon = QtGui.QIcon() icon.addPixmap(self.iconScaning.currentPixmap()) self.tray.setIcon(icon) self.tray.show() print(self.iconScaning.isValid())
def __init__(self, iface, parent): super(Vector2ShapeWidget, self).__init__(parent) self.setupUi(self) self.mMapLayerComboBox.setFilters(QgsMapLayerProxyModel.PointLayer) self.mMapLayerComboBox.layerChanged.connect(self.findFields) self.buttonBox.button(QDialogButtonBox.Apply).clicked.connect(self.apply) self.iface = iface self.unitOfAxisComboBox.addItems(DISTANCE_MEASURE) self.unitOfDistanceComboBox.addItems(DISTANCE_MEASURE) self.distUnitsPolyComboBox.addItems(DISTANCE_MEASURE) self.unitsStarComboBox.addItems(DISTANCE_MEASURE) self.unitsRoseComboBox.addItems(DISTANCE_MEASURE) self.unitsCyclodeComboBox.addItems(DISTANCE_MEASURE) self.unitsFoilComboBox.addItems(DISTANCE_MEASURE) self.unitsHeartComboBox.addItems(DISTANCE_MEASURE) self.unitsEpicyclodeComboBox.addItems(DISTANCE_MEASURE) self.pieUnitOfDistanceComboBox.addItems(DISTANCE_MEASURE) self.polygonLayer = None self.geod = Geodesic.WGS84 icon = QIcon(os.path.dirname(__file__) + '/images/ellipse.png') self.tabWidget.setTabIcon(0, icon) icon = QIcon(os.path.dirname(__file__) + '/images/line.png') self.tabWidget.setTabIcon(1, icon) icon = QIcon(os.path.dirname(__file__) + '/images/pie.png') self.tabWidget.setTabIcon(2, icon) icon = QIcon(os.path.dirname(__file__) + '/images/polygon.png') self.tabWidget.setTabIcon(3, icon) icon = QIcon(os.path.dirname(__file__) + '/images/star.png') self.tabWidget.setTabIcon(4, icon) icon = QIcon(os.path.dirname(__file__) + '/images/rose.png') self.tabWidget.setTabIcon(5, icon) icon = QIcon(os.path.dirname(__file__) + '/images/hypocycloid.png') self.tabWidget.setTabIcon(6, icon) icon = QIcon(os.path.dirname(__file__) + '/images/polyfoil.png') self.tabWidget.setTabIcon(7, icon) icon = QIcon(os.path.dirname(__file__) + '/images/epicycloid.png') self.tabWidget.setTabIcon(8, icon) icon = QIcon(os.path.dirname(__file__) + '/images/heart.png') self.tabWidget.setTabIcon(9, icon)
def __init__(self, parent): QtGui.QSystemTrayIcon.__init__(self, QtGui.QIcon(':/quartz.png'), parent) self.messageClicked.connect(self.deleteLater) self.activated.connect(self.deleteLater)
def __init__(self, parent=None): super(UrlEdit, self).__init__(parent) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.setStyleSheet("QLineEdit { padding: 2 2 2 22; background: transparent; border: 1px solid gray; border-radius: 3px;}") self.returnPressed.connect(self.onReturnPress) # Create button for showing page icon self.iconButton = QtGui.QToolButton(self) self.iconButton.setStyleSheet("QToolButton { border: 0; background: transparent; width: 16px; height: 16px; }") self.iconButton.move(4,3) self.iconButton.setCursor(QtCore.Qt.PointingHandCursor) self.iconButton.clicked.connect(self.selectAll) self.setIcon(QtGui.QIcon(':/quartz.png')) #self.setStyleSheet("QLineEdit { background-image:url(:/search.png);background-repeat:no-repeat;\ # padding: 2 2 2 24 ;font-size:15px;}")
def setMyData(self): for row, item in enumerate (self.data): title_item = QtGui.QTableWidgetItem(item[0]) font = title_item.font() font.setBold(True) title_item.setFont(font) if self.use_icons: icon = QtGui.QIcon(icon_dir + item[1].split('/')[2] + '.png') if icon.pixmap(16, 16).isNull(): icon = QtGui.QIcon.fromTheme('applications-internet') title_item.setIcon(icon) self.setItem(row, 0, title_item)
def setup_clear_button (self): """Initialize the clear button.""" self.clearButton = QtGui.QToolButton(self) pixmap = QtGui.QPixmap(":/icons/clear.png") self.clearButton.setIcon(QtGui.QIcon(pixmap)) self.clearButton.setIconSize(pixmap.size()) self.clearButton.setCursor(QtCore.Qt.ArrowCursor) style = "QToolButton { border: none; padding: 0px; }" self.clearButton.setStyleSheet(style) self.clearButton.hide() self.clearButton.clicked.connect(self.clear) self.textChanged.connect(self.updateCloseButton)
def setup_list_button (self): """Initialize the dropdown list button.""" self.listButton = QtGui.QToolButton(self) pixmap = QtGui.QPixmap(":/icons/arrow_down.png") self.listButton.setIcon(QtGui.QIcon(pixmap)) self.listButton.setIconSize(pixmap.size()) self.listButton.setCursor(QtCore.Qt.ArrowCursor) style = "QToolButton { border: none; padding: 0px; }" self.listButton.setStyleSheet(style) self.listButton.hide() self.listButton.clicked.connect(self.toggle_list)
def get_icon (name): """Return QIcon with given pixmap resource name.""" icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(name), QtGui.QIcon.Normal, QtGui.QIcon.Off) return icon
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setWindowTitle(u'?????') self.resize(700, 650) self.setWindowIcon(QtGui.QIcon('icons/logo.ico')) screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2) self.initUI()
def resource_icon(name): """Load an image as an icon""" # print("Icon used: %s" % name) from PyQt4.QtGui import QIcon return QIcon(resource_icon_path(name))
def show(self, title, iconType, text, infoText, closeType, closeVal): msg = QtGui.QMessageBox() msg.setIcon(iconType) msg.setWindowIcon(QtGui.QIcon(GlobalVars.IconPath)) msg.setText(text) msg.setInformativeText(infoText) msg.setWindowTitle(title) msg.setStandardButtons(closeType) msg.exec_() if closeVal != 0: sys.exit(closeVal)