Piggy 0.4.2.4 → 0.4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. data/CHANGES.txt +15 -0
  2. data/INSTALL.txt +9 -4
  3. data/README.txt +8 -6
  4. data/bin/directory_diff +1 -1
  5. data/bin/ftp_browser +1 -1
  6. data/bin/piggy +1 -1
  7. data/lib/directory_diff.rb +8 -6
  8. data/lib/ftp_browser.rb +8 -6
  9. data/lib/icons/connect.ico +0 -0
  10. data/lib/icons/hide_details.ico +0 -0
  11. data/lib/icons/show_details.ico +0 -0
  12. data/lib/piggy-core/alive_check.rb +4 -4
  13. data/lib/piggy-core/debug.rb +4 -4
  14. data/lib/piggy-core/environment.rb +24 -26
  15. data/lib/piggy-core/exifr_adapter.rb +11 -11
  16. data/lib/piggy-core/file_info.rb +61 -61
  17. data/lib/piggy-core/ftp_adapter.rb +24 -24
  18. data/lib/piggy-core/htmlgen.rb +41 -45
  19. data/lib/piggy-core/nconvert_thumbsgen.rb +22 -22
  20. data/lib/piggy-core/options.rb +25 -19
  21. data/lib/piggy-core/options_persistence.rb +8 -8
  22. data/lib/piggy-core/progress.rb +7 -7
  23. data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +14 -14
  24. data/lib/piggy-core/thumbnail_generator.rb +26 -26
  25. data/lib/piggy-core/thumbnail_page_generator.rb +234 -230
  26. data/lib/piggy-core/upload_info.rb +22 -22
  27. data/lib/piggy-core/version.rb +7 -7
  28. data/lib/piggy-core/winshell.rb +136 -80
  29. data/lib/piggy-gui/dir_chooser.rb +14 -14
  30. data/lib/piggy-gui/directory_diff_widget.rb +177 -160
  31. data/lib/piggy-gui/filtered_file_list.rb +87 -87
  32. data/lib/piggy-gui/fox_thumbsgen.rb +4 -4
  33. data/lib/piggy-gui/ftp_browser_widget.rb +211 -155
  34. data/lib/piggy-gui/fullscreen.rb +4 -4
  35. data/lib/piggy-gui/html_generation_dialog.rb +42 -115
  36. data/lib/piggy-gui/html_options_widget.rb +97 -0
  37. data/lib/piggy-gui/image_processor.rb +58 -58
  38. data/lib/piggy-gui/modal_dialog.rb +11 -5
  39. data/lib/piggy-gui/multiimagecanvas.rb +59 -59
  40. data/lib/piggy-gui/options_dialog.rb +170 -48
  41. data/lib/piggy-gui/piggy_image_browser.rb +382 -340
  42. data/lib/piggy-gui/pipe_log.rb +17 -17
  43. data/lib/piggy-gui/progress_with_dialog.rb +8 -8
  44. data/lib/piggy-gui/require-fox.rb +23 -8
  45. data/lib/piggy.rb +7 -5
  46. data/lib/templates/styles/basic/style.css +16 -14
  47. data/lib/templates/styles/black/style.css +28 -29
  48. data/lib/templates/styles/roundedbox/style.css +28 -31
  49. data/lib/templates/styles/shadow/style.css +26 -26
  50. data/lib/templates/styles/shadow_D9F5F3/style.css +1 -1
  51. data/lib/templates/styles/shadow_black/lo.jpg +0 -0
  52. data/lib/templates/styles/shadow_black/lu.jpg +0 -0
  53. data/lib/templates/styles/shadow_black/ro.jpg +0 -0
  54. data/lib/templates/styles/shadow_black/ru.jpg +0 -0
  55. data/lib/templates/styles/shadow_black/style.css +78 -0
  56. data/lib/templates/styles/shadow_bowers/style.css +48 -51
  57. data/lib/templates/styles/sylvester/sh.png +0 -0
  58. data/lib/templates/styles/sylvester/style.css +74 -0
  59. data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
  60. data/test/file_info_test.rb +29 -29
  61. metadata +52 -38
