Beispiel #1
0
 def open_doc_overpass():
     """
     Open Overpass's documentation
     """
     url = "http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide"
     desktop_service = QDesktopServices()
     desktop_service.openUrl(QUrl(url))
Beispiel #2
0
 def open_map_features():
     """
     Open MapFeatures
     """
     desktop_service = QDesktopServices()
     desktop_service.openUrl(
         QUrl("http://wiki.openstreetmap.org/wiki/Mapfeatures"))
Beispiel #3
0
 def onHelp(self):
     helpPath = Utils.getHelpPath()
     if helpPath == '':
         url = QUrl("http://www.gdal.org/" + self.helpFileName)
     else:
         url = QUrl.fromLocalFile(helpPath + '/' + self.helpFileName)
     QDesktopServices.openUrl(url)
Beispiel #4
0
 def openLink(self, url):
     if url.toString() == "log":
         self.close()
         logDock = iface.mainWindow().findChild(QDockWidget, 'MessageLog')
         logDock.show()
     else:
         QDesktopServices.openUrl(url)
Beispiel #5
0
 def openScriptFileExtEditor(self):
     tabWidget = self.tabEditorWidget.currentWidget()
     path = tabWidget.path
     import subprocess
     try:
         subprocess.Popen([os.environ['EDITOR'], path])
     except KeyError:
         QDesktopServices.openUrl(QUrl.fromLocalFile(path))
Beispiel #6
0
    def openHelp(self):
        locale = QgsApplication.locale()

        if locale in ['uk']:
            QDesktopServices.openUrl(
                QUrl(self.home))
        else:
            QDesktopServices.openUrl(
                QUrl(self.home))
Beispiel #7
0
    def openHelp(self):
        locale = QgsApplication.locale()

        if locale in ['uk']:
            QDesktopServices.openUrl(
                QUrl('https://github.com/alexbruy/photo2shape'))
        else:
            QDesktopServices.openUrl(
                QUrl('https://github.com/alexbruy/photo2shape'))
    def exportAsPDF(self):

        paths = super().exportAsPDF()

        if self.isMulti:
            info = u"Les relevés ont été enregistrés dans le répertoire :\n%s\n\nOuvrir le dossier ?" % self.targetDir
            openFolder = QDesktopServices()
            openFolder.openUrl(QUrl('file:///%s' % self.targetDir))

        return paths
Beispiel #9
0
    def showHelp(self):
        """Shows the help page."""

        locale = QSettings().value('locale/userLocale')[0:2]
        help_file = self.plugin_dir + '/help/help_{}.html'.format(locale)

        if os.path.exists(help_file):
            QDesktopServices.openUrl(QUrl('file:///'+ help_file))
        else:
            QDesktopServices.openUrl(QUrl(
                'file:///'+ self.plugin_dir + '/help/help.html')
                )
Beispiel #10
0
def show_help(message=None):
    """Open an help message in the user's browser

    :param message: An optional message object to display in the dialog.
    :type message: Message.Message
    """

    help_path = mktemp('.html')
    with open(help_path, 'wb+') as f:
        help_html = get_help_html(message)
        f.write(help_html.encode('utf8'))
        path_with_protocol = 'file://' + help_path
        QDesktopServices.openUrl(QUrl(path_with_protocol))
Beispiel #11
0
    def openHelp(self):
        overrideLocale = QSettings().value('locale/overrideFlag', False, bool)
        if not overrideLocale:
            locale = QLocale.system().name()[:2]
        else:
            locale = QSettings().value('locale/userLocale', '')

        if locale in ['uk']:
            QDesktopServices.openUrl(
                QUrl('https://github.com/alexbruy/qscatter'))
        else:
            QDesktopServices.openUrl(
                QUrl('https://github.com/alexbruy/qscatter'))
def main():
    datestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
    if QT5:
        ini_out_dir = QStandardPaths.writableLocation(QStandardPaths.DesktopLocation)
    else:
        ini_out_dir = QDesktopServices.storageLocation(QDesktopServices.DesktopLocation)
    ini_name = 'org.qgis.{0}-settings_{1}.ini'.format(QGIS_APP_NAME, datestamp)
    ini_out = QDir(ini_out_dir).absoluteFilePath(ini_name)

    if not os.path.exists(ini_out_dir):
        print('INI output directory does not exist: {0}'.format(ini_out_dir))
        return

    if not os.access(ini_out_dir, os.W_OK | os.X_OK):
        print('INI output directory is not writeable: {0}'.format(ini_out_dir))
        return

    # QGIS settings
    if HAS_QGSSETTINGS:
        qgis_settings = QgsSettings()
    else:
        qgis_settings = QSettings()

    # Output INI settings
    ini_settings = QSettings(ini_out, QSettings.IniFormat)

    qgis_keys = qgis_settings.allKeys()
    for k in qgis_keys:
        ini_settings.setValue(k, qgis_settings.value(k))

    ini_settings.sync()

    print("Settings output to: {0}".format(QDir.toNativeSeparators(ini_out)))
