:type add_to_menu: bool :param add_to_toolbar: Flag indicating whether the action should also be added to the toolbar. :type enabled_flag: bool :param add_to_menu: Flag indicating whether the action should also be added to the menu. :type callback: function :param enabled_flag: A flag indicating if the action should be enabled by default. :type text: str :param callback: Function to be called when the action is triggered. :type icon_path: str :param text: Text that should be shown in menu items for this action. ':/plugins/foo/bar.png') or a normal file system path. :param icon_path: Path to the icon for this action. translate ( 'SaveAttributes', message ) 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. :rtype: QString """ # noinspection PyTypeChecker,PyArgumentList,P圜allB圜lass return QCoreApplication. :type message: str, QString :returns: Translated version of message. We implement this ourselves since we do not inherit QObject. first_start = None # noinspection PyMethodMayBeStatic def tr ( self, message ): """Get the translation for a string using Qt translation API. tr ( u '&Save Attributes' ) # Check if plugin was started the first time in current QGIS session # Must be set in initGui() to survive plugin reloads self. translator ) # Declare instance attributes self. load ( locale_path ) if qVersion () > '4.3.3' : QCoreApplication. value ( 'locale/userLocale' ) locale_path = os.
dirname ( _file_ ) # initialize locale locale = QSettings (). iface = iface # initialize plugin directory self. :type iface: QgsInterface """ # Save reference to the QGIS interface self. :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. save_attributes_dialog import SaveAttributesDialog import os.path class SaveAttributes : """QGIS Plugin Implementation.""" def _init_ ( self, iface ): """Constructor.
#Python qt designer mac code#
resources import * # Import the code for the dialog from. * * * ***************************************************************************/ """ from PyQt5.QtCore import QSettings, QTranslator, qVersion, QCoreApplication from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QAction, QFileDialog from re import QgsProject, Qgis # Initialize Qt resources from file resources.py from.