当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QIcon类代码示例

本文整理汇总了Python中PySide.QtGui.QIcon的典型用法代码示例。如果您正苦于以下问题:Python QIcon类的具体用法?Python QIcon怎么用?Python QIcon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: paint

	def paint(self, painter, option, index):
		painter.save()
		index0 = index.sibling( index.row(), 0 )
		utype = index0.data( Qt.UserRole )

		# # set background color
		if option.state & QStyle.State_Selected:
			painter.setPen  ( Qt.NoPen )
			painter.setBrush( GraphTreeItemDelegate._backgroundBrushSelected )
			painter.drawRect(option.rect)
		elif option.state & QStyle.State_MouseOver:
			painter.setPen  ( Qt.NoPen )
			painter.setBrush( GraphTreeItemDelegate._backgroundBrushHovered )
			painter.drawRect(option.rect)

		rect = option.rect
		icon = QIcon( index.data( Qt.DecorationRole) )
		rect.adjust( 5, 0, 0, 0 )
		if icon and not icon.isNull():
			icon.paint( painter, rect, Qt.AlignLeft )
			rect.adjust( 22, 0, 0, 0 )
		text = index.data(Qt.DisplayRole)
		if utype == 1: #GROUP
			painter.setPen( GraphTreeItemDelegate._textPenGroup )
		else:
			painter.setPen( GraphTreeItemDelegate._textPen )
		painter.drawText( rect, Qt.AlignLeft | Qt.AlignVCenter, text )
		painter.restore()
开发者ID:cloudteampro,项目名称:juma-editor,代码行数:28,代码来源:GraphEditor.py

示例2: __init__

 def __init__(self,winTitle='Rotate WP', icon='rotWP.svg'):
   super(rotWPForm,self).__init__()
   self.move(QPoint(100,250))
   self.setWindowFlags(Qt.WindowStaysOnTopHint)
   self.setWindowTitle(winTitle)
   iconPath=join(dirname(abspath(__file__)),"icons",icon)
   from PySide.QtGui import QIcon
   Icon=QIcon()
   Icon.addFile(iconPath)
   self.setWindowIcon(Icon) 
   self.grid=QGridLayout()
   self.setLayout(self.grid)
   self.radioX=QRadioButton('X')
   self.radioX.setChecked(True)
   self.radioY=QRadioButton('Y')
   self.radioZ=QRadioButton('Z')
   self.lab1=QLabel('Angle:')
   self.edit1=QLineEdit('45')
   self.edit1.setAlignment(Qt.AlignCenter)
   self.edit1.setValidator(QDoubleValidator())
   self.btn1=QPushButton('Rotate working plane')
   self.btn1.clicked.connect(self.rotate)
   self.grid.addWidget(self.radioX,0,0,1,1,Qt.AlignCenter)
   self.grid.addWidget(self.radioY,0,1,1,1,Qt.AlignCenter)
   self.grid.addWidget(self.radioZ,0,2,1,1,Qt.AlignCenter)
   self.grid.addWidget(self.lab1,1,0,1,1)
   self.grid.addWidget(self.edit1,1,1,1,2)
   self.grid.addWidget(self.btn1,2,0,1,3,Qt.AlignCenter)
   self.show()
   self.sg=FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
   s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
   sc=[float(x*s) for x in [1,1,.2]]
   from polarUtilsCmd import arrow
   self.arrow =arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
开发者ID:oddtopus,项目名称:flamingo,代码行数:34,代码来源:qForms.py

示例3: _reload_notebooks_list

    def _reload_notebooks_list(self, select_notebook_id=None):
        # TODO could enable selecting an already selected stack
        self.notebooksModel.clear()
        root = QStandardItem(QIcon.fromTheme('user-home'), self.tr('All Notes'))
        self.notebooksModel.appendRow(root)
        selected_item = root

        stacks = {}
        for notebook_struct in self.app.provider.list_notebooks():
            notebook = Notebook.from_tuple(notebook_struct)
            count = self.app.provider.get_notebook_notes_count(notebook.id)
            item = QNotebookItem(notebook, count)

            if(notebook.stack == ''):
                root.appendRow(item)
            else:
                if(notebook.stack not in stacks.keys()):
                    stack = QStandardItem(QIcon.fromTheme('user-home'), notebook.stack)
                    stack.stack = notebook.stack
                    root.appendRow(stack)
                    stacks[notebook.stack] = stack

                stacks[notebook.stack].appendRow(item)

            if select_notebook_id and notebook.id == select_notebook_id:
                selected_item = item

        self.ui.notebooksList.expandAll()

        if selected_item and not select_notebook_id == SELECT_NONE:
            index = self.notebooksModel.indexFromItem(selected_item)
            self.ui.notebooksList.setCurrentIndex(index)
            self.notebook_selected(index)
开发者ID:AnderSilva,项目名称:everpad,代码行数:33,代码来源:list.py

示例4: get_tray_icon

