コード例 #1
0
    def load_from_file(uri):
        """Determine the correct subclass to instantiate.

        Also time everything and report how long it took. Raises OSError if
        the file extension is unknown, or no track points were found.
        """
        start_time = clock()

        try:
            gpx = globals()[uri[-3:].upper() + 'File'](uri)
        except KeyError:
            raise OSError

        Widgets.status_message(
            _('%d points loaded in %.2fs.') %
            (len(gpx.tracks), clock() - start_time), True)

        if len(gpx.tracks) < 2:
            return

        TrackFile.instances.add(gpx)
        MapView.emit('realize')
        MapView.set_zoom_level(MapView.get_max_zoom_level())
        MapView.ensure_visible(TrackFile.get_bounding_box(), False)

        TrackFile.update_range()
        Camera.set_all_found_timezone(gpx.start.geotimezone)
コード例 #2
0
ファイル: photos.py プロジェクト: apapillon/gottengeography
    def load_from_file(uri):
        """Coordinates instantiation of various classes.

        Ensures that related Photograph, Camera, CameraView, and Label are all
        instantiated together.
        """
        photo = Photograph(uri)

        Label(photo)

        photo.read()

        Widgets.empty_camera_list.hide()

        camera_id, camera_name = Camera.generate_id(photo.camera_info)
        camera = Camera(camera_id)
        camera.add_photo(photo)

        CameraView(camera, camera_name)

        # If the user has selected the lookup method, then the timestamp
        # was probably calculated incorrectly the first time (before the
        # timezone was discovered). So call it again to get the correct value.
        if camera.timezone_method == 'lookup':
            photo.calculate_timestamp(camera.offset)

        Widgets.button_sensitivity()

        return photo
コード例 #3
0
ファイル: xmlfiles.py プロジェクト: akadig/gottengeography
    def load_from_file(uri):
        """Determine the correct subclass to instantiate.

        Also time everything and report how long it took. Raises OSError if
        the file extension is unknown, or no track points were found.
        """
        start_time = clock()

        try:
            gpx = globals()[uri[-3:].upper() + 'File'](uri)
        except KeyError:
            raise OSError

        Widgets.status_message(_('%d points loaded in %.2fs.') %
            (len(gpx.tracks), clock() - start_time), True)

        if len(gpx.tracks) < 2:
            return

        TrackFile.instances.add(gpx)
        MapView.emit('realize')
        MapView.set_zoom_level(MapView.get_max_zoom_level())
        MapView.ensure_visible(TrackFile.get_bounding_box(), False)

        TrackFile.update_range()
        Camera.set_all_found_timezone(gpx.start.geotimezone)
コード例 #4
0
def animate_in(anim=True):
    """Fade in all the map actors."""
    for i in range(Gst.get_int('animation-steps') if anim else 1, 0, -1):
        for actor in (Crosshair, Box, Scale):
            actor.set_opacity(256 - i)
        Widgets.redraw_interface()
        sleep(0.01)
コード例 #5
0
ファイル: photos.py プロジェクト: akadig/gottengeography
    def load_from_file(uri):
        """Coordinates instantiation of various classes.

        Ensures that related Photograph, Camera, CameraView, and Label are all
        instantiated together.
        """
        photo = Photograph(uri)

        Label(photo)

        photo.read()

        Widgets.empty_camera_list.hide()

        camera_id, camera_name = Camera.generate_id(photo.camera_info)
        camera = Camera(camera_id)
        camera.add_photo(photo)

        CameraView(camera, camera_name)

        # If the user has selected the lookup method, then the timestamp
        # was probably calculated incorrectly the first time (before the
        # timezone was discovered). So call it again to get the correct value.
        if camera.timezone_method == 'lookup':
            photo.calculate_timestamp(camera.offset)

        Widgets.button_sensitivity()

        return photo
コード例 #6
0
ファイル: actor.py プロジェクト: TheNeuralBit/gottengeography
def animate_in(anim=True):
    """Fade in all the map actors."""
    for i in range(Gst.get_int('animation-steps') if anim else 1, 0, -1):
        for actor in (Crosshair, Box, Scale):
            actor.set_opacity(256 - i)
        Widgets.redraw_interface()
        sleep(0.01)
コード例 #7
0
ファイル: search.py プロジェクト: telkel/gottengeography
 def search_completed(self, entry, model, itr):
     """Go to the selected location."""
     self.last_search = itr.copy()
     MapView.emit('realize')
     MapView.set_zoom_level(MapView.get_max_zoom_level())
     Widgets.redraw_interface()
     MapView.center_on(*model.get(itr, LATITUDE, LONGITUDE))
     MapView.set_zoom_level(11)
コード例 #8
0
def test_gtk_builder():
    """GtkBuilder should be creating some widgets for us"""
    assert Widgets.loaded_photos.get_n_columns() == 4
    assert Widgets.search_results.get_n_columns() == 3
    size = Widgets.main.get_size()
    assert size[1] > 300
    assert size[0] > 400
    assert Widgets.photos_selection.count_selected_rows() == 0
    assert Widgets.error_message is Widgets["error_message"]
    assert Widgets.photos_selection is Widgets.get_object("photos_view").get_selection()
コード例 #9
0
def test_gtk_builder():
    """GtkBuilder should be creating some widgets for us"""
    assert Widgets.loaded_photos.get_n_columns() == 4
    assert Widgets.search_results.get_n_columns() == 3
    size = Widgets.main.get_size()
    assert size[1] > 300
    assert size[0] > 400
    assert Widgets.photos_selection.count_selected_rows() == 0
    assert Widgets.error_message is Widgets['error_message']
    assert Widgets.photos_selection is \
        Widgets.get_object('photos_view').get_selection()
コード例 #10
0
 def offset_handler(self, *ignore):
     """When the offset is changed, update the loaded photos."""
     for i, photo in enumerate(self.photos):
         if not i % 10:
             Widgets.redraw_interface()
         photo.calculate_timestamp(self.offset)
コード例 #11
0
 def offset_handler(self, *ignore):
     """When the offset is changed, update the loaded photos."""
     for i, photo in enumerate(self.photos):
         if not i % 10:
             Widgets.redraw_interface()
         photo.calculate_timestamp(self.offset)