Python PyQt4.QtCore 模块,qVersion() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用PyQt4.QtCore.qVersion()

项目:GeoWrap    作者:MACBIO    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'GeometryWrapper_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)


        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Geometry Wrapper')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'GeometryWrapper')
        self.toolbar.setObjectName(u'GeometryWrapper')

        # listen for browse button 
        self.dlg = GeometryWrapperDialog()
        self.dlg.inButton.clicked.connect(self.setInDataset) 

    # noinspection PyMethodMayBeStatic
项目:qgis-earthengine-plugin    作者:gena    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface

        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)

        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'GoogleEarthEnginePlugin_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Google Earth Engine')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'GoogleEarthEngine')
        self.toolbar.setObjectName(u'GoogleEarthEngine')

        self.pluginIsActive = False
        self.dock_widget = None

    # noinspection PyMethodMayBeStatic
项目:QGISSortAndNumber    作者:ArMoraer    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """

        super(SortNumber, self).__init__() # necessary for pyqtSignal

        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'SortNumber_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = SortNumberDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Sort and Number')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'SortNumber')
        self.toolbar.setObjectName(u'SortNumber')

    # noinspection PyMethodMayBeStatic
项目:isochrones    作者:Samweli    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'isochrones_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = isochronesDialog(self.iface.mainWindow(), self.iface)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Isochrones')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'isochrones')
        self.toolbar.setObjectName(u'isochrones')

    # noinspection PyMethodMayBeStatic
项目:HotSpotAnalysis_Plugin    作者:stanly3690    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'HotspotAnalysis_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = HotspotAnalysisDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Hotspot Analysis')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'HotspotAnalysis')
        self.toolbar.setObjectName(u'HotspotAnalysis')
        # Load output directory path
        self.dlg.lineEdit.clear()
        self.dlg.pushButton.clicked.connect(self.select_output_file)
        self.clear_ui()

    # noinspection PyMethodMayBeStatic
项目:mapillary    作者:geodrinx    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'mapillary_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = mapillaryDialog()

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&mapillary')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'mapillary')
        self.toolbar.setObjectName(u'mapillary')

    # noinspection PyMethodMayBeStatic
项目:qgis-ecmwf-catalogue-plugin    作者:OpenDataHack    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'DataLoader_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)


        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Data Loader')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'DataLoader')
        self.toolbar.setObjectName(u'DataLoader')

    # noinspection PyMethodMayBeStatic
项目:qgis_resources_sharing    作者:akbargumbira    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'QgsResourceSharing_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = ResourceSharingDialog(iface=self.iface)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Resource Sharing')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'QgsResourceSharing')
        self.toolbar.setObjectName(u'QgsResourceSharing')

    # noinspection PyMethodMayBeStatic
项目:QGIS-CKAN-Browser    作者:BergWerkGIS    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        QSettings().setValue("ckan_browser/isopen", False)
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'CKANBrowser_{}.qm'.format(locale))

        # load english file for testing
#         locale_path = os.path.join(
#             self.plugin_dir,
#             'i18n',
#             'CKANBrowser_en.qm')

        if not os.path.exists(locale_path):
            locale_path = os.path.join(
                self.plugin_dir,
                'i18n',
                'CKANBrowser_en.qm')

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        self.settings = Settings()
        self.settings.load()
        self.util = Util(self.settings, self.iface.mainWindow())

        # TODO ping API

        # Create the dialog (after translation) and keep reference
#         self.dlg = CKANBrowserDialog(self.settings, self.iface, self.iface.mainWindow())

        # Declare instance attributes
        self.actions = []
        self.menu = self.util.tr(u'&Open Data (CKAN) Browser')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'Open Data (CKAN) Browser')
        self.toolbar.setObjectName(u'Open Data (CKAN) Browser')
项目:qgis-elevation-plugin    作者:bopen    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        self.elevation_dir = os.path.join(self.plugin_dir, 'elevation')
        print self.elevation_dir

        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            '{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Create the dialog (after translation) and keep reference
        self.dlg = ElevationPluginDialog()
        self.dlg.choose_dir_button.clicked.connect(self.open_browse)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&QGIS Elevation Plugin')

        # Making GDAL visible
        local_path = '/usr/local/bin:'
        if local_path not in os.environ['PATH']:
            os.environ['PATH'] = local_path + os.environ['PATH']

        # Checking the presence of elevation library
        try:
            import elevation
            print elevation.util.selfcheck(elevation.datasource.TOOLS)
        except:
            self.clear_and_push_message("Installing elevation library!", QgsMessageBar.WARNING, 10)
            pip.main(['install', '--target=%s' % self.elevation_dir, 'elevation'])
            if self.elevation_dir not in sys.path:
                sys.path.append(self.elevation_dir)
            self.clear_and_push_message("Elevation Library correctly installed!", QgsMessageBar.INFO, 5)
项目:qgsMapzenIsochrones    作者:spatialmonk    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.dlg = MapzenIsochronesDialog()
        self.iface = iface
        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)
        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'MapzenIsochrones_{}.qm'.format(locale))


        #Populate comboBox_2 with all point file layers
        for layer in qgis.utils.iface.legendInterface().layers():
                layerType = layer.type()
                if layerType == QgsMapLayer.VectorLayer and layer.wkbType() == QGis.WKBPoint:
                    self.dlg.comboBox_2.addItem(layer.name())

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)


        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&Mapzen Isochrones')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'MapzenIsochrones')
        self.toolbar.setObjectName(u'MapzenIsochrones')

    # noinspection PyMethodMayBeStatic
项目:GkukanMusiumdb    作者:matsu-reki    | 项目源码 | 文件源码
def __init__(self, iface):
        """Constructor.

        :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.
        :type iface: QgsInterface
        """
        # Save reference to the QGIS interface
        self.iface = iface
        self.canvas = self.iface.mapCanvas()

        # initialize plugin directory
        self.plugin_dir = os.path.dirname(__file__)

        # initialize locale
        locale = QSettings().value('locale/userLocale')[0:2]
        locale_path = os.path.join(
            self.plugin_dir,
            'i18n',
            'GkukanMusiumdb_{}.qm'.format(locale))

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

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # Declare instance attributes
        self.actions = []
        self.menu = self.tr(u'&gkukanmusiumdb')
        # TODO: We are going to let the user set this up in a future iteration
        self.toolbar = self.iface.addToolBar(u'GkukanMusiumdb')
        self.toolbar.setObjectName(u'GkukanMusiumdb')

        #print "** INITIALIZING GkukanMusiumdb"

        self.pluginIsActive = False
        self.dockwidget = None

        self.GKukanSetting()
        self.land=LandmarkPlugin(self.iface)

        self.projectloaded=False

        QgsProject.instance().readProject.connect(self.project_loaded)


    # noinspection PyMethodMayBeStatic