Piggy 0.5.0.0 → 0.5.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/CHANGES.txt +31 -0
  2. data/README.txt +3 -5
  3. data/lib/icons/gallery.jpg +0 -0
  4. data/lib/piggy-core/album.rb +8 -0
  5. data/lib/piggy-core/exifr_adapter.rb +10 -2
  6. data/lib/piggy-core/file_info.rb +6 -1
  7. data/lib/piggy-core/options.rb +21 -3
  8. data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +8 -7
  9. data/lib/piggy-core/thumbnail_generator.rb +1 -1
  10. data/lib/piggy-core/thumbnail_page_generator.rb +12 -4
  11. data/lib/piggy-core/version.rb +2 -2
  12. data/lib/piggy-gui/directory_diff_widget.rb +12 -8
  13. data/lib/piggy-gui/filtered_file_list.rb +6 -1
  14. data/lib/piggy-gui/ftp_browser_widget.rb +4 -3
  15. data/lib/piggy-gui/html_generation_dialog.rb +2 -0
  16. data/lib/piggy-gui/html_options_widget.rb +27 -4
  17. data/lib/piggy-gui/image_processor.rb +3 -2
  18. data/lib/piggy-gui/options_dialog.rb +52 -13
  19. data/lib/piggy-gui/piggy_image_browser.rb +134 -15
  20. data/lib/templates/PiggyFX.jar +0 -0
  21. data/lib/templates/PiggyFX.jnlp +2 -2
  22. data/lib/templates/PiggyFX_browser.jnlp +2 -2
  23. data/lib/templates/javafx.htm +2 -2
  24. data/lib/templates/slideshow.htm +12 -3
  25. data/lib/templates/slideshow.js +5 -0
  26. data/lib/templates/styles/candle/kerze-160x213.png +0 -0
  27. data/lib/templates/styles/candle/style.css +73 -0
  28. data/lib/templates/styles/cappuccinoheart/cappuccino-300x225.png +0 -0
  29. data/lib/templates/styles/cappuccinoheart/cappuccinoheart-80x81.png +0 -0
  30. data/lib/templates/styles/cappuccinoheart/style.css +81 -0
  31. data/lib/templates/styles/feuerzangenbowle/feuerzangenbowle.jpg +0 -0
  32. data/lib/templates/styles/feuerzangenbowle/sh.png +0 -0
  33. data/lib/templates/styles/feuerzangenbowle/style.css +79 -0
  34. data/lib/templates/styles/glitterballs/christbaum-detail.png +0 -0
  35. data/lib/templates/styles/glitterballs/christbaumkugel-120x155-multi.png +0 -0
  36. data/lib/templates/styles/glitterballs/christbaumkugel-120x155.png +0 -0
  37. data/lib/templates/styles/glitterballs/style.css +86 -0
  38. data/lib/templates/styles/qualle/qualle.jpg +0 -0
  39. data/lib/templates/styles/qualle/style.css +73 -0
  40. data/lib/templates/styles/snow/sitzgruppe-im-schnee-300x225.png +0 -0
  41. data/lib/templates/styles/snow/style.css +76 -0
  42. data/lib/templates/styles/snowman/snowman.png +0 -0
  43. data/lib/templates/styles/snowman/style.css +73 -0
  44. data/lib/templates/styles/snowwoman/snowwomen.png +0 -0
  45. data/lib/templates/styles/snowwoman/style.css +73 -0
  46. data/lib/templates/styles/sylvester/fireworks.png +0 -0
  47. data/lib/templates/styles/sylvester/gluecksklee-375x500.png +0 -0
  48. data/lib/templates/styles/sylvester/style.css +7 -9
  49. data/lib/templates/styles/sylvester/wunderkerze.gif +0 -0
  50. metadata +64 -33
  51. data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
