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


Python QCoreApplication.translate方法代码示例

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


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

示例1: OpenStream

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def OpenStream(self, _):
        protocol = self.cmb_protocol.currentText().lower()
        host = self.ln_host.text()
        port = self.ln_port.text()
        v = protocol + "://" + host + ":" + port
        if host != "" and port != "":
            qgsu.showUserAndLogMessage(QCoreApplication.translate(
                "QgsFmvOpenStream", "Checking connection!"))
            QApplication.setOverrideCursor(Qt.WaitCursor)
            QApplication.processEvents()
            # Check if connection exist
            cap = cv2.VideoCapture(v)
            ret, _ = cap.read()
            cap.release()
            if ret:
                self.parent.AddFileRowToManager(v, v)
                self.close()
            else:
                qgsu.showUserAndLogMessage(QCoreApplication.translate(
                    "QgsFmvOpenStream", "There is no such connection!"), level=QGis.Warning)
            QApplication.restoreOverrideCursor() 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:23,代码来源:QgsFmvOpenStream.py

示例2: SaveACSV

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def SaveACSV(self):
        """ Save Table as CSV  """
        data = self.player.GetPacketData()
        out, _ = askForFiles(self, QCoreApplication.translate(
            "QgsFmvMetadata", "Save CSV"),
            isSave=True,
            exts='csv')
        if not out:
            return

        task = QgsTask.fromFunction('Save CSV Report Task',
                                    self.CreateCSV,
                                    out=out,
                                    data=data,
                                    VManager=self.VManager,
                                    on_finished=self.finishedTask,
                                    flags=QgsTask.CanCancel)

        QgsApplication.taskManager().addTask(task)
        return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:22,代码来源:QgsFmvMetadata.py

示例3: tr

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def tr(self, text):
        return QCoreApplication.translate("edgebundling", text) 
开发者ID:dts-ait,项目名称:qgis-edge-bundling,代码行数:4,代码来源:edgebundling.py

示例4: tr

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def tr(string):
    return QCoreApplication.translate('Processing', string) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:4,代码来源:field2geom.py

示例5: tr

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('HydroSEDPlugin', message) 
开发者ID:nicolas998,项目名称:WMF,代码行数:15,代码来源:HydroSEDPlugin.py

示例6: test_qgis_translations

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def test_qgis_translations(self):
        """Test that translations work."""
        parent_path = os.path.join(__file__, os.path.pardir, os.path.pardir)
        dir_path = os.path.abspath(parent_path)
        file_path = os.path.join(
            dir_path, 'i18n', 'af.qm')
        translator = QTranslator()
        translator.load(file_path)
        QCoreApplication.installTranslator(translator)

        expected_message = 'Goeie more'
        real_message = QCoreApplication.translate("@default", 'Good morning')
        self.assertEqual(real_message, expected_message) 
开发者ID:nicolas998,项目名称:WMF,代码行数:15,代码来源:test_translations.py

示例7: tr

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('go2mapillary', message) 
开发者ID:enricofer,项目名称:go2mapillary,代码行数:15,代码来源:mapillary_explorer.py

示例8: __init__

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def __init__(self, iface, parent=None):
        super().__init__(parent)
        self.setupUi(self)
        self.parent = parent
        self.iface = iface
        self._PlayerDlg = None
        self.isStreaming = False
        self.meta_reader = {}
        self.initialPt = {}
        self.pass_time = 250

        self.VManager.viewport().installEventFilter(self)

        # Context Menu
        self.VManager.customContextMenuRequested.connect(self.__context_menu)
        self.removeAct = QAction(QIcon(":/imgFMV/images/mActionDeleteSelected.svg"),
                                 QCoreApplication.translate("ManagerDock", "Remove from list"), self,
                                 triggered=self.remove)

        self.VManager.setColumnWidth(1, 150)
        self.VManager.setColumnWidth(2, 80)
        self.VManager.setColumnWidth(3, 300)
        self.VManager.setColumnWidth(4, 300)
        self.VManager.verticalHeader().setDefaultAlignment(Qt.AlignHCenter)
        self.VManager.hideColumn(0)

        # Get Video Manager List
        VideoList = getVideoManagerList()
        for load_id in VideoList:
            filename = s.value(getNameSpace() + "/Manager_List/" + load_id)
            _, name = os.path.split(filename)

            folder = getVideoFolder(filename)
            klv_folder = os.path.join(folder, "klv")
            exist = os.path.exists(klv_folder)
            if exist:
                self.AddFileRowToManager(name, filename, load_id, exist, klv_folder)
            else:
                self.AddFileRowToManager(name, filename, load_id)

        draw.setValues() 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:43,代码来源:QgsManager.py

示例9: openVideoFileDialog

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def openVideoFileDialog(self):
        ''' Open video file dialog '''
        Exts = ast.literal_eval(parser.get("FILES", "Exts"))
        filename, _ = askForFiles(self, QCoreApplication.translate(
            "ManagerDock", "Open video"),
            exts=Exts)

        if filename:
            _, name = os.path.split(filename)
            self.AddFileRowToManager(name, filename)

        return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:14,代码来源:QgsManager.py

示例10: ToggleActiveRow

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def ToggleActiveRow(self, row, value="Playing"):
        ''' Toggle Active row manager video status '''
        self.VManager.setItem(row, 2, QTableWidgetItem(QCoreApplication.translate(
            "ManagerDock", value)))
        return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:7,代码来源:QgsManager.py

示例11: OpenCsvFile

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def OpenCsvFile(self):
        ''' Open Csv File '''
        filename, _ = askForFiles(self, QCoreApplication.translate(
            "Multiplexor", "Open file"),
            exts="csv")
        if filename:
            self.csv_file = filename
            self.ln_inputMeta.setText(self.csv_file)
        return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:11,代码来源:QgsMultiplexor.py

