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


Python QAction.setWhatsThis方法代码示例

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


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

示例1: add_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setWhatsThis [as 别名]
    def add_action(
            self,
            icon_path,
            text,
            callback,
            enabled_flag=True,
            add_to_menu=True,
            add_to_toolbar=True,
            status_tip=None,
            whats_this=None,
            parent=None):
        """Add a toolbar icon to the toolbar."""

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(
                self.menu,
                action)

        self.actions.append(action)

        return action
开发者ID:mattkernow,项目名称:ZoomToPostcode-QGIS-Plugin,代码行数:37,代码来源:zoom_to_postcode.py

示例2: pointSamplingTool

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setWhatsThis [as 别名]
class pointSamplingTool(object):

 def __init__(self, iface):
    self.iface = iface
    
    if QSettings().value('locale/overrideFlag'):
        locale = QSettings().value('locale/userLocale')
    else:
        locale = QLocale.system().name()

    locale_path = os.path.join(
        os.path.dirname(__file__),
        'i18n',
        'pointSamplingTool_{}.qm'.format(locale[0:2]))

    if os.path.exists(locale_path):
        self.translator = QTranslator()
        self.translator.load(locale_path)
        QCoreApplication.installTranslator(self.translator)


 def initGui(self):
    # create action
    self.action = QAction(QIcon(":/plugins/pointSamplingTool/pointSamplingToolIcon.png"),
                          QCoreApplication.translate('Point Sampling Tool', 'Point Sampling Tool'),
                          self.iface.mainWindow())
    self.action.setWhatsThis(QCoreApplication.translate('Point Sampling Tool',
                                                        'Collects polygon attributes and raster values from multiple layers at specified sampling points'))
    self.action.triggered.connect(self.run)
    # add toolbar button and menu item
    self.iface.addToolBarIcon(self.action)
    self.iface.addPluginToMenu(QCoreApplication.translate('Point Sampling Tool', "&Analyses"), self.action)


 def unload(self):
    # remove the plugin menu item and icon
    self.iface.removePluginMenu(QCoreApplication.translate('Point Sampling Tool', "&Analyses"), self.action)
    self.iface.removeToolBarIcon(self.action)


 def run(self):
    # create and show a configuration dialog or something similar
    dialoga = doPointSamplingTool.Dialog(self.iface)
    dialoga.exec_()
开发者ID:borysiasty,项目名称:pointsamplingtool,代码行数:46,代码来源:pointSamplingTool.py

示例3: TRPreviewer

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setWhatsThis [as 别名]

#.........这里部分代码省略.........
        super(TRPreviewer, self).show()
        if self.filesToLoad:
            filenames, self.filesToLoad = (self.filesToLoad[:], [])
            first = True
            for fn in filenames:
                fi = QFileInfo(fn)
                if fi.suffix().lower() == 'ui':
                    self.preview.loadWidget(fn)
                elif fi.suffix().lower() == 'qm':
                    self.translations.add(fn, first)
                    first = False
            
            self.__updateActions()
        
    def closeEvent(self, event):
        """
        Protected event handler for the close event.
        
        @param event close event (QCloseEvent)
        """
        if self.SAServer is not None:
            self.SAServer.shutdown()
            self.SAServer = None
        event.accept()
        
    def __initActions(self):
        """
        Private method to define the user interface actions.
        """
        self.openUIAct = QAction(
            UI.PixmapCache.getIcon("openUI.png"),
            self.tr('&Open UI Files...'), self)
        self.openUIAct.setStatusTip(self.tr('Open UI files for display'))
        self.openUIAct.setWhatsThis(self.tr(
            """<b>Open UI Files</b>"""
            """<p>This opens some UI files for display.</p>"""
        ))
        self.openUIAct.triggered.connect(self.__openWidget)
        
        self.openQMAct = QAction(
            UI.PixmapCache.getIcon("openQM.png"),
            self.tr('Open &Translation Files...'), self)
        self.openQMAct.setStatusTip(self.tr(
            'Open Translation files for display'))
        self.openQMAct.setWhatsThis(self.tr(
            """<b>Open Translation Files</b>"""
            """<p>This opens some translation files for display.</p>"""
        ))
        self.openQMAct.triggered.connect(self.__openTranslation)
        
        self.reloadAct = QAction(
            UI.PixmapCache.getIcon("reload.png"),
            self.tr('&Reload Translations'), self)
        self.reloadAct.setStatusTip(self.tr(
            'Reload the loaded translations'))
        self.reloadAct.setWhatsThis(self.tr(
            """<b>Reload Translations</b>"""
            """<p>This reloads the translations for the loaded"""
            """ languages.</p>"""
        ))
        self.reloadAct.triggered.connect(self.translations.reload)
        
        self.exitAct = QAction(
            UI.PixmapCache.getIcon("exit.png"), self.tr('&Quit'), self)
        self.exitAct.setShortcut(QKeySequence(
            self.tr("Ctrl+Q", "File|Quit")))
