diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 76349e7fd..ba46c7ee0 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -341,6 +341,8 @@ class MainFrame(wx.Frame): saveDialog.Destroy() def closeWaitDialog(self): + if self.waitDialog.timer.IsRunning(): + self.waitDialog.timer.Stop() self.waitDialog.Destroy() def toggleShipBrowser(self, event): @@ -360,7 +362,28 @@ class MainFrame(wx.Frame): class WaitDialog(wx.Dialog): def __init__(self, parent): - wx.Dialog.__init__ (self, parent, id=wx.ID_ANY, title=u"Please wait ...", size=wx.Size(200, 100), - style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL) + wx.Dialog.__init__ (self, parent, id=wx.ID_ANY, title=u"Please wait ...", size=(200,30), + style=wx.NO_BORDER) + mainSizer = wx.BoxSizer( wx.HORIZONTAL ) - wx.StaticText(self, wx.ID_ANY, "Please wait ...") + self.progress = wx.Gauge( self, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL | wx.GA_SMOOTH ) + mainSizer.Add( self.progress, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 0 ) + self.progress.SetRange(20) + self.progress.SetValue(0) + self.cycle = 0 + self.SetSizer( mainSizer ) + self.Layout() + self.timer = wx.Timer(self,wx.ID_ANY) + self.timer.Start(100) + self.Bind(wx.EVT_CLOSE,self.OnClose) + self.Bind(wx.EVT_TIMER,self.OnTimer) + self.CenterOnParent() + + def OnTimer(self, event): + self.cycle += 1 + if self.cycle > self.progress.GetRange(): + self.cycle = 0 + self.progress.SetValue(self.cycle) + + def OnClose(self, event): + pass