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:
parent
c8c894bb7b
commit
239e0e58dd
@ -1,6 +1,7 @@
|
|||||||
2.2
|
2.2
|
||||||
- Added again make install target
|
- Added again make install target
|
||||||
- Ctrl+C in the terminal will terminate the GUI
|
- Ctrl+C in the terminal will terminate the GUI
|
||||||
|
- Blurs UI while processing
|
||||||
|
|
||||||
2.1
|
2.1
|
||||||
- Introduced sessions; GUI loads the same relations of the previous time
|
- Introduced sessions; GUI loads the same relations of the previous time
|
||||||
|
@ -133,34 +133,43 @@ class relForm(QtWidgets.QMainWindow):
|
|||||||
self.showRelation(self.selectedRelation)
|
self.showRelation(self.selectedRelation)
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
'''Executes the query'''
|
|
||||||
if self.multiline:
|
|
||||||
return self._run_multiline()
|
|
||||||
|
|
||||||
# Single line query
|
blur = QtWidgets.QGraphicsBlurEffect()
|
||||||
query = self.ui.txtQuery.text()
|
self.setGraphicsEffect(blur)
|
||||||
res_rel = self.ui.txtResult.text() # result relation's name
|
QtCore.QCoreApplication.processEvents()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.selectedRelation = self.user_interface.execute(query, res_rel)
|
'''Executes the query'''
|
||||||
self.updateRelations() # update the list
|
if self.multiline:
|
||||||
self.showRelation(self.selectedRelation)
|
return self._run_multiline()
|
||||||
except Exception as e:
|
|
||||||
return self.error(e)
|
|
||||||
|
|
||||||
# Adds to history
|
# Single line query
|
||||||
item = u'%s = %s' % (
|
query = self.ui.txtQuery.text()
|
||||||
self.ui.txtResult.text(),
|
res_rel = self.ui.txtResult.text() # result relation's name
|
||||||
self.ui.txtQuery.text()
|
|
||||||
)
|
try:
|
||||||
hitem = QtWidgets.QListWidgetItem(None, 0)
|
self.selectedRelation = self.user_interface.execute(query, res_rel)
|
||||||
hitem.setText(item)
|
self.updateRelations() # update the list
|
||||||
self.ui.lstHistory.addItem(hitem)
|
self.showRelation(self.selectedRelation)
|
||||||
self.ui.lstHistory.setCurrentItem(hitem)
|
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):
|
def showRelation(self, rel):
|
||||||
'''Shows the selected relation into the table'''
|
'''Shows the selected relation into the table'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user