Beispiel #1
0
 def destroy(self, button=None):
     """Die a horrible death."""
     for polygon in self.polygons:
         MapView.remove_layer(polygon)
     self.polygons.clear()
     self.widgets.trackfile_settings.destroy()
     del self.cache[self.filename]
     TrackFile.instances.discard(self)
     points.clear()
     for trackfile in TrackFile.instances:
         points.update(trackfile.tracks)
     TrackFile.update_range()
Beispiel #2
0
 def destroy(self, button=None):
     """Die a horrible death."""
     for polygon in self.polygons:
         MapView.remove_layer(polygon)
     self.polygons.clear()
     self.widgets.trackfile_settings.destroy()
     del self.cache[self.filename]
     TrackFile.instances.discard(self)
     points.clear()
     for trackfile in TrackFile.instances:
         points.update(trackfile.tracks)
     TrackFile.update_range()
    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)
Beispiel #4
0
    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)