Beispiel #13
0
    def run_sketch_line(network, ref):
        """
        Run an action with two values for sketchline

        @param network:network of the bus
        @type network:str
        @param ref:ref of the bus
        @type ref:str
        """
        if network == '' or ref == '':
            iface.messageBar().pushMessage(
                tr('Sorry, this field is empty for this entity.'),
                level=Qgis.Warning,
                duration=7)
        else:
            var = QDesktopServices()
            url = 'http://www.overpass-api.de/api/sketch-line?' \
                  'network=' + network + '&ref=' + ref
            var.openUrl(QUrl(url))
 def __reportError(self):
     body = ("Please provide any additional information here:\n\n\n"
             "If you encountered an upload error, if possible please attach a zip file containing a minimal extract of the dataset, as well as the QGIS project file.\n\n\n"
             "Technical information:\n%s\n\n"
             "Versions:\n"
             " QGIS: %s\n"
             " Python: %s\n"
             " OS: %s\n"
             " QGIS Cloud Plugin: %s\n\n"
             "Username: %s\n") % (
                 self.plainTextEdit.toPlainText(),
                 Qgis.QGIS_VERSION,
                 sys.version.replace("\n", " "),
                 platform.platform(),
                 self.metadata.version(),
                 self.username)
     url = QUrl()
     url.toEncoded("mailto:[email protected]?subject=%s&body=%s" % (
             urllib.parse.quote(self.windowTitle()),
             urllib.parse.quote(body)),
     )
     QDesktopServices.openUrl(url)
Beispiel #15
0
 def show_website():
     QDesktopServices.openUrl(QUrl('https://github.com/erpas/serval/wiki'))
Beispiel #16
0
def open_link_with_browser(url):
    QDesktopServices.openUrl(QUrl(url))
Beispiel #17
0
    def showHelp(self):
        help_file = 'file:///%s/help/index.html' % self.plugin_dir

        QDesktopServices.openUrl(QUrl(help_file))
Beispiel #18
0
 def openURL(self):
     curindex = self.proxyModel.mapToSource(
         self.geoClassList.selectionModel().currentIndex())
     concept = self.geoClassListModel.itemFromIndex(curindex).data(1)
     url = QUrl(concept)
     QDesktopServices.openUrl(url)
 def showHelp(self):
     """Display application help to the user."""
     help_file = os.path.join(
         os.path.split(os.path.dirname(__file__))[0], 'help', 'index.html')
     QDesktopServices.openUrl(QUrl.fromLocalFile(help_file))
 def open_help(self):
     """Open help."""
     doc_url = QUrl('http://qgis-contribution.github.io/' +
                    'QGIS-ResourceSharing/')
     QDesktopServices.openUrl(doc_url)
Beispiel #21
0
 def open_help(self):
     """Opens the html help file content with default browser"""
     help_url = "http://3liz.github.io/QgisCadastrePlugin/"
     QDesktopServices.openUrl(QUrl(help_url))
 def giveHelp(self):
     self.showInfo('Giving help')
     QDesktopServices.openUrl(QUrl.fromLocalFile(
                      self.plugin_dir + "/help/html/index.html"))
Beispiel #23
0
 def openHelp(self):
     QDesktopServices.openUrl(
         QUrl("https://github.com/danzig666/qconsolidate3"))
Beispiel #24
0
 def open_url(self):
     """Open (GET) the url of this RequestParentItem in the default browser
     of the user"""
     QDesktopServices.openUrl(self.url)
 def platform(self):
     """Open link to web app"""
     url = QUrl(get_plugin_config()['platform_server'])
     QDesktopServices.openUrl(url)
Beispiel #26
0
 def open_help(self):
     '''Opens the html help file content with default browser'''
     #~ localHelpUrl = "https://github.com/3liz/QgisCadastrePlugin/blob/master/doc/index.rst"
     localHelpUrl = os.path.dirname(__file__) + "/doc/index.html"
     QDesktopServices.openUrl(QUrl(localHelpUrl))