@@ -18,25 +18,25 @@ class FtpAdapter
18
18
  end
19
19
 
20
20
  def connect(host, user, password)
21
- cTimeout { @connection = Net::FTP.open(host, user, password) }
21
+ c_timeout { @connection = Net::FTP.open(host, user, password) }
22
22
  @connection.debug_mode = @options.debug
23
23
  end
24
24
 
25
25
  def chdir(path)
26
26
  if path && !path.empty?
27
- cTimeout { @connection.chdir(path) }
27
+ c_timeout { @connection.chdir(path) }
28
28
  end
29
29
  end
30
30
 
31
31
  def nlst
32
- cTimeout { @connection.nlst }
32
+ c_timeout { @connection.nlst }
33
33
  end
34
34
 
35
35
  def info(file, path)
36
36
  info = FileInfo.new(file, path)
37
37
  begin
38
- mtime = cTimeout {
39
- @connection.mtime(file, @options.ftpHasLocaltime?)
38
+ mtime = c_timeout {
39
+ @connection.mtime(file, @options.ftpHasLocaltime?)
40
40
  }
41
41
  mtime = mtime.localtime unless @options.ftpHasLocaltime?
42
42
  info.mtime = mtime
@@ -47,11 +47,11 @@ class FtpAdapter
47
47
  end
48
48
 
49
49
  def mkdir(dir)
50
- cTimeout { @connection.mkdir(dir) }
50
+ c_timeout { @connection.mkdir(dir) }
51
51
  end
52
52
 
53
53
  def delete(file)
54
- cTimeout { @connection.delete(file) }
54
+ c_timeout { @connection.delete(file) }
55
55
  end
56
56
 
57
57
  # Upload with progress events.
@@ -66,27 +66,27 @@ class FtpAdapter
66
66
  # This will create a remote file bla/big.zip
67
67
  # and every chunk of transferred data will
68
68
  # be given to the block.
69
- def upload(localPath, file, &block)
70
- depthOffset = FilePath.split(localPath).size
71
- pathSections = FilePath.split(file)
72
- dirs = pathSections[depthOffset..-2]
69
+ def upload(local_path, file, &block)
70
+ depth_offset = FilePath.split(local_path).size
71
+ path_sections = FilePath.split(file)
72
+ dirs = path_sections[depth_offset..-2]
73
73
  unless dirs == nil
74
74
  dirs.each do
75
- |dir|
76
- begin
77
- chdir(dir)
78
- rescue Net::FTPError
79
- mkdir(dir)
80
- chdir(dir)
81
- end
75
+ |dir|
76
+ begin
77
+ chdir(dir)
78
+ rescue Net::FTPError
79
+ mkdir(dir)
80
+ chdir(dir)
81
+ end
82
82
  end
83
83
  end
84
- aliveChecker = AliveCheck.new(@options.ftpTransferTimeout,
85
- "ftp transfer timeout")
86
- aliveChecker.check do
84
+ alive_checker = AliveCheck.new(@options.ftpTransferTimeout,
85
+ "ftp transfer timeout")
86
+ alive_checker.check do
87
87
  @connection.putbinaryfile(file) { |data|
88
- aliveChecker.alive!
89
- block.call(data)
88
+ alive_checker.alive!
89
+ block.call(data)
90
90
  }
91
91
  end
92
92
  unless dirs == nil
@@ -100,7 +100,7 @@ class FtpAdapter
100
100
 
101
101
  private
102
102
 
103
- def cTimeout(&block)
103
+ def c_timeout(&block)
104
104
  timeout(@options.ftpConnectionTimeout, &block)
105
105
  end
106
106
  end
@@ -17,36 +17,36 @@ class HtmlGenerator
17
17
  @depth = "\n"
18
18
  end
19
19
 
20
- def incDepth
20
+ def inc_depth
21
21
  @depth += ' '
22
22
  end
23
23
 
24
- def decDepth
24
+ def dec_depth
25
25
  @depth = @depth[0..-3]
26
26
  end
27
27
 
28
28
  # Start a frameset
29
- def newFrame
29
+ def new_frame
30
30
  reset
31
31
  @page = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">'
32
32
  end
33
33
 
34
34
  # Start a 'normal' HTML-page
35
- def newTransitional
35
+ def new_transitional
36
36
  reset
37
37
  @page = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
38
38
  end
39
39
 
40
40
  # Start a RSS 2.0 feed
41
- def newRss(titleString, descString, &block)
41
+ def new_rss(title_string, desc_string, &block)
42
42
  reset
43
43
  @page = '<?xml version="1.0" encoding="utf-8"?>'
44
44
  cr
45
45
  @page += '<rss version="2.0">'
46
46
  cr
47
47
  channel {
48
- title { addHtml(escapeHtml(titleString)) }
49
- description { addHtml(escapeHtml(descString)) }
48
+ title { add_html(escape_html(title_string)) }
49
+ description { add_html(escape_html(desc_string)) }
50
50
  language
51
51
  block.call
52
52
  }
@@ -55,54 +55,50 @@ class HtmlGenerator
55
55
  cr
56
56
  end
57
57
 
58
- def addItem(titleString, linkString, descString)
58
+ def add_item(title_string, link_string, desc_string)
59
59
  tag('item', {}) {
60
- title { addHtml(escapeHtml(titleString)) }
61
- tag('link', {}) { addHtml(escapeHtml(linkString)) }
62
- description { addHtml(escapeHtml(descString)) }
60
+ title { add_html(escape_html(title_string)) }
61
+ tag('link', {}) { add_html(escape_html(link_string)) }
62
+ description { add_html(escape_html(desc_string)) }
63
63
  }
64
64
  end
65
65
 
66
- def escapeHtml(text)
66
+ def escape_html(text)
67
67
  return string_as_utf8(CGI.escapeHTML(text))
68
68
  end
69
-
70
- def escapeHTML(text)
71
- return escapeHtml(text)
72
- end
73
69
 
74
- def quote(aString)
75
- return '"' + aString + '"'
70
+ def quote(string)
71
+ return '"' + string + '"'
76
72
  end
77
73
 
78
- def formatTag(aTag)
79
- return aTag.downcase
74
+ def format_tag(tag)
75
+ return tag.downcase
80
76
  end
81
77
 
82
78
  def cr
83
79
  @page += @depth
84
80
  end
85
81
 
86
- def beginTag(tagname, parameters)
82
+ def begin_tag(tagname, parameters)
87
83
  cr
88
- @page += '<' + formatTag(tagname)
84
+ @page += '<' + format_tag(tagname)
89
85
  parameters.each_pair { |key, value|
90
86
  @page += ' ' + key + '=' + quote(value)
91
87
  }
92
88
  @page += '>'
93
89
  end
94
90
 
95
- def endTag(aTag)
91
+ def end_tag(aTag)
96
92
  cr
97
- @page += '</' + formatTag(aTag) + '>'
93
+ @page += '</' + format_tag(aTag) + '>'
98
94
  end
99
95
 
100
96
  def tag(tagname, parameters, &block)
101
- beginTag(tagname, parameters)
102
- incDepth
97
+ begin_tag(tagname, parameters)
98
+ inc_depth
103
99
  block.call # assume block modifies @page, too
104
- decDepth
105
- endTag(tagname)
100
+ dec_depth
101
+ end_tag(tagname)
106
102
  end
107
103
 
108
104
  def html(&block)
@@ -114,30 +110,30 @@ class HtmlGenerator
114
110
  end
115
111
 
116
112
  def meta(params)
117
- beginTag 'meta', params
113
+ begin_tag 'meta', params
118
114
  end
119
115
 
120
116
  def utf8()
121
117
  meta({
122
- "http-equiv" => "content-type",
123
- "content" => "text/html;charset=utf-8"})
118
+ "http-equiv" => "content-type",
119
+ "content" => "text/html;charset=utf-8"})
124
120
  end