data/CHANGES.txt CHANGED
@@ -1,3 +1,34 @@
1
+ Changes in 0.5.1-2
2
+ - Save/load album list with comment and rotations
3
+ - Separate width option for widescreen images
4
+ (ignored when image processing is done by nconvert)
5
+ - Slideshow startable from any image page
6
+ - Bugfix: JavaFX version info in about dialog
7
+ - New style: snowwoman
8
+ - New style: cappuccinoheart
9
+
10
+ Changes in 0.5.1-1
11
+ - Bugfix: browsers located in C:\Program Files (x86)\...
12
+ - Logging times
13
+ - New style: glitter balls
14
+ - New style: snowman
15
+ - New style: candle
16
+ - New style: snow
17
+ Changes in 0.5.1-0
18
+ - Sort by time of photo creation before generation
19
+ (includes workaround for missing time information)
20
+ - Support different naming patterns (different cameras)
21
+ - Added slideshow version info
22
+ - Updated to JavaFX 1.3
23
+ - Revert to using doubleclick for directory changes
24
+ - Bugfix: Encoding error for rotation info
25
+ - Bugfix: Exception in FTP-browser (sending #mtime to nil)
26
+ - Bugfix: Open file dialog (fxruby api change)
27
+ - Bugfix: Directories with special characters (in FTP browser)
28
+ - New style "qualle"
29
+ - New style "feuerzangenbowle"
30
+ - Completed options dialog
31
+
1
32
  Changes in 0.5.0-0
2
33
  - Ftp: Abort upload
3
34
  - Ftp: Delete directories (if empty)
data/README.txt CHANGED
@@ -19,9 +19,8 @@ Piggy uses exif metainfo to guess initial rotations and comments.
19
19
  Limitations
20
20
  -----------
21
21
 
22
- Piggy is currently developed under Windows Vista.
23
- Additional tests include Windows XP and Linux.
24
- It is not tested on Mac.
22
+ Piggy is currently developed under Windows 7.
23
+ It is not properly tested on other platforms
25
24
 
26
25
  Piggy is not meant as general purpose tool for image manipulations:
27
26
  - Image rotation reduces the quality of the image
@@ -36,7 +35,6 @@ for more information on this topic.)
36
35
 
37
36
  Piggy output optionally contains Javascript and Java FX Script.
38
37
  Note that JavaFX is relatively new technology with several bugs.
39
- For example Version 1.2 seems to prevent the Opera browser from shutting
40
- down the opera process.
38
+
41
39
 
42
40
 
Binary file
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/ruby
2
+ #$Id: options_persistence.rb 161 2006-12-23 15:41:01Z Sascha $
3
+
4
+ # Album information containing file list, comments and rotations
5
+
6
+ class Album
7
+ attr_accessor(:path, :file_infos)
8
+ end
@@ -17,7 +17,10 @@ class ExifrAdapter
17
17
  def comment
18
18
  return '' unless @exif
19
19
  c = @exif.comment.class == String ? @exif.comment : @exif.comment.to_s
20
- return c.gsub(/\0/, '')
20
+ c = c.gsub(/\0/, '')
21
+ # m = @exif.make.class == String ? @exif.make : @exif.make.to_s
22
+ # m = m.gsub(/\0/, '')
23
+ # return "#{c} Made with #{m}"
21
24
  end
22
25
 
23
26
  def to_s
@@ -27,7 +30,7 @@ class ExifrAdapter
27
30
  desc += "\twidth: #{@exif.width.to_s}\n"
28
31
  desc += "\tbits: #{@exif.bits.to_s}\n"
29
32
  if @exif.comment.class == String
30
- desc += "\tcomment: #{@exif.comment}\n"
33
+ desc += "\tcomment: #{comment}\n"
31
34
  elsif @exif.comment.class == Array
32
35
  desc += "\tcomments: "