Beispiel #27
0
 def open_overpass_turbo():
     """
     Open Overpass Turbo
     """
     desktop_service = QDesktopServices()
     desktop_service.openUrl(QUrl("http://overpass-turbo.eu/"))
Beispiel #28
0
 def showWebsite(self):
     QDesktopServices.openUrl(QUrl('http://rivergis.com'))
Beispiel #29
0
 def openHelpAPI(self):
     m = re.search(r'^([0-9]+)\.([0-9]+)\.', Qgis.QGIS_VERSION)
     if m:
         QDesktopServices.openUrl(
             QUrl('https://qgis.org/pyqgis/{}.{}/'.format(
                 m.group(1), m.group(2))))
Beispiel #30
0
 def openLink(self, url):
     QDesktopServices.openUrl(url)
Beispiel #31
0
 def close_file(self, f, reportpath):
     f.write("\n</p></body></html>")
     f.close()
     #print reportpath#debug
     url_status = QDesktopServices.openUrl(QUrl.fromLocalFile(reportpath))
     return url_status
Beispiel #32
0
 def help(self):
     QDesktopServices.openUrl(QUrl.fromLocalFile(
                      self.plugin_dir + "/help/html/index.html"))
Beispiel #33
0
 def open_external_help():
     QDesktopServices.openUrl(QUrl('https://docs.3liz.org/qgis-pgmetadata-plugin/'))
 def open_collection(self):
     """Slot called when the user clicks the 'Open' button."""
     collection_path = local_collection_path(self._sel_coll_id)
     directory_url = QUrl.fromLocalFile(str(collection_path))
     QDesktopServices.openUrl(directory_url)
Beispiel #35
0
 def on_help(self):
     QDesktopServices.openUrl(QUrl("https://github.com/aeag/mask/wiki"))
Beispiel #36
0
 def generateGHToken(self):
     description = self.tr("PyQGIS Console")
     url = 'https://github.com/settings/tokens/new?description={}&scopes=gist'.format(
         description)
     QDesktopServices.openUrl(QUrl(url))
Beispiel #37
0
 def openResult(self, item, column):
     QDesktopServices.openUrl(QUrl.fromLocalFile(item.filename))
 def open_collection(self):
     """Slot for when user clicks 'Open' button."""
     collection_path = local_collection_path(self._selected_collection_id)
     directory_url = QUrl.fromLocalFile(collection_path)
     QDesktopServices.openUrl(directory_url)
 def openURL(self):
     QDesktopServices.openUrl(QUrl("https://qms.nextgis.com/create"))
Beispiel #40
0
 def open_link(url):
     QDesktopServices.openUrl(url)
    def __init__(self, settingsdict, num_data_cols, rowheader_colwidth_percent,
                 empty_row_between_tables, page_break_between_tables,
                 from_active_layer, sql_table):
        #show the user this may take a long time...
        utils.start_waiting_cursor()

        self.nr_header_rows = 3

        reportfolder = os.path.join(QDir.tempPath(), 'midvatten_reports')
        if not os.path.exists(reportfolder):
            os.makedirs(reportfolder)
        reportpath = os.path.join(reportfolder, "w_qual_report.html")
        f = codecs.open(reportpath, "wb", "utf-8")

        #write some initiating html
        rpt = r"""<head><title>%s</title></head>""" % ru(
            QCoreApplication.translate(
                'Wqualreport',
                'water quality report from Midvatten plugin for QGIS'))
        rpt += r""" <meta http-equiv="content-type" content="text/html; charset=utf-8" />"""  #NOTE, all report data must be in 'utf-8'
        rpt += "<html><body>"
        f.write(rpt)

        if from_active_layer:
            utils.pop_up_info(
                ru(
                    QCoreApplication.translate(
                        'CompactWqualReport',
                        'Check that exported number of rows are identical to expected number of rows!\nFeatures in layers from sql queries can be invalid and then excluded from the report!'
                    )), 'Warning!')
            w_qual_lab_layer = qgis.utils.iface.activeLayer()
            if w_qual_lab_layer is None:
                raise utils.UsageError(
                    ru(
                        QCoreApplication.translate('CompactWqualReport',
                                                   'Must select a layer!')))
            if not w_qual_lab_layer.selectedFeatureCount():
                w_qual_lab_layer.selectAll()
            data = self.get_data_from_qgislayer(w_qual_lab_layer)
        else:
            data = self.get_data_from_sql(sql_table,
                                          utils.getselectedobjectnames())

        report_data, num_data = self.data_to_printlist(data)
        utils.MessagebarAndLog.info(bar_msg=ru(
            QCoreApplication.translate(
                'CompactWqualReport',
                'Created report from %s number of rows.')) % str(num_data))

        for startcol in range(1, len(report_data[0]), num_data_cols):
            printlist = [[row[0]] for row in report_data]
            for rownr, row in enumerate(report_data):
                printlist[rownr].extend(
                    row[startcol:min(startcol + num_data_cols, len(row))])

            filtered = [row for row in printlist if any(row[1:])]

            self.htmlcols = len(filtered[0])
            self.WriteHTMLReport(
                filtered,
                f,
                rowheader_colwidth_percent,
                empty_row_between_tables=empty_row_between_tables,
                page_break_between_tables=page_break_between_tables)

        # write some finishing html and close the file
        f.write("\n</body></html>")
        f.close()

        utils.stop_waiting_cursor(
        )  # now this long process is done and the cursor is back as normal

        if report_data:
            QDesktopServices.openUrl(QUrl.fromLocalFile(reportpath))