125
121
 
126
122
  def norobots()
127
123
  meta({
128
- "name" => "robots",
129
- "content" =>"noindex,nofollow"})
124
+ "name" => "robots",
125
+ "content" =>"noindex,nofollow"})
130
126
  end
131
127
 
132
128
  def link(params)
133
- beginTag 'link', params
129
+ begin_tag 'link', params
134
130
  end
135
131
 
136
132
  def stylesheet(url)
137
133
  link({
138
- "rel" => "stylesheet",
139
- "type"=>"text/css",
140
- "href"=>"#{url}"})
134
+ "rel" => "stylesheet",
135
+ "type"=>"text/css",
136
+ "href"=>"#{url}"})
141
137
  end
142
138
 
143
139
  def title(&block)
@@ -157,7 +153,7 @@ class HtmlGenerator
157
153
  end
158
154
 
159
155
  def language(value = 'de')
160
- tag('language', {}) { addHtml value }
156
+ tag('language', {}) { add_html value }
161
157
  end
162
158
 
163
159
  def center(&block)
@@ -188,8 +184,8 @@ class HtmlGenerator
188
184
  tag 'div', params, &block
189
185
  end
190
186
 
191
- def img(srcPath, altName)
192
- beginTag('img', { 'src'=>srcPath, 'alt'=>altName })
187
+ def img(src_path, alt_name)
188
+ begin_tag('img', { 'src'=>src_path, 'alt'=>alt_name })
193
189
  end