33
36
  @exif.comment.each { |c|
@@ -50,6 +53,11 @@ class ExifrAdapter
50
53
  return image_mock.degree
51
54
  end
52
55
 
56
+ def date_time
57
+ return nil unless exif?
58
+ @exif.date_time_original
59
+ end
60
+
53
61
  def width
54
62
  exif? ? @exif.width : 0
55
63
  end
@@ -126,15 +126,20 @@ class FileInfo < FileName
126
126
  end
127
127
 
128
128
  class CommentedFile < FileInfo
129
- attr_accessor(:comment, :rotation, :width, :height)
129
+ attr_accessor(:comment, :rotation, :width, :height, :date_time)
130
130
 
131
131
  def initialize(the_name, the_path = '', the_comment = '')
132
132
  super(the_name, the_path)
133
133
  @comment = the_comment
134
+ @date_time = nil
134
135
  @rotation = 0
135
136
  @width = 0
136
137
  @height = 0
137
138
  end
139
+
140
+ def time
141
+ @date_time.nil? ? @ctime : @date_time
142
+ end
138
143
 
139
144
  def rotate?
140
145
  @rotation && @rotation != 0
@@ -7,7 +7,8 @@ require 'piggy-core/winshell'
7
7
  class PiggyOptions
8
8
  attr_accessor(:usePreview, :useLog,
9
9
  :thumbWidth, :thumbHeight, :imageWidth, :imageHeight,
10
- :generateFramePage, :useTable,
10
+ :widescreenWidth,
11
+ :generateFramePage, :useTable, :sortOrder,
11
12
  :localDestinationPath, :remoteDestinationPath,
12
13
  :ftpUser, :ftpHost, :ftpHasLocaltime,
13
14
  :ftpConnectionTimeout, :ftpTransferTimeout,
@@ -16,14 +17,18 @@ class PiggyOptions
16
17
  :slideshowDelay,
17
18
  :style, :stylesSample, :skipImageProcessing,
18
19
  :browser,
19
- :excludeFilters,
20
+ :useExifComments, :excludeFilters, :namingPatterns,
20
21
  :debug)
21
22
 
22
23
  # possible values for @image_processor
23
24
  ProcessorNconvert = 'nconvert'
24
25
  ProcessorFxruby = 'fxruby'
25
26
  ProcessorRmagick = 'rmagick'
26
-
27
+
28
+ # possible values for @sort_order
29
+ SortByTime = 'time'
30
+ SortByName = 'name'
31
+
27
32
  def initialize
28
33
  @usePreview = nil
29
34
  @useLog = nil
@@ -32,6 +37,7 @@ class PiggyOptions
32
37
  @thumbWidth = nil
33
38
  @thumbHeight = nil
34
39
  @imageWidth = nil
40
+ @widescreenWidth = nil
35
41
  @imageHeight = nil
36
42
  @generateFramePage = nil
37
43
  @useTable = nil
@@ -51,7 +57,10 @@ class PiggyOptions
51
57
  @debug = nil
52
58
  @browser = nil
53
59
  @stylesSample = nil
60
+ @useExifComments = nil
54
61
  @excludeFilters = nil
62
+ @namingPatterns = nil
63
+ @sortOrder = nil
55
64
  initialize_nils_with_default
56
65
  end
57
66
 
@@ -67,6 +76,7 @@ class PiggyOptions
67
76
  @thumbWidth = 100 if @thumbWidth.nil?
68
77
  @thumbHeight = 100 if @thumbHeight.nil?
69
78
  @imageWidth = 600 if @imageWidth.nil?
79
+ @widescreenWidth = 700 if @widescreenWidth.nil?
70
80
  @imageHeight = 520 if @imageHeight.nil?
71
81
  @generateFramePage = false if @generateFramePage.nil?
72
82
  @useTable = generateFramePage? if @uosPathseTable.nil?
@@ -86,7 +96,10 @@ class PiggyOptions
86
96
  @debug = false if @debug.nil?
87
97
  @browser = '' if @browser.nil?
88
98
  @stylesSample = false if @stylesSample.nil?
99
+ @useExifComments = false if @useExifComments.nil?
89
100
  @excludeFilters = ['~$', '#$', '^\.'] if @excludeFilters.nil?
101
+ @namingPatterns = ['IMG_.*', 'DSC.*'] if @namingPatterns.nil?
102
+ @sortOrder = SortByName if @sortOrder.nil?
90
103
  end
91
104
 
92
105
  def use_fxruby!
@@ -116,6 +129,10 @@ class PiggyOptions
116
129
  def browser?
117
130
  !@browser.nil? && !@browser.empty?
118
131
  end
132
+
133
+ def sort_by_time?
134
+ @sortOrder == SortByTime
135
+ end
119
136
 
120
137
  alias :usePreview? :usePreview
121
138
  alias :useLog? :useLog
@@ -129,5 +146,6 @@ class PiggyOptions
129
146
  alias :debug? :debug
130
147
  alias :stylesSample? :stylesSample
131
148
  alias :initializeNilsWithDefault :initialize_nils_with_default
149
+ alias :useExifComments? :useExifComments
132
150
  end
133
151
 
@@ -2,16 +2,17 @@ require 'RMagick'
2
2
 
3
3
  class RmagickThumbnailPageGenerator < ThumbnailPageGenerator
4
4
 
5
- def resize_file(file_info, width, height, prefix)
5
+ def resize_file(file_info, widescreen_width, width, height, prefix)
6
6
  img = Magick::Image.read(file_info.name_with_path)[0]
7
+ if(file_info.rotate?)
8
+ img = img.rotate!(file_info.rotation)
9
+ end
7
10
  img_width = img.columns.to_f
8
11
  img_height = img.rows.to_f
9
- scale_x = img_width > width ? width/img_width : 1
12
+ used_width = (img_height > 0 and img_width/img_height > 1.6) ? widescreen_width : width
13
+ scale_x = img_width > used_width ? used_width/img_width : 1
10
14
  scale_y = img_height > height ? height/img_height : 1
11
15
  scale = scale_x < scale_y ? scale_x : scale_y
12
- if(file_info.rotate?)
13
- img = img.rotate!(file_info.rotation)
14
- end
15
16
  img = img.resize!(scale)
16
17
  img.write(File.join(imageOutputPath,prefix + file_info.name))
17
18
  end
@@ -23,8 +24,8 @@ class RmagickThumbnailPageGenerator < ThumbnailPageGenerator
23
24
  @inputFilenames.each {
24
25
  |info|
25
26
  progress.set_progress(info.name, 1)
26
- resize_file(info, @options.thumbWidth, @options.thumbHeight, 't_')
27
- resize_file(info, @options.imageWidth, @options.imageHeight, '')
27
+ resize_file(info, @options.thumbWidth, @options.thumbWidth, @options.thumbHeight, 't_')
28
+ resize_file(info, @options.widescreenWidth, @options.imageWidth, @options.imageHeight, '')
28
29
  }
29
30
  end
30
31
  end
@@ -40,7 +40,7 @@ class ThumbnailGenerator
40
40
  if(info.rotate?)
41
41
  @imageProcessor.rotate_image(img, info.rotation)
42
42
  end
43
- @imageProcessor.fit_image(img, @options.imageWidth, @options.imageHeight)
43
+ @imageProcessor.fit_image(img, @options.imageWidth, @options.imageHeight, 1, @options.widescreenWidth)
44
44
  @imageProcessor.save_image(img, outname_big(inputFile))
45
45
  @imageProcessor.fit_image(img, @options.thumbWidth, @options.thumbHeight)
46
46
  @imageProcessor.save_image(img, outname_small(inputFile))
@@ -113,7 +113,7 @@ class ThumbnailPageGenerator < HtmlGenerator
113
113
  def main_index_with_path
114
114
  return main_index_path + sep + indexName
115
115
  end
116
-
116
+
117
117
  def get_backlink_string
118
118
  @options.generateFramePage? ? back + subDir + HtmlExt : indexName
119
119
  end
@@ -189,6 +189,13 @@ class ThumbnailPageGenerator < HtmlGenerator
189
189
  add('overview')
190
190
  }
