Commit 00c4d6e3 authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix with QVectorsPlugin when trying to close the first q vectors tab

Bug fix with SphericalQVectors (no status start defined)
parent 3463d2d4
......@@ -228,16 +228,13 @@ class QVectorsPlugin(UserDefinitionPlugin):
self.Destroy()
def on_close_tab(self, event):
if event.GetSelection() == 0:
qPanel = event.GetEventObject().GetPage(event.GetSelection())
if qPanel.progress.is_running():
d = wx.MessageDialog(None, 'The background task is still running. You must cancel it before closing this tab.', 'Warning', wx.OK|wx.ICON_WARNING)
d.ShowModal()
event.Veto()
else:
qPanel = event.GetEventObject().GetPage(event.GetSelection())
if qPanel.progress.is_running():
d = wx.MessageDialog(None, 'The background task is still running. You must cancel it before closing this tab.', 'Warning', wx.OK|wx.ICON_WARNING)
d.ShowModal()
event.Veto()
return
return
def generate_q_vectors(self,generator):
......
......@@ -59,6 +59,9 @@ class SphericalQVectors(IQVectors):
nVectors = self._configuration["n_vectors"]["value"]
self._configuration["q_vectors"] = {}
if self._status is not None:
self._status.start(len(self._configuration["shells"]["value"]))
for q in self._configuration["shells"]["value"]:
......
......@@ -43,8 +43,10 @@ class ProgressBar(wx.Panel,Status):
def start_status(self):
print self.nSteps, self.currentStep
self._stop.Enable()
self._progress.SetValue(self.currentStep)
self._progress.SetValue(0)
self._progress.SetRange(self.nSteps)
self._progress.SetBarColor(wx.GREEN)
......@@ -54,6 +56,6 @@ class ProgressBar(wx.Panel,Status):
self._progress.Refresh()
def update_status(self):
self._progress.SetValue(self.currentStep)
self._progress.Refresh()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment