Piggy 0.4.3.0 → 0.5.0.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.
- data/CHANGES.txt +7 -0
- data/README.txt +7 -0
- data/lib/piggy-core/alive_check.rb +1 -0
- data/lib/piggy-core/ftp_adapter.rb +59 -8
- data/lib/piggy-core/htmlgen.rb +31 -17
- data/lib/piggy-core/options.rb +7 -3
- data/lib/piggy-core/thumbnail_page_generator.rb +86 -24
- data/lib/piggy-core/version.rb +2 -2
- data/lib/piggy-gui/ftp_browser_widget.rb +63 -19
- data/lib/piggy-gui/html_options_widget.rb +7 -1
- data/lib/piggy-gui/piggy_image_browser.rb +3 -1
- data/lib/templates/PiggyFX.jar +0 -0
- data/lib/templates/PiggyFX.jnlp +23 -0
- data/lib/templates/PiggyFX_browser.jnlp +19 -0
- data/lib/templates/javafx.htm +34 -0
- data/lib/templates/styles/basic/style.css +5 -0
- data/lib/templates/styles/black/style.css +5 -0
- data/lib/templates/styles/roundedbox/style.css +5 -0
- data/lib/templates/styles/shadow/style.css +5 -0
- data/lib/templates/styles/shadow_D9F5F3/style.css +5 -0
- data/lib/templates/styles/shadow_black/style.css +16 -0
- data/lib/templates/styles/shadow_bowers/style.css +6 -3
- data/lib/templates/styles/sylvester/style.css +5 -0
- metadata +6 -2
data/CHANGES.txt
CHANGED
data/README.txt
CHANGED
@@ -33,3 +33,10 @@ Uncheck this option if this metadata includes personal information
|
|
33
33
|
that you do not want to publish.
|
34
34
|
(See http://netzreport.googlepages.com/hidden_data_in_jpeg_files.html
|
35
35
|
for more information on this topic.)
|
36
|
+
|
37
|
+
Piggy output optionally contains Javascript and Java FX Script.
|
38
|
+
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.
|
41
|
+
|
42
|
+
|
@@ -18,8 +18,15 @@ class FtpAdapter
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def connect(host, user, password)
|
21
|
-
|
22
|
-
@
|
21
|
+
@host = host
|
22
|
+
@user = user
|
23
|
+
@password = password
|
24
|
+
reconnect
|
25
|
+
end
|
26
|
+
|
27
|
+
def reconnect
|
28
|
+
c_timeout { @connection = Net::FTP.open(@host, @user, @password) }
|
29
|
+
@connection.debug_mode = @options.debug
|
23
30
|
end
|
24
31
|
|
25
32
|
def chdir(path)
|
@@ -53,11 +60,15 @@ class FtpAdapter
|
|
53
60
|
def delete(file)
|
54
61
|
c_timeout { @connection.delete(file) }
|
55
62
|
end
|
63
|
+
|
64
|
+
def rmdir(dir)
|
65
|
+
c_timeout { @connection.rmdir(dir) }
|
66
|
+
end
|
56
67
|
|
57
68
|
# Upload with progress events.
|
58
69
|
#
|
59
70
|
# Example:
|
60
|
-
# upload('C:\tmp
|
71
|
+
# upload('C:\tmp', 'C:\tmp\bla\big.zip') {
|
61
72
|
# |data|
|
62
73
|
# ...
|
63
74
|
# data.size
|
@@ -67,9 +78,11 @@ class FtpAdapter
|
|
67
78
|
# and every chunk of transferred data will
|
68
79
|
# be given to the block.
|
69
80
|
def upload(local_path, file, &block)
|
81
|
+
puts "FtpAdapter\#upload #{file}"
|
70
82
|
depth_offset = FilePath.split(local_path).size
|
71
83
|
path_sections = FilePath.split(file)
|
72
84
|
dirs = path_sections[depth_offset..-2]
|
85
|
+
pwd = c_timeout { @connection.pwd }
|
73
86
|
unless dirs == nil
|
74
87
|
dirs.each do
|
75
88
|
|dir|
|
@@ -81,22 +94,60 @@ class FtpAdapter
|
|
81
94
|
end
|
82
95
|
end
|
83
96
|
end
|
97
|
+
if(putbinaryfile(file, &block))
|
98
|
+
unless dirs == nil
|
99
|
+
dirs.each { |dir| chdir('..') }
|
100
|
+
end
|
101
|
+
puts "Done"
|
102
|
+
else
|
103
|
+
begin
|
104
|
+
puts "Abortion delete: #{file}"
|
105
|
+
reconnect
|
106
|
+
chdir(pwd + dirs.join("/"))
|
107
|
+
puts(@connection.pwd)
|
108
|
+
delete(File.basename(file))
|
109
|
+
puts "Abortion delete done"
|
110
|
+
rescue StandardError => ex
|
111
|
+
puts "Abortion delete failed"
|
112
|
+
puts "#{ex.class.to_s}: #{ex.message}"
|
113
|
+
ensure
|
114
|
+
# force cleanup after error or abortion
|
115
|
+
begin
|
116
|
+
c_timeout { @connection.close }
|
117
|
+
rescue StandardError => ex
|
118
|
+
puts "Abortion cleanup failed"
|
119
|
+
puts "#{ex.class.to_s}: #{ex.message}"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def putbinaryfile(file, &block)
|
126
|
+
aborted = false
|
84
127
|
alive_checker = AliveCheck.new(@options.ftpTransferTimeout,
|
85
128
|
"ftp transfer timeout")
|
86
129
|
alive_checker.check do
|
87
130
|
@connection.putbinaryfile(file) { |data|
|
88
131
|
alive_checker.alive!
|
89
|
-
block.call(data)
|
132
|
+
if block.call(data)
|
133
|
+
print "."
|
134
|
+
else
|
135
|
+
# @connection.abort would cause Errno::EINVAL later on
|
136
|
+
aborted = true
|
137
|
+
break
|
138
|
+
end
|
90
139
|
}
|
91
140
|
end
|
92
|
-
|
93
|
-
dirs.each { |dir| chdir('..') }
|
94
|
-
end
|
141
|
+
return !aborted
|
95
142
|
end
|
96
|
-
|
143
|
+
|
97
144
|
def close
|
98
145
|
@connection.close unless @connection.nil?
|
99
146
|
end
|
147
|
+
|
148
|
+
def closed?
|
149
|
+
@connection.nil? or @connection.closed?
|
150
|
+
end
|
100
151
|
|
101
152
|
private
|
102
153
|
|
data/lib/piggy-core/htmlgen.rb
CHANGED
@@ -39,27 +39,33 @@ class HtmlGenerator
|
|
39
39
|
|
40
40
|
# Start a RSS 2.0 feed
|
41
41
|
def new_rss(title_string, desc_string, &block)
|
42
|
+
new_xml do
|
43
|
+
@page += '<rss version="2.0">'
|
44
|
+
cr
|
45
|
+
channel {
|
46
|
+
title { add_html(title_string) }
|
47
|
+
description { add_html(desc_string) }
|
48
|
+
language
|
49
|
+
block.call
|
50
|
+
}
|
51
|
+
cr
|
52
|
+
@page += '</rss>'
|
53
|
+
cr
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def new_xml(encoding="utf-8", &block)
|
42
58
|
reset
|
43
|
-
@page =
|
44
|
-
cr
|
45
|
-
@page += '<rss version="2.0">'
|
46
|
-
cr
|
47
|
-
channel {
|
48
|
-
title { add_html(escape_html(title_string)) }
|
49
|
-
description { add_html(escape_html(desc_string)) }
|
50
|
-
language
|
51
|
-
block.call
|
52
|
-
}
|
53
|
-
cr
|
54
|
-
@page += '</rss>'
|
59
|
+
@page = "<?xml version=\"1.0\" encoding=\"#{encoding}\"?>"
|
55
60
|
cr
|
61
|
+
block.call
|
56
62
|
end
|
57
63
|
|
58
64
|
def add_item(title_string, link_string, desc_string)
|
59
65
|
tag('item', {}) {
|
60
|
-
title { add_html(
|
61
|
-
tag('link', {}) { add_html(
|
62
|
-
description { add_html(
|
66
|
+
title { add_html(title_string) }
|
67
|
+
tag('link', {}) { add_html(link_string) }
|
68
|
+
description { add_html(desc_string) }
|
63
69
|
}
|
64
70
|
end
|
65
71
|
|
@@ -153,7 +159,7 @@ class HtmlGenerator
|
|
153
159
|
end
|
154
160
|
|
155
161
|
def language(value = 'de')
|
156
|
-
tag('language', {}) {
|
162
|
+
tag('language', {}) { add value }
|
157
163
|
end
|
158
164
|
|
159
165
|
def center(&block)
|
@@ -184,6 +190,10 @@ class HtmlGenerator
|
|
184
190
|
tag 'div', params, &block
|
185
191
|
end
|
186
192
|
|
193
|
+
def span(params = {}, &block)
|
194
|
+
tag 'span', params, &block
|
195
|
+
end
|
196
|
+
|
187
197
|
def img(src_path, alt_name)
|
188
198
|
begin_tag('img', { 'src'=>src_path, 'alt'=>alt_name })
|
189
199
|
end
|
@@ -229,7 +239,11 @@ class HtmlGenerator
|
|
229
239
|
end
|
230
240
|
|
231
241
|
def add_html(html_string)
|
232
|
-
|
242
|
+
add(escape_html(html_string))
|
243
|
+
end
|
244
|
+
|
245
|
+
def add(string)
|
246
|
+
@page += string
|
233
247
|
end
|
234
248
|
|
235
249
|
def get_page
|
data/lib/piggy-core/options.rb
CHANGED
@@ -11,9 +11,9 @@ class PiggyOptions
|
|
11
11
|
:localDestinationPath, :remoteDestinationPath,
|
12
12
|
:ftpUser, :ftpHost, :ftpHasLocaltime,
|
13
13
|
:ftpConnectionTimeout, :ftpTransferTimeout,
|
14
|
-
:addZip, :addSlideshow,
|
14
|
+
:addZip, :addSlideshow, :addJavaFxSlideshow,
|
15
15
|
:preselectDirectories,
|
16
|
-
:slideshowDelay,
|
16
|
+
:slideshowDelay,
|
17
17
|
:style, :stylesSample, :skipImageProcessing,
|
18
18
|
:browser,
|
19
19
|
:excludeFilters,
|
@@ -44,6 +44,7 @@ class PiggyOptions
|
|
44
44
|
@ftpTransferTimeout = nil
|
45
45
|
@addZip = nil
|
46
46
|
@addSlideshow = nil
|
47
|
+
@addJavaFxSlideshow = nil
|
47
48
|
@preselectDirectories = nil
|
48
49
|
@slideshowDelay = nil
|
49
50
|
@style = nil
|
@@ -78,6 +79,7 @@ class PiggyOptions
|
|
78
79
|
@ftpTransferTimeout = 30 if @ftpTransferTimeout.nil?
|
79
80
|
@addZip = true if @addZip.nil?
|
80
81
|
@addSlideshow = true if @addSlideshow.nil?
|
82
|
+
@addJavaFxSlideshow = false if @addJavaFxSlideshow.nil?
|
81
83
|
@preselectDirectories = true if @preselectDirectories.nil?
|
82
84
|
@slideshowDelay = 5 if @slideshowDelay.nil?
|
83
85
|
@style = 'shadow' if @style.nil?
|
@@ -114,7 +116,7 @@ class PiggyOptions
|
|
114
116
|
def browser?
|
115
117
|
!@browser.nil? && !@browser.empty?
|
116
118
|
end
|
117
|
-
|
119
|
+
|
118
120
|
alias :usePreview? :usePreview
|
119
121
|
alias :useLog? :useLog
|
120
122
|
alias :generateFramePage? :generateFramePage
|
@@ -122,8 +124,10 @@ class PiggyOptions
|
|
122
124
|
alias :ftpHasLocaltime? :ftpHasLocaltime
|
123
125
|
alias :addZip? :addZip
|
124
126
|
alias :addSlideshow? :addSlideshow
|
127
|
+
alias :addJavaFxSlideshow? :addJavaFxSlideshow
|
125
128
|
alias :preselectDirectories? :preselectDirectories
|
126
129
|
alias :debug? :debug
|
127
130
|
alias :stylesSample? :stylesSample
|
131
|
+
alias :initializeNilsWithDefault :initialize_nils_with_default
|
128
132
|
end
|
129
133
|
|
@@ -59,8 +59,9 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
59
59
|
attr_writer(:client)
|
60
60
|
|
61
61
|
HtmlExt = '.htm'
|
62
|
-
DownloadName =
|
63
|
-
SlideshowName =
|
62
|
+
DownloadName = 'download.zip'
|
63
|
+
SlideshowName = 'slideshow'
|
64
|
+
JavaFxName = 'animation'
|
64
65
|
|
65
66
|
def initialize(options)
|
66
67
|
@client = self
|
@@ -174,18 +175,24 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
174
175
|
}
|
175
176
|
body({"class"=>"image_page"}) {
|
176
177
|
div({'class' => 'content'}){
|
177
|
-
div({'class' => 'navigation'}){
|
178
|
+
div({'class' => 'navigation', 'id'=>'toprevnext'}){
|
178
179
|
div {
|
179
180
|
div {
|
180
181
|
p {
|
181
|
-
|
182
|
-
|
182
|
+
span {
|
183
|
+
a({"HREF" => escape_html(pred) + HtmlExt}){
|
184
|
+
add(i == 0 ? 'last' : 'previous')
|
185
|
+
}
|
183
186
|
}
|
184
|
-
|
185
|
-
|
187
|
+
span {
|
188
|
+
a({"HREF" => escape_html(backlink) }) {
|
189
|
+
add('overview')
|
190
|
+
}
|
186
191
|
}
|
187
|
-
|
188
|
-
|
192
|
+
span {
|
193
|
+
a({"HREF" => escape_html(succ) + HtmlExt}) {
|
194
|
+
add(i == max_ind ? 'first' : 'next')
|
195
|
+
}
|
189
196
|
}
|
190
197
|
}
|
191
198
|
}
|
@@ -203,7 +210,7 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
203
210
|
div({'class' => 'comment'}){
|
204
211
|
div {
|
205
212
|
div {
|
206
|
-
p { add_html(
|
213
|
+
p { add_html(comment) }
|
207
214
|
}
|
208
215
|
}
|
209
216
|
}
|
@@ -216,6 +223,27 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
216
223
|
}
|
217
224
|
end
|
218
225
|
|
226
|
+
def build_javafx_config()
|
227
|
+
new_xml do
|
228
|
+
tag('root', {}) do
|
229
|
+
add("<title>#{escape_html(@title)}</title>")
|
230
|
+
cr
|
231
|
+
tag('images', {}){
|
232
|
+
cr
|
233
|
+
maxInd = @inputFilenames.size - 1
|
234
|
+
(0..maxInd).each { | i |
|
235
|
+
current = image_name(@inputFilenames[i])
|
236
|
+
add("<image src=\"#{string_as_utf8(current)}\"/>")
|
237
|
+
cr
|
238
|
+
}
|
239
|
+
}
|
240
|
+
tag('layout', {}) {
|
241
|
+
add("<imageSize width=\"#{@options.imageWidth}\" height=\"#{@options.imageHeight}\"/>")
|
242
|
+
}
|
243
|
+
end
|
219
244
|
end
|
245
|
+
write_file(File.join(imageOutputPath, 'config.xml'), get_page)
|
246
|
+
end
|
247
|
+
|
220
248
|
def build_slideshow_list
|
221
249
|
File.open(File.join(imageOutputPath, 'images.js'), 'w') { | fp |
|
222
250
|
fp.print("var images = new Array(\n")
|
@@ -283,15 +311,28 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
283
311
|
stylesheet sub_stylesheet_url
|
284
312
|
}
|
285
313
|
body({'class'=>'thumbs'}){
|
286
|
-
h3({}){
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
314
|
+
h3({}){ add(escape_html(@title)) }
|
315
|
+
div({'class'=>'navigation', 'id'=>'toslides' }) do
|
316
|
+
if(size_of_zipfile > 0)
|
317
|
+
span {
|
318
|
+
a({"href" => DownloadName }) { add_html(DownloadName) }
|
319
|
+
add_html("(#{bytes_as_string(size_of_zipfile)})")
|
320
|
+
}
|
321
|
+
end
|
322
|
+
if(@options.addSlideshow?)
|
323
|
+
span {
|
324
|
+
a({"href" => File.join('slideshow.htm'), "target" => "_top"}) {
|
325
|
+
add_html(SlideshowName)
|
326
|
+
}
|
327
|
+
}
|
328
|
+
end
|
329
|
+
if(@options.addJavaFxSlideshow?)
|
330
|
+
span {
|
331
|
+
a({"href" => File.join('javafx.htm'), "target" => "_top"}) {
|
332
|
+
add_html(JavaFxName)
|
333
|
+
}
|
334
|
+
}
|
335
|
+
end
|
295
336
|
end
|
296
337
|
image_table({'class'=>'table'}) {
|
297
338
|
matrix.each do |m_row|
|
@@ -388,9 +429,9 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
388
429
|
})
|
389
430
|
noframes(){
|
390
431
|
cr
|
391
|
-
|
432
|
+
add('Ohne Frames siehe: ')
|
392
433
|
a({'href'=>"navigation.htm"}){
|
393
|
-
|
434
|
+
add('Navigationsleiste')
|
394
435
|
}
|
395
436
|
}
|
396
437
|
}
|
@@ -436,8 +477,19 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
436
477
|
if @options.addSlideshow?
|
437
478
|
copy_templates(['slideshow.htm', 'slideshow.js'], imageOutputPath)
|
438
479
|
link = "<link href=\"#{sub_stylesheet_url}\" rel=\"stylesheet\" type=\"text/css\">"
|
439
|
-
insert_in_file(File.join(imageOutputPath, 'slideshow.htm'),
|
440
|
-
|
480
|
+
insert_in_file(File.join(imageOutputPath, 'slideshow.htm'), /<!--STYLE-->/, link)
|
481
|
+
end
|
482
|
+
if @options.addJavaFxSlideshow?
|
483
|
+
fx_files = ['javafx.htm', 'PiggyFX.jnlp', 'PiggyFX_browser.jnlp']
|
484
|
+
copy_templates(fx_files + ['PiggyFX.jar'], imageOutputPath)
|
485
|
+
fx_files.each { |file_name|
|
486
|
+
# magic numbers from javafx code
|
487
|
+
w = @options.imageWidth + 205
|
488
|
+
h = @options.imageHeight + 140
|
489
|
+
h = 700 if h < 700 # need this height for image bar with 5 images
|
490
|
+
replace_in_file(File.join(imageOutputPath, file_name), /@WIDTH@/, w.to_s)
|
491
|
+
replace_in_file(File.join(imageOutputPath, file_name), /@HEIGHT@/, h.to_s)
|
492
|
+
}
|
441
493
|
end
|
442
494
|
end
|
443
495
|
|
@@ -473,6 +525,15 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
473
525
|
}
|
474
526
|
}
|
475
527
|
end
|
528
|
+
|
529
|
+
def replace_in_file(file, pattern, replacement)
|
530
|
+
lines = File.readlines(file)
|
531
|
+
File.open(file, 'w') { |fp|
|
532
|
+
lines.each { |line|
|
533
|
+
fp.print(line.gsub(pattern, replacement))
|
534
|
+
}
|
535
|
+
}
|
536
|
+
end
|
476
537
|
|
477
538
|
def update_navigation_frame()
|
478
539
|
reset
|
@@ -480,7 +541,7 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
480
541
|
a({
|
481
542
|
'href' => escape_html(subDir) + '/index.htm',
|
482
543
|
'target' => 'Daten'}) {
|
483
|
-
add_html(
|
544
|
+
add_html(@title)
|
484
545
|
}
|
485
546
|
br
|
486
547
|
add_html("\n")
|
@@ -523,6 +584,7 @@ class ThumbnailPageGenerator < HtmlGenerator
|
|
523
584
|
build_thumbnail_page(size_of_zipfile)
|
524
585
|
copy_template_files
|
525
586
|
build_slideshow_list if @options.addSlideshow?
|
587
|
+
build_javafx_config if @options.addJavaFxSlideshow?
|
526
588
|
if @options.generateFramePage?
|
527
589
|
build_frame_page
|
528
590
|
update_navigation_frame
|
data/lib/piggy-core/version.rb
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
# Provide release information for Piggy.
|
5
5
|
module PiggyVersion
|
6
6
|
def PiggyVersion.version_string
|
7
|
-
'0.
|
7
|
+
'0.5.0-0'
|
8
8
|
end
|
9
9
|
def PiggyVersion.copyright_string
|
10
10
|
'Copyright (C) 2009 Sascha D�rdelmann'
|
11
11
|
end
|
12
12
|
def PiggyVersion.development_status
|
13
|
-
'
|
13
|
+
'beta'
|
14
14
|
end
|
15
15
|
def PiggyVersion.display_string
|
16
16
|
"#{PiggyVersion.version_string} (#{PiggyVersion.development_status})"
|
@@ -243,22 +243,26 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
243
243
|
@leftFileList.clearItems
|
244
244
|
@leftContents = DirectoryContents.new(left_path)
|
245
245
|
begin
|
246
|
-
|
247
|
-
@ftpAdapter.connect(host, user, password)
|
248
|
-
@connectionDataVerified = true
|
249
|
-
@connect_button.setState(STATE_DOWN)
|
250
|
-
@ftpAdapter.chdir(left_path)
|
246
|
+
connect
|
251
247
|
block.call # <------ the call
|
252
|
-
|
253
|
-
|
254
|
-
@ftpAdapter.
|
248
|
+
puts 'ftpDo: call finished'
|
249
|
+
begin
|
250
|
+
connect if @ftpAdapter.closed?
|
251
|
+
update_left_connected
|
252
|
+
rescue Errno::EINVAL => ex
|
253
|
+
puts "Recover from: #{ex.message}"
|
254
|
+
# abortion and big files
|
255
|
+
# might cause socket errors
|
256
|
+
# force reconnect
|
257
|
+
connect
|
258
|
+
update_left_connected
|
255
259
|
end
|
256
260
|
rescue SocketError => ex
|
257
|
-
error(ex.message)
|
261
|
+
error("SocketError: #{ex.message}")
|
258
262
|
rescue Net::FTPError => ex
|
259
|
-
error(ex.message)
|
263
|
+
error("Net::FTPError: #{ex.message}")
|
260
264
|
rescue StandardError => ex
|
261
|
-
error(ex.message)
|
265
|
+
error("#{ex.class.to_s}: #{ex.message}")
|
262
266
|
rescue Timeout::Error => ex
|
263
267
|
error("Timeout - operation took longer than expected. \nCheck network connection and try again.")
|
264
268
|
ensure
|
@@ -268,6 +272,20 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
268
272
|
getApp.endWaitCursor
|
269
273
|
end
|
270
274
|
|
275
|
+
def connect
|
276
|
+
@connectionDataVerified = false
|
277
|
+
@ftpAdapter.connect(host, user, password)
|
278
|
+
@ftpAdapter.chdir(left_path)
|
279
|
+
@connectionDataVerified = true
|
280
|
+
@connect_button.setState(STATE_DOWN)
|
281
|
+
end
|
282
|
+
|
283
|
+
def update_left_connected
|
284
|
+
update_list(@ftpAdapter.nlst, @leftFileList, @leftContents) do
|
285
|
+
|file, path|
|
286
|
+
@ftpAdapter.info(file, path)
|
287
|
+
end
|
271
288
|
end
|
289
|
+
|
272
290
|
def update_ftp_list
|
273
291
|
ftp_do {} # every ftp action includes an update :-)
|
274
292
|
end
|
@@ -322,27 +340,48 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
322
340
|
end
|
323
341
|
update_status_icons
|
324
342
|
end
|
343
|
+
|
344
|
+
def ftp_remove_left(dirs)
|
345
|
+
ftp_do do
|
346
|
+
dirs.each { |dir|
|
347
|
+
@ftpAdapter.rmdir(dir)
|
348
|
+
}
|
349
|
+
end
|
350
|
+
update_status_icons
|
351
|
+
end
|
325
352
|
|
326
353
|
def ftp_upload_right(hash, totalSize)
|
354
|
+
all = hash.keys.size
|
355
|
+
current = 0
|
327
356
|
ftp_do do
|
328
357
|
progressDialog = FXProgressDialog.new(self,
|
329
358
|
'Transferring data',
|
330
|
-
'Transferring data'
|
359
|
+
'Transferring data',
|
360
|
+
PROGRESSDIALOG_NORMAL | PROGRESSDIALOG_CANCEL)
|
331
361
|
begin
|
332
|
-
progressDialog.setProgress(
|
362
|
+
progressDialog.setProgress(0)
|
333
363
|
progressDialog.setTotal(totalSize)
|
334
364
|
progressDialog.create
|
335
365
|
progressDialog.show
|
336
366
|
progressDialog.repaint
|
337
367
|
hash.keys.sort.each do
|
338
368
|
|file|
|
369
|
+
current = current + 1
|
370
|
+
progressDialog.setMessage(ruby_2_fox("Transferring #{current.to_s}/#{all.to_s}: #{File.basename(file)}"))
|
371
|
+
progressDialog.repaint
|
339
372
|
@ftpAdapter.upload(right_path, file) { |data|
|
340
|
-
progressDialog.setMessage(ruby_2_fox("Transferring #{File.basename(file)}"))
|
341
373
|
progressDialog.increment(data.size)
|
342
374
|
progressDialog.repaint
|
375
|
+
# Workaround for
|
376
|
+
# response problem with vista
|
377
|
+
# getApp().runModalWhileEvents()
|
378
|
+
getApp().runWhileEvents()
|
379
|
+
!progressDialog.cancelled?
|
343
380
|
}
|
381
|
+
break if progressDialog.cancelled?
|
344
382
|
end
|
345
383
|
ensure
|
384
|
+
puts "Upload stopped at #{current.to_s}/#{all.to_s}"
|
346
385
|
progressDialog.hide
|
347
386
|
end
|
348
387
|
end
|
@@ -370,12 +409,17 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
370
409
|
dirs = sel.select { |file|
|
371
410
|
@leftContents[file].directory?
|
372
411
|
}
|
373
|
-
|
412
|
+
files = sel.reject { |file|
|
413
|
+
@leftContents[file].directory?
|
414
|
+
}
|
374
415
|
return false if sel.empty?
|
375
|
-
|
376
|
-
|
377
|
-
"
|
378
|
-
|
416
|
+
answer = FXMessageBox.question(self, MBOX_YES_NO,
|
417
|
+
"Really delete?",
|
418
|
+
"Selected:\n#{dirs.size.to_s} directories\n#{files.size.to_s} files\nReally delete?")
|
419
|
+
if answer == MBOX_CLICKED_YES
|
420
|
+
ftp_delete_left(files)
|
421
|
+
ftp_remove_left(dirs)
|
422
|
+
end
|
379
423
|
end
|
380
424
|
|
381
425
|
# events
|
@@ -53,11 +53,17 @@ class HtmlOptionsWidget < Fox::FXMatrix
|
|
53
53
|
@options.addZip = ptr
|
54
54
|
}
|
55
55
|
add_label_to(self, ""); # TODO empty cell in matrix layout
|
56
|
-
add_slideshow_check = FXCheckButton.new(self, 'Add slideshow')
|
56
|
+
add_slideshow_check = FXCheckButton.new(self, 'Add Javascript slideshow')
|
57
57
|
add_slideshow_check.setCheck(@options.addSlideshow?)
|
58
58
|
add_slideshow_check.connect(SEL_COMMAND) { |sender, sel, ptr|
|
59
59
|
@options.addSlideshow = ptr
|
60
60
|
}
|
61
|
+
add_label_to(self, ""); # TODO empty cell in matrix layout
|
62
|
+
add_slideshow_check = FXCheckButton.new(self, 'Add JavaFX slideshow')
|
63
|
+
add_slideshow_check.setCheck(@options.addJavaFxSlideshow?)
|
64
|
+
add_slideshow_check.connect(SEL_COMMAND) { |sender, sel, ptr|
|
65
|
+
@options.addJavaFxSlideshow = ptr
|
66
|
+
}
|
61
67
|
add_label_to(self, "Style:")
|
62
68
|
style_text_field = new_combobox(self, 32,
|
63
69
|
10,
|
@@ -195,6 +195,7 @@ class PiggyImageBrowser < Fox::FXMainWindow
|
|
195
195
|
msg += "- FXRuby #{Fox.fxrubyversion}\n"
|
196
196
|
msg += "- FOX Toolkit #{Fox.fxversion}\n"
|
197
197
|
msg += "- Javascript slideshow no version information availiable\n"
|
198
|
+
msg += "- JavaFX animation uses JavaFX Script Version 1.2 which runs on top of Java 6\n"
|
198
199
|
msg += "- Piggy #{PiggyVersion.display_string}\n"
|
199
200
|
about_title = "About Piggy"
|
200
201
|
tmp = FXMenuCommand.new(menus['help'], "&About Piggy...")
|
@@ -543,7 +544,7 @@ class PiggyImageBrowser < Fox::FXMainWindow
|
|
543
544
|
if @currentRotation >= 360
|
544
545
|
@currentRotation = @currentRotation - 360
|
545
546
|
end
|
546
|
-
@orientationStatus.setText(ruby_2_fox(@currentRotation.to_s + '�'))
|
547
|
+
@orientationStatus.setText(ruby_2_fox(@currentRotation.to_s + '�'))
|
547
548
|
current_file_info.rotation = @currentRotation
|
548
549
|
end
|
549
550
|
|
@@ -790,6 +791,7 @@ class PiggyImageBrowser < Fox::FXMainWindow
|
|
790
791
|
get_style_list.each { |style|
|
791
792
|
@options.style = style
|
792
793
|
@options.skipImageProcessing = (style != 'basic')
|
794
|
+
@options.addJavaFxSlideshow = (style == 'basic')
|
793
795
|
@options.stylesSample = (style != 'basic')
|
794
796
|
generator.set_title(style)
|
795
797
|
generator.set_output_directory(style)
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<jnlp spec="1.0+" codebase="http://piggy.rubyforge.org/samples/basic/" href="PiggyFX.jnlp">
|
3
|
+
<information>
|
4
|
+
<title>PiggyFX</title>
|
5
|
+
<vendor>piggy project at rubyforge.org</vendor>
|
6
|
+
<homepage href="http://piggy.rubyforge.org"/>
|
7
|
+
<description>PiggyFX</description>
|
8
|
+
<offline-allowed/>
|
9
|
+
<shortcut>
|
10
|
+
<desktop/>
|
11
|
+
</shortcut>
|
12
|
+
</information>
|
13
|
+
<security>
|
14
|
+
<all-permissions/>
|
15
|
+
</security>
|
16
|
+
<resources>
|
17
|
+
<j2se version="1.5+"/>
|
18
|
+
<extension name="JavaFX Runtime" href="http://dl.javafx.com/1.2/javafx-rt.jnlp"/>
|
19
|
+
<jar href="PiggyFX.jar" main="true"/>
|
20
|
+
</resources>
|
21
|
+
<application-desc main-class="piggyfx.Main">
|
22
|
+
</application-desc>
|
23
|
+
</jnlp>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<jnlp spec="1.0+" href="PiggyFX_browser.jnlp">
|
3
|
+
<update check="background"/>
|
4
|
+
<information>
|
5
|
+
<title>PiggyFX</title>
|
6
|
+
<vendor>piggy project at rubyforge.org</vendor>
|
7
|
+
<homepage href="http://piggy.rubyforge.org"/>
|
8
|
+
<description>PiggyFX</description>
|
9
|
+
<offline-allowed/>
|
10
|
+
</information>
|
11
|
+
<resources>
|
12
|
+
<j2se version="1.5+"/>
|
13
|
+
<extension name="JavaFX Runtime" href="http://dl.javafx.com/1.2/javafx-rt.jnlp"/>
|
14
|
+
<jar href="PiggyFX.jar" main="true"/>
|
15
|
+
</resources>
|
16
|
+
<applet-desc name="PiggyFX" main-class="com.sun.javafx.runtime.adapter.Applet" width="@WIDTH@" height="@HEIGHT@">
|
17
|
+
<param name="MainJavaFXScript" value="piggyfx.Main">
|
18
|
+
</applet-desc>
|
19
|
+
</jnlp>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
4
|
+
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
|
5
|
+
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
|
6
|
+
<title>PiggyFX gallery</title>
|
7
|
+
</head>
|
8
|
+
<body id="body" style="background:black;margin:0;padding:0;" >
|
9
|
+
<center>
|
10
|
+
<script src="http://dl.javafx.com/1.2/dtfx.js"></script>
|
11
|
+
<script>
|
12
|
+
javafx(
|
13
|
+
{
|
14
|
+
archive: "PiggyFX.jar",
|
15
|
+
draggable: true,
|
16
|
+
width: @WIDTH@,
|
17
|
+
height: @HEIGHT@,
|
18
|
+
code: "piggyfx.Main",
|
19
|
+
name: "PiggyFX",
|
20
|
+
id: "app"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
isApplet: "true",
|
24
|
+
configfile: "config.xml"
|
25
|
+
}
|
26
|
+
);
|
27
|
+
</script>
|
28
|
+
<noscript>
|
29
|
+
The slideshow only loads with active Javascript and Java.<br>
|
30
|
+
(Java 6 Update 13 or newer is recommended.)
|
31
|
+
</noscript>
|
32
|
+
</center>
|
33
|
+
</body>
|
34
|
+
</html>
|
@@ -12,6 +12,22 @@ a {
|
|
12
12
|
margin: 10px;
|
13
13
|
}
|
14
14
|
|
15
|
+
.navigation span {
|
16
|
+
margin-left: 1em;
|
17
|
+
padding: 0.1em;
|
18
|
+
background: #222222;
|
19
|
+
border-right: solid lightgray 1pt;
|
20
|
+
border-bottom: solid lightgray 1pt;
|
21
|
+
}
|
22
|
+
|
23
|
+
.navigation span a{
|
24
|
+
text-decoration: none;
|
25
|
+
}
|
26
|
+
|
27
|
+
.navigation span:hover{
|
28
|
+
background: #444444;
|
29
|
+
}
|
30
|
+
|
15
31
|
.thumbs dl.table {
|
16
32
|
padding-left: 84px;
|
17
33
|
}
|
@@ -45,16 +45,19 @@ dd {
|
|
45
45
|
margin-bottom: 8px;
|
46
46
|
}
|
47
47
|
|
48
|
-
.
|
48
|
+
.navigation a {
|
49
49
|
display: block;
|
50
|
-
float: left;
|
51
|
-
width: 60px;
|
52
50
|
margin: 10px;
|
53
51
|
text-decoration: none;
|
54
52
|
color: Silver;
|
55
53
|
font-weight: bold;
|
56
54
|
}
|
57
55
|
|
56
|
+
.image_page .navigation a {
|
57
|
+
float: left;
|
58
|
+
width: 60px;
|
59
|
+
}
|
60
|
+
|
58
61
|
.image_page .image {
|
59
62
|
clear: both;
|
60
63
|
float: left;
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Piggy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Sascha D\xF6rdelmann"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-20 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -128,8 +128,12 @@ files:
|
|
128
128
|
- lib/piggy.rb
|
129
129
|
- lib/templates
|
130
130
|
- lib/templates/fuss.htm
|
131
|
+
- lib/templates/javafx.htm
|
131
132
|
- lib/templates/kopf.htm
|
132
133
|
- lib/templates/navigation.htm
|
134
|
+
- lib/templates/PiggyFX.jar
|
135
|
+
- lib/templates/PiggyFX.jnlp
|
136
|
+
- lib/templates/PiggyFX_browser.jnlp
|
133
137
|
- lib/templates/slideshow.htm
|
134
138
|
- lib/templates/slideshow.js
|
135
139
|
- lib/templates/styles
|