示例12: OpenVideoFile

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def OpenVideoFile(self):
        ''' Open Video File '''
        filename, _ = askForFiles(self, QCoreApplication.translate(
            "Multiplexor", "Open file"),
            exts=self.Exts)
        if filename:
            self.video_file = filename
            self.ln_inputVideo.setText(self.video_file)
        return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:11,代码来源:QgsMultiplexor.py

示例13: install_pip_requirements

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def install_pip_requirements():
    ''' Install Requeriments from pip >= 10.0.1'''
    package_dir = QgsApplication.qgisSettingsDirPath() + 'python/plugins/QGIS_FMV/'
    requirements_file = os.path.join(package_dir, 'requirements.txt')
    if not os.path.isfile(requirements_file):
        qgsu.showUserAndLogMessage(QCoreApplication.translate("QgsFmvInstaller", "No requirements file found in {}").format(
            requirements_file), onlyLog=True)
        raise
    try:
        process = Popen(["python3", "-m", 'pip', "install", '--upgrade', 'pip'],
                        shell=windows,
                        stdout=PIPE,
                        stderr=PIPE)
        process.wait()
        process = Popen(["python3", "-m", 'pip', "install", '-U', 'pip', 'setuptools'],
                        shell=windows,
                        stdout=PIPE,
                        stderr=PIPE)
        process.wait()
        process = Popen(["pip3", "install", '--user', '-r', requirements_file],
                        shell=windows,
                        stdout=PIPE,
                        stderr=PIPE)
        process.wait()
    except Exception:
        raise

    return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:30,代码来源:QgsFmvInstaller.py

示例14: initElevationModel

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def initElevationModel(frameCenterLat, frameCenterLon, dtm_path):
    ''' Start DEM transformation and extract data for set Z value in points '''
    global dtm_data, dtm_transform, dtm_colLowerBound, dtm_rowLowerBound

    # Initialize the dtm once, based on a zone arouind the target
    qgsu.showUserAndLogMessage("", "Initializing DTM.", onlyLog=True)
    dataset = gdal.Open(dtm_path)
    if dataset is None:
        qgsu.showUserAndLogMessage(QCoreApplication.translate(
            "QgsFmvUtils", "Failed to read DTM file. "), level=QGis.Warning)
        return
    band = dataset.GetRasterBand(1)
    dtm_transform = dataset.GetGeoTransform()
    xOrigin = dtm_transform[0]
    yOrigin = dtm_transform[3]
    pixelWidth = dtm_transform[1]
    pixelHeight = -dtm_transform[5]
    cIndex = int((frameCenterLon - xOrigin) / pixelWidth)
    rIndex = int((frameCenterLat - yOrigin) / (-pixelHeight))
    dtm_colLowerBound = cIndex - dtm_buffer
    dtm_rowLowerBound = rIndex - dtm_buffer
    if dtm_colLowerBound < 0 or dtm_rowLowerBound < 0:
        qgsu.showUserAndLogMessage(QCoreApplication.translate(
            "QgsFmvUtils", "There is no DTM for theses bounds. Check/increase DTM_buffer_size in settings.ini"), level=QGis.Warning)
    else:
        # qgsu.showUserAndLogMessage("UpdateLayers: ", " dtm_colLowerBound:"+str(dtm_colLowerBound)+" dtm_rowLowerBound:"+str(dtm_rowLowerBound)+" dtm_buffer:"+str(dtm_buffer), onlyLog=True)
        dtm_data = band.ReadAsArray(
            dtm_colLowerBound, dtm_rowLowerBound, 2 * dtm_buffer, 2 * dtm_buffer)
        if dtm_data is not None:
            qgsu.showUserAndLogMessage(
                "", "DTM successfully initialized, len: " + str(len(dtm_data)), onlyLog=True) 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:33,代码来源:QgsFmvUtils.py

示例15: UpdateTrajectoryData

# 需要导入模块: from qgis.PyQt.QtCore import QCoreApplication [as 别名]
# 或者: from qgis.PyQt.QtCore.QCoreApplication import translate [as 别名]
def UpdateTrajectoryData(packet, ele):
    ''' Update Trajectory Values '''
    lat = packet.SensorLatitude
    lon = packet.SensorLongitude
    alt = packet.SensorTrueAltitude

    global groupName
    trajectoryLyr = qgsu.selectLayerByName(Trajectory_lyr, groupName)

    try:
        if all(v is not None for v in [trajectoryLyr, lat, lon, alt]):
            trajectoryLyr.startEditing()
            f = QgsFeature()
            if trajectoryLyr.featureCount() == 0:
                f.setAttributes(
                    [lon, lat, alt])
                f.setGeometry(QgsLineString(QgsPoint(lon, lat, alt), QgsPoint(lon, lat, alt)))
                trajectoryLyr.addFeatures([f])

            else:
                f_last = trajectoryLyr.getFeature(trajectoryLyr.featureCount())
                f.setAttributes([lon, lat, alt])
                f.setGeometry(QgsLineString(QgsPoint(lon, lat, alt), QgsPoint(f_last.attribute(0), f_last.attribute(1), f_last.attribute(2))))
                trajectoryLyr.addFeatures([f])

            CommonLayer(trajectoryLyr)
            # 3D Style
            if ele:
                SetDefaultTrajectory3DStyle(trajectoryLyr)

    except Exception as e:
        qgsu.showUserAndLogMessage(QCoreApplication.translate(
            "QgsFmvUtils", "Failed Update Trajectory Layer! : "), str(e))
    return 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:36,代码来源:QgsFmvLayers.py


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