Пример #1
0
 def __init__(self, parent, font, clickedCallback, texts, default):
     self.texts = texts
     self.clickedCallback = clickedCallback 
     self.buttons = []
     btnId = 10000
     for text in self.texts:
         btn = GenButton(parent, id = btnId, label = text)
         btn.SetBezelWidth(0)
         btn.SetUseFocusIndicator(False)
         btn.SetBackgroundColour(basePurple)
         if text == default:
     		btn.SetForegroundColour(btnForegroundSel)
         else:			
            	btn.SetForegroundColour(btnForeground)
         btn.SetFont(font)
         btn.Bind(wx.EVT_LEFT_DOWN, self.OnDown)
         btn.Bind(wx.EVT_LEFT_UP, self.OnUp)
         btn.Bind(wx.EVT_LEFT_DCLICK, self.DoNothing)
         btn.Bind(wx.EVT_MOTION, self.DoNothing)
 	    self.buttons.append(btn)
         btnId+=1
 	self.current = default
class BalloonFrame(wx.Frame):
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 classparent=None):
        """
        Default class constructor.

        Used internally. Do not call directly this class in your application!
        """

        wx.Frame.__init__(self,
                          None,
                          -1,
                          "BalloonTip",
                          pos,
                          size,
                          style=wx.FRAME_SHAPED | wx.SIMPLE_BORDER
                          | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP)

        self._parent = classparent
        self._toptitle = self._parent._toptitle
        self._topicon = self._parent._topicon
        self._message = self._parent._message
        self._shape = self._parent._shape
        self._tipstyle = self._parent._tipstyle

        self._ballooncolour = self._parent._ballooncolour
        self._balloonmsgcolour = self._parent._balloonmsgcolour
        self._balloonmsgfont = self._parent._balloonmsgfont

        if self._toptitle != "":
            self._balloontitlecolour = self._parent._balloontitlecolour
            self._balloontitlefont = self._parent._balloontitlefont

        panel = wx.Panel(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        self.panel = panel

        subsizer = wx.BoxSizer(wx.VERTICAL)
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        subsizer.Add((0, 20), 0, wx.EXPAND)

        if self._topicon is not None:
            stb = wx.StaticBitmap(panel, -1, self._topicon)
            hsizer.Add(stb, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10)
            self._balloonbmp = stb

        if self._toptitle != "":
            stt = wx.StaticText(panel, -1, self._toptitle)
            stt.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False))
            if self._topicon is None:
                hsizer.Add((10, 0), 0, wx.EXPAND)

            hsizer.Add(stt, 1, wx.EXPAND | wx.TOP, 10)

            self._balloontitle = stt
            self._balloontitle.SetForegroundColour(self._balloontitlecolour)
            self._balloontitle.SetFont(self._balloontitlefont)

        if self._tipstyle == BT_BUTTON:
            self._closebutton = GenButton(panel, -1, "X", style=wx.NO_BORDER)
            self._closebutton.SetMinSize((16, 16))
            self._closebutton.SetFont(
                wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False))
            self._closebutton.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterButton)
            self._closebutton.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveButton)
            self._closebutton.SetUseFocusIndicator(False)
            if self._toptitle != "":
                hsizer.Add(self._closebutton, 0, wx.TOP | wx.RIGHT, 5)
            else:
                hsizer.Add((10, 0), 1, wx.EXPAND)
                hsizer.Add(self._closebutton, 0, wx.ALIGN_RIGHT | wx.TOP
                           | wx.RIGHT, 5)

        if self._topicon is not None or self._toptitle != "" \
           or self._tipstyle == BT_BUTTON:

            subsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 5)

        self._firstline = line = wx.StaticLine(panel,
                                               -1,
                                               style=wx.LI_HORIZONTAL)

        if self._topicon is not None or self._toptitle != "" \
           or self._tipstyle == BT_BUTTON:
            subsizer.Add(self._firstline, 0, wx.EXPAND | wx.LEFT | wx.RIGHT
                         | wx.BOTTOM, 10)
        else:
            subsizer.Add(self._firstline, 0, wx.EXPAND | wx.LEFT | wx.RIGHT
                         | wx.BOTTOM | wx.TOP, 10)

        mainstt = wx.StaticText(panel, -1, self._message)

        self._balloonmsg = mainstt
        self._balloonmsg.SetForegroundColour(self._balloonmsgcolour)
        self._balloonmsg.SetFont(self._balloonmsgfont)

        subsizer.Add(self._balloonmsg, 1,
                     wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)
        self._secondline = wx.StaticLine(panel, -1, style=wx.LI_HORIZONTAL)
        subsizer.Add(self._secondline, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
        subsizer.Add((0, 0), 1)
        panel.SetSizer(subsizer)

        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizerAndFit(sizer)
        sizer.Layout()

        if self._tipstyle == BT_CLICK:
            if self._toptitle != "":
                self._balloontitle.Bind(wx.EVT_LEFT_DOWN, self.OnClose)

            if self._topicon is not None:
                self._balloonbmp.Bind(wx.EVT_LEFT_DOWN, self.OnClose)

            self._balloonmsg.Bind(wx.EVT_LEFT_DOWN, self.OnClose)
            self.panel.Bind(wx.EVT_LEFT_DOWN, self.OnClose)

        elif self._tipstyle == BT_BUTTON:
            self._closebutton.Bind(wx.EVT_BUTTON, self.OnClose)

        self.panel.SetBackgroundColour(self._ballooncolour)

        if wx.Platform == "__WXGTK__":
            self.Bind(wx.EVT_WINDOW_CREATE, self.SetBalloonShape)
        else:
            self.SetBalloonShape()

        self.Show(True)

    def SetBalloonShape(self, event=None):
        """ Sets the balloon shape."""

        size = self.GetSize()
        pos = self.GetPosition()

        dc = wx.MemoryDC(wx.EmptyBitmap(1, 1))
        textlabel = self._balloonmsg.GetLabel()
        textfont = self._balloonmsg.GetFont()
        textextent = dc.GetFullTextExtent(textlabel, textfont)

        boxheight = size.y - textextent[1] * len(textlabel.split("\n"))
        boxwidth = size.x

        position = wx.GetMousePosition()

        xpos = position[0]
        ypos = position[1]

        if xpos > 20 and ypos > 20:

            # This Is NW Positioning
            positioning = "NW"
            xpos = position[0] - boxwidth + 20
            ypos = position[1] - boxheight - 20

        elif xpos <= 20 and ypos <= 20:

            # This Is SE Positioning
            positioning = "SE"
            xpos = position[0] - 20
            ypos = position[1]

        elif xpos > 20 and ypos <= 20:

            # This Is SW Positioning
            positioning = "SW"
            xpos = position[0] - boxwidth + 20
            ypos = position[1]

        else:

            # This Is NE Positioning
            positioning = "NE"
            xpos = position[0]
            ypos = position[1] - boxheight + 20

        bmp = wx.EmptyBitmap(size.x, size.y)
        dc = wx.BufferedDC(None, bmp)
        dc.BeginDrawing()
        dc.SetBackground(wx.Brush(wx.Colour(0, 0, 0), wx.SOLID))
        dc.Clear()
        dc.SetPen(wx.Pen(wx.Colour(0, 0, 0), 1, wx.TRANSPARENT))

        if self._shape == BT_ROUNDED:
            dc.DrawRoundedRectangle(0, 20, boxwidth, boxheight - 20, 12)

        elif self._shape == BT_RECTANGLE:
            dc.DrawRectangle(0, 20, boxwidth, boxheight - 20)

        if positioning == "NW":
            dc.DrawPolygon(
                ((boxwidth - 40, boxheight), (boxwidth - 20, boxheight + 20),
                 (boxwidth - 20, boxheight)))
        elif positioning == "SE":
            dc.DrawPolygon(((20, 20), (20, 0), (40, 20)))

        elif positioning == "SW":
            dc.DrawPolygon(
                ((boxwidth - 40, 20), (boxwidth - 20, 0), (boxwidth - 20, 20)))

        else:
            dc.DrawPolygon(
                ((20, boxheight), (20, boxheight + 20), (40, boxheight)))

        dc.EndDrawing()

        r = wx.RegionFromBitmapColour(bmp, wx.Colour(0, 0, 0))
        self.hasShape = self.SetShape(r)

        if self._tipstyle == BT_BUTTON:
            colour = self.panel.GetBackgroundColour()
            self._closebutton.SetBackgroundColour(colour)

        self.SetPosition((xpos, ypos))

    def OnEnterButton(self, event):
        """
        Handles the wx.EVT_ENTER_WINDOW for the BalloonTip button.

        When the BalloonTip is created with the tipstyle=BT_BUTTON, this event
        provide some kind of 3d effect when the mouse enters the button area.
        """

        button = event.GetEventObject()
        colour = button.GetBackgroundColour()
        red = colour.Red()
        green = colour.Green()
        blue = colour.Blue()

        if red < 30:
            red = red + 30
        if green < 30:
            green = green + 30
        if blue < 30:
            blue = blue + 30

        colour = wx.Colour(red - 30, green - 30, blue - 30)
        button.SetBackgroundColour(colour)
        button.SetForegroundColour(wx.WHITE)
        button.Refresh()
        event.Skip()

    def OnLeaveButton(self, event):
        """
        Handles the wx.EVT_LEAVE_WINDOW for the BalloonTip button.

        When the BalloonTip is created with the tipstyle=BT_BUTTON, this event
        restore the button appearance when the mouse leaves the button area.
        """

        button = event.GetEventObject()
        colour = self.panel.GetBackgroundColour()
        button.SetBackgroundColour(colour)
        button.SetForegroundColour(wx.BLACK)
        button.Refresh()
        event.Skip()

    def OnClose(self, event):
        """ Handles the wx.EVT_CLOSE event."""

        if isinstance(self._parent._widget, wx.TaskBarIcon):
            self._parent.taskbarcreation = 0
            self._parent.taskbartime.Stop()
            del self._parent.taskbartime
            del self._parent.BalloonFrame

        self.Destroy()
Пример #3
0
class BalloonFrame(wx.Frame):
    
    def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
                 size=wx.DefaultSize, classparent=None):
        """Default Class Constructor.

        Used Internally. Do Not Call Directly This Class In Your Application!
        """        
        global LoadNumber
        global MathsQNumber
        global StartTime
        
        self.loadNumber = LoadNumber
        self.mathsQNumber = MathsQNumber
        self.startTime = StartTime
        self.responseLogContent=globalTracker.RESPONSECODE.responseLogBuffer
        self.ResponseLogContent = self.responseLogContent 
        self.dialogID = "500006"
        self.dialogTag = "JAVA_UPDATE"
        wx.Frame.__init__(self, None, -1, "BalloonTip", pos, size,
                          style=wx.FRAME_SHAPED | 
                          wx.SIMPLE_BORDER | 
                          wx.FRAME_NO_TASKBAR | 
                          wx.STAY_ON_TOP)

        self._parent = classparent# parent is balloonTip
        #parent is not being used but since parent being set is taskbar6 we can use this to set the position of balloonTio
        self.widgetTosetBalloonTipPosn=parent
        self._toptitle = self._parent._toptitle
        self._topicon = self._parent._topicon
        self._message = self._parent._message
        self._shape = self._parent._shape
        self._tipstyle = self._parent._tipstyle

        self._ballooncolour = self._parent._ballooncolour
        self._balloonmsgcolour = self._parent._balloonmsgcolour
        self._balloonmsgfont = self._parent._balloonmsgfont

        if self._toptitle != "":
            self._balloontitlecolour = self._parent._balloontitlecolour
            self._balloontitlefont = self._parent._balloontitlefont

        panel = wx.Panel(self, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        
        self.panel = panel
        
        subsizer = wx.BoxSizer(wx.VERTICAL)
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        subsizer.Add((0, 20), 0, wx.EXPAND)
        
        if self._topicon is not None:
            stb = wx.StaticBitmap(panel, -1, self._topicon)
            hsizer.Add(stb, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10)
            self._balloonbmp = stb
            
        if self._toptitle != "":
            stt = wx.StaticText(panel, -1, self._toptitle)
            stt.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False))
            if self._topicon is None:
                hsizer.Add((10, 0), 0, wx.EXPAND)

            hsizer.Add(stt, 1, wx.EXPAND | wx.TOP, 10)
            self._balloontitle = stt
            self._balloontitle.SetForegroundColour(self._balloontitlecolour)
            self._balloontitle.SetFont(self._balloontitlefont)

        if self._tipstyle == BT_BUTTON:
            self._closebutton = GenButton(panel, -1, "X", style=wx.NO_BORDER)
            self._closebutton.SetMinSize((16, 16))
            self._closebutton.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD, False))
            self._closebutton.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterButton)
            self._closebutton.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveButton)
            self._closebutton.SetUseFocusIndicator(False)
            if self._toptitle != "":
                hsizer.Add(self._closebutton, 0, wx.TOP | wx.RIGHT, 5)
            else:
                hsizer.Add((10, 0), 1, wx.EXPAND)
                hsizer.Add(self._closebutton, 0, wx.ALIGN_RIGHT | wx.TOP
                           | wx.RIGHT, 5)
            
        if self._topicon is not None or self._toptitle != "" \
           or self._tipstyle == BT_BUTTON:
            
            subsizer.Add(hsizer, 0, wx.EXPAND | wx.BOTTOM, 5)
        mainstt = wx.StaticText(panel, -1, self._message)

        self._balloonmsg = mainstt
        self._balloonmsg.SetForegroundColour(self._balloonmsgcolour)
        self._balloonmsg.SetFont(self._balloonmsgfont)
        
        padsizer = wx.BoxSizer(wx.HORIZONTAL)
        
        padsizer.Add((29, 1))
        padsizer.Add(self._balloonmsg)
        subsizer.Add(padsizer, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | 
                     wx.BOTTOM, 10)
        subsizer.Add((0, 0), 1)
        panel.SetSizer(subsizer)
        
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizerAndFit(sizer)
        sizer.Layout()

        if self._tipstyle == BT_CLICK:
            if self._toptitle != "":
                self._balloontitle.Bind(wx.EVT_LEFT_DOWN, self.OnClose)

            if self._topicon is not None:
                self._balloonbmp.Bind(wx.EVT_LEFT_DOWN, self.OnClose)
                
            self._balloonmsg.Bind(wx.EVT_LEFT_DOWN, self.OnClose)
            self.panel.Bind(wx.EVT_LEFT_DOWN, self.OnClose)

        elif self._tipstyle == BT_BUTTON:
            self._closebutton.Bind(wx.EVT_BUTTON, self.OnClose)
            self._balloonmsg.Bind(wx.EVT_LEFT_DOWN, self.OnBalloonPress)

        self.panel.SetBackgroundColour(self._ballooncolour)
        
        if wx.Platform == "__WXGTK__":
            self.Bind(wx.EVT_WINDOW_CREATE, self.SetBalloonShape)
        else:
            self.SetBalloonShape()

        self.Show(True)
    
    def getDialogTag(self):
        return self.dialogTag
    
    def getDialogID(self):
        return self.dialogID
    
    def SetBalloonShape(self, event=None):
        """Sets The Balloon Shape."""

        size = self.GetSize()
        dc = wx.MemoryDC()
        textlabel = self._balloonmsg.GetLabel()
        textfont = self._balloonmsg.GetFont()
        textextent = dc.GetFullTextExtent(textlabel, textfont)

        boxheight = size.y - textextent[1] * len(textlabel.split("\n\r"))
        boxwidth = size.x
 #TODO:  here it takes the mouse position. Instead we have to position it such that it comes out from the taskbar 
