Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[pyqgis-console] adress some comment: add button to link at generate …
…token page
  • Loading branch information
slarosa authored and nyalldawson committed Sep 26, 2020
1 parent eee2925 commit 4347e81
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions python/console/console_settings.py
Expand Up @@ -19,9 +19,9 @@
Some portions of code were taken from https://code.google.com/p/pydee/
"""

from qgis.PyQt.QtCore import QCoreApplication, QSize, Qt
from qgis.PyQt.QtCore import QCoreApplication, QSize, Qt, QUrl
from qgis.PyQt.QtWidgets import QDialog, QFileDialog, QMessageBox, QTableWidgetItem
from qgis.PyQt.QtGui import QIcon, QFont, QColor, QFontDatabase
from qgis.PyQt.QtGui import QIcon, QFont, QColor, QFontDatabase, QDesktopServices

from qgis.core import QgsSettings

Expand Down Expand Up @@ -59,6 +59,13 @@ def __init__(self, parent):
self.resetFontColor.setIconSize(QSize(18, 18))
self.resetFontColor.clicked.connect(self._resetFontColor)

self.generateToken.clicked.connect(self.generateGHToken)

def generateGHToken(self):
description = self.tr("PyQGIS Console")
url = 'https://github.com/settings/tokens/new?description={}&scopes=gist'.format(description)
QDesktopServices.openUrl(QUrl(url))

def initialCheck(self):
if self.preloadAPI.isChecked():
self.enableDisable(False)
Expand Down
11 changes: 9 additions & 2 deletions python/console/console_settings.ui
Expand Up @@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>1055</width>
<height>720</height>
<height>786</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -687,7 +687,14 @@
<item row="0" column="0">
<widget class="QLineEdit" name="tokenGhLineEdit">
<property name="placeholderText">
<string>&lt;ACCESS_TOKEN&gt;</string>
<string>&lt;PERSONAL_ACCESS_TOKEN&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="generateToken">
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 4347e81

Please sign in to comment.