def set_timezone(self): """Set the timezone to the given zone and update all photos.""" if 'TZ' in environ: del environ['TZ'] if gst.get_boolean('lookup-timezone'): environ['TZ'] = self.gpx_timezone elif gst.get_boolean('custom-timezone'): region = self.region.get_active_id() city = self.cities.get_active_id() if region is not None and city is not None: environ['TZ'] = '%s/%s' % (region, city) tzset() for photo in photos.values(): photo.calculate_timestamp() auto_timestamp_comparison(photo)
def preferences_dialog(self, button, dialog, region, cities, colorpicker): """Allow the user to configure this application.""" previous = Struct({ 'system': gst.get_boolean('system-timezone'), 'lookup': gst.get_boolean('lookup-timezone'), 'custom': gst.get_boolean('custom-timezone'), 'region': region.get_active(), 'city': cities.get_active(), 'color': colorpicker.get_current_color() }) if not dialog.run(): colorpicker.set_current_color(previous.color) colorpicker.set_previous_color(previous.color) gst.set_boolean('system-timezone', previous.system) gst.set_boolean('lookup-timezone', previous.lookup) gst.set_boolean('custom-timezone', previous.custom) region.set_active(previous.region) cities.set_active(previous.city) dialog.hide()