开发者ID:pycom,项目名称:EricShort,代码行数:70,代码来源:TRPreviewer.py

示例4: UIPreviewer

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setWhatsThis [as 别名]

#.........这里部分代码省略.........
        
        self.__initActions()
        self.__initMenus()
        self.__initToolbars()
        
        self.__updateActions()
        
        # defere loading of a UI file until we are shown
        self.fileToLoad = filename
        
    def show(self):
        """
        Public slot to show this dialog.
        
        This overloaded slot loads a UI file to be previewed after
        the main window has been shown. This way, previewing a dialog
        doesn't interfere with showing the main window.
        """
        super(UIPreviewer, self).show()
        if self.fileToLoad is not None:
            fn, self.fileToLoad = (self.fileToLoad, None)
            self.__loadFile(fn)
            
    def __initActions(self):
        """
        Private method to define the user interface actions.
        """
        self.openAct = QAction(
            UI.PixmapCache.getIcon("openUI.png"),
            self.tr('&Open File'), self)
        self.openAct.setShortcut(
            QKeySequence(self.tr("Ctrl+O", "File|Open")))
        self.openAct.setStatusTip(self.tr('Open a UI file for display'))
        self.openAct.setWhatsThis(self.tr(
            """<b>Open File</b>"""
            """<p>This opens a new UI file for display.</p>"""
        ))
        self.openAct.triggered.connect(self.__openFile)
        
        self.printAct = QAction(
            UI.PixmapCache.getIcon("print.png"),
            self.tr('&Print'), self)
        self.printAct.setShortcut(
            QKeySequence(self.tr("Ctrl+P", "File|Print")))
        self.printAct.setStatusTip(self.tr('Print a screen capture'))
        self.printAct.setWhatsThis(self.tr(
            """<b>Print</b>"""
            """<p>Print a screen capture.</p>"""
        ))
        self.printAct.triggered.connect(self.__printImage)
        
        self.printPreviewAct = QAction(
            UI.PixmapCache.getIcon("printPreview.png"),
            self.tr('Print Preview'), self)
        self.printPreviewAct.setStatusTip(self.tr(
            'Print preview a screen capture'))
        self.printPreviewAct.setWhatsThis(self.tr(
            """<b>Print Preview</b>"""
            """<p>Print preview a screen capture.</p>"""
        ))
        self.printPreviewAct.triggered.connect(self.__printPreviewImage)
        
        self.imageAct = QAction(
            UI.PixmapCache.getIcon("screenCapture.png"),
            self.tr('&Screen Capture'), self)
        self.imageAct.setShortcut(
开发者ID:Darriall,项目名称:eric,代码行数:70,代码来源:UIPreviewer.py

示例5: add_action

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setWhatsThis [as 别名]
    def add_action(
        self,
        icon_path,
        text,
        callback,
        enabled_flag=True,
        add_to_menu=True,
        add_to_toolbar=True,
        status_tip=None,
        whats_this=None,
        parent=None):
        """Add a toolbar icon to the toolbar.

        :param icon_path: Path to the icon for this action. Can be a resource
            path (e.g. ':/plugins/foo/bar.png') or a normal file system path.
        :type icon_path: str

        :param text: Text that should be shown in menu items for this action.
        :type text: str

        :param callback: Function to be called when the action is triggered.
        :type callback: function

        :param enabled_flag: A flag indicating if the action should be enabled
            by default. Defaults to True.
        :type enabled_flag: bool

        :param add_to_menu: Flag indicating whether the action should also
            be added to the menu. Defaults to True.
        :type add_to_menu: bool

        :param add_to_toolbar: Flag indicating whether the action should also
            be added to the toolbar. Defaults to True.
        :type add_to_toolbar: bool

        :param status_tip: Optional text to show in a popup when mouse pointer
            hovers over the action.
        :type status_tip: str

        :param parent: Parent widget for the new action. Defaults None.
        :type parent: QWidget

        :param whats_this: Optional text to show in the status bar when the
            mouse pointer hovers over the action.

        :returns: The action that was created. Note that the action is also
            added to self.actions list.
        :rtype: QAction
        """

        icon = QIcon(icon_path)
        action = QAction(icon, text, parent)
        action.triggered.connect(callback)
        action.setEnabled(enabled_flag)

        if status_tip is not None:
            action.setStatusTip(status_tip)

        if whats_this is not None:
            action.setWhatsThis(whats_this)

        if add_to_toolbar:
            self.toolbar.addAction(action)

        if add_to_menu:
            self.iface.addPluginToMenu(
                self.menu,
                action)

        self.actions.append(action)

        return action
开发者ID:Taknok,项目名称:Qgisplugin-ClipMultipleLayers,代码行数:74,代码来源:clip_multiple_layers.py

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QAction [as 别名]
# 或者: from PyQt5.QtWidgets.QAction import setWhatsThis [as 别名]
class joinmultiplelines:
    def __init__(self, iface):
        # save reference to the QGIS interface
        self.iface = iface

    def initGui(self):
        self.action = QAction(QIcon(":/plugins/joinmultiplelines/icon.png"), "Join multiple lines", self.iface.mainWindow())
        self.action.setWhatsThis("Permanently join multiple lines")
        self.action.setStatusTip("Permanently join multiple lines (removes lines used for joining)")

        self.action.triggered.connect(self.run)

        if hasattr( self.iface, "addPluginToVectorMenu" ):
            self.iface.addVectorToolBarIcon(self.action)
            self.iface.addPluginToVectorMenu("&Join multiple lines", self.action)
        else:
            self.iface.addToolBarIcon(self.action)
            self.iface.addPluginToMenu("&Join multiple lines", self.action)

    def unload(self):
        if hasattr( self.iface, "addPluginToVectorMenu" ):
            self.iface.removePluginVectorMenu("&Join multiple lines",self.action)
            self.iface.removeVectorToolBarIcon(self.action)
        else:
            self.iface.removePluginMenu("&Join multiple lines",self.action)
            self.iface.removeToolBarIcon(self.action)

    def Distance(self, vertex1, vertex2):
        return vertex1.distanceSquared(vertex2)

    def FirstVertex(self, geom):
        return geom.vertexAt(0)

    def LastVertexIndex(self, geom):
        return len(geom.asPolyline()) - 1

    def LastVertex(self, geom):
        return geom.vertexAt(self.LastVertexIndex(geom))

    def Step(self, geom, queue_list):
        if geom is None:
            if len(queue_list) > 0:
                return queue_list.pop()
            else:
                return None
        base_firstvertex = self.FirstVertex(geom)
        base_lastvertex = self.LastVertex(geom)
        found_geom = None
        found_distance = 0
        for i_geom in queue_list:
            i_firstvertex = self.FirstVertex(i_geom)
            i_lastvertex = self.LastVertex(i_geom)
            distance_baselast_ifirst = self.Distance(base_lastvertex, i_firstvertex)
            distance_baselast_ilast = self.Distance(base_lastvertex, i_lastvertex)
            distance_basefirst_ifirst = self.Distance(base_firstvertex, i_firstvertex)
            distance_basefirst_ilast = self.Distance(base_firstvertex, i_lastvertex)
            distance = distance_baselast_ifirst
            base_reverse = False
            i_reverse = False
            if distance_baselast_ilast < distance:
                distance = distance_baselast_ilast
                base_reverse = False
                i_reverse = True
            if distance_basefirst_ifirst < distance:
                distance = distance_basefirst_ifirst
                base_reverse = True
                i_reverse = False
            if distance_basefirst_ilast < distance:
                distance = distance_basefirst_ilast
                base_reverse = True
                i_reverse = True
            if (found_geom is None) or (distance < found_distance):
                found_geom = i_geom
                found_distance = distance
                found_base_reverse = base_reverse
                found_i_reverse = i_reverse
        if found_geom is not None:
            queue_list.remove(found_geom)
            geom_line = geom.constGet()
            found_geom_line = found_geom.constGet()
            if found_base_reverse:
                geom_line = geom_line.reversed()
            if found_i_reverse:
                found_geom_line = found_geom_line.reversed()
            # .append automatically takes care not to create a duplicate
            # vertex when the last respectively first vertex of the two
            # segments are identical.
            geom_line.append(found_geom_line)
            geom.set(geom_line)
            return geom
        else:
            return None

    def run(self):
        cl = self.iface.mapCanvas().currentLayer()

        if (cl == None):
            self.iface.messageBar().pushMessage("Join multiple lines","No layers selected", Qgis.Warning, 10)
            return
        if (cl.type() != cl.VectorLayer):
#.........这里部分代码省略.........
开发者ID:dgoedkoop,项目名称:joinmultiplelines,代码行数:103,代码来源:joinmultiplelines.py


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