예제 #1
0
 def time_offset_changed(self, widget):
     """Update all photos each time the camera's clock is corrected."""
     seconds = self.secbutton.get_value()
     minutes = self.minbutton.get_value()
     offset = int((minutes * 60) + seconds)
     if offset != metadata.delta:
         metadata.delta = offset
         if abs(seconds) == 60 and abs(minutes) != 60:
             minutes += seconds / 60
             self.secbutton.set_value(0)
             self.minbutton.set_value(minutes)
         for photo in photos.values():
             auto_timestamp_comparison(photo)
예제 #2
0
 def time_offset_changed(self, widget):
     """Update all photos each time the camera's clock is corrected."""
     seconds = self.secbutton.get_value()
     minutes = self.minbutton.get_value()
     offset  = int((minutes * 60) + seconds)
     if offset != metadata.delta:
         metadata.delta = offset
         if abs(seconds) == 60 and abs(minutes) != 60:
             minutes += seconds / 60
             self.secbutton.set_value(0)
             self.minbutton.set_value(minutes)
         for photo in photos.values():
             auto_timestamp_comparison(photo)
예제 #3
0
 def set_timezone(self):
     """Set the timezone to the given zone and update all photos."""
     if 'TZ' in environ:
         del environ['TZ']
     if gst.get_boolean('lookup-timezone'):
         environ['TZ'] = self.gpx_timezone
     elif gst.get_boolean('custom-timezone'):
         region = self.region.get_active_id()
         city   = self.cities.get_active_id()
         if region is not None and city is not None:
             environ['TZ'] = '%s/%s' % (region, city)
     tzset()
     for photo in photos.values():
         photo.calculate_timestamp()
         auto_timestamp_comparison(photo)
예제 #4
0
 def calculate_timestamp(self):
     """Determine the timestamp based on the currently selected timezone.
     
     This method relies on the TZ environment variable to be set before
     it is called. If you don't set TZ before calling this method, then it
     implicitely assumes that the camera and the computer are set to the
     same timezone.
     """
     try:
         self.timestamp = int(mktime(
             self.exif['Exif.Photo.DateTimeOriginal'].value.timetuple()))
     except KeyError:
         self.timestamp = int(stat(self.filename).st_mtime)
     self.timestamp += self.camera.get_offset()
     if self.label is not None:
         auto_timestamp_comparison(self)
예제 #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)
예제 #6
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)