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


Python QtGui.QIcon方法代码示例

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


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

示例1: toggleCorrectionMode

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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 
开发者ID:pierluigiferrari,项目名称:fcn8s_tensorflow,代码行数:21,代码来源:cityscapesLabelTool.py

示例2: init_ui

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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) 
开发者ID:duguyue100,项目名称:minesweeper,代码行数:19,代码来源:gui.py

示例3: update_grid

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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() 
开发者ID:duguyue100,项目名称:minesweeper,代码行数:18,代码来源:gui.py

示例4: dataIcon

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def dataIcon(self, row, col):
        icon_path = None
        if col == PlayerModel.PLAYER:
            icon_path = ':/flags/' + self.players[row][PlayerModel.COUNTRY] + '.png'
        elif col == PlayerModel.OPPONENT:
            icon_path = ':/flags/' + self.players[row][PlayerModel.OPPONENT_COUNTRY] + '.png'
        elif col == PlayerModel.STATE:
            val = self.players[row][col]
            if self.controller.challenged:
                if self.players[row][PlayerModel.PLAYER] == self.controller.challenged:
                    icon_path = ':/images/sword-no.png'
                elif val == PlayerModelState.PLAYING:
                    icon_path = ':/images/eye.png'
                elif val == PlayerModelState.AFK:
                    icon_path = ':/assets/face-sleeping.png'
            else:
                if val == PlayerModelState.AVAILABLE:
                    icon_path = ':/images/sword.png'
                elif val == PlayerModelState.PLAYING:
                    icon_path = ':/images/eye.png'
                elif val == PlayerModelState.AFK:
                    icon_path = ':/assets/face-sleeping.png'
        if icon_path:
            return QtGui.QIcon(icon_path) 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:26,代码来源:playermodel.py

示例5: initUI

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def initUI(self):

        self.text = QtGui.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")) 
开发者ID:goldsborough,项目名称:Writer-Tutorial,代码行数:26,代码来源:part-3.py

示例6: addItem

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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) 
开发者ID:danilabs,项目名称:rexploit,代码行数:21,代码来源:scanview.py

示例7: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        path = os.path.join(app_root, 'UI', 'images', 'icon.png')
        self.setWindowIcon(QtGui.QIcon(path))
        self.batch_dialog = BatchAddDialogue(self)
        self.ui.saveToLineEdit.setText(desktop_path)
        self.ui.BrowseConvertToLineEdit.setText(os.getcwd())
        self.ui.BrowseConvertLineEdit.files = []
        self.ui.statusbar.showMessage('Ready.')
        self.set_connections()

        self.url_list = []
        self.complete_url_list = {}
        self.convert_list = []
        self.thread_pool = {}
        self.ui.tableWidget.horizontalHeader().setResizeMode(0, QtGui.QHeaderView.Stretch)
        self.rowcount = 0

        self.connect_menu_action()
        self.show() 
开发者ID:yasoob,项目名称:youtube-dl-GUI,代码行数:24,代码来源:main.py

示例8: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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) 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:26,代码来源:universal_tool_template_0903.py

示例9: setupWin

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:18,代码来源:universal_tool_template_v7.3.py

示例10: initUI

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def initUI(self):

        self.initDocument()
        self.initToolbar()
        self.initFormatbar()
        self.initMenubar()
        self.initStatus()

        self.setMinimumSize(995,900)
        self.move(450,25)

        self.setWindowTitle("Writer")
        self.setWindowIcon(QtGui.QIcon("icons/icon.png")) 
开发者ID:goldsborough,项目名称:Writer,代码行数:15,代码来源:writer.py

示例11: __init__

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
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() 
开发者ID:HatBoy,项目名称:SimpleSniffer,代码行数:11,代码来源:Sniffer.py

