Example #1
0
 def test_drag_controller(self):
     """Make sure that we can drag photos around."""
     # Can we load files?
     data = Struct({'get_text': lambda: '\n'.join(DEMOFILES)})
     self.assertEqual(len(photos), 0)
     self.assertEqual(len(points), 0)
     gui.drag.photo_drag_end(None, None, 20, 20, data,
                             None, None, True)
     self.assertEqual(len(photos), 6)
     self.assertEqual(len(points), 374)
     for button in ('select_all', 'close', 'clear'):
         get_obj(button + '_button').emit('clicked')
     self.assertEqual(len(photos), 0)
     self.assertEqual(len(points), 0)
     
     gui.open_files(DEMOFILES)
     for photo in photos.values():
         # 'Drag' a ChamplainLabel and make sure the photo location matches.
         photo.label.set_location(random_coord(80), random_coord(180))
         photo.label.emit('drag-finish', Clutter.Event())
         self.assertEqual(photo.label.get_latitude(), photo.latitude)
         self.assertEqual(photo.label.get_longitude(), photo.longitude)
         self.assertGreater(len(photo.pretty_geoname()), 5)
         old = [photo.latitude, photo.longitude]
         
         # 'Drag' a photo onto the map and make sure that also works.
         selected.add(photo)
         data = Struct({'get_text': lambda: photo.filename})
         gui.drag.photo_drag_end(None, None, 20, 20, data,
                                 None, None, True)
         self.assertEqual(photo.label.get_latitude(), photo.latitude)
         self.assertEqual(photo.label.get_longitude(), photo.longitude)
         self.assertGreater(len(photo.pretty_geoname()), 5)
         self.assertNotEqual(photo.latitude, old[0])
         self.assertNotEqual(photo.longitude, old[1])
Example #2
0
 def test_drag_controller(self):
     """Make sure that we can drag photos around."""
     # Can we load files?
     data = Struct({'get_text': lambda: '\n'.join(DEMOFILES)})
     self.assertEqual(len(photos), 0)
     self.assertEqual(len(points), 0)
     gui.drag.photo_drag_end(None, None, 20, 20, data,
                             None, None, True)
     self.assertEqual(len(photos), 6)
     self.assertEqual(len(points), 374)
     self.tearDown()
     self.assertEqual(len(photos), 0)
     self.assertEqual(len(points), 0)
     
     gui.open_files(DEMOFILES)
     for photo in photos.values():
         # 'Drag' a ChamplainLabel and make sure the photo location matches.
         photo.label.set_location(random_coord(80), random_coord(180))
         photo.label.emit('drag-finish', Clutter.Event())
         self.assertEqual(photo.label.get_latitude(), photo.latitude)
         self.assertEqual(photo.label.get_longitude(), photo.longitude)
         self.assertGreater(len(photo.pretty_geoname()), 5)
         old = [photo.latitude, photo.longitude]
         
         # 'Drag' a photo onto the map and make sure that also works.
         selected.add(photo)
         data = Struct({'get_text': lambda: photo.filename})
         gui.drag.photo_drag_end(None, None, 20, 20, data,
                                 None, None, True)
         self.assertEqual(photo.label.get_latitude(), photo.latitude)
         self.assertEqual(photo.label.get_longitude(), photo.longitude)
         self.assertGreater(len(photo.pretty_geoname()), 5)
         self.assertNotEqual(photo.latitude, old[0])
         self.assertNotEqual(photo.longitude, old[1])
Example #3
0
def update_highlights(selection):
    """Ensure only the selected labels are highlighted."""
    selection_exists = selection.count_selected_rows() > 0
    selected.clear()
    for photo in photos.values():
        # Maintain the 'selected' set() for easier iterating later.
        if selection.iter_is_selected(photo.iter):
            selected.add(photo)
        photo.set_label_highlight(photo in selected, selection_exists)
Example #4
0
def update_highlights(selection):
    """Ensure only the selected labels are highlighted."""
    selection_exists = selection.count_selected_rows() > 0
    selected.clear()
    for photo in photos.values():
        # Maintain the 'selected' set() for easier iterating later.
        if selection.iter_is_selected(photo.iter):
            selected.add(photo)
        photo.set_label_highlight(photo in selected, selection_exists)
 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)