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')
Example #2
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 #3
0
 def load_img_from_file(self, uri):
     """Create or update a row in the ListStore.
     
     Checks if the file has already been loaded, and if not, creates a new
     row in the ListStore. Either way, it then populates that row with
     photo metadata as read from disk. Effectively, this is used both for
     loading new photos, and reverting old photos, discarding any changes.
     
     Raises IOError if filename refers to a file that is not a photograph.
     """
     photo = photos.get(uri) or Photograph(uri, self.modify_summary)
     photo.read()
     if uri not in photos:
         photo.iter  = self.liststore.append()
         photo.label = self.labels.add(uri)
         photos[uri] = photo
     photo.position_label()
     modified.discard(photo)
     self.liststore.set_row(photo.iter,
         [uri, photo.long_summary(), photo.thumb, photo.timestamp])
     auto_timestamp_comparison(photo)
Example #4
0
 def load_img_from_file(self, uri):
     """Create or update a row in the ListStore.
     
     Checks if the file has already been loaded, and if not, creates a new
     row in the ListStore. Either way, it then populates that row with
     photo metadata as read from disk. Effectively, this is used both for
     loading new photos, and reverting old photos, discarding any changes.
     
     Raises IOError if filename refers to a file that is not a photograph.
     """
     photo = photos.get(uri) or Photograph(uri)
     photo.read()
     if uri not in photos:
         photo.label = self.labels.add(uri)
         photos[uri] = photo
     # 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 photo.camera.gst.get_string('timezone-method') == 'lookup':
         photo.calculate_timestamp()
     modified.discard(photo)
Example #5
0
 def load_img_from_file(self, uri):
     """Create or update a row in the ListStore.
     
     Checks if the file has already been loaded, and if not, creates a new
     row in the ListStore. Either way, it then populates that row with
     photo metadata as read from disk. Effectively, this is used both for
     loading new photos, and reverting old photos, discarding any changes.
     
     Raises IOError if filename refers to a file that is not a photograph.
     """
     photo = photos.get(uri) or Photograph(uri, self.modify_summary)
     photo.read()
     if uri not in photos:
         photo.iter = self.liststore.append()
         photo.label = self.labels.add(uri)
         photos[uri] = photo
     photo.position_label()
     modified.discard(photo)
     self.liststore.set_row(
         photo.iter,
         [uri, photo.long_summary(), photo.thumb, photo.timestamp])
     auto_timestamp_comparison(photo)