191
191
  }
192
+ if(@options.addSlideshow?)
193
+ span {
194
+ a({"HREF" => escape_html(SlideshowName + HtmlExt + "?" + image_name(currentInfo)) }) {
195
+ add('slideshow')
196
+ }
197
+ }
198
+ end
192
199
  span {
193
200
  a({"HREF" => escape_html(succ) + HtmlExt}) {
194
201
  add(i == max_ind ? 'first' : 'next')
@@ -240,7 +247,8 @@ class ThumbnailPageGenerator < HtmlGenerator
240
247
  tag('layout', {}) {
241
248
  add("<imageSize width=\"#{@options.imageWidth}\" height=\"#{@options.imageHeight}\"/>")
242
249
  }
243
- end
244
250
  end
251
+ end
252
+ end
245
253
  write_file(File.join(imageOutputPath, 'config.xml'), get_page)
246
254
  end
247
255
 
@@ -256,7 +264,7 @@ class ThumbnailPageGenerator < HtmlGenerator
256
264
  fp.print(")\n")
257
265
  }
258
266
  unless @inputFilenames.empty?
259
- update_slideshow_template(slideshow_image(@inputFilenames[1]))
267
+ update_slideshow_template(@inputFilenames[1])
260
268
  end
261
269
  end
262
270
 
@@ -273,7 +281,7 @@ class ThumbnailPageGenerator < HtmlGenerator
273
281
  backlink = "href=\"#{get_backlink_string}\""
274
282
  File.open(file, 'w') { |fp|
275
283
  lines.each { |line|
276
- line = line.gsub('PLACEHOLDER_FOR_IMAGE_NAME', imageFile)
284
+ line = line.gsub('PLACEHOLDER_FOR_IMAGE_NAME', image_name(imageFile))
277
285
  line = line.gsub('href="index.htm"', backlink)
278
286
  fp.print(line)
279
287
  }
@@ -4,10 +4,10 @@
4
4
  # Provide release information for Piggy.
5
5
  module PiggyVersion
6
6
  def PiggyVersion.version_string
7
- '0.5.0-0'
7
+ '0.5.1-2'
8
8
  end
9
9
  def PiggyVersion.copyright_string
10
- 'Copyright (C) 2009 Sascha D�rdelmann'
10
+ 'Copyright (C) 2010 Sascha D�rdelmann'
11
11
  end
12
12
  def PiggyVersion.development_status
13
13
  'beta'
@@ -198,11 +198,11 @@ class DirectoryDiffWidget < Fox::FXScrollWindow
198
198
 
199
199
  def dir_changed(side)
200
200
  if(side == 'right')
201
- set_right_path(@rightPathField.getText)
201
+ set_right_path(ruby_path(@rightPathField.getText))
202
202
  update_right_list
203
203
  update_status_icons
204
204
  else
205
- set_left_path(@leftPathField.getText)
205
+ set_left_path(ruby_path(@leftPathField.getText))
206
206
  update_left_list
207
207
  update_status_icons
208
208
  end
@@ -228,12 +228,16 @@ class DirectoryDiffWidget < Fox::FXScrollWindow
228
228
  method(:on_menu_right_list))
229
229
  end
230
230
 
231
- def fox_pah(ruby_path)
231
+ def fox_path(ruby_path)
232
232
  ruby_2_fox(WinShell.instance.os_path(ruby_path))
233
233
  end
234
+
235
+ def ruby_path(fox_path)
236
+ WinShell.instance.ruby_path(fox_2_ruby(fox_path))
237
+ end
234
238
 
235
239
  def set_defaults
236
- p = fox_pah(@options.localDestinationPath)
240
+ p = fox_path(@options.localDestinationPath)
237
241
  @rightPathField.setText(@options.localDestinationPath)
238
242
  @leftPathField.setText(@options.localDestinationPath)
239
243
  end
@@ -246,7 +250,7 @@ class DirectoryDiffWidget < Fox::FXScrollWindow
246
250
 
247
251
  def set_right_path(p)
248
252
  @options.localDestinationPath = FilePath.intern_path(p)
249
- @rightPathField.setText(p) # fixme winpath
253
+ @rightPathField.setText(fox_path(p))
250
254
  end
251
255
 
252
256
  def left_path
@@ -254,7 +258,7 @@ class DirectoryDiffWidget < Fox::FXScrollWindow
254
258
  end
255
259
 
256
260
  def set_left_path(p)
257
- @leftPathField.setText(p) # fixme winpath
261
+ @leftPathField.setText(fox_path(p))
258
262
  end
259
263
 
260
264
  def selection_in_list(list)
@@ -389,7 +393,7 @@ class DirectoryDiffWidget < Fox::FXScrollWindow
389
393
  end
390
394
 
391
395
  def on_doubleclick_left_file_list(sender, sel, index)
392
- file_or_folder = @leftFileList.getItemText(index)
396
+ file_or_folder = ruby_path(@leftFileList.getItemText(index))
393
397
  file = file_or_folder.split(Regexp.compile("\t"))[0]
394
398
  info = @leftContents[file]
395
399
  return false unless info && info.directory?
@@ -401,7 +405,7 @@ class DirectoryDiffWidget < Fox::FXScrollWindow
401
405
  end
402
406
 
403
407
  def on_doubleclick_right_file_list(sender, sel, index)
404
- file_or_folder = @rightFileList.getItemText(index)
408
+ file_or_folder = ruby_path(@rightFileList.getItemText(index))
405
409
  file = file_or_folder.split(Regexp.compile("\t"))[0]
406
410
  info = @rightContents[file]
407
411
  return false unless info && info.directory?
@@ -83,10 +83,15 @@ class FilteredFileList < Fox::FXFileList
83
83
  end
84
84
  return selected_files
85
85
  end
86
-
86
+
87
+ def choose(file)
88
+ @chosenFiles.add(@shell.os_path(file))
89
+ end
90
+
87
91
  def add_selected_files
88
92
  get_selected_image_files(true, 'add').each { |file|
89
93
  @chosenFiles.add(file)
94
+ puts(file)
90
95
  }
91
96
  end
92
97
 
@@ -162,7 +162,7 @@ class FtpBrowserWidget < DirectoryDiffWidget
162
162
  def set_defaults
163
163
  @serverField.setText(ruby_2_fox(@options.ftpHost))
164
164
  @userField.setText(ruby_2_fox(@options.ftpUser))
165
- @rightPathField.setText(fox_pah(@options.localDestinationPath))
165
+ @rightPathField.setText(fox_path(@options.localDestinationPath))
166
166
  @leftPathField.setText(ruby_2_fox(@options.remoteDestinationPath))
167
167
  end
168
168
 
@@ -220,7 +220,7 @@ class FtpBrowserWidget < DirectoryDiffWidget
220
220
  icon = if myInfo.directory?
221
221
  otherInfo ? @dirIcon : @moveRightDirIcon
222
222
  else
223
- if otherInfo
223
+ if otherInfo and otherInfo.mtime
224
224
  otherInfo.mtime < myInfo.mtime ? @newerFileIcon : @fileIcon
225
225
  else
226
226
  @moveRightFileIcon
@@ -284,7 +284,8 @@ class FtpBrowserWidget < DirectoryDiffWidget
284
284
  update_list(@ftpAdapter.nlst, @leftFileList, @leftContents) do
285
285
  |file, path|
286
286
  @ftpAdapter.info(file, path)
287
- end
288
287
  end
288
+ end
289
+ end
289
290
 
290
291
  def update_ftp_list
291
292
  ftp_do {} # every ftp action includes an update :-)
@@ -29,11 +29,13 @@ class HtmlGenerationDialog < ModalDialog
29
29
  labels = Array.new
30
30
  labels.push(FXLabel.new(contents, "Title:"))
31
31
  @titleField = FXTextField.new(contents, 32)
32
+ @titleField.setText("Styles sample") if(@options.stylesSample?)
32
33
  @titleField.connect(SEL_COMMAND) { |sender, sel, new_txt|
33
34
  on_title_changed(fox_2_ruby(new_txt)) if (new_txt)
34
35
  }
35
36
  labels.push(FXLabel.new(contents, "Subdirectory:"))
36
37
  @subdirField = FXTextField.new(contents, 32)
38
+ @subdirField.setText("basic") if(@options.stylesSample?)
37
39
  labels.each { |label| label.setLayoutHints LAYOUT_CENTER_Y }
38
40
  contents.init_gui
39
41
  add_ok_cancel_buttons_to(frame)