Beispiel #42
0
 def openLink(self, url):
     QDesktopServices.openUrl(url)
 def open_help():
     """ Open the online help. """
     QDesktopServices.openUrl(
         QUrl('https://docs.3liz.org/qgis-pgmetadata-plugin/'))
 def open_help(self):
     """Open help."""
     doc_url = QUrl('http://www.akbargumbira.com/qgis_resources_sharing')
     QDesktopServices.openUrl(doc_url)
Beispiel #45
0
 def help(self):
     QDesktopServices.openUrl(
         QUrl.fromLocalFile(self.plugin_dir + "/help/html/index.html"))
Beispiel #46
0
    def run(field, value):
        """
        Run an action with only one value as parameter

        @param field:Type of the action
        @type field:str
        @param value:Value of the field for one entity
        @type value:str
        """

        if value == '':
            iface.messageBar().pushMessage(
                tr('Sorry, this field \'{}\' is empty for this entity.'
                   .format(field)),
                level=Qgis.Warning, duration=7)
        else:

            if field in ['url', 'website', 'wikipedia', 'wikidata']:
                var = QDesktopServices()
                url = None

                if field == 'url' or field == 'website':
                    url = value

                if field == 'ref_UAI':
                    url = "http://www.education.gouv.fr/pid24302/annuaire-" \
                          "resultat-recherche.html?lycee_name=" + value

                if field == 'wikipedia':
                    url = "http://en.wikipedia.org/wiki/" + value

                if field == 'wikidata':
                    url = "http://www.wikidata.org/wiki/" + value

                var.openUrl(QUrl(url))

            elif field == 'mapillary':
                if 'go2mapillary' in plugins:
                    plugins['go2mapillary'].dockwidget.show()
                    plugins["go2mapillary"].mainAction.setChecked(False)
                    plugins['go2mapillary'].viewer.openLocation(value)
                else:
                    var = QDesktopServices()
                    url = 'https://www.mapillary.com/map/im/' + value
                    var.openUrl(QUrl(url))

            elif field == 'josm':
                import urllib.request, urllib.error, urllib.parse
                try:
                    url = 'http://localhost:8111/load_object?objects=' + value
                    urllib.request.urlopen(url).read()
                except urllib.error.URLError:
                    iface.messageBar().pushMessage(
                        tr('The JOSM remote seems to be disabled.'),
                        level=Qgis.Critical,
                        duration=7)

            # NOT USED
            elif field == 'rawedit':
                # url = QUrl("http://rawedit.openstreetmap.fr/edit/" + value)
                # web_browser = QWebView(None)
                # web_browser.load(url)
                # web_browser.show()
                pass
Beispiel #47
0
 def CallSite(self):
     if self.locale != 'pt':
         link = 'https://github.com/Amphibitus/selectThemes/blob/main/README.md'
     else:
         link = 'https://github.com/Amphibitus/selectThemes/blob/main/README_en.md'
     QDesktopServices.openUrl(QUrl(link))
 def openURL(self):
     QDesktopServices.openUrl(QUrl("https://qms.nextgis.com/create"))
 def close_file(self, f, reportpath):
     f.write("\n</p></body></html>")
     f.close()
     #print reportpath#debug
     url_status = QDesktopServices.openUrl(QUrl.fromLocalFile(reportpath))
     return url_status
 def open_help(self):
     '''Opens the html help file content with default browser'''
     #~ localHelpUrl = "https://github.com/3liz/QgisCadastrePlugin/blob/master/doc/index.rst"
     localHelpUrl = os.path.join(str(Path(__file__).resolve().parent), 'doc', 'index.html')
     QDesktopServices.openUrl( QUrl(localHelpUrl) )