194
190
 
195
191
  def dl(params, &block)
@@ -221,7 +217,7 @@ class HtmlGenerator
221
217
  end
222
218
 
223
219
  def frame(params)
224
- beginTag 'frame', params
220
+ begin_tag 'frame', params
225
221
  end
226
222
 
227
223
  def noframes(&block)
@@ -229,14 +225,14 @@ class HtmlGenerator
229
225
  end
230
226
 
231
227
  def br
232
- beginTag 'br', Hash.new
228
+ begin_tag 'br', Hash.new
233
229
  end
234
230
 
235
- def addHtml(htmlString)
236
- @page += htmlString
231
+ def add_html(html_string)
232
+ @page += html_string
237
233
  end
238
234
 
239
- def getPage
235
+ def get_page
240
236
  return @page # CGI.pretty(@page)
241
237
  end
242
238
  end
@@ -11,45 +11,45 @@ require 'piggy-core/winshell'
11
11
  # nconvert_thumbsgen.rb work.
12
12
  class NconvertThumbnailPageGenerator < ThumbnailPageGenerator
13
13
 
14
- def osPath(rubyPath)
15
- WinShell.instance.osPath(rubyPath)
14
+ def os_path(rubyPath)
15
+ WinShell.instance.os_path(rubyPath)
16
16
  end
17
17
 
18
18
  def escape(path)
19
19
  WinShell.instance.escape(path)
20
20
  end
21
21
 
22
- def sharpen?(fileInfo)
23
- ['JPG', 'JPEG'].include?(fileInfo.extension.upcase)
22
+ def sharpen?(file_info)
23
+ ['JPG', 'JPEG'].include?(file_info.extension.upcase)
24
24
  end
25
25
 
26
- def resizeFile(fileInfo, width, height, prefix)
27
- filename = fileInfo.name
28
- nconvertPath = 'nconvert'
26
+ def resize_file(file_info, width, height, prefix)
27
+ filename = file_info.name
28
+ nconvert_path = 'nconvert'
29
29
  format = '-out jpeg -q 90'
30
30
  mode = '-ratio -rtype linear -rflag decr'
31
- sharpen = sharpen?(fileInfo) ? '-sharpen 5' : ''
32
- filesArgString = escape(filename)
33
- out = "-o #{escape(osPath(File.join(imageOutputPath, prefix + '%.jpg')))}"
31
+ sharpen = sharpen?(file_info) ? '-sharpen 5' : ''
32
+ files_arg_string = escape(filename)
33
+ out = "-o #{escape(os_path(File.join(imageOutputPath, prefix + '%.jpg')))}"
34
34
  resize = '-resize ' + width.to_s + ' ' + height.to_s
