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
@@ -16,8 +16,8 @@ class FtpBrowserDialog < Fox::FXDialogBox
|
|
16
16
|
@frame = FXVerticalFrame.new(self)
|
17
17
|
@frame.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_Y)
|
18
18
|
@browser = FtpBrowserWidget.new(@frame, options)
|
19
|
-
connect(SEL_CLOSE, method(:
|
20
|
-
@browser.quitButton.connect(SEL_COMMAND, method(:
|
19
|
+
connect(SEL_CLOSE, method(:on_cmd_close))
|
20
|
+
@browser.quitButton.connect(SEL_COMMAND, method(:on_quit_button))
|
21
21
|
end
|
22
22
|
|
23
23
|
def options
|
@@ -25,18 +25,18 @@ class FtpBrowserDialog < Fox::FXDialogBox
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def create
|
28
|
-
resize(
|
28
|
+
resize(@browser.preferred_width + 20, 600)
|
29
29
|
place(PIGGY_WINDOW_PLACEMENT)
|
30
30
|
super
|
31
31
|
end
|
32
32
|
|
33
33
|
# Send whenever this window is about to close
|
34
|
-
def
|
35
|
-
@browser.
|
34
|
+
def on_cmd_close(sender, sel, ptr)
|
35
|
+
@browser.prepare_closure
|
36
36
|
return 0
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def on_quit_button(sender, sel, ptr)
|
40
40
|
handle(sender, MKUINT(ID_ACCEPT, SEL_COMMAND), nil)
|
41
41
|
end
|
42
42
|
end
|
@@ -48,11 +48,11 @@ class FtpBrowserMainWindow < DirectoryDiffMainWindow
|
|
48
48
|
super(app, options)
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def title_string
|
52
52
|
"Piggy FTP Browser"
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def set_main_widget(options)
|
56
56
|
@browser = FtpBrowserWidget.new(@frame, options)
|
57
57
|
end
|
58
58
|
end
|
@@ -66,139 +66,192 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
66
66
|
super(window, options)
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
69
|
+
def load_icons
|
70
70
|
super
|
71
|
-
@reloadIcon =
|
72
|
-
@autoSelectForDelIco =
|
73
|
-
@removeSelectedIco =
|
74
|
-
@autoSelectRightIcon =
|
75
|
-
@uploadIcon =
|
76
|
-
@moveRightDirIcon =
|
77
|
-
@moveRightFileIcon =
|
71
|
+
@reloadIcon = basic_load_icon('reload.ico')
|
72
|
+
@autoSelectForDelIco = basic_load_icon('auto-select-for-del.ico')
|
73
|
+
@removeSelectedIco = basic_load_icon('remove-selected.ico')
|
74
|
+
@autoSelectRightIcon = basic_load_icon('auto-select-right.ico')
|
75
|
+
@uploadIcon = basic_load_icon('auto-upload-right.ico')
|
76
|
+
@moveRightDirIcon = basic_load_icon('move-right-dir.ico')
|
77
|
+
@moveRightFileIcon = basic_load_icon('move-right-file.ico')
|
78
|
+
@connectIcon = basic_load_icon('connect.ico')
|
79
|
+
@showDetailsIcon = basic_load_icon('show_details.ico')
|
80
|
+
@hideDetailsIcon = basic_load_icon('hide_details.ico')
|
78
81
|
end
|
79
82
|
|
80
|
-
def
|
83
|
+
def initialize_controls_top_left
|
81
84
|
@labels.push(FXLabel.new(@leftListPropFrame, "FTP server:"))
|
82
|
-
@serverField = FXTextField.new(@leftListPropFrame,
|
85
|
+
@serverField = FXTextField.new(@leftListPropFrame, txt_field_num_chars)
|
83
86
|
@serverField.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
84
87
|
@labels.push(FXLabel.new(@leftListPropFrame, "User:"))
|
85
|
-
@userField = FXTextField.new(@leftListPropFrame,
|
88
|
+
@userField = FXTextField.new(@leftListPropFrame, txt_field_num_chars)
|
86
89
|
@userField.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
87
90
|
@labels.push(FXLabel.new(@leftListPropFrame, "Password:"))
|
88
|
-
|
91
|
+
pw_frame = new_hframe_without_padding(@leftListPropFrame)
|
92
|
+
@passwordField = FXTextField.new(pw_frame, txt_field_num_chars)
|
89
93
|
@passwordField.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
90
94
|
@passwordField.setTextStyle(TEXTFIELD_PASSWD)
|
95
|
+
@connect_button = FXButton.new(pw_frame, "\tConnect", @connectIcon)
|
91
96
|
@labels.push(FXLabel.new(@leftListPropFrame, "Destination path:"))
|
92
|
-
|
93
|
-
@leftPathField.
|
97
|
+
left_path_frame = new_hframe_without_padding(@leftListPropFrame)
|
98
|
+
@leftPathField = FXTextField.new(left_path_frame, txt_field_num_chars)
|
99
|
+
@leftPathField.setLayoutHints(LAYOUT_FILL_X|LAYOUT_FILL_COLUMN)
|
100
|
+
@details_button = FXButton.new(left_path_frame,
|
101
|
+
"\tShow connection details", @hideDetailsIcon)
|
102
|
+
@details_button.setFrameStyle(FRAME_NONE)
|
103
|
+
@details_button.disable
|
94
104
|
end
|
95
105
|
|
96
|
-
def
|
106
|
+
def details_shown?
|
107
|
+
@passwordField.visible?
|
108
|
+
end
|
109
|
+
|
110
|
+
def initialize_controls_bottom_left
|
97
111
|
@updateButton = FXButton.new(@leftButtonsFrame,
|
98
|
-
|
99
|
-
|
112
|
+
"\tUpdate list",
|
113
|
+
@reloadIcon)
|
100
114
|
super
|
101
115
|
@autoSelectForDelButton = FXButton.new(@leftButtonsFrame,
|
102
|
-
|
103
|
-
|
116
|
+
"\tChoose files automatically",
|
117
|
+
@autoSelectForDelIco)
|
104
118
|
@removeSelectedLeftButton = FXButton.new(@leftButtonsFrame,
|
105
|
-
|
106
|
-
|
119
|
+
"\tRemove selected files",
|
120
|
+
@removeSelectedIco)
|
107
121
|
end
|
108
122
|
|
109
|
-
def
|
123
|
+
def initialize_controls_bottom_right
|
110
124
|
super
|
111
125
|
@autoSelectRightButton = FXButton.new(@rightButtonsFrame,
|
112
|
-
|
113
|
-
|
126
|
+
"\tChoose files automatically",
|
127
|
+
@autoSelectRightIcon)
|
114
128
|
@uploadSelectedButton = FXButton.new(@rightButtonsFrame,
|
115
|
-
|
116
|
-
|
129
|
+
"\tUpload selected",
|
130
|
+
@uploadIcon)
|
117
131
|
end
|
118
|
-
|
119
|
-
def
|
132
|
+
|
133
|
+
def connect_events
|
120
134
|
super
|
121
135
|
@serverField.connect(SEL_COMMAND) {
|
122
|
-
@options.ftpHost = @serverField.getText
|
136
|
+
@options.ftpHost = fox_2_ruby(@serverField.getText)
|
137
|
+
@connect_button.setState(STATE_UP)
|
123
138
|
}
|
124
139
|
@userField.connect(SEL_COMMAND) {
|
125
|
-
@options.ftpUser = @userField.getText
|
140
|
+
@options.ftpUser = fox_2_ruby(@userField.getText)
|
141
|
+
@connect_button.setState(STATE_UP)
|
142
|
+
}
|
143
|
+
@passwordField.connect(SEL_COMMAND) {
|
144
|
+
@connect_button.setState(STATE_UP)
|
145
|
+
}
|
146
|
+
[@connect_button, @updateButton].each { |b|
|
147
|
+
b.connect(SEL_COMMAND, method(:on_cmd_update))
|
148
|
+
}
|
149
|
+
@autoSelectForDelButton.connect(SEL_COMMAND, method(:on_cmd_auto_select_left))
|
150
|
+
@removeSelectedLeftButton.connect(SEL_COMMAND, method(:on_cmd_remove_selected_left))
|
151
|
+
@autoSelectRightButton.connect(SEL_COMMAND, method(:on_cmd_auto_select_right))
|
152
|
+
@uploadSelectedButton.connect(SEL_COMMAND, method(:on_cmd_upload))
|
153
|
+
@details_button.connect(SEL_COMMAND) {
|
154
|
+
if(details_shown?)
|
155
|
+
hide_connection_details
|
156
|
+
else
|
157
|
+
show_connection_details
|
158
|
+
end
|
126
159
|
}
|
127
|
-
@updateButton.connect(SEL_COMMAND, method(:onCmdUpdate))
|
128
|
-
@autoSelectForDelButton.connect(SEL_COMMAND, method(:onCmdAutoSelectLeft))
|
129
|
-
@removeSelectedLeftButton.connect(SEL_COMMAND, method(:onCmdRemoveSelectedLeft))
|
130
|
-
@autoSelectRightButton.connect(SEL_COMMAND, method(:onCmdAutoSelectRight))
|
131
|
-
@uploadSelectedButton.connect(SEL_COMMAND, method(:onCmdUpload))
|
132
160
|
end
|
133
|
-
|
134
|
-
def
|
135
|
-
@serverField.setText(@options.ftpHost)
|
136
|
-
@userField.setText(@options.ftpUser)
|
137
|
-
@rightPathField.setText(@options.localDestinationPath)
|
138
|
-
@leftPathField.setText(@options.remoteDestinationPath)
|
161
|
+
|
162
|
+
def set_defaults
|
163
|
+
@serverField.setText(ruby_2_fox(@options.ftpHost))
|
164
|
+
@userField.setText(ruby_2_fox(@options.ftpUser))
|
165
|
+
@rightPathField.setText(fox_pah(@options.localDestinationPath))
|
166
|
+
@leftPathField.setText(ruby_2_fox(@options.remoteDestinationPath))
|
139
167
|
end
|
140
168
|
|
141
169
|
# accessing
|
142
170
|
|
143
|
-
def
|
171
|
+
def left_path
|
144
172
|
@options.remoteDestinationPath
|
145
173
|
end
|
146
174
|
|
147
|
-
def
|
148
|
-
@options.remoteDestinationPath = FilePath.
|
149
|
-
@leftPathField.setText(
|
175
|
+
def set_left_path(p)
|
176
|
+
@options.remoteDestinationPath = FilePath.intern_path(p)
|
177
|
+
@leftPathField.setText(left_path)
|
150
178
|
end
|
151
179
|
|
152
180
|
def password
|
153
|
-
@passwordField.getText
|
181
|
+
fox_2_ruby(@passwordField.getText)
|
154
182
|
end
|
155
183
|
|
156
184
|
def host
|
157
|
-
@serverField.getText
|
185
|
+
fox_2_ruby(@serverField.getText)
|
158
186
|
end
|
159
187
|
|
160
188
|
def user
|
161
|
-
@userField.getText
|
189
|
+
fox_2_ruby(@userField.getText)
|
162
190
|
end
|
163
|
-
|
191
|
+
|
192
|
+
def connection_details_fields
|
193
|
+
[ @passwordField, @serverField, @userField, @connect_button ] +
|
194
|
+
@labels.slice(0..2)
|
195
|
+
end
|
196
|
+
|
164
197
|
# update
|
198
|
+
|
199
|
+
def hide_connection_details
|
200
|
+
fields = connection_details_fields
|
201
|
+
fields.each { |f| f.hide }
|
202
|
+
@details_button.enable
|
203
|
+
@details_button.setIcon(@showDetailsIcon)
|
204
|
+
@left_frame.recalc
|
205
|
+
end
|
206
|
+
|
207
|
+
def show_connection_details
|
208
|
+
fields = connection_details_fields
|
209
|
+
fields.each { |f| f.show }
|
210
|
+
@details_button.setIcon(@hideDetailsIcon)
|
211
|
+
@left_frame.recalc
|
212
|
+
end
|
165
213
|
|
166
|
-
def
|
214
|
+
def update_status_icons_right
|
167
215
|
(0..@rightFileList.getNumItems - 1).each do
|
168
216
|
|index|
|
169
|
-
file =
|
217
|
+
file = item_filename(@rightFileList, index)
|
170
218
|
myInfo = @rightContents[file]
|
171
219
|
otherInfo = @leftContents[file]
|
172
220
|
icon = if myInfo.directory?
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
221
|
+
otherInfo ? @dirIcon : @moveRightDirIcon
|
222
|
+
else
|
223
|
+
if otherInfo
|
224
|
+
otherInfo.mtime < myInfo.mtime ? @newerFileIcon : @fileIcon
|
225
|
+
else
|
226
|
+
@moveRightFileIcon
|
227
|
+
end
|
228
|
+
end
|
181
229
|
@rightFileList.setItemMiniIcon(index, icon)
|
182
230
|
end
|
183
231
|
end
|
184
232
|
|
185
|
-
def
|
186
|
-
|
233
|
+
def update_left_list
|
234
|
+
if @connectionDataVerified
|
235
|
+
update_ftp_list
|
236
|
+
else
|
237
|
+
show_connection_details
|
238
|
+
end
|
187
239
|
end
|
188
240
|
|
189
|
-
def
|
241
|
+
def ftp_do(&block) # don't chdir in block
|
190
242
|
getApp.beginWaitCursor
|
191
243
|
@leftFileList.clearItems
|
192
|
-
@leftContents = DirectoryContents.new(
|
244
|
+
@leftContents = DirectoryContents.new(left_path)
|
193
245
|
begin
|
194
246
|
@connectionDataVerified = false
|
195
247
|
@ftpAdapter.connect(host, user, password)
|
196
248
|
@connectionDataVerified = true
|
197
|
-
@
|
249
|
+
@connect_button.setState(STATE_DOWN)
|
250
|
+
@ftpAdapter.chdir(left_path)
|
198
251
|
block.call # <------ the call
|
199
|
-
|
200
|
-
|
201
|
-
|
252
|
+
update_list(@ftpAdapter.nlst, @leftFileList, @leftContents) do
|
253
|
+
|file, path|
|
254
|
+
@ftpAdapter.info(file, path)
|
202
255
|
end
|
203
256
|
rescue SocketError => ex
|
204
257
|
error(ex.message)
|
@@ -210,109 +263,110 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
210
263
|
error("Timeout - operation took longer than expected. \nCheck network connection and try again.")
|
211
264
|
ensure
|
212
265
|
@ftpAdapter.close
|
266
|
+
@connect_button.setState(STATE_UP) unless @connectionDataVerified
|
213
267
|
end
|
214
268
|
getApp.endWaitCursor
|
215
269
|
end
|
216
270
|
|
217
|
-
def
|
218
|
-
|
271
|
+
def update_ftp_list
|
272
|
+
ftp_do {} # every ftp action includes an update :-)
|
219
273
|
end
|
220
274
|
|
221
275
|
# actions
|
222
276
|
|
223
|
-
def
|
277
|
+
def auto_select_left
|
224
278
|
list = @leftFileList
|
225
279
|
list.killSelection
|
226
280
|
(0..list.getNumItems-1).each do
|
227
281
|
|index|
|
228
|
-
file =
|
282
|
+
file = item_filename(list, index)
|
229
283
|
myInfo = @leftContents[file]
|
230
284
|
otherInfo = @rightContents[file]
|
231
285
|
select = if myInfo.directory?
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
286
|
+
false
|
287
|
+
elsif otherInfo
|
288
|
+
false
|
289
|
+
else
|
290
|
+
true
|
291
|
+
end
|
238
292
|
list.selectItem(index) if select
|
239
293
|
end
|
240
294
|
end
|
241
295
|
|
242
|
-
def
|
296
|
+
def auto_select_right
|
243
297
|
list = @rightFileList
|
244
298
|
list.killSelection
|
245
299
|
(0..list.getNumItems-1).each do
|
246
300
|
|index|
|
247
|
-
file =
|
301
|
+
file = item_filename(list, index)
|
248
302
|
myInfo = @rightContents[file]
|
249
303
|
otherInfo = @leftContents[file]
|
250
304
|
select = if myInfo.directory?
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
305
|
+
false
|
306
|
+
elsif otherInfo && otherInfo.directory?
|
307
|
+
false
|
308
|
+
elsif !otherInfo || otherInfo.mtime < myInfo.mtime
|
309
|
+
true
|
310
|
+
else
|
311
|
+
false
|
312
|
+
end
|
259
313
|
list.selectItem(index) if select
|
260
314
|
end
|
261
315
|
end
|
262
316
|
|
263
|
-
def
|
264
|
-
|
317
|
+
def ftp_delete_left(files)
|
318
|
+
ftp_do do
|
265
319
|
files.each { |file|
|
266
|
-
|
320
|
+
@ftpAdapter.delete(file)
|
267
321
|
}
|
268
|
-
|
269
|
-
|
322
|
+
end
|
323
|
+
update_status_icons
|
270
324
|
end
|
271
325
|
|
272
|
-
def
|
273
|
-
|
326
|
+
def ftp_upload_right(hash, totalSize)
|
327
|
+
ftp_do do
|
274
328
|
progressDialog = FXProgressDialog.new(self,
|
275
|
-
|
276
|
-
|
329
|
+
'Transferring data',
|
330
|
+
'Transferring data')
|
277
331
|
begin
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
332
|
+
progressDialog.setProgress(1)
|
333
|
+
progressDialog.setTotal(totalSize)
|
334
|
+
progressDialog.create
|
335
|
+
progressDialog.show
|
336
|
+
progressDialog.repaint
|
337
|
+
hash.keys.sort.each do
|
338
|
+
|file|
|
339
|
+
@ftpAdapter.upload(right_path, file) { |data|
|
340
|
+
progressDialog.setMessage(ruby_2_fox("Transferring #{File.basename(file)}"))
|
341
|
+
progressDialog.increment(data.size)
|
342
|
+
progressDialog.repaint
|
343
|
+
}
|
344
|
+
end
|
291
345
|
ensure
|
292
|
-
|
346
|
+
progressDialog.hide
|
293
347
|
end
|
294
348
|
end
|
295
|
-
|
349
|
+
update_status_icons
|
296
350
|
end
|
297
351
|
|
298
|
-
def
|
299
|
-
sel =
|
300
|
-
return false if sel.empty?
|
301
|
-
files = sel.collect { |e| FilePath.join(
|
302
|
-
|
303
|
-
num =
|
352
|
+
def ask_and_upload_selection
|
353
|
+
sel = selection_in_list(@rightFileList)
|
354
|
+
return false if !sel || sel.empty?
|
355
|
+
files = sel.collect { |e| FilePath.join(right_path, e) }
|
356
|
+
upload_info = UploadInfo.new(files)
|
357
|
+
num = upload_info.num_files
|
304
358
|
if(num < 1)
|
305
359
|
FXMessageBox.information(self, MBOX_OK, 'No files',
|
306
|
-
|
360
|
+
'No files found in selected directories!')
|
307
361
|
return false
|
308
362
|
end
|
309
363
|
answer = FXMessageBox.question(self, MBOX_YES_NO, 'Really upload?',
|
310
|
-
|
311
|
-
|
364
|
+
"Upload #{num} fil#{num == 1 ? 'e' : 'es'}?")
|
365
|
+
ftp_upload_right(upload_info.bytes_hash, upload_info.bytes) if answer == MBOX_CLICKED_YES
|
312
366
|
end
|
313
367
|
|
314
|
-
def
|
315
|
-
sel =
|
368
|
+
def ask_and_ftp_delete_selection
|
369
|
+
sel = selection_in_list(@leftFileList)
|
316
370
|
dirs = sel.select { |file|
|
317
371
|
@leftContents[file].directory?
|
318
372
|
}
|
@@ -320,35 +374,36 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
320
374
|
return false if sel.empty?
|
321
375
|
num = sel.size
|
322
376
|
answer = FXMessageBox.question(self, MBOX_YES_NO, 'Really delete?',
|
323
|
-
|
324
|
-
|
377
|
+
"Delete #{num} fil#{num == 1 ? 'e' : 'es'}?")
|
378
|
+
ftp_delete_left(sel) if answer == MBOX_CLICKED_YES
|
325
379
|
end
|
326
380
|
|
327
381
|
# events
|
328
382
|
|
329
|
-
def
|
330
|
-
|
331
|
-
|
383
|
+
def on_cmd_update(sender, sel, ptr)
|
384
|
+
update_ftp_list
|
385
|
+
update_status_icons
|
386
|
+
hide_connection_details if @connectionDataVerified
|
332
387
|
end
|
333
388
|
|
334
|
-
def
|
335
|
-
|
389
|
+
def on_cmd_auto_select_left(sender, sel, ptr)
|
390
|
+
auto_select_left
|
336
391
|
end
|
337
392
|
|
338
|
-
def
|
339
|
-
|
393
|
+
def on_cmd_remove_selected_left(sender, sel, ptr)
|
394
|
+
ask_and_ftp_delete_selection
|
340
395
|
end
|
341
396
|
|
342
|
-
def
|
343
|
-
|
397
|
+
def on_cmd_auto_select_right(sender, sel, ptr)
|
398
|
+
auto_select_right
|
344
399
|
end
|
345
400
|
|
346
|
-
def
|
347
|
-
|
401
|
+
def on_cmd_upload(sender, sel, event)
|
402
|
+
ask_and_upload_selection
|
348
403
|
end
|
349
404
|
|
350
|
-
def
|
351
|
-
selection =
|
405
|
+
def on_menu_left_list(sender, sel, event)
|
406
|
+
selection = selection_in_list(@leftFileList)
|
352
407
|
pane = FXMenuPane.new(self)
|
353
408
|
# FXMenuSeparator.new(pane)
|
354
409
|
item = FXMenuCommand.new(pane, "&Remove selected")
|
@@ -356,7 +411,7 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
356
411
|
item.disable
|
357
412
|
else
|
358
413
|
item.connect(SEL_COMMAND){ |sender, sel, event|
|
359
|
-
|
414
|
+
ask_and_ftp_delete_selection
|
360
415
|
}
|
361
416
|
end
|
362
417
|
pane.create
|
@@ -365,15 +420,15 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
365
420
|
return 1
|
366
421
|
end
|
367
422
|
|
368
|
-
def
|
369
|
-
selection =
|
423
|
+
def on_menu_right_list(sender, sel, event)
|
424
|
+
selection = selection_in_list(@rightFileList)
|
370
425
|
pane = FXMenuPane.new(self)
|
371
426
|
item = FXMenuCommand.new(pane, "&Upload selected")
|
372
427
|
if(selection.empty?)
|
373
428
|
item.disable
|
374
429
|
else
|
375
430
|
item.connect(SEL_COMMAND){ |sender, sel, event|
|
376
|
-
|
431
|
+
ask_and_upload_selection
|
377
432
|
}
|
378
433
|
end
|
379
434
|
# FXMenuSeparator.new(pane)
|
@@ -384,14 +439,15 @@ class FtpBrowserWidget < DirectoryDiffWidget
|
|
384
439
|
end
|
385
440
|
|
386
441
|
# open/close
|
387
|
-
|
388
|
-
def
|
389
|
-
|
390
|
-
|
391
|
-
|
442
|
+
|
443
|
+
def in_create
|
444
|
+
update_right_list
|
445
|
+
update_status_icons
|
446
|
+
puts preferred_width.to_s
|
447
|
+
@horizontal_splitter.setSplit(0, preferred_width/2)
|
392
448
|
end
|
393
449
|
|
394
|
-
def
|
450
|
+
def prepare_closures
|
395
451
|
@ftpAdapter.close
|
396
452
|
super
|
397
453
|
end
|
data/lib/piggy-gui/fullscreen.rb
CHANGED
@@ -10,15 +10,15 @@ class Fullscreen < Fox::FXMainWindow
|
|
10
10
|
|
11
11
|
def initialize(*args)
|
12
12
|
super(*args)
|
13
|
-
FXMAPFUNC(SEL_KEYPRESS, 0, :
|
13
|
+
FXMAPFUNC(SEL_KEYPRESS, 0, :on_key_press)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def on_key_press(sender, sel, event)
|
17
17
|
if event.code == KEY_Escape
|
18
18
|
if FOXVERSION_GE_1_2
|
19
|
-
|
19
|
+
close(true)
|
20
20
|
else
|
21
|
-
|
21
|
+
hide()
|
22
22
|
end
|
23
23
|
return 1
|
24
24
|
end
|