def get_tray_icon(is_black=False):
    if os.environ.get('DESKTOP_SESSION', 'default') == 'gnome':
        return QIcon.fromTheme('everpad', QIcon('../../data/everpad.png'))
    if is_black:
        return QIcon.fromTheme('everpad-black', QIcon('../../data/everpad-black.png'))
    else:
        return QIcon.fromTheme('everpad-mono', QIcon('../../data/everpad-mono.png'))
开发者ID:KamranMackey,项目名称:everpad,代码行数:7,代码来源:__init__.py

示例5: run

 def run(self):
     mw = self.mw
     if mw.google_radio.isChecked():
         mw.setStatusTip("Loading...")
         mw.start_button.setText("Loading...")
         mw.setEnabled(False)
         try:
             streetdb = table2dbf.load_from_google(mw.username.text(), mw.password.text(), mw.document_id.text())
         except:
             import traceback
             traceback.print_exc()
             self.mbox = ("Google-Fail", QMessageBox.Warning, QIcon.fromTheme("dialog-warning"),
                     "Couldn't login or load data from google!", None)
             return
     else:
         streetdb = table2dbf.load_street_db(mw.csv_file.text())
     mw.setStatusTip("Updating...")
     mw.start_button.setText("Updating...")
     try:
         table = dbf.Table(mw.dbf_file.text())
         table.open()
         self.updates = table2dbf.update_table(table, streetdb)
         table.close()
     except dbf.DbfError as e:
         self.mbox = ("DB-Fail", QMessageBox.Warning, QIcon.fromTheme("dialog-warning"),
                     "Couldn't open/update table!", e.message)
         return
     self.streetdb = streetdb
     if mw.split_check.checkState():
         import split_dbf
         split_dbf.split_files(mw.dbf_file.text())
开发者ID:nylser,项目名称:P-Seminar-Util,代码行数:31,代码来源:table2dbf_gui.py

示例6: __init__

    def __init__(self, parent=None, warningAction=None, warningService=None):
        """
        Constructor

        @param parent: Qt widget parent of this dialog window
        @type parent: QWidget

        @param warningAction: The action to connect to.
        @type warningAction: QAction
        """
        super(WarningsDialog, self).__init__(parent)
        self.setupUi(self)

        self.setWarningAction(warningAction)
        self.setWarningService(warningService)

        self.statusBarService = StatusBarService()

        self.errorString = ""
        self.errorMsgTextEdit.setPlainText(self.errorString)

        self.iconWarning = QIcon()
        self.iconWarning.addPixmap(QPixmap(":/tango-status-32px/images/tango-icon-theme/32x32/status/weather-severe-alert.png"), QIcon.Normal, QIcon.Off)

        self.iconNoWarning = QIcon()
        self.iconNoWarning.addPixmap(QPixmap(":/tango-status-32px/images/tango-icon-theme/32x32/status/weather-clear.png"), QIcon.Normal, QIcon.Off)
开发者ID:byteman1,项目名称:BioPARKIN,代码行数:26,代码来源:warningsdialog.py

示例7: __init__

    def __init__(self, app, *args, **kwargs):
        QDialog.__init__(self, *args, **kwargs)
        self.app = app
        self.closed = False
        self.sort_order = None
        self.ui = Ui_List()
        self.ui.setupUi(self)
        self.setWindowIcon(get_icon())

        self.notebooksModel = QStandardItemModel()
        self.ui.notebooksList.setModel(self.notebooksModel)
        self.ui.notebooksList.selection.connect(self.selection_changed)
        self.ui.notebooksList.setContextMenuPolicy(Qt.CustomContextMenu)
        self.ui.notebooksList.customContextMenuRequested.connect(self.notebook_context_menu)

        self.notesModel = QStandardItemModel()
        self.notesModel.setHorizontalHeaderLabels(
            [self.tr('Title'), self.tr('Last Updated')])

        self.ui.notesList.setModel(self.notesModel)
        self.ui.notesList.doubleClicked.connect(self.note_dblclicked)
        self.ui.notesList.setContextMenuPolicy(Qt.CustomContextMenu)
        self.ui.notesList.customContextMenuRequested.connect(self.note_context_menu)
        self.ui.notesList.header().sortIndicatorChanged.connect(self.sort_order_updated)

        self.ui.newNotebookBtn.setIcon(QIcon.fromTheme('folder-new'))
        self.ui.newNotebookBtn.clicked.connect(self.new_notebook)

        self.ui.newNoteBtn.setIcon(QIcon.fromTheme('document-new'))
        self.ui.newNoteBtn.clicked.connect(self.new_note)

        self.ui.newNoteBtn.setShortcut(QKeySequence(self.tr('Ctrl+n')))
        self.ui.newNotebookBtn.setShortcut(QKeySequence(self.tr('Ctrl+Shift+n')))
        QShortcut(QKeySequence(self.tr('Ctrl+q')), self, self.close)
开发者ID:berzjackson,项目名称:everpad,代码行数:34,代码来源:list.py

