Skip to content
Permalink
Browse files

Merge pull request #7087 from slarosa/fix_19001

Fixes #19001: update url for _pyqgis and _api commands
  • Loading branch information
slarosa committed May 29, 2018
2 parents d157b6e + 3edc07b commit 68b7f5a80766ca6aa129cbc105cada09ef48e7f7
Showing with 8 additions and 4 deletions.
  1. +8 −4 python/console/console_sci.py
@@ -31,7 +31,7 @@
import re
import traceback

from qgis.core import QgsApplication, QgsSettings
from qgis.core import QgsApplication, QgsSettings, Qgis
from .ui_console_history_dlg import Ui_HistoryDialogPythonConsole

_init_commands = ["from qgis.core import *", "from qgis.gui import *", "from qgis.analysis import *", "import processing", "import qgis.utils",
@@ -619,11 +619,15 @@ def runCommand(self, cmd):
self.writeCMD(cmd)
import webbrowser
self.updateHistory(cmd)
if cmd in ('_pyqgis', '_api'):
version = 'master' if 'master' in Qgis.QGIS_VERSION.lower() else re.findall('^\d.[0-9]*', Qgis.QGIS_VERSION)[0]
if cmd in ('_pyqgis', '_api', '_cookbook'):
if cmd == '_pyqgis':
webbrowser.open("http://qgis.org/pyqgis-cookbook/")
webbrowser.open("https://qgis.org/pyqgis/{}".format(version))
elif cmd == '_api':
webbrowser.open("http://qgis.org/api/")
webbrowser.open("https://qgis.org/api/{}".format(version))
elif cmd == '_cookbook':
webbrowser.open("https://docs.qgis.org/{}/en/docs/pyqgis_developer_cookbook/".format(
'testing' if version == 'master' else version))
more = False
else:
self.buffer.append(cmd)

0 comments on commit 68b7f5a

Please sign in to comment.
You can’t perform that action at this time.