35
- rotate = fileInfo.rotate? ? " -rotate #{fileInfo.rotation.to_s} " : ''
36
- command = "#{nconvertPath} #{format} #{mode} #{rotate} #{resize} #{sharpen} #{out} #{filesArgString}"
37
- client.runCommand(command, osPath(fileInfo.path))
35
+ rotate = file_info.rotate? ? " -rotate #{file_info.rotation.to_s} " : ''
36
+ command = "#{nconvert_path} #{format} #{mode} #{rotate} #{resize} #{sharpen} #{out} #{files_arg_string}"
37
+ client.run_command(command, os_path(file_info.path))
38
38
  end
39
39
 
40
- def conversionTypeFor(type)
40
+ def conversion_type_for(type)
41
41
  'jpg'
42
42
  end
43
43
 
44
44
  protected
45
45
 
46
- def imageProcessing(progress)
47
- progress.setTask("Processing images", @inputFilenames.size)
46
+ def image_processing(progress)
47
+ progress.set_task("Processing images", @inputFilenames.size)
48
48
  @inputFilenames.each {
49
49
  |info|
50
- progress.setProgress(info.name, 1)
51
- resizeFile(info, @options.thumbWidth, @options.thumbHeight, 't_')
52
- resizeFile(info, @options.imageWidth, @options.imageHeight, '')
50
+ progress.set_progress(info.name, 1)
51
+ resize_file(info, @options.thumbWidth, @options.thumbHeight, 't_')
52
+ resize_file(info, @options.imageWidth, @options.imageHeight, '')
53
53
  }
54
54
  end
55
55
  end
@@ -66,8 +66,8 @@ if $0 == __FILE__
66
66
  # end
67
67
  # generator = NconvertThumbnailPageGenerator.new(PiggyOptions.new)
68
68
  # generator.setInputDirectory(directory)
69
- # generator.setOutputDirectory(outputDir)
70
- # generator.setTitle(title)
71
- # generator.setFiles(filenames)
69
+ # generator.set_output_directory(outputDir)
70
+ # generator.set_title(title)
71
+ # generator.set_files(filenames)
72
72
  # generator.generate
73
73
  end
@@ -6,19 +6,20 @@ require 'piggy-core/winshell'
6
6
  # Provide Piggy with user defined settings.
7
7
  class PiggyOptions
8
8
  attr_accessor(:usePreview, :useLog,
9
- :thumbWidth, :thumbHeight, :imageWidth, :imageHeight,
10
- :generateFramePage, :useTable,
11
- :localDestinationPath, :remoteDestinationPath,
12
- :ftpUser, :ftpHost, :ftpHasLocaltime,
13
- :ftpConnectionTimeout, :ftpTransferTimeout,
14
- :addZip, :addSlideshow,
15
- :preselectDirectories,
9
+ :thumbWidth, :thumbHeight, :imageWidth, :imageHeight,
10
+ :generateFramePage, :useTable,
11
+ :localDestinationPath, :remoteDestinationPath,
12
+ :ftpUser, :ftpHost, :ftpHasLocaltime,
13
+ :ftpConnectionTimeout, :ftpTransferTimeout,
14
+ :addZip, :addSlideshow,
15
+ :preselectDirectories,
16
16
  :slideshowDelay,
17
- :style,
17
+ :style, :stylesSample, :skipImageProcessing,
18
18
  :browser,
19
- :debug)
19
+ :excludeFilters,
20
+ :debug)
20
21
 
21
- # possible values for @imageProcessor
22
+ # possible values for @image_processor
22
23
  ProcessorNconvert = 'nconvert'
23
24
  ProcessorFxruby = 'fxruby'
24
25
  ProcessorRmagick = 'rmagick'
@@ -48,12 +49,14 @@ class PiggyOptions
48
49
  @style = nil
49
50
  @debug = nil
50
51
  @browser = nil
51
- initializeNilsWithDefault
52
+ @stylesSample = nil
53
+ @excludeFilters = nil
54
+ initialize_nils_with_default
52
55
  end
53
56
 
54
57
  # Public init e. g. after reading some entries
55
58
  # from an older config file.