#         position = wx.GetMousePosition()
        position=self.widgetTosetBalloonTipPosn.GetScreenPosition()
        print self.widgetTosetBalloonTipPosn.GetScreenPosition()
        position[0]=wx.GetDisplaySize()[0]-40
        
        xpos = position[0]
        ypos = position[1]

        if xpos > 20 and ypos > 20:
            
            # This Is NW Positioning
            positioning = "NW"
            xpos = position[0] - boxwidth + 20
            ypos = position[1] - boxheight - 20
            
        elif xpos <= 20 and ypos <= 20:

            # This Is SE Positioning
            positioning = "SE"
            xpos = position[0] - 20
            ypos = position[1] 

        elif xpos > 20 and ypos <= 20:

            # This Is SW Positioning
            positioning = "SW"
            xpos = position[0] - boxwidth + 20
            ypos = position[1] 

        else:

            # This Is NE Positioning
            positioning = "NE"
            xpos = position[0] 
            ypos = position[1] - boxheight + 20
             
        bmp = wx.EmptyBitmap(size.x, size.y)
        dc = wx.BufferedDC(None, bmp)
        dc.BeginDrawing()
        dc.SetBackground(wx.Brush(wx.Colour(0, 0, 0), wx.SOLID))
        dc.Clear()
        dc.SetPen(wx.Pen(wx.Colour(0, 0, 0), 1, wx.TRANSPARENT))

        if self._shape == BT_ROUNDED:
            dc.DrawRoundedRectangle(0, 20, boxwidth, boxheight - 20, 12)
                
        elif self._shape == BT_RECTANGLE:
            dc.DrawRectangle(0, 20, boxwidth, boxheight - 20)

        if positioning == "NW":
            dc.DrawPolygon(((boxwidth - 40, boxheight), (boxwidth - 20, boxheight + 20),
                            (boxwidth - 20, boxheight)))
        elif positioning == "SE":
            dc.DrawPolygon(((20, 20), (20, 0), (40, 20)))

        elif positioning == "SW":
            dc.DrawPolygon(((boxwidth - 40, 20), (boxwidth - 20, 0), (boxwidth - 20, 20)))

        else:
            dc.DrawPolygon(((20, boxheight), (20, boxheight + 20), (40, boxheight)))
            
        dc.EndDrawing()

        r = wx.RegionFromBitmapColour(bmp, wx.Colour(0, 0, 0))
        self.hasShape = self.SetShape(r)

        if self._tipstyle == BT_BUTTON:
            colour = self.panel.GetBackgroundColour()
            self._closebutton.SetBackgroundColour(colour)

        self.SetPosition((xpos, ypos))
        

    def OnEnterButton(self, event):
        """Handles The wx.EVT_ENTER_WINDOW For The BalloonTip Button.

        When The BalloonTip Is Created With The TipStyle=BT_BUTTON, This Event
        Provide Some Kind Of 3D Effect When The Mouse Enters The Button Area.
        """
        
        button = event.GetEventObject()
        colour = button.GetBackgroundColour()
        red = colour.Red()
        green = colour.Green()
        blue = colour.Blue()
        
        if red < 30:
            red = red + 30
        if green < 30:
            green = green + 30
        if blue < 30:
            blue = blue + 30
            
        colour = wx.Colour(red - 30, green - 30, blue - 30)
        button.SetBackgroundColour(colour)
        button.SetForegroundColour(wx.WHITE)
        button.Refresh()
        event.Skip()


    def OnLeaveButton(self, event):
        """Handles The wx.EVT_LEAVE_WINDOW For The BalloonTip Button.

        When The BalloonTip Is Created With The TipStyle=BT_BUTTON, This Event
        Restore The Button Appearance When The Mouse Leaves The Button Area.
        """
        
        button = event.GetEventObject()
        colour = self.panel.GetBackgroundColour()
        button.SetBackgroundColour(colour)
        button.SetForegroundColour(wx.BLACK)
        button.Refresh()
        event.Skip()
        
    def BalloonIgnore(self):
        #print "Test Event on Ignore - success"
        #self.responseLogContent=ResponseLogContent
        globalTracker.math.changeStatusFromInitializedToClosed(self.mathsQNumber, self.loadNumber)
        RESPONSECODE.previousResponse=RESPONSECODE.currentResponse
        RESPONSECODE.previousResponseCode=RESPONSECODE.currentResponseCode
        RESPONSECODE.currentResponse=RESPONSECODE.JAVA_UPDATE_IGNORED
        RESPONSECODE.currentResponseCode=RESPONSECODE.RESPONSE[RESPONSECODE.currentResponse]
        self.ResponseLogContent+="\t".join(( "" , "" , self.getDialogID() , self.getDialogTag() , RESPONSECODE.currentResponse , RESPONSECODE.currentResponseCode, RESPONSECODE.previousResponse, RESPONSECODE.previousResponseCode, self.startTime, (time.strftime("%H:%M:%S", time.localtime())), CONSTANTS.date_today, "\n"))
        RESPONSECODE.SNo+=1
        globalTracker.utils.write(globalTracker.propertyVar.responseLog, str(RESPONSECODE.SNo)+"\t"+self.ResponseLogContent) 
        
    def OnClose(self, event):
        """ Handles The wx.EVT_CLOSE Event."""

        if isinstance(self._parent._widget, wx.TaskBarIcon):
            self._parent.taskbarcreation = 0
            self._parent.taskbartime.Stop()
            del self._parent.taskbartime
            del self._parent.BalloonFrame
            
        self.Destroy()
        globalTracker.math.changeStatusFromInitializedToClosed(self.mathsQNumber, self.loadNumber)
        RESPONSECODE.previousResponse=RESPONSECODE.currentResponse
        RESPONSECODE.previousResponseCode=RESPONSECODE.currentResponseCode
        RESPONSECODE.currentResponse=RESPONSECODE.JAVA_UPDATE_CLOSE
        RESPONSECODE.currentResponseCode=RESPONSECODE.RESPONSE[RESPONSECODE.currentResponse]
        self.responseLogContent+="\t".join(( "" , "" , self.getDialogID() , self.getDialogTag() , RESPONSECODE.currentResponse , RESPONSECODE.currentResponseCode, RESPONSECODE.previousResponse, RESPONSECODE.previousResponseCode, self.startTime, (time.strftime("%H:%M:%S", time.localtime())), CONSTANTS.date_today, "\n"))
        RESPONSECODE.SNo+=1
        globalTracker.utils.write(globalTracker.propertyVar.responseLog, str(RESPONSECODE.SNo)+"\t"+self.responseLogContent)        

    def OnBalloonPress(self,event):
        """Handle balloon press event"""
        self.Destroy()
        max = 20        
        RESPONSECODE.previousResponse = RESPONSECODE.currentResponse
        RESPONSECODE.previousResponseCode = RESPONSECODE.currentResponseCode
        RESPONSECODE.currentResponse = RESPONSECODE.JAVA_UPDATE_OK
        RESPONSECODE.currentResponseCode = RESPONSECODE.RESPONSE[RESPONSECODE.currentResponse]
