Blurs UI while processing

Before the processing of a query starts, it will blur the UI.

This gives feedback to the user that something is happening, and is
simple to implement because I am too lazy to move the processing in
a separate thread.
This commit is contained in:
Salvo 'LtWorf' Tomaselli 2015-12-21 00:54:05 +01:00
parent c8c894bb7b
commit 239e0e58dd
2 changed files with 33 additions and 23 deletions

View File

@ -1,6 +1,7 @@
2.2
- Added again make install target
- Ctrl+C in the terminal will terminate the GUI
- Blurs UI while processing
2.1
- Introduced sessions; GUI loads the same relations of the previous time

View File

@ -133,34 +133,43 @@ class relForm(QtWidgets.QMainWindow):
self.showRelation(self.selectedRelation)
def execute(self):
'''Executes the query'''
if self.multiline:
return self._run_multiline()
# Single line query
query = self.ui.txtQuery.text()
res_rel = self.ui.txtResult.text() # result relation's name
blur = QtWidgets.QGraphicsBlurEffect()
self.setGraphicsEffect(blur)
QtCore.QCoreApplication.processEvents()
try:
self.selectedRelation = self.user_interface.execute(query, res_rel)
self.updateRelations() # update the list
self.showRelation(self.selectedRelation)
except Exception as e:
return self.error(e)
'''Executes the query'''
if self.multiline:
return self._run_multiline()
# Adds to history
item = u'%s = %s' % (
self.ui.txtResult.text(),
self.ui.txtQuery.text()
)
hitem = QtWidgets.QListWidgetItem(None, 0)
hitem.setText(item)
self.ui.lstHistory.addItem(hitem)
self.ui.lstHistory.setCurrentItem(hitem)
# Single line query
query = self.ui.txtQuery.text()
res_rel = self.ui.txtResult.text() # result relation's name
try:
self.selectedRelation = self.user_interface.execute(query, res_rel)
self.updateRelations() # update the list
self.showRelation(self.selectedRelation)
except Exception as e:
return self.error(e)
# Adds to history
item = u'%s = %s' % (
self.ui.txtResult.text(),
self.ui.txtQuery.text()
)
hitem = QtWidgets.QListWidgetItem(None, 0)
hitem.setText(item)
self.ui.lstHistory.addItem(hitem)
self.ui.lstHistory.setCurrentItem(hitem)
self.qcounter += 1
# Sets the result relation name to none
self.ui.txtResult.setText(u"_last%d" % self.qcounter)
finally:
blur.setBlurRadius(0)
self.qcounter += 1
# Sets the result relation name to none
self.ui.txtResult.setText(u"_last%d" % self.qcounter)
def showRelation(self, rel):
'''Shows the selected relation into the table'''