56
- def initializeNilsWithDefault
59
+ def initialize_nils_with_default
57
60
  @usePreview = false if @usePreview.nil?
58
61
  @useLog = false if @useLog.nil?
59
62
  @useNconvert = false if @useNconvert.nil?
@@ -66,7 +69,7 @@ class PiggyOptions
66
69
  @imageHeight = 520 if @imageHeight.nil?
67
70
  @generateFramePage = false if @generateFramePage.nil?
68
71
  @useTable = generateFramePage? if @uosPathseTable.nil?
69
- @localDestinationPath = WinShell.instance.pictureDirectory if @localDestinationPath.nil?
72
+ @localDestinationPath = WinShell.instance.picture_directory if @localDestinationPath.nil?
70
73
  @remoteDestinationPath = '' if @remoteDestinationPath.nil?
71
74
  @ftpUser = 'anonymous' if @ftpUser.nil?
72
75
  @ftpHost = 'ftp.blablabla.de' if @ftpHost.nil?
@@ -80,29 +83,31 @@ class PiggyOptions
80
83
  @style = 'shadow' if @style.nil?
81
84
  @debug = false if @debug.nil?
82
85
  @browser = '' if @browser.nil?
86
+ @stylesSample = false if @stylesSample.nil?
87
+ @excludeFilters = ['~$', '#$', '^\.'] if @excludeFilters.nil?
83
88
  end
84
89
 
85
- def useFxruby!
90
+ def use_fxruby!
86
91
  @imageProcessor = ProcessorFxruby
87
92
  end
88
93
 
89
- def useFxruby?
94
+ def use_fxruby?
90
95
  @imageProcessor == ProcessorFxruby
91
96
  end
92
97
 
93
- def useNconvert!
98
+ def use_nconvert!
94
99
  @imageProcessor = ProcessorNconvert
95
100
  end
96
101
 
97
- def useNconvert?
102
+ def use_nconvert?
98
103
  @imageProcessor == ProcessorNconvert
99
104
  end
100
105
 
101
- def useRmagick!
106
+ def use_rmagick!
102
107
  @imageProcessor = ProcessorRmagick
103
108
  end
104
109
 
105
- def useRmagick?
110
+ def use_rmagick?
106
111
  @imageProcessor == ProcessorRmagick
107
112
  end
108
113
 
@@ -119,5 +124,6 @@ class PiggyOptions
119
124
  alias :addSlideshow? :addSlideshow
120
125
  alias :preselectDirectories? :preselectDirectories
121
126
  alias :debug? :debug
127
+ alias :stylesSample? :stylesSample
122
128
  end
123
129
 
@@ -9,18 +9,18 @@ require 'piggy-core/options'
9
9
 
10
10
  # Store PiggyOptions into (or load from) configuration files.
11
11
  # File format will be Yaml. File location will be system specific:
12
- # "#{WinShell.instance.pathForSpecialFolder("LOCALAPPDATA")}/piggy"
12
+ # "#{WinShell.instance.path_for_special_folder("LOCALAPPDATA")}/piggy"
13
13
  class PiggyOptionsPersistence
14
14
  def initialize
15
15
  super
16
16
  shell = WinShell.instance
17
- localAppDataPath = shell.pathForSpecialFolder("LOCALAPPDATA")
18
- piggyAppDataPath = localAppDataPath + "#{File::SEPARATOR}" + 'piggy'
19
- Dir.mkdir(piggyAppDataPath) unless File.directory?(piggyAppDataPath)
20
- @optionsFile = piggyAppDataPath + "#{File::SEPARATOR}" + 'options.yaml'
17
+ local_app_data_path = shell.path_for_special_folder("LOCALAPPDATA")
18
+ piggy_app_data_path = local_app_data_path + "#{File::SEPARATOR}" + 'piggy'
19
+ Dir.mkdir(piggy_app_data_path) unless File.directory?(piggy_app_data_path)
20
+ @optionsFile = piggy_app_data_path + "#{File::SEPARATOR}" + 'options.yaml'
21
21
  end
22
22
 
23
- def loadYaml
23
+ def load_yaml
24
24
  return PiggyOptions.new unless File.exists?(@optionsFile)