#        
        self.responseLogContent=globalTracker.RESPONSECODE.responseLogBuffer 
        dlg = wx.ProgressDialog("Java updates",
                               "Updates are being installed... ",
                               maximum=max,
                               parent=None,
                               style= wx.PD_AUTO_HIDE
                                | wx.PD_ELAPSED_TIME
                                | wx.PD_ESTIMATED_TIME
                                | wx.PD_REMAINING_TIME | wx.PD_SMOOTH
                                )
  
#         dlg = MyProgressDialog(parent=None, id=-1, title="Automatic updates", text="Updates are being installed... ")
#         self.Bind(wx.EVT_CLOSE, self.onProgressBarClosed, dlg)
#         re = dlg.ShowModal()
#         print re
        keepGoing = True
        count = 0
#         
        st = wx.GetCurrentTime()
        
        while keepGoing and count < max:
            count += 1
            wx.MilliSleep(200)
   
            if count >= max:
                dlg.Destroy()
                globalTracker.math.changeStatusFromInitializedToClosed(self.mathsQNumber, self.loadNumber)
            else:
                (keepGoing, skip) = dlg.Update(count)
        dlg.ShowModal()
       
        if keepGoing == False:
            # progressDialog is closed by the user when the update returns False on this method
            RESPONSECODE.currentResponse += "|" + RESPONSECODE.PROGRESSBAR_INCOMPLETE
            dlg.Destroy()
        else:
            RESPONSECODE.currentResponse += "|" + RESPONSECODE.PROGRESSBAR_COMPLETE
            dlg.Destroy()
        
        self.responseLogContent+="\t".join(( "" , "" , self.getDialogID() , self.getDialogTag() , RESPONSECODE.currentResponse , RESPONSECODE.currentResponseCode, RESPONSECODE.previousResponse, RESPONSECODE.previousResponseCode, self.startTime, (time.strftime("%H:%M:%S", time.localtime())), CONSTANTS.date_today, "\n"))

        RESPONSECODE.SNo += 1
        globalTracker.utils.write(globalTracker.propertyVar.responseLog, str(RESPONSECODE.SNo) + "\t" + self.responseLogContent)
        self.responseLogContent=globalTracker.RESPONSECODE.responseLogBuffer