Piggy 0.4.2.4 → 0.4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +15 -0
- data/INSTALL.txt +9 -4
- data/README.txt +8 -6
- data/bin/directory_diff +1 -1
- data/bin/ftp_browser +1 -1
- data/bin/piggy +1 -1
- data/lib/directory_diff.rb +8 -6
- data/lib/ftp_browser.rb +8 -6
- data/lib/icons/connect.ico +0 -0
- data/lib/icons/hide_details.ico +0 -0
- data/lib/icons/show_details.ico +0 -0
- data/lib/piggy-core/alive_check.rb +4 -4
- data/lib/piggy-core/debug.rb +4 -4
- data/lib/piggy-core/environment.rb +24 -26
- data/lib/piggy-core/exifr_adapter.rb +11 -11
- data/lib/piggy-core/file_info.rb +61 -61
- data/lib/piggy-core/ftp_adapter.rb +24 -24
- data/lib/piggy-core/htmlgen.rb +41 -45
- data/lib/piggy-core/nconvert_thumbsgen.rb +22 -22
- data/lib/piggy-core/options.rb +25 -19
- data/lib/piggy-core/options_persistence.rb +8 -8
- data/lib/piggy-core/progress.rb +7 -7
- data/lib/piggy-core/rmagick_thumbnail_page_generator.rb +14 -14
- data/lib/piggy-core/thumbnail_generator.rb +26 -26
- data/lib/piggy-core/thumbnail_page_generator.rb +234 -230
- data/lib/piggy-core/upload_info.rb +22 -22
- data/lib/piggy-core/version.rb +7 -7
- data/lib/piggy-core/winshell.rb +136 -80
- data/lib/piggy-gui/dir_chooser.rb +14 -14
- data/lib/piggy-gui/directory_diff_widget.rb +177 -160
- data/lib/piggy-gui/filtered_file_list.rb +87 -87
- data/lib/piggy-gui/fox_thumbsgen.rb +4 -4
- data/lib/piggy-gui/ftp_browser_widget.rb +211 -155
- data/lib/piggy-gui/fullscreen.rb +4 -4
- data/lib/piggy-gui/html_generation_dialog.rb +42 -115
- data/lib/piggy-gui/html_options_widget.rb +97 -0
- data/lib/piggy-gui/image_processor.rb +58 -58
- data/lib/piggy-gui/modal_dialog.rb +11 -5
- data/lib/piggy-gui/multiimagecanvas.rb +59 -59
- data/lib/piggy-gui/options_dialog.rb +170 -48
- data/lib/piggy-gui/piggy_image_browser.rb +382 -340
- data/lib/piggy-gui/pipe_log.rb +17 -17
- data/lib/piggy-gui/progress_with_dialog.rb +8 -8
- data/lib/piggy-gui/require-fox.rb +23 -8
- data/lib/piggy.rb +7 -5
- data/lib/templates/styles/basic/style.css +16 -14
- data/lib/templates/styles/black/style.css +28 -29
- data/lib/templates/styles/roundedbox/style.css +28 -31
- data/lib/templates/styles/shadow/style.css +26 -26
- data/lib/templates/styles/shadow_D9F5F3/style.css +1 -1
- data/lib/templates/styles/shadow_black/lo.jpg +0 -0
- data/lib/templates/styles/shadow_black/lu.jpg +0 -0
- data/lib/templates/styles/shadow_black/ro.jpg +0 -0
- data/lib/templates/styles/shadow_black/ru.jpg +0 -0
- data/lib/templates/styles/shadow_black/style.css +78 -0
- data/lib/templates/styles/shadow_bowers/style.css +48 -51
- data/lib/templates/styles/sylvester/sh.png +0 -0
- data/lib/templates/styles/sylvester/style.css +74 -0
- data/lib/templates/styles/sylvester/wunderkerze.jpg +0 -0
- data/test/file_info_test.rb +29 -29
- metadata +52 -38
@@ -5,34 +5,34 @@
|
|
5
5
|
# a set of given files and directories.
|
6
6
|
# The size of directories is computed recursively.
|
7
7
|
class UploadInfo
|
8
|
-
attr_reader(:bytes, :
|
8
|
+
attr_reader(:bytes, :num_files, :bytes_hash)
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
@
|
10
|
+
def initialize(files_with_path)
|
11
|
+
@bytes_hash = Hash.new
|
12
12
|
@bytes = 0
|
13
|
-
@
|
14
|
-
add(
|
13
|
+
@num_files = 0
|
14
|
+
add(files_with_path)
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
def add(
|
20
|
-
|
21
|
-
unless @
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
19
|
+
def add(files_with_path)
|
20
|
+
files_with_path.each do |fileWithPath|
|
21
|
+
unless @bytes_hash.has_key?(fileWithPath)
|
22
|
+
if File.directory?(fileWithPath)
|
23
|
+
subfiles = Dir.entries(fileWithPath).reject { |e|
|
24
|
+
e =~ /^\./
|
25
|
+
}
|
26
|
+
subfiles_with_path = subfiles.collect { |e|
|
27
|
+
FilePath.join(fileWithPath, e)
|
28
|
+
}
|
29
|
+
add(subfiles_with_path)
|
30
|
+
else
|
31
|
+
fileSize = File.size(fileWithPath)
|
32
|
+
@bytes_hash[fileWithPath] = fileSize
|
33
|
+
@bytes = @bytes + fileSize
|
34
|
+
@num_files = @num_files + 1
|
35
|
+
end
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/piggy-core/version.rb
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
|
4
4
|
# Provide release information for Piggy.
|
5
5
|
module PiggyVersion
|
6
|
-
def PiggyVersion.
|
7
|
-
'0.4.
|
6
|
+
def PiggyVersion.version_string
|
7
|
+
'0.4.3-0'
|
8
8
|
end
|
9
|
-
def PiggyVersion.
|
10
|
-
'Copyright (C)
|
9
|
+
def PiggyVersion.copyright_string
|
10
|
+
'Copyright (C) 2009 Sascha D�rdelmann'
|
11
11
|
end
|
12
|
-
def PiggyVersion.
|
12
|
+
def PiggyVersion.development_status
|
13
13
|
'alpha'
|
14
14
|
end
|
15
|
-
def PiggyVersion.
|
16
|
-
"#{PiggyVersion.
|
15
|
+
def PiggyVersion.display_string
|
16
|
+
"#{PiggyVersion.version_string} (#{PiggyVersion.development_status})"
|
17
17
|
end
|
18
18
|
end
|
data/lib/piggy-core/winshell.rb
CHANGED
@@ -6,10 +6,9 @@ require 'singleton'
|
|
6
6
|
# Windows oriented but platform independent file system abstraction.
|
7
7
|
class ShellInterface
|
8
8
|
def initialize
|
9
|
-
@
|
9
|
+
@special_folder_ids = {
|
10
10
|
"ALTSTARTUP" => 0x1d,
|
11
11
|
"APPDATA" => 0x1a,
|
12
|
-
"BITBUCKET" => 0xa,
|
13
12
|
"COMMONALTSTARTUP" => 0x1e,
|
14
13
|
"COMMONAPPDATA" => 0x23,
|
15
14
|
"COMMONDESKTOPDIR" => 0x19,
|
@@ -21,7 +20,6 @@ class ShellInterface
|
|
21
20
|
"COOKIES" => 0x21,
|
22
21
|
"DESKTOP" => 0x0,
|
23
22
|
"DESKTOPDIRECTORY" => 0x10,
|
24
|
-
"DRIVES" => 0x11,
|
25
23
|
"FAVORITES" => 0x6,
|
26
24
|
"FONTS" => 0x14,
|
27
25
|
"HISTORY" => 0x22,
|
@@ -29,9 +27,7 @@ class ShellInterface
|
|
29
27
|
"LOCALAPPDATA" => 0x1c,
|
30
28
|
"MYPICTURES" => 0x27,
|
31
29
|
"NETHOOD" => 0x13,
|
32
|
-
"NETWORK" => 0x12,
|
33
30
|
"PERSONAL" => 0x5,
|
34
|
-
"PRINTERS" => 0x4,
|
35
31
|
"PRINTHOOD" => 0x1b,
|
36
32
|
"PROFILE" => 0x28,
|
37
33
|
"PROGRAMFILES" => 0x26,
|
@@ -44,10 +40,10 @@ class ShellInterface
|
|
44
40
|
"TEMPLATES" => 0x15,
|
45
41
|
"WINDOWS" => 0x24
|
46
42
|
}
|
47
|
-
|
43
|
+
init_home
|
48
44
|
end
|
49
45
|
|
50
|
-
def
|
46
|
+
def init_home
|
51
47
|
@home = ENV['HOME']
|
52
48
|
@home = ENV['HOMEPATH'] unless @home
|
53
49
|
unless @home
|
@@ -57,11 +53,11 @@ class ShellInterface
|
|
57
53
|
end
|
58
54
|
|
59
55
|
# try to provide a platform independent default
|
60
|
-
def
|
56
|
+
def path_for_special_folder(name)
|
61
57
|
return @home
|
62
58
|
end
|
63
59
|
|
64
|
-
def
|
60
|
+
def tmp_path
|
65
61
|
tmp = ENV['TEMP']
|
66
62
|
tmp = ENV['TMP'] unless tmp
|
67
63
|
tmp = '/' unless tmp
|
@@ -69,8 +65,8 @@ class ShellInterface
|
|
69
65
|
end
|
70
66
|
|
71
67
|
# platform dependent path (no better default possible)
|
72
|
-
def
|
73
|
-
return
|
68
|
+
def os_path(pathString)
|
69
|
+
return win_path(pathString)
|
74
70
|
end
|
75
71
|
|
76
72
|
# for use in commandline execution
|
@@ -78,29 +74,29 @@ class ShellInterface
|
|
78
74
|
return pathString
|
79
75
|
end
|
80
76
|
|
81
|
-
# old name, use
|
82
|
-
def
|
77
|
+
# old name, use os_path instead
|
78
|
+
def win_path(pathString)
|
83
79
|
return pathString
|
84
80
|
end
|
85
81
|
|
86
82
|
# Get a path string usable by common ruby classes such as Dir and File.
|
87
83
|
# Default: convert '\' to '/' on all systems, even on Unix
|
88
|
-
def
|
84
|
+
def ruby_path(pathString)
|
89
85
|
return pathString.gsub(/\\/, separator).gsub(/^~/, @home)
|
90
86
|
end
|
91
87
|
|
92
|
-
def
|
93
|
-
return
|
88
|
+
def picture_directory
|
89
|
+
return path_for_special_folder("MYPICTURES")
|
94
90
|
end
|
95
91
|
|
96
|
-
def
|
97
|
-
return
|
92
|
+
def desktop_directory
|
93
|
+
return path_for_special_folder("DESKTOPDIRECTORY")
|
98
94
|
end
|
99
95
|
|
100
|
-
def
|
101
|
-
@
|
96
|
+
def special_folder_listing
|
97
|
+
@special_folder_ids.keys.sort.each do |aFolder|
|
102
98
|
printf "#{aFolder}: "
|
103
|
-
puts "#{
|
99
|
+
puts "#{path_for_special_folder aFolder}"
|
104
100
|
end
|
105
101
|
end
|
106
102
|
|
@@ -109,8 +105,8 @@ class ShellInterface
|
|
109
105
|
return File::SEPARATOR
|
110
106
|
end
|
111
107
|
|
112
|
-
def
|
113
|
-
return
|
108
|
+
def remove_path(filename_with_path)
|
109
|
+
return ruby_path(filename_with_path).split(separator)[-1]
|
114
110
|
end
|
115
111
|
|
116
112
|
# Is filename a Windows shortcut? - Default: no file is a shortcut
|
@@ -119,15 +115,14 @@ class ShellInterface
|
|
119
115
|
end
|
120
116
|
|
121
117
|
# Has filename the Extension ext (e. g. ".jpg")
|
122
|
-
def
|
118
|
+
def has_extension?(filename, ext)
|
123
119
|
raise ArgumentError, "Extension missing" if ext.empty?
|
124
|
-
|
125
|
-
|
126
|
-
return File.basename(
|
120
|
+
p_ext = (ext[0] == '.'[0] ? ext : '.' + ext).downcase
|
121
|
+
dc_filename = filename.downcase
|
122
|
+
return File.basename(dc_filename, p_ext) != File.basename(dc_filename)
|
127
123
|
end
|
128
124
|
end
|
129
125
|
|
130
|
-
|
131
126
|
# Default access to file system abstraction.
|
132
127
|
# A platform dependent singleton will be instantiated.
|
133
128
|
class WinShell < ShellInterface
|
@@ -136,33 +131,79 @@ end
|
|
136
131
|
|
137
132
|
if RUBY_PLATFORM =~ /win32/
|
138
133
|
require 'win32ole'
|
134
|
+
require 'win32/dir'
|
139
135
|
|
140
136
|
class WinShell < ShellInterface
|
141
137
|
|
142
138
|
def initialize
|
143
139
|
@shell = WIN32OLE.new('Shell.application')
|
140
|
+
@os_paths = {
|
141
|
+
"ALTSTARTUP" => Dir::ALTSTARTUP,
|
142
|
+
"APPDATA" => Dir::APPDATA,
|
143
|
+
"COMMONALTSTARTUP" => Dir::COMMON_ALTSTARTUP,
|
144
|
+
"COMMONAPPDATA" => Dir::COMMON_APPDATA,
|
145
|
+
"COMMONDESKTOPDIR" => Dir::COMMON_DESKTOPDIRECTORY,
|
146
|
+
"COMMONFAVORITES" => Dir::COMMON_FAVORITES,
|
147
|
+
"COMMONPROGRAMS" => Dir::COMMON_PROGRAMS,
|
148
|
+
"COMMONSTARTMENU" => Dir::COMMON_STARTMENU,
|
149
|
+
"COMMONSTARTUP" =>Dir::COMMON_STARTUP,
|
150
|
+
"COOKIES" => Dir::COOKIES,
|
151
|
+
"DESKTOP" => Dir::DESKTOP,
|
152
|
+
"DESKTOPDIRECTORY" => Dir::DESKTOPDIRECTORY,
|
153
|
+
"FAVORITES" => Dir::FAVORITES,
|
154
|
+
"FONTS" => Dir::FONTS,
|
155
|
+
"HISTORY" => Dir::HISTORY,
|
156
|
+
"INTERNETCACHE" => Dir::INTERNET_CACHE,
|
157
|
+
"LOCALAPPDATA" => Dir::LOCAL_APPDATA,
|
158
|
+
"MYPICTURES" => Dir::MYPICTURES,
|
159
|
+
"NETHOOD" => Dir::NETHOOD,
|
160
|
+
"PERSONAL" => Dir::PERSONAL,
|
161
|
+
"PRINTHOOD" => Dir::PRINTHOOD,
|
162
|
+
"PROFILE" => Dir::PROFILE,
|
163
|
+
"PROGRAMFILES" => Dir::PROGRAM_FILES,
|
164
|
+
"PROGRAMS" => Dir::PROGRAMS,
|
165
|
+
"RECENT" => Dir::RECENT,
|
166
|
+
"SENDTO" => Dir::SENDTO,
|
167
|
+
"STARTMENU" => Dir::STARTMENU,
|
168
|
+
"STARTUP" => Dir::STARTUP,
|
169
|
+
"SYSTEM" => Dir::SYSTEM,
|
170
|
+
"TEMPLATES" => Dir::TEMPLATES,
|
171
|
+
"WINDOWS" => Dir::WINDOWS
|
172
|
+
}
|
144
173
|
super
|
145
174
|
end
|
146
175
|
|
147
|
-
def
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
176
|
+
def path_for_special_folder(name)
|
177
|
+
win32_utils_path = @os_paths[name]
|
178
|
+
return win32_utils_path ? ruby_path(win32_utils_path) : ""
|
179
|
+
end
|
180
|
+
|
181
|
+
# Include virtual paths on vindows
|
182
|
+
def special_folder_listing
|
183
|
+
@special_folder_ids.keys.sort.each do |aFolder|
|
184
|
+
puts "#{aFolder}:"
|
185
|
+
puts "\t#{path_for_special_folder aFolder}"
|
186
|
+
puts "\t#{virtual_path_for aFolder}"
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def virtual_path_for(name)
|
191
|
+
ole_folder = special_folder(name)
|
192
|
+
return path_for_folder(ole_folder)
|
152
193
|
end
|
153
194
|
|
154
195
|
# Is filename a Windows shortcut?
|
155
196
|
def link?(filename)
|
156
|
-
return
|
197
|
+
return has_extension?(filename, '.lnk')
|
157
198
|
end
|
158
199
|
|
159
200
|
# Get a path string usable by Windows systems.
|
160
|
-
def
|
201
|
+
def win_path(pathString)
|
161
202
|
return pathString.gsub(separator, "\\")
|
162
203
|
end
|
163
204
|
|
164
205
|
# Get a path string usable by common ruby classes such as Dir and File.
|
165
|
-
def
|
206
|
+
def ruby_path(pathString)
|
166
207
|
return pathString.gsub(/\\/, separator)
|
167
208
|
end
|
168
209
|
|
@@ -171,52 +212,67 @@ if RUBY_PLATFORM =~ /win32/
|
|
171
212
|
return "\"#{pathString}\""
|
172
213
|
end
|
173
214
|
|
174
|
-
#Get the path stored in the Windows shortcut filename.
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
215
|
+
# Get the path stored in the Windows shortcut filename.
|
216
|
+
# PRE: link?(filename)
|
217
|
+
def get_link_target(filename, path_string = Dir.getwd)
|
218
|
+
raise(ArgumentError, "No link") unless link?(filename)
|
219
|
+
puts "Compute shortcut: #{filename}"
|
220
|
+
filename_only = remove_path(filename) # avoid errors ignore performance
|
221
|
+
location = win_path(path_string)
|
222
|
+
ole_folder = shell.NameSpace(location)
|
223
|
+
raise(ArgumentError, "#{path_string} is no folder") unless ole_folder
|
224
|
+
ole_item = get_link_item(filename_only, ole_folder)
|
225
|
+
return '' unless ole_item
|
226
|
+
return ruby_path(ole_item.GetLink.Path.to_s)
|
184
227
|
end
|
185
228
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
title = current.Title
|
194
|
-
end
|
195
|
-
if title =~ /(.):/
|
196
|
-
title.gsub!(/.*\((\w:)\)/, '\1')
|
197
|
-
return title + separator + path
|
198
|
-
end
|
199
|
-
path = title + separator + path
|
200
|
-
current = current.ParentFolder
|
229
|
+
# private; public for better testing only
|
230
|
+
|
231
|
+
def get_link_item(filename, ole_folder)
|
232
|
+
begin
|
233
|
+
return ole_folder.ParseName(filename)
|
234
|
+
rescue Error => ex
|
235
|
+
puts ex.message
|
201
236
|
end
|
202
|
-
|
237
|
+
# Fallback to old solution:
|
238
|
+
# Compare filename with all item names in folder.
|
239
|
+
# This didn't work with Vista's shortcut "Sample Pictures"
|
240
|
+
# (The item name in german Vista is "Beispielbilder"
|
241
|
+
# which is not equal to the filename.)
|
242
|
+
ext = '.' + filename.split('.')[-1]
|
243
|
+
linkdef = File.basename(filename, ext)
|
244
|
+
raise(ArgumentError, "Link name empty") if linkdef.empty?
|
245
|
+
puts "Location: #{path_string}"
|
246
|
+
puts "Shortcut name: #{linkdef}"
|
247
|
+
ole_items = ole_folder.items
|
248
|
+
ole_item_col = (0..ole_items.Count-1).collect { |i| ole_items.item(i) }
|
249
|
+
return ole_item_col.find { |fi| fi.isLink && linkdef == (fi.Name.to_s) }
|
203
250
|
end
|
204
251
|
|
205
|
-
# private; public for better testing only
|
206
|
-
|
207
252
|
# My shell is the ole object "Shell" as described in the Windows SDK.
|
208
253
|
def shell
|
209
254
|
return @shell
|
210
255
|
end
|
211
256
|
|
212
|
-
def
|
213
|
-
id = @
|
257
|
+
def special_folder(name)
|
258
|
+
id = @special_folder_ids[name]
|
214
259
|
return shell.NameSpace(id)
|
215
260
|
end
|
261
|
+
|
262
|
+
def path_for_folder(folder)
|
263
|
+
current = folder.ParentFolder
|
264
|
+
path = folder.Title
|
265
|
+
while current do
|
266
|
+
title = current.Title
|
267
|
+
path = title + separator + path
|
268
|
+
current = current.ParentFolder
|
269
|
+
end
|
270
|
+
return path
|
271
|
+
end
|
216
272
|
|
217
273
|
# Get Directory entries as ole-objects, not as strings!
|
218
|
-
def
|
219
|
-
folder = shell.NameSpace(
|
274
|
+
def get_folder_items(directoryPathString)
|
275
|
+
folder = shell.NameSpace(win_path(directoryPathString))
|
220
276
|
raise "Folderermittlung fehlgeschlagen" if !folder
|
221
277
|
items = folder.items
|
222
278
|
return (0..items.Count-1).collect { |i| items.item(i) }
|
@@ -227,21 +283,21 @@ end
|
|
227
283
|
|
228
284
|
if $0 == __FILE__
|
229
285
|
def example
|
230
|
-
|
286
|
+
shell = WinShell.instance
|
231
287
|
h = "Example 1: WinShell.new.specialFolderListing"
|
232
|
-
|
233
|
-
puts "#{
|
234
|
-
|
288
|
+
h_line = (1..h.size).collect { |c| '*'}
|
289
|
+
puts "#{h_line}\n#{h}\n#{h_line}"
|
290
|
+
shell.special_folder_listing
|
235
291
|
h = "Example 2. Links on Desktop"
|
236
|
-
|
237
|
-
puts "#{
|
238
|
-
|
239
|
-
links = Dir[
|
240
|
-
links.each do |
|
241
|
-
|
242
|
-
puts "#{
|
292
|
+
h_line = (1..h.size).collect { |c| '*'}
|
293
|
+
puts "#{h_line}\n#{h}\n#{h_line}"
|
294
|
+
desktop_dir = shell.desktop_directory
|
295
|
+
links = Dir[desktop_dir + '/*'].select { |p| shell.link?(File.basename(p)) }
|
296
|
+
links.each do |link_path|
|
297
|
+
link_name = File.basename link_path
|
298
|
+
puts "#{link_name} => \"#{shell.get_link_target link_name, desktop_dir}\""
|
243
299
|
end
|
244
300
|
end
|
245
|
-
example
|
301
|
+
example
|
246
302
|
end
|
247
303
|
|
@@ -7,40 +7,40 @@ require 'piggy-gui/require-fox'
|
|
7
7
|
# Combobox like input field to choose an existing directory
|
8
8
|
class DirChooser < Fox::FXHorizontalFrame
|
9
9
|
include Fox
|
10
|
-
def initialize(owner,
|
10
|
+
def initialize(owner, init_value, &on_changed_dir)
|
11
11
|
super(owner, FRAME_NONE, 0, 0, 0 , 0, 0, 0, 0, 0) {}
|
12
12
|
@field = FXTextField.new(self, 32)
|
13
13
|
@button = FXButton.new(self, '...')
|
14
|
-
@block =
|
14
|
+
@block = on_changed_dir
|
15
15
|
@shell = WinShell.instance
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
connect_button_to_field
|
17
|
+
init_layout
|
18
|
+
set_path(init_value)
|
19
19
|
@field.connect(SEL_COMMAND) {
|
20
|
-
@block.call(
|
20
|
+
@block.call(get_path)
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def init_layout
|
25
25
|
@field.setLayoutHints(LAYOUT_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def connect_button_to_field
|
29
29
|
@button.connect(SEL_COMMAND) {
|
30
30
|
dialog = FXDirDialog.new(self, "Choose directory")
|
31
31
|
dialog.directory = @field.getText
|
32
32
|
unless dialog.execute == 0
|
33
|
-
|
34
|
-
|
33
|
+
@field.setText(dialog.directory)
|
34
|
+
@block.call(get_path)
|
35
35
|
end
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
@shell.
|
39
|
+
def get_path
|
40
|
+
@shell.ruby_path(fox_2_ruby(@field.getText))
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
@field.setText(
|
43
|
+
def set_path(value)
|
44
|
+
@field.setText(ruby_2_fox(@shell.os_path(value)))
|
45
45
|
end
|
46
46
|
end
|