示例8: notebook_context_menu

 def notebook_context_menu(self, pos):
     index = self.ui.notebooksList.currentIndex()
     item = self.notebooksModel.itemFromIndex(index)
     if hasattr(item, 'notebook'):
         menu = QMenu(self.ui.notebooksList)
         menu.addAction(QIcon.fromTheme('gtk-edit'), self.tr('Rename'), self.rename_notebook)
         menu.addAction(QIcon.fromTheme('gtk-delete'), self.tr('Remove'), self.remove_notebook)
         menu.exec_(self.ui.notebooksList.mapToGlobal(pos))
开发者ID:berzjackson,项目名称:everpad,代码行数:8,代码来源:list.py

示例9: apply_status_to_icon

def apply_status_to_icon(icon, index_status, work_tree_status):
    result = QIcon()
    overlay = status_icon[index_status, work_tree_status]
    for size in icon.availableSizes():
        pixmap = icon.pixmap(size).copy()
        x, y = (size - overlay.size()).toTuple()
        QPainter(pixmap).drawPixmap(x, y, overlay)
        result.addPixmap(pixmap)
    return result
开发者ID:vstojkovic,项目名称:berk,代码行数:9,代码来源:__init__.py

示例10: _init_window

 def _init_window(self):
     """Init window attributes"""
     self.setWindowTitle('Series list')
     if os.path.exists(const.ICON_PATH):
         icon = QIcon()
         icon.addFile(const.ICON_PATH)
     else:
         icon = QIcon.fromTheme('series_list_icon')
     self.setWindowIcon(icon)
开发者ID:igorer88,项目名称:series_list,代码行数:9,代码来源:series_window.py

示例11: init_toolbar

 def init_toolbar(self):
     self.save_btn = self.ui.toolBar.addAction(QIcon.fromTheme("document-save"), self.tr("Save"), self.save)
     self.close_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("window-close"), self.tr("Close without saving"), self.close
     )
     self.ui.toolBar.addAction(QIcon.fromTheme("edit-delete"), self.tr("Remove note"), self.delete)
     self.print_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("document-print"), self.tr("Print note"), self.note_edit.print_
     )
     self.email_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("mail-unread"), self.tr("Email note"), self.note_edit.email_note
     )
     self.email_btn = self.ui.toolBar.addAction(
         QIcon.fromTheme("emblem-shared"), self.tr("Share note"), self.share_note
     )
     self.ui.toolBar.addSeparator()
     for action in self.note_edit.get_format_actions():
         self.ui.toolBar.addAction(action)
     self.ui.toolBar.addSeparator()
     self.find_action = QAction(QIcon.fromTheme("edit-find"), self.tr("Find"), self)
     self.find_action.setCheckable(True)
     self.find_action.triggered.connect(self.findbar.toggle_visible)
     self.ui.toolBar.addAction(self.find_action)
     self.ui.toolBar.addSeparator()
     self.pin = self.ui.toolBar.addAction(
         QIcon.fromTheme("edit-pin", QIcon.fromTheme("everpad-pin")), self.tr("Pin note"), self.mark_touched
     )
     self.pin.setCheckable(True)
     self.pin.setChecked(self.note.pinnded)
开发者ID:ihjn,项目名称:everpad,代码行数:29,代码来源:__init__.py

示例12: __init__

 def __init__(self, parent=None):
     super(About, self).__init__(parent)
     icon = QIcon()
     icon.addPixmap(
         QPixmap(":/Images/aktools_48x48.png"), QIcon.Normal, QIcon.Off)
     self.setWindowIcon(icon)
     self.setWindowTitle("Tietoja")
     label = QLabel("Tehnyt: Aleksi Kauppila 2014")
     layout = QVBoxLayout()
     layout.addWidget(label)
     self.setLayout(layout)
开发者ID:alkaupp,项目名称:tifpdf,代码行数:11,代码来源:Dialogs.py

示例13: _get_icon

 def _get_icon(self, icons):
     """Get icon"""
     if len(icons):
         icon, other = icons[0], icons[1:]
         fallback = self._get_icon(other)
         if fallback:
             return QIcon.fromTheme(icon, fallback=fallback)
         else:
             return QIcon.fromTheme(icon)
     else:
         return None
开发者ID:igorer88,项目名称:series_list,代码行数:11,代码来源:loader.py

示例14: get

def get(name):
    if QFile('icons:{}.svg'.format(name)).exists():
        return QIcon('icons:{}.svg'.format(name))
    
    if QIcon.hasThemeIcon(name):
        return QIcon.fromTheme(name)
    
    if os.path.exists(name):
        return QIcon(name)
    
    return QIcon()
开发者ID:elmamyra,项目名称:kbremap,代码行数:11,代码来源:__init__.py

示例15: _action_with_icon

    def _action_with_icon(self, action_type, icon_names, is_action=False):
        if is_action:
            action = action_type
        else:
            action = self.page.action(action_type)
        for icon_name in icon_names:
            if QIcon.hasThemeIcon(icon_name):
                action.setIcon(QIcon.fromTheme(icon_name))
                break

        self.copy_available.connect(action.setEnabled)
        return action
开发者ID:RadixSeven,项目名称:everpad,代码行数:12,代码来源:content.py


注:本文中的PySide.QtGui.QIcon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。