25
25
  begin
26
26
  config = File.open(@optionsFile) { |io| YAML.load(io) }
@@ -29,7 +29,7 @@ class PiggyOptionsPersistence
29
29
  else
30
30
  options = config
31
31
  end
32
- options.initializeNilsWithDefault
32
+ options.initialize_nils_with_default
33
33
  rescue StandardError => ex
34
34
  puts('Configuration error, options.yaml ignored: ' + ex.message)
35
35
  options = PiggyOptions.new
@@ -37,7 +37,7 @@ class PiggyOptionsPersistence
37
37
  return options
38
38
  end
39
39
 
40
- def saveYaml(options)
40
+ def save_yaml(options)
41
41
  begin
42
42
  if File.exists?(@optionsFile)
43
43
  File.rename(@optionsFile, "#{@optionsFile}.bak")
@@ -17,25 +17,25 @@ class Progress
17
17
  !@cancel
18
18
  end
19
19
 
20
- def setTask(task, numUnits=1)
20
+ def set_task(task, num_units=1)
21
21
  @units = 0
22
22
  @task = task
23
- @numUnits = numUnits
24
- logTask
23
+ @numUnits = num_units
24
+ log_task
25
25
  return continue?
26
26
  end
27
27
 
28
- def logTask
28
+ def log_task
29
29
  puts "Now working on Task #{@task} (#{@numUnits} units)"
30
30
  end
31
31
 
32
- def setProgress(message=".", unit=1)
32
+ def set_progress(message=".", unit=1)
33
33
  @units = @units + unit
34
- logProgress(message, unit)
34
+ log_progress(message, unit)
35
35
  return continue?
36
36
  end
37
37
 
38
- def logProgress(message, unit)
38
+ def log_progress(message, unit)
39
39
  if(message == ".")
40
40
  put message
41
41
  else
@@ -2,29 +2,29 @@ require 'RMagick'
2
2
 
3
3
  class RmagickThumbnailPageGenerator < ThumbnailPageGenerator
4
4
 
5
- def resizeFile(fileInfo, width, height, prefix)
6
- img = Magick::Image.read(fileInfo.nameWithPath)[0]
7
- imgWidth = img.columns.to_f
8
- imgHeight = img.rows.to_f
9
- scale_x = imgWidth > width ? width/imgWidth : 1
10
- scale_y = imgHeight > height ? height/imgHeight : 1
5
+ def resize_file(file_info, width, height, prefix)
6
+ img = Magick::Image.read(file_info.name_with_path)[0]
7
+ img_width = img.columns.to_f
8
+ img_height = img.rows.to_f
9
+ scale_x = img_width > width ? width/img_width : 1
10
+ scale_y = img_height > height ? height/img_height : 1
11
11
  scale = scale_x < scale_y ? scale_x : scale_y
12
- if(fileInfo.rotate?)
13
- img = img.rotate!(fileInfo.rotation)
12
+ if(file_info.rotate?)
13
+ img = img.rotate!(file_info.rotation)
14
14
  end
15
15
  img = img.resize!(scale)
16
- img.write(File.join(imageOutputPath,prefix + fileInfo.name))
16
+ img.write(File.join(imageOutputPath,prefix + file_info.name))
17
17
  end
18
18
 
19
19
  protected
20
20
 
21
- def imageProcessing(progress)
22
- progress.setTask("Processing images", @inputFilenames.size)
21
+ def image_processing(progress)
22
+ progress.set_task("Processing images", @inputFilenames.size)
23
23
  @inputFilenames.each {
24
24
  |info|
25
- progress.setProgress(info.name, 1)
26
- resizeFile(info, @options.thumbWidth, @options.thumbHeight, 't_')
27
- resizeFile(info, @options.imageWidth, @options.imageHeight, '')
25
+ progress.set_progress(info.name, 1)
26
+ resize_file(info, @options.thumbWidth, @options.thumbHeight, 't_')
27
+ resize_file(info, @options.imageWidth, @options.imageHeight, '')
28
28
  }
29
29
  end
30
30
  end