Skip to content

Commit

Permalink
[pyqgis-console] warn user to generate personal access token
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa authored and nyalldawson committed Sep 26, 2020
1 parent 4347e81 commit 1760e26
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/console/console_editor.py
Expand Up @@ -302,8 +302,7 @@ def contextMenuEvent(self, e):
runSelected.setEnabled(True) # spellok
copyAction.setEnabled(True)
cutAction.setEnabled(True)
if self.settings.value("pythonConsole/accessTokenGithub", ''):
gist_menu.setEnabled(True)
gist_menu.setEnabled(True)
pyQGISHelpAction.setEnabled(True)
if not self.text() == '':
selectAllAction.setEnabled(True)
Expand Down Expand Up @@ -368,6 +367,12 @@ def objectListEditor(self):

def shareOnGist(self, is_public):
ACCESS_TOKEN = self.settings.value("pythonConsole/accessTokenGithub", '', type=QByteArray)
if not ACCESS_TOKEN:
msg_text = QCoreApplication.translate(
'PythonConsole', 'GitHub personal access token must be generated (see Console Options)')
self.parent.pc.callWidgetMessageBarEditor(msg_text, 0, True)
return

URL = "https://api.github.com/gists"

path = self.parent.tw.currentWidget().path
Expand Down

0 comments on commit 1760e26

Please sign in to comment.