From: Michael Curran Date: Fri, 27 Apr 2012 02:00:30 +0000 (+1000) Subject: gui: move IndeterminateProgressDialog out of installerGui.py and into __init__.py... X-Git-Tag: jpdev130418~877^2~24 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=74b1a3feee4b0f47a5eb21cc283317b22f061b11;p=nvdajp%2Fnvdajp.git gui: move IndeterminateProgressDialog out of installerGui.py and into __init__.py so it can be used by more code. --- diff --git a/source/gui/__init__.py b/source/gui/__init__.py index a2c49f801..ea8b70bc1 100644 --- a/source/gui/__init__.py +++ b/source/gui/__init__.py @@ -11,6 +11,7 @@ import threading import ctypes import wx import globalVars +import tones import ui from logHandler import log import config @@ -611,3 +612,23 @@ class ExecAndPump(threading.Thread): self.func(*self.args,**self.kwargs) except Exception as e: self.threadExc=e + +class IndeterminateProgressDialog(wx.ProgressDialog): + + def __init__(self, parent, title, message): + super(IndeterminateProgressDialog, self).__init__(title, message, parent=parent) + self.timer = wx.PyTimer(self.Pulse) + self.timer.Start(1000) + self.Raise() + + def Pulse(self): + super(IndeterminateProgressDialog, self).Pulse() + if self.IsActive(): + tones.beep(440, 40) + + def done(self): + self.timer.Stop() + if self.IsActive(): + tones.beep(1760, 40) + self.Hide() + self.Destroy() diff --git a/source/gui/installerGui.py b/source/gui/installerGui.py index cc8cdfe13..758dace27 100644 --- a/source/gui/installerGui.py +++ b/source/gui/installerGui.py @@ -16,7 +16,7 @@ import gui import tones def doInstall(createDesktopShortcut,startOnLogon,isUpdate,silent=False): - progressDialog = IndeterminateProgressDialog(gui.mainFrame, + progressDialog = gui.IndeterminateProgressDialog(gui.mainFrame, # Translators: The title of the dialog presented while NVDA is being updated. _("Updating NVDA") if isUpdate # Translators: The title of the dialog presented while NVDA is being installed. @@ -107,26 +107,6 @@ class InstallerDialog(wx.Dialog): def onCancel(self, evt): self.Destroy() -class IndeterminateProgressDialog(wx.ProgressDialog): - - def __init__(self, parent, title, message): - super(IndeterminateProgressDialog, self).__init__(title, message, parent=parent) - self.timer = wx.PyTimer(self.Pulse) - self.timer.Start(1000) - self.Raise() - - def Pulse(self): - super(IndeterminateProgressDialog, self).Pulse() - if self.IsActive(): - tones.beep(440, 40) - - def done(self): - self.timer.Stop() - if self.IsActive(): - tones.beep(1760, 40) - self.Hide() - self.Destroy() - class PortableCreaterDialog(wx.Dialog): def __init__(self, parent): @@ -201,7 +181,7 @@ class PortableCreaterDialog(wx.Dialog): self.Destroy() def doCreatePortable(portableDirectory,createAutorun=False,copyUserConfig=False): - d = IndeterminateProgressDialog(gui.mainFrame, + d = gui.IndeterminateProgressDialog(gui.mainFrame, # Translators: The title of the dialog presented while a portable copy of NVDA is bieng created. _("Creating Portable Copy"), # Translators: The message displayed while a portable copy of NVDA is bieng created.