示例#1
0
 def update_highlights(self, selection):
     """Ensure only the selected labels are highlighted."""
     selection_exists = selection.count_selected_rows() > 0
     selected.clear()
     for label in MarkerLayer.get_markers():
         photo = label.photo
         itr = photo.iter
         if itr and selection.iter_is_selected(itr):
             selected.add(photo)
         label.set_highlight(photo in selected, selection_exists)
def test_drags_from_liststore():
    """Drag from the GtkListStore to the map"""
    gui.open_files(DEMOFILES)
    assert Photograph.instances
    assert Label.instances
    for photo in Photograph.instances:
        old = [photo.latitude, photo.longitude]
        selected.add(photo)
        data = Struct({'get_text': lambda: photo.filename})
        gui.drag.photo_drag_end(None, None, 20, 20, data, None, None, True)
        assert Label(photo).get_latitude() == photo.latitude
        assert Label(photo).get_longitude() == photo.longitude
        photo.lookup_geodata()
        assert len(photo.geoname) > 5
        assert photo.latitude != old[0]
        assert photo.longitude != old[1]
def test_drags_from_liststore():
    """Drag from the GtkListStore to the map"""
    gui.open_files(DEMOFILES)
    assert Photograph.instances
    assert Label.instances
    for photo in Photograph.instances:
        old = [photo.latitude, photo.longitude]
        selected.add(photo)
        data = Struct({'get_text': lambda: photo.filename})
        gui.drag.photo_drag_end(None, None, 20, 20, data,
                                None, None, True)
        assert Label(photo).get_latitude() == photo.latitude
        assert Label(photo).get_longitude() == photo.longitude
        photo.lookup_geodata()
        assert len(photo.geoname) > 5
        assert photo.latitude != old[0]
        assert photo.longitude != old[1]