~gnome15-team/gnome15/trunk

« back to all changes in this revision

Viewing changes to gnome15-plugins/src/clock/clock.py

  • Committer: tanktarta
  • Date: 2012-11-24 10:27:36 UTC
  • Revision ID: tanktarta-20121124102736-0drhasy3jdn862wx
0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    display_date.set_active(gconf_client.get_bool(gconf_key + "/display_date"))
77
77
    display_date.connect("toggled", _changed, gconf_key + "/display_date", gconf_client)
78
78
    
 
79
    use_24hr_format = widget_tree.get_object("TwentFourHourCheckbox")
 
80
    use_24hr_format.set_active(gconf_client.get_bool(gconf_key + "/use_24hr_format"))
 
81
    use_24hr_format.connect("toggled", _changed, gconf_key + "/use_24hr_format", gconf_client)
 
82
    
79
83
    dialog.run()
80
84
    dialog.hide()
81
85
 
180
184
        The watch function is used, as this will automatically track the monitor handles
181
185
        and clean them up when the plugin is deactivated
182
186
        '''        
183
 
        self.watch(None, self._config_changed);
 
187
        self.watch(None, self._config_changed)
184
188
    
185
189
    def deactivate(self):
186
190
        g15plugin.G15Plugin.deactivate(self)
304
308
    def _load_configuration(self):
305
309
        self.display_date = self.gconf_client.get_bool(self.gconf_key + "/display_date")
306
310
        self.display_seconds = self.gconf_client.get_bool(self.gconf_key + "/display_seconds")
 
311
        self.use_24hr_format = self.gconf_client.get_bool(self.gconf_key + "/use_24hr_format")
307
312
        
308
313
    def _redraw(self):
309
314
        '''
351
356
        Get the details to display and place them as properties which are passed to
352
357
        the theme
353
358
        '''
354
 
        time_format = "%H:%M"
355
 
        properties["time_nosec"] = datetime.datetime.now().strftime(time_format)
356
 
        if self.display_seconds:
357
 
            time_format = "%H:%M:%S"
358
 
        properties["time"] = datetime.datetime.now().strftime(time_format)            
 
359
        now = datetime.datetime.now()
 
360
        if self.use_24hr_format:
 
361
            properties["time"] = g15locale.format_time_24hour(now, self.gconf_client, self.display_seconds)
 
362
        else:
 
363
            properties["time"] = g15locale.format_time(now, self.gconf_client, self.display_seconds)
359
364
        if self.display_date:
360
 
            properties["date"] = datetime.datetime.now().strftime(locale.nl_langinfo(locale.D_FMT))
 
365
            properties["date"] = g15locale.format_date(now, self.gconf_client)
361
366
            
362
367
        return properties