Skip to content

Commit

Permalink
Clean up a few things, add undo and fix delete to help box
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 3, 2010
1 parent ba4dc89 commit 919adde
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions photosorter.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def redraw_window(self, increment=False):
" H: flip horizontal\n" +
" L: rotate 90 degrees\n" +
" D: delete photo\n" +
" U: undo last sort\n" +
""
)
self.window.resize(1, 1)
Expand Down Expand Up @@ -526,11 +527,6 @@ def keyboard_command(self, widget, event):
self.sortedItems += 1
self.redraw_window(increment=True)

# D: dump information about unsorted buckets
if chr(event.keyval).upper() == "D":
for bucket in self.photoSortingBackend.buckets:
print bucket.year, [b.filename for b in bucket.unsorted]

# L: rotate photo 90 degrees. may rotate several times.
if chr(event.keyval).upper() == "L":
self.photoSortingBackend.rotate_clockwise(self.photoSortingBackend.CURRENT_PHOTO)
Expand All @@ -544,8 +540,8 @@ def keyboard_command(self, widget, event):
self.photoSortingBackend.unsort(self.photoSortingBackend.PREVIOUS_PHOTO)
self.sortedItems -= 1

# X: delete photo
if chr(event.keyval).upper() == "X":
# D: delete photo
if chr(event.keyval).upper() == "D":
self.photoSortingBackend.delete_photo(self.photoSortingBackend.CURRENT_PHOTO,
self.photoSortingBackend.CURRENT_BUCKET)
self.sortedItems += 1
Expand All @@ -555,13 +551,22 @@ def keyboard_command(self, widget, event):
if chr(event.keyval).upper() == "Q":
self.quit(None, None)
return

# X: dump information about unsorted buckets
if chr(event.keyval).upper() == "X":
for bucket in self.photoSortingBackend.buckets:
print bucket.year, [b.filename for b in bucket.unsorted]


# Z: move "unknown" photos to "unsorted"
if chr(event.keyval).upper() == "Z":
for bucket in self.photoSortingBackend.buckets:
bucket.unsorted |= bucket.unknown
bucket.unknown = set([])

# modify internal state variable... shhhh
self.photoSortingBackend._RESTART_PHOTO_GENERATOR = True

# resize window if necessary
if type(widget) == gtk.Window:
pass
Expand Down

0 comments on commit 919adde

Please sign in to comment.