Example #1
0
    def photo_drag_end(self, widget, drag_context, x, y, data, info, time,
                       on_map):
        """Respond to drops and position photos accordingly.
        
        This method allows photos to be dropped in from the photo
        pane or any other drag source, such as the file browser.
        """
        files = [
            urlparse(s).path.strip() for s in data.get_text().split('\n') if s
        ]

        if self.external_drag:
            self.open_files(files)
        self.external_drag = True

        if on_map:
            for filename in files:
                photo = photos.get(filename)
                if photo is not None:
                    photo.manual = True
                    photo.set_location(map_view.y_to_latitude(y),
                                       map_view.x_to_longitude(x))
                    modified.add(photo)

        self.selection.emit('changed')
        map_view.emit('animation-completed')
 def set_location(self, lat, lon, ele=None):
     """Alter the coordinates of this photo."""
     modified.add(self)
     if ele is not None:
         self.altitude = ele
     self.latitude  = lat
     self.longitude = lon
Example #3
0
 def photo_drag_end(self, widget, drag_context, x, y,
                    data, info, time, on_map):
     """Respond to drops and position photos accordingly.
     
     This method allows photos to be dropped in from the photo
     pane or any other drag source, such as the file browser.
     """
     files = [urlparse(s).path.strip() for s in
              data.get_text().split('\n') if s]
     
     if self.external_drag:
         self.open_files(files)
     self.external_drag = True
     
     if on_map:
       for filename in files:
             photo = photos.get(filename)
             if photo is not None:
                 photo.manual = True
                 photo.set_location(
                     map_view.y_to_latitude(y),
                     map_view.x_to_longitude(x))
                 modified.add(photo)
     
     self.selection.emit('changed')
     map_view.emit('animation-completed')
Example #4
0
 def __init__(self, photo):
     Champlain.Label.__init__(self)
     self.photo = photo
     self.set_name(photo.filename)
     self.set_text(basename(photo.filename))
     self.set_selectable(True)
     self.set_draggable(True)
     self.set_property('reactive', True)
     self.connect('enter-event', hover, 1.05)
     self.connect('leave-event', hover, 1/1.05)
     self.connect('button-press', clicked)
     self.connect('drag-finish',
         lambda *ignore: modified.add(photo)
             and photo.disable_auto_position())
     
     if photo.positioned:
         self.set_location(photo.latitude, photo.longitude)
         self.show()
     else:
         self.hide()
     
     for prop in ('latitude', 'longitude'):
         Binding(photo, prop, self,
                         flags=GObject.BindingFlags.BIDIRECTIONAL)
     Binding(photo, 'positioned', self, 'visible')
     
     MarkerLayer.add_marker(self)
Example #5
0
 def modify_summary(self):
     """Update the text displayed in the GtkListStore."""
     modified.add(self)
     self.liststore.set_value(self.iter, 1,
         ('<b>%s</b>' % self.long_summary()))
Example #6
0
 def modify_summary(self, photo):
     """Insert the current photo summary into the liststore."""
     modified.add(photo)
     self.liststore.set_value(photo.iter, SUMMARY,
                              ('<b>%s</b>' % photo.long_summary()))
Example #7
0
 def modify_summary(self, photo):
     """Insert the current photo summary into the liststore."""
     modified.add(photo)
     self.liststore.set_value(photo.iter, SUMMARY,
         ('<b>%s</b>' % photo.long_summary()))