예제 #1
0
파일: updater.py 프로젝트: vlegoff/cocomud
class DummyUpdater(wx.Frame):

    """Dummy updater, to which updaters should inherit."""

    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        self.autoupdater = None
        self.default_text = t("ui.message.update.loading")
        self.progress = 0

        # Event binding
        pub.subscribe(self.OnGauge, "gauge")
        pub.subscribe(self.OnText, "text")
        pub.subscribe(self.OnForceDestroy, "forceDestroy")
        pub.subscribe(self.OnResponseUpdate, "responseUpdate")

    def create_updater(self, just_checking=False):
        """Create a new autoupdater instance."""
        self.autoupdate = AutoUpdate(BUILD, self, just_checking=just_checking)
        self.autoupdate.start()

    def OnGauge(self, value=0):
        """The progress indicator changes."""
        pass

    def OnText(self, text=""):
        """The text of the indicator changes."""
        pass

    def OnForceDestroy(self):
        """Ask for the window's destruction."""
        pass

    def OnResponseUpdate(self, build=None):
        """The check for updates is complete."""
        pass

    def UpdateGauge(self, value):
        """Change the level indicator."""
        wx.CallAfter(pub.sendMessage, "gauge", value=value)

    def UpdateText(self, text):
        """Change the text."""
        wx.CallAfter(pub.sendMessage, "text", text=text)

    def AskDestroy(self):
        wx.CallAfter(pub.sendMessage, "forceDestroy")

    def ResponseUpdate(self, build):
        """The check for updates has responded.

        Note: the build parameter may be None (no update is available)
        or a number (updates are available).

        """
        wx.CallAfter(pub.sendMessage, "responseUpdate", build=build)
예제 #2
0
class DummyUpdater(wx.Frame):
    """Dummy updater, to which updaters should inherit."""
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        self.autoupdater = None
        self.default_text = t("ui.message.update.loading")
        self.progress = 0

        # Event binding
        pub.subscribe(self.OnGauge, "gauge")
        pub.subscribe(self.OnText, "text")
        pub.subscribe(self.OnForceDestroy, "forceDestroy")
        pub.subscribe(self.OnResponseUpdate, "responseUpdate")

    def create_updater(self, just_checking=False):
        """Create a new autoupdater instance."""
        self.autoupdate = AutoUpdate(BUILD, self, just_checking=just_checking)
        self.autoupdate.start()

    def OnGauge(self, value=0):
        """The progress indicator changes."""
        pass

    def OnText(self, text=""):
        """The text of the indicator changes."""
        pass

    def OnForceDestroy(self):
        """Ask for the window's destruction."""
        pass

    def OnResponseUpdate(self, build=None):
        """The check for updates is complete."""
        pass

    def UpdateGauge(self, value):
        """Change the level indicator."""
        wx.CallAfter(pub.sendMessage, "gauge", value=value)

    def UpdateText(self, text):
        """Change the text."""
        wx.CallAfter(pub.sendMessage, "text", text=text)

    def AskDestroy(self):
        wx.CallAfter(pub.sendMessage, "forceDestroy")

    def ResponseUpdate(self, build):
        """The check for updates has responded.

        Note: the build parameter may be None (no update is available)
        or a number (updates are available).

        """
        wx.CallAfter(pub.sendMessage, "responseUpdate", build=build)