Skip to content
Permalink
Browse files

Avoid endless wait cursors in console

  • Loading branch information
m-kuhn committed Jul 30, 2017
1 parent 973d351 commit 4b6b8434f4cefdb3db86bcb430fc6df4a32d4943
Showing with 11 additions and 13 deletions.
  1. +10 −12 python/console/console_editor.py
  2. +1 −1 python/plugins/processing/gui/GetScriptsAndModels.py
@@ -27,6 +27,7 @@
from qgis.PyQt.Qsci import QsciScintilla, QsciLexerPython, QsciAPIs, QsciStyle
from qgis.core import QgsApplication, QgsSettings
from qgis.gui import QgsMessageBar
from qgis.utils import OverrideCursor
import sys
import os
import subprocess
@@ -726,10 +727,9 @@ def focusInEvent(self, e):
file = open(pathfile, "r")
fileLines = file.readlines()
file.close()
QApplication.setOverrideCursor(Qt.WaitCursor)
for line in reversed(fileLines):
self.insert(line)
QApplication.restoreOverrideCursor()
with OverrideCursor(Qt.WaitCursor):
for line in reversed(fileLines):
self.insert(line)
self.setModified(False)
self.endUndoAction()

@@ -785,11 +785,10 @@ def loadFile(self, filename, modified):
fn = codecs.open(filename, "rb", encoding='utf-8')
txt = fn.read()
fn.close()
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
self.newEditor.setText(txt)
if self.readOnly:
self.newEditor.setReadOnly(self.readOnly)
QApplication.restoreOverrideCursor()
with OverrideCursor(Qt.WaitCursor):
self.newEditor.setText(txt)
if self.readOnly:
self.newEditor.setReadOnly(self.readOnly)
self.newEditor.setModified(modified)
self.newEditor.recolor()

@@ -1259,9 +1258,8 @@ def refreshSettingsEditor(self):
if objInspectorEnabled:
cW = self.currentWidget()
if cW and not self.parent.listClassMethod.isVisible():
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
self.listObject(cW)
QApplication.restoreOverrideCursor()
with OverrideCursor(Qt.WaitCursor):
self.listObject(cW)

def changeLastDirPath(self, tab):
tabWidget = self.widget(tab)
@@ -165,7 +165,7 @@ def popupError(self, error=None, url=None):

def grabHTTP(self, url, loadFunction, arguments=None):
"""Grab distant content via QGIS internal classes and QtNetwork."""
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
QApplication.setOverrideCursor(Qt.WaitCursor)
request = QUrl(url)
reply = self.manager.get(QNetworkRequest(request))
if arguments:

0 comments on commit 4b6b843

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