def test_timezone_lookups(): """Ensure that the timezone can be discovered from the map""" # Be very careful to reset everything so that we're sure that # we're not just finding the timezone from gsettings. teardown() gst = GSettings('camera', 'canon_canon_powershot_a590_is') gst.reset('found-timezone') gst.reset('offset') gst.set_string('timezone-method', 'lookup') Camera.cache.clear() # Open just the GPX gui.open_files(GPXFILES) # At this point the camera hasn't been informed of the timezone assert gst.get_string('found-timezone') == '' # Opening a photo should place it on the map. gui.open_files([IMGFILES[0]]) print(Camera.instances) print(gst.get_string('found-timezone')) assert gst.get_string('found-timezone') == 'America/Edmonton' assert Photograph.instances assert Camera.instances photo = list(Photograph.instances).pop() assert photo.latitude == 53.530476 assert photo.longitude == -113.450635
def __init__(self, filename, root, watch): self.watchlist = watch self.filename = filename self.progress = Widgets.progressbar self.polygons = set() self.widgets = Builder('trackfile') self.append = None self.tracks = {} self.clock = clock() self.gst = GSettings('trackfile', basename(filename)) if self.gst.get_string('start-timezone') is '': # Then this is the first time this file has been loaded # and we should honor the user-selected global default # track color instead of using the schema-defined default self.gst.set_value('track-color', Gst.get_value('track-color')) self.gst.bind_with_convert( 'track-color', self.widgets.colorpicker, 'color', lambda x: Gdk.Color(*x), lambda x: (x.red, x.green, x.blue)) self.widgets.trackfile_label.set_text(basename(filename)) self.widgets.unload.connect('clicked', self.destroy) self.widgets.colorpicker.set_title(basename(filename)) self.widgets.colorpicker.connect('color-set', track_color_changed, self.polygons) Widgets.trackfile_unloads_group.add_widget(self.widgets.unload) Widgets.trackfile_colors_group.add_widget(self.widgets.colorpicker) Widgets.trackfiles_group.add_widget(self.widgets.trackfile_label) self.parse(filename, root, watch, self.element_start, self.element_end) if not self.tracks: raise OSError('No points found') points.update(self.tracks) keys = self.tracks.keys() self.alpha = min(keys) self.omega = max(keys) self.start = Coordinates(latitude = self.tracks[self.alpha].lat, longitude = self.tracks[self.alpha].lon) self.gst.set_string('start-timezone', self.start.lookup_geodata()) Widgets.trackfiles_view.add(self.widgets.trackfile_settings)
def __init__(self, camera_id): GObject.GObject.__init__(self) self.id = camera_id self.photos = set() # Bind properties to settings self.gst = GSettings('camera', camera_id) for prop in self.gst.list_keys(): self.gst.bind(prop, self) # Get notifications when properties are changed self.connect('notify::offset', self.offset_handler) self.connect('notify::timezone-method', self.timezone_handler) self.connect('notify::timezone-city', self.timezone_handler) self.connect('notify::utc-offset', self.timezone_handler)