~ubuntu-branches/ubuntu/maverick/awn-extras-applets/maverick

« back to all changes in this revision

Viewing changes to applets/maintained/weather/forecast.py

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-08-29 14:29:52 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100829142952-rhvuetyms9bv5uu7
Tags: upstream-0.4.0+bzr1372
ImportĀ upstreamĀ versionĀ 0.4.0+bzr1372

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
        """
47
47
        def cb(forecast):
48
 
            if forecast is not None and forecast != self.cachedForecast:
 
48
            if forecast is not None and (self.forecastDialog is None or forecast != self.cachedForecast):
49
49
                self.cachedForecast = forecast
50
50
 
51
51
                if self.forecastDialog is None:
59
59
        if self.cachedForecast is not None:
60
60
            self.forecastArea.set_forecast(self.cachedForecast)
61
61
 
 
62
    def finalize_dialog(self):
 
63
        if self.forecastDialog is not None:
 
64
            self.forecastDialog = None
 
65
            self.applet.dialog.unregister("main")
 
66
        self.forecastArea = None
 
67
 
62
68
    def setup_forecast_dialog(self):
63
69
        """Update the forecast dialog, either a placeholder if no forecast
64
70
        data exists, or the desired dialog (curved or normal).
67
73
 
68
74
        """
69
75
        if self.cachedForecast is not None:
70
 
            if self.forecastDialog is not None:
71
 
                del self.forecastDialog
72
 
                self.applet.dialog.unregister("main")
73
 
            if self.forecastArea is not None:
74
 
                del self.forecastArea
 
76
            self.finalize_dialog()
75
77
    
76
78
            if self.parent.applet.settings['curved_dialog']:
77
79
                self.forecastDialog = self.CurvedDialogWrapper(self.applet)