Beispiel #51
0
 def open_help():
     """Opens the html help file content with default browser"""
     help_url = "https://docs.3liz.org/QgisCadastrePlugin/"
     QDesktopServices.openUrl(QUrl(help_url))
Beispiel #52
0
 def openResult(self, item, column):
     QDesktopServices.openUrl(QUrl.fromLocalFile(item.filename))
 def open_doc(self):
     if DEBUG:
         print('Opening : %s' % self.help_url)
     QDesktopServices.openUrl(QUrl.fromLocalFile(self.help_url))
     QWhatsThis.leaveWhatsThisMode()
Beispiel #54
0
 def open_help(self):
     QDesktopServices.openUrl(
         QUrl.fromLocalFile(
             os.path.join(os.path.dirname(__file__), "doc", "build", "html",
                          "index.html")))
    def __init__(self, settingsdict, num_data_cols, rowheader_colwidth_percent,
                 empty_row_between_tables, page_break_between_tables,
                 from_active_layer, sql_table, sort_parameters_alphabetically,
                 sort_by_obsid, date_time_as_columns, date_time_format, method,
                 data_column):
        #show the user this may take a long time...

        reportfolder = os.path.join(QDir.tempPath(), 'midvatten_reports')
        if not os.path.exists(reportfolder):
            os.makedirs(reportfolder)
        reportpath = os.path.join(reportfolder, "w_qual_report.html")
        f = codecs.open(reportpath, "wb", "utf-8")

        #write some initiating html
        rpt = r"""<head><title>%s</title></head>""" % ru(
            QCoreApplication.translate(
                'Wqualreport',
                'water quality report from Midvatten plugin for QGIS'))
        rpt += r""" <meta http-equiv="content-type" content="text/html; charset=utf-8" />"""  #NOTE, all report data must be in 'utf-8'
        rpt += "<html><body>"
        f.write(rpt)

        if date_time_as_columns:
            data_columns = [
                'obsid', 'date_time', 'report', 'parameter', 'unit',
                data_column
            ]
        else:
            data_columns = [
                'obsid', 'date_time', 'parameter', 'unit', data_column
            ]

        if from_active_layer:
            w_qual_lab_layer = qgis.utils.iface.activeLayer()
            if w_qual_lab_layer is None:
                raise utils.UsageError(
                    ru(
                        QCoreApplication.translate('CompactWqualReport',
                                                   'Must select a layer!')))
            if not w_qual_lab_layer.selectedFeatureCount():
                w_qual_lab_layer.selectAll()
            df = self.get_data_from_qgislayer(w_qual_lab_layer, data_columns)
        else:
            df = self.get_data_from_sql(sql_table,
                                        utils.getselectedobjectnames(),
                                        data_columns)

        if date_time_as_columns:
            columns = ['obsid', 'date_time', 'report']
            rows = ['parunit']
            values = [data_column]
            report_data = self.data_to_printlist(
                df, list(columns), list(rows), values,
                sort_parameters_alphabetically, sort_by_obsid, method,
                date_time_format)
        else:
            columns = ['obsid']
            rows = ['parunit', 'date_time']
            values = [data_column]
            report_data = self.data_to_printlist(
                df, list(columns), list(rows), values,
                sort_parameters_alphabetically, sort_by_obsid, method,
                date_time_format)

        # Split the data into separate tables with the specified number of columns
        for startcol in range(len(rows), len(report_data[0]), num_data_cols):
            printlist = [row[:len(rows)] for row in report_data]
            for rownr, row in enumerate(report_data):
                printlist[rownr].extend(
                    row[startcol:min(startcol + num_data_cols, len(row))])

            filtered = [row for row in printlist if any(row[len(rows):])]

            self.htmlcols = len(filtered[0])
            self.write_html_table(
                filtered,
                f,
                rowheader_colwidth_percent,
                empty_row_between_tables=empty_row_between_tables,
                page_break_between_tables=page_break_between_tables,
                nr_header_rows=len(columns),
                nr_row_header_columns=len(rows))

        # write some finishing html and close the file
        f.write("\n</body></html>")
        f.close()

        if report_data:
            QDesktopServices.openUrl(QUrl.fromLocalFile(reportpath))