Python qgis.PyQt.QtCore.QCoreApplication.translate() Examples

The following are 30 code examples of qgis.PyQt.QtCore.QCoreApplication.translate(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module qgis.PyQt.QtCore.QCoreApplication , or try the search function .
Example #1
Source File: QgsFmvMetadata.py    From QGISFMV with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #2
Source File: QgsFmvOpenStream.py    From QGISFMV with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #3
Source File: create_new_script.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.name = QCoreApplication.translate("RAlgorithmProvider", "Create New R Script…")
        self.group = self.tr("Tools") 
Example #4
Source File: test_translations.py    From qgis-earthengine-plugin with MIT License 5 votes vote down vote up
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) 
Example #5
Source File: utils.py    From qgis-shapetools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def tr(string):
    return QCoreApplication.translate('@default', string) 
Example #6
Source File: settings.py    From qgis-shapetools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def tr(string):
    return QCoreApplication.translate('Processing', string) 
Example #7
Source File: shapeTools.py    From qgis-shapetools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def tr(string):
    return QCoreApplication.translate('@default', string) 
Example #8
Source File: lineDigitizer.py    From qgis-shapetools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def tr(string):
    return QCoreApplication.translate('Processing', string) 
Example #9
Source File: dsg_tools.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
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('DsgTools', message) 
Example #10
Source File: dsgToolsProcessingModel.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parameters, name, taskName=None, flags=None, feedback=None):
        """
        Class constructor.
        :param parameters: (dict) map of attributes for a model.
        :param name: (str) name to identify current model.
        :param taskName: (str) name to be exposed on progress bar.
        :param flags: (list) a list of QgsTask flags to be set to current model.
        :param feedback: (QgsProcessingFeedback) task progress tracking QGIS
                         object.
        """
        super(DsgToolsProcessingModel, self).__init__(
            # "", QgsTask.CanCancel if flags is None else flags
            taskName or QCoreApplication.translate(
                "DsgToolsProcessingModel",
                "DSGTools Quality Assurance Model"
            ),
            QgsTask.CanCancel if flags is None else flags
        )
        self._name = name
        self._param = {} if self.validateParameters(parameters) else parameters
        # self.setTitle(taskName or self.displayName())
        self.feedback = feedback or QgsProcessingFeedback()
        self.feedback.canceled.connect(self.cancel)
        self.output = {
            "result" : dict(),
            "status" : False,
            "executionTime" : .0,
            "errorMessage" : self.tr("Thread not started yet."),
            "finishStatus" : "initial"
        } 
Example #11
Source File: singleOutputUnitTestAlgorithm.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, string):
        return QCoreApplication.translate('SingleOutputUnitTestAlgorithm', string) 
Example #12
Source File: assignValueMapToLayersAlgorithm.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, string):
        return QCoreApplication.translate(
            'AssignValueMapToLayersAlgorithm',
            string
        ) 
Example #13
Source File: identifyDuplicatedGeometriesAlgorithm.py    From DsgTools with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, string):
        return QCoreApplication.translate('IdentifyDuplicatedGeometriesAlgorithm', string) 
Example #14
Source File: utils.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def tr(string, context=''):
        """
        Translates a string
        """
        if context == '':
            context = 'RUtils'
        return QCoreApplication.translate(context, string) 
Example #15
Source File: delete_script.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.name = QCoreApplication.translate("DeleteScriptAction", "Delete Script…") 
Example #16
Source File: field2geom.py    From qgis-latlontools-plugin with GNU General Public License v2.0 5 votes vote down vote up
def tr(string):
    return QCoreApplication.translate('Processing', string) 
Example #17
Source File: edit_script.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.name = QCoreApplication.translate("EditScriptAction", "Edit Script…") 
Example #18
Source File: provider.py    From qgis-processing-r with GNU General Public License v3.0 5 votes vote down vote up
def tr(self, string, context=''):
        """
        Translates a string
        """
        if context == '':
            context = 'RAlgorithmProvider'
        return QCoreApplication.translate(context, string) 
Example #19
Source File: qgis_map_helpers.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def tr(message):
    # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
    # return QCoreApplication.translate('QuickMapServices', message)
    return message 
Example #20
Source File: quick_map_services.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, message):
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('QuickMapServices', message) 
Example #21
Source File: groups_list.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, message):
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('QuickMapServices', message) 
Example #22
Source File: data_sources_list.py    From quickmapservices with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, message):
        try:
            message = str(message)
        except:
            return message
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('QuickMapServices', message) 
Example #23
Source File: addMetersPerSecAlgorithm.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def tr(self, text):
        return QCoreApplication.translate("add_meters_per_sec", text) 
Example #24
Source File: addHeadingAlgorithm.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def tr(self, text):
        return QCoreApplication.translate("add_heading", text) 
Example #25
Source File: clipTrajectoriesByExtentAlgorithm.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def tr(self, text):
        return QCoreApplication.translate("clip_traj_extent", text) 
Example #26
Source File: trajectoriesFromPointLayerAlgorithm.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def tr(self, text):
        return QCoreApplication.translate("clip_traj_extent", text) 
Example #27
Source File: splitOnDayBreakAlgorithm.py    From qgis-processing-trajectory with GNU General Public License v3.0 5 votes vote down vote up
def tr(self, text):
        return QCoreApplication.translate("split_on_day_break", text) 
Example #28
Source File: opeNoise.py    From openoise-map with GNU General Public License v3.0 5 votes vote down vote up
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('opeNoise', message) 
Example #29
Source File: plot_type.py    From DataPlotly with GNU General Public License v2.0 5 votes vote down vote up
def tr(string, context=''):
        """
        Translates a string
        """
        if context == '':
            context = 'Types'
        return QCoreApplication.translate(context, string) 
Example #30
Source File: edgebundling.py    From qgis-edge-bundling with GNU General Public License v2.0 5 votes vote down vote up
def tr(self, text):
        return QCoreApplication.translate("edgebundling", text)