示例12: updateList

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def updateList(self, visualizations):
        self.ui.tablesList.clear()
        for visualization in visualizations:
            item = QListWidgetItem(self.ui.tablesList)

            owner = None
            owner = visualization['permission']['owner']['username']

            widget = CartoDBDatasetsListItem(
                visualization['name'], owner, visualization['table']['size'], visualization['table']['row_count'],
                shared=(owner != self.currentUser), multiuser=self.currentMultiuser)
            # item.setText(visualization['name'])
            readonly = False
            # qDebug('Vis:' + json.dumps(visualization, sort_keys=True, indent=2, separators=(',', ': ')))
            if visualization['permission'] is not None and owner != self.currentUser and \
               visualization['permission']['acl'] is not None:
                for acl in visualization['permission']['acl']:
                    if acl['type'] == 'user' and 'username' in acl['entity'] and acl['entity']['username'] == self.currentUser and \
                       acl['access'] == 'r':
                        readonly = True
                        break

            widget.readonly = readonly
            if readonly:
                widget.setTextColor('#999999')

            item.setSizeHint(widget.sizeHint())
            # item.setIcon(QIcon(":/plugins/qgis-cartodb/images/icons/layers.png"))
            self.ui.tablesList.setItemWidget(item, widget) 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:31,代码来源:Main.py

示例13: initUI

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def initUI(self):

    # buttonNew
    self.buttonNew = QtGui.QPushButton()
    self.buttonNew.setText("New Project")
    self.buttonNew.clicked.connect(self.__buttonNew_Click)

    # buttonOpen
    self.buttonOpen = QtGui.QPushButton()
    self.buttonOpen.setText("Open Project")
    self.buttonOpen.clicked.connect(self.__buttonOpen_Click)

    # buttonClose
    self.buttonClose = QtGui.QPushButton()
    self.buttonClose.setText("Close")
    self.buttonClose.clicked.connect(self.__buttonClose_Click)

    # formLayout
    layout = QtGui.QHBoxLayout()
    layout.addWidget(self.buttonNew)
    layout.addWidget(self.buttonOpen)
    layout.addWidget(self.buttonClose)

    # StartForm
    self.setLayout(layout)
    self.setWindowTitle("NuPIC Studio")
    self.setWindowIcon(QtGui.QIcon(Global.appPath + '/images/logo.ico'))
    self.resize(350, 50)

  #endregion

  #region Events 
开发者ID:htm-community,项目名称:nupic.studio,代码行数:34,代码来源:start_form.py

示例14: main

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def main(argv=None):
    app = None

    # create the application if necessary
    if not QtGui.QApplication.instance():
        app = QtGui.QApplication(argv)
        app.setQuitOnLastWindowClosed(True)
        app.setOrganizationName("GGPO")
        QtCore.QCoreApplication.setApplicationName("GGPO")
    ColorTheme.saveDefaultStyle()
    controller = Controller()
    thread = QtCore.QThread()
    controller.moveToThread(thread)
    thread.started.connect(controller.selectLoop)
    thread.start()

    def loggedIn():
        controller.connectUdp()
        window = GGPOWindow()
        window.setWindowIcon(QtGui.QIcon(':/assets/icon-128.png'))
        window.setController(controller)
        window.restorePreference()
        controller.sendListChannels()
        window.show()
        window.raise_()
        window.activateWindow()

    logindialog = LoginDialog()
    logindialog.setController(controller)
    logindialog.accepted.connect(loggedIn)
    logindialog.rejected.connect(sys.exit)
    logindialog.exec_()
    logindialog.raise_()
    logindialog.activateWindow()

    return app.exec_() 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:38,代码来源:main.py

示例15: headerData

# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QIcon [as 别名]
def headerData(self, section, Qt_Orientation, role=None):
        if role == Qt.DisplayRole and Qt_Orientation == Qt.Horizontal and 0 <= section < PlayerModel.N_DISPLAY_COLS:
            return PlayerModel.displayColumns[section]
        if role == Qt.DecorationRole and Qt_Orientation == Qt.Horizontal:
            if section == PlayerModel.IGNORE:
                return QtGui.QIcon(':/assets/face-ignore.png') 
开发者ID:doctorguile,项目名称:pyqtggpo,代码行数:8,代码来源:playermodel.py


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