當前位置: 首頁>>代碼示例>>Python>>正文


Python QIcon.addFile方法代碼示例

本文整理匯總了Python中AnyQt.QtGui.QIcon.addFile方法的典型用法代碼示例。如果您正苦於以下問題:Python QIcon.addFile方法的具體用法?Python QIcon.addFile怎麽用?Python QIcon.addFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AnyQt.QtGui.QIcon的用法示例。


在下文中一共展示了QIcon.addFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from AnyQt.QtGui import QIcon [as 別名]
# 或者: from AnyQt.QtGui.QIcon import addFile [as 別名]
    def get(self, name, default=None):
        path = self.find(name)
        if not path:
            path = self.find(self.DEFAULT_ICON if default is None else default)
        if not path:
            raise IOError(2, "Cannot find %r in %s" %
                          (name, self.search_paths()))
        if self.is_icon_glob(path):
            icons = self.icon_glob(path)
        else:
            icons = [path]

        from AnyQt.QtGui import QIcon

        icon = QIcon()
        for path in icons:
            icon.addFile(path)
        return icon
開發者ID:RachitKansal,項目名稱:orange3,代碼行數:20,代碼來源:resources.py

示例2: get

# 需要導入模塊: from AnyQt.QtGui import QIcon [as 別名]
# 或者: from AnyQt.QtGui.QIcon import addFile [as 別名]
    def get(self, name, default=None):
        if name:
            path = self.find(name)
        else:
            path = None

        if path is None:
            path = self.find(self.DEFAULT_ICON if default is None else default)
        if path is None:
            return QIcon()

        if self.is_icon_glob(path):
            icons = self.icon_glob(path)
        else:
            icons = [path]

        icon = QIcon()
        for path in icons:
            icon.addFile(path)
        return icon
開發者ID:ales-erjavec,項目名稱:orange-canvas,代碼行數:22,代碼來源:resources.py

示例3: set_basic_layout

# 需要導入模塊: from AnyQt.QtGui import QIcon [as 別名]
# 或者: from AnyQt.QtGui.QIcon import addFile [as 別名]
    def set_basic_layout(self):
        """Provide the basic widget layout

        Which parts are created is regulated by class attributes
        `want_main_area`, `want_control_area`, `want_message_bar` and
        `buttons_area_orientation`, the presence of method `send_report`
        and attribute `graph_name`.
        """
        self.setLayout(QVBoxLayout())
        self.layout().setContentsMargins(2, 2, 2, 2)

        if not self.resizing_enabled:
            self.layout().setSizeConstraint(QVBoxLayout.SetFixedSize)

        self.want_main_area = self.want_main_area or self.graph_name
        self._create_default_buttons()

        self._insert_splitter()
        if self.want_control_area:
            self._insert_control_area()
        if self.want_main_area:
            self._insert_main_area()

        if self.want_message_bar:
            # Use a OverlayWidget for status bar positioning.
            c = OverlayWidget(self, alignment=Qt.AlignBottom)
            c.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
            c.setWidget(self)
            c.setLayout(QVBoxLayout())
            c.layout().setContentsMargins(0, 0, 0, 0)
            sb = QStatusBar()
            sb.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Maximum)
            sb.setSizeGripEnabled(self.resizing_enabled)
            c.layout().addWidget(sb)

            help = self.__help_action
            icon = QIcon(gui.resource_filename("icons/help.svg"))
            icon.addFile(gui.resource_filename("icons/help-hover.svg"), mode=QIcon.Active)
            help_button = SimpleButton(
                icon=icon,
                toolTip="Show widget help", visible=help.isVisible(),
            )
            @help.changed.connect
            def _():
                help_button.setVisible(help.isVisible())
                help_button.setEnabled(help.isEnabled())
            help_button.clicked.connect(help.trigger)
            sb.addWidget(help_button)

            if self.graph_name is not None:
                icon = QIcon(gui.resource_filename("icons/chart.svg"))
                icon.addFile(gui.resource_filename("icons/chart-hover.svg"), mode=QIcon.Active)
                b = SimpleButton(
                    icon=icon,
                    toolTip="Save Image",
                )
                b.clicked.connect(self.save_graph)
                sb.addWidget(b)
            if hasattr(self, "send_report"):
                icon = QIcon(gui.resource_filename("icons/report.svg"))
                icon.addFile(gui.resource_filename("icons/report-hover.svg"), mode=QIcon.Active)
                b = SimpleButton(
                    icon=icon,
                    toolTip="Report"
                )
                b.clicked.connect(self.show_report)
                sb.addWidget(b)
            self.message_bar = MessagesWidget(self)
            self.message_bar.setSizePolicy(QSizePolicy.Preferred,
                                           QSizePolicy.Preferred)
            pb = QProgressBar(maximumWidth=120, minimum=0, maximum=100)
            pb.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Ignored)
            pb.setAttribute(Qt.WA_LayoutUsesWidgetRect)
            pb.setAttribute(Qt.WA_MacMiniSize)
            pb.hide()
            sb.addPermanentWidget(pb)
            sb.addPermanentWidget(self.message_bar)

            def statechanged():
                pb.setVisible(bool(self.processingState) or self.isBlocking())
                if self.isBlocking() and not self.processingState:
                    pb.setRange(0, 0)  # indeterminate pb
                elif self.processingState:
                    pb.setRange(0, 100)  # determinate pb

            self.processingStateChanged.connect(statechanged)
            self.blockingStateChanged.connect(statechanged)

            @self.progressBarValueChanged.connect
            def _(val):
                pb.setValue(int(val))

            # Reserve the bottom margins for the status bar
            margins = self.layout().contentsMargins()
            margins.setBottom(sb.sizeHint().height())
            self.setContentsMargins(margins)
開發者ID:randxie,項目名稱:orange3,代碼行數:98,代碼來源:widget.py


注:本文中的AnyQt.QtGui.QIcon.addFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。