cremefraiche 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +114 -0
  3. data/bin/cremefraiche +117 -0
  4. data/bin/cremefraicheGui +26 -0
  5. data/cremefraiche.gemspec +24 -0
  6. data/doc/gui_howto.pdf +0 -0
  7. data/lib/LANG +1 -0
  8. data/lib/basic_logging.rb +170 -0
  9. data/lib/busy_indicator/.busy_function_test.rb.swp +0 -0
  10. data/lib/busy_indicator/.busy_indicator.rb.swp +0 -0
  11. data/lib/busy_indicator/.color_output.rb.swp +0 -0
  12. data/lib/busy_indicator/busy_function_test.rb +50 -0
  13. data/lib/busy_indicator/busy_indicator.rb +89 -0
  14. data/lib/busy_indicator/color_output.rb +45 -0
  15. data/lib/cfprawn.rb +387 -0
  16. data/lib/confcheck.rb +103 -0
  17. data/lib/config +187 -0
  18. data/lib/configuration.rb +234 -0
  19. data/lib/configuration.rb~ +247 -0
  20. data/lib/cremefraiche.rb +181 -0
  21. data/lib/emlfile.rb +136 -0
  22. data/lib/file_checking.rb +82 -0
  23. data/lib/gui/.ButtonLabel.rb.swp +0 -0
  24. data/lib/gui/.conf_value.rb.swp +0 -0
  25. data/lib/gui/.cremefraicheGui.rb.swp +0 -0
  26. data/lib/gui/.message_dialog.rb.swp +0 -0
  27. data/lib/gui/AboutDialog.rb +63 -0
  28. data/lib/gui/ButtonLabel.rb +41 -0
  29. data/lib/gui/ConfDialog.rb +610 -0
  30. data/lib/gui/HowtoDialog.rb +183 -0
  31. data/lib/gui/conf_option.rb +274 -0
  32. data/lib/gui/conf_value.rb +58 -0
  33. data/lib/gui/cremefraicheGui.rb +568 -0
  34. data/lib/gui/gtk-about.xpm +90 -0
  35. data/lib/gui/gtk-close.xpm +90 -0
  36. data/lib/gui/gtk-execute.xpm +118 -0
  37. data/lib/gui/gtk-open.xpm +147 -0
  38. data/lib/gui/gtk-properties.xpm +378 -0
  39. data/lib/gui/gtk-quit.xpm +352 -0
  40. data/lib/gui/gtk-remove.xpm +123 -0
  41. data/lib/gui/gtk-save.xpm +214 -0
  42. data/lib/gui/gtk-stop.xpm +344 -0
  43. data/lib/gui/help.xpm +463 -0
  44. data/lib/gui/icon.xpm +300 -0
  45. data/lib/gui/message_dialog.rb +34 -0
  46. data/lib/gui/okay.xpm +49 -0
  47. data/lib/gui/preferences-color.xpm +252 -0
  48. data/lib/gui/view.xpm +75 -0
  49. data/lib/html2text.rb +195 -0
  50. data/lib/icon/icon.xpm +300 -0
  51. data/lib/icon/icon_big.xpm +661 -0
  52. data/lib/license.rb +38 -0
  53. data/lib/log.conf +65 -0
  54. data/lib/tag_munging.rb +89 -0
  55. data/lib/translating.rb +78 -0
  56. data/lib/translations +609 -0
  57. data/lib/version.rb +25 -0
  58. metadata +221 -0
@@ -0,0 +1,568 @@
1
+ #!/usr/local/bin/env ruby
2
+ #encoding: UTF-8
3
+ =begin
4
+ /***************************************************************************
5
+ * ©2011-2023, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
+ * *
7
+ * This program is free software; you can redistribute it and/or modify *
8
+ * it under the terms of the WTFPL 2.0 or later version of the LICENSE. *
9
+ * See https://wtfpl2.com/ for details. *
10
+ * *
11
+ * This program is distributed in the hope that it will be useful, *
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
14
+ * *
15
+ ***************************************************************************/
16
+ =end
17
+ require_relative '../basic_logging'
18
+ require_relative '../translating'
19
+ require_relative 'message_dialog'
20
+ require_relative '../cremefraiche'
21
+ require 'gtk3'
22
+ require 'ostruct'
23
+ require_relative '../file_checking'
24
+ require_relative 'ConfDialog'
25
+ require_relative 'HowtoDialog'
26
+ require_relative 'AboutDialog'
27
+ require_relative 'ButtonLabel'
28
+
29
+
30
+ DLG_ERROR = :error
31
+ DLG_INFO = :info
32
+ DLG_WARN = :warning
33
+
34
+ # maximum length of the file-names before they are clipped
35
+ MAX_FN_LEN = 35
36
+
37
+ HOME = ENV['HOME'].dup
38
+
39
+ # the list of eml-files is stored each time upon quitting
40
+ LIST_FILE = HOME << File::Separator << '.cremefraiche.lst'
41
+
42
+ # String-constants
43
+ CLICKED = 'clicked'
44
+ LN = "\n"
45
+ FIELD_SEPARATOR = '#'
46
+ LINE_SEPARATOR = nil
47
+
48
+ =begin
49
+ A simple user-interface for Crème Fraiche.
50
+ =end
51
+
52
+ class CremeFraicheGui
53
+ include Translating
54
+ include BasicLogging
55
+ @@GD = File::expand_path(File::dirname(__FILE__) ) + File::Separator if !defined?(@@GD)
56
+ def initialize(args = nil)
57
+ info('$CONF is ' << $CONF.to_s)
58
+ info('level is ' << log_level.to_s)
59
+ debug('init gui')
60
+ prog_info = CremeFraiche::prog_info()
61
+ @eml_files = {}
62
+
63
+ @window = Gtk::Window.new(prog_info[:app_name])
64
+ @window.set_default_size(300, 100)
65
+ @window.set_icon($ICON_DIR + 'icon.xpm');
66
+ # populate the window
67
+ create
68
+ # prepare an object to collect the tooltips
69
+ @tooltips = Gtk::Tooltip.new
70
+ # create some static tool-tips for the static elements
71
+ set_tooltips
72
+ # connect the static buttons with the functionality
73
+ connect_buttons
74
+ # the transformations in progress
75
+ @threads = Array.new
76
+ # restore list of files from previous session
77
+ read_list
78
+ # make sure, that there will be only one file-dialog at a time.
79
+ @fdialog = nil
80
+ # display on screen
81
+ show
82
+ end
83
+
84
+ private
85
+
86
+ def show
87
+ @window.show
88
+ Gtk::main
89
+ end
90
+
91
+ def create
92
+ # layout-elements
93
+ top_vbox = Gtk::Box.new(:vertical, 5)
94
+ top_vbox.border_width = 5
95
+
96
+ eml_vbox = Gtk::Box.new(:vertical, 2)
97
+
98
+ eml_hbox = Gtk::Box.new(:horizontal, 5)
99
+ eml_hbox.border_width = 5
100
+
101
+ # the text-entry for the chosen file-names
102
+ @eml_input = Gtk::Entry.new
103
+ @eml_input.width_chars = 33
104
+ @eml_input.height_request = 25
105
+ # the button to add a file-name to the list
106
+ @eml_add_button = Gtk::Button.new
107
+ @eml_add_button.add(ButtonLabel.new( trl('Add _file') ))
108
+ @eml_add_button.height_request = 0.0
109
+ # a button to open a file-chooser
110
+ @eml_button = Gtk::Button.new()
111
+ @eml_button.add(ButtonLabel.new(trl('_Choose'), @@GD + "gtk-open.xpm"))
112
+ @eml_button.height_request = 0.0
113
+ # organize the above elements
114
+ eml_hbox.pack_start(@eml_button, :expand => false, :fill => false)
115
+ eml_hbox.pack_start(@eml_input, :expand => true, :fill => true)
116
+ eml_hbox.pack_end(@eml_add_button, :expand => false, :fill => false)
117
+ # a group of horizontally aligned buttons
118
+ button_box = Gtk::ButtonBox.new(:horizontal)
119
+ button_box.layout_style = Gtk::ButtonBoxStyle::START
120
+
121
+ @quit_button = Gtk::Button.new()
122
+ @quit_button.add(ButtonLabel.new(trl('_Quit'), @@GD + "gtk-quit.xpm" ))
123
+ @start_button = Gtk::Button.new()
124
+ @start_button.add(ButtonLabel.new(trl('Sta_rt'), @@GD + "gtk-execute.xpm"))
125
+
126
+ @stop_button = Gtk::Button.new()
127
+ @stop_button.add(ButtonLabel.new(trl('Sto_p'), @@GD + "gtk-stop.xpm") )
128
+
129
+ @config_button = Gtk::Button.new()
130
+ @config_button.add(ButtonLabel.new(trl('_Configure'), @@GD + "gtk-properties.xpm" ))
131
+
132
+ @about_button = Gtk::Button.new()
133
+ @about_button.add(ButtonLabel.new(trl('_About'), @@GD + "gtk-about.xpm"))
134
+
135
+ @howto_button = Gtk::Button.new()
136
+ @howto_button.add(ButtonLabel.new(trl('_Howto'), @@GD + "help.xpm"))
137
+
138
+ button_box.pack_start(@start_button, :expand => false, :fill => false)
139
+ button_box.pack_start(@stop_button, :expand => false, :fill => false)
140
+ # button_box.pack_start(@save_button, false)
141
+ button_box.pack_start(@quit_button, :expand => false, :fill => false)
142
+ button_box.pack_start(@config_button, :expand => false, :fill => false)
143
+ button_box.pack_start(@about_button, :expand => false, :fill => false)
144
+ button_box.pack_start(@howto_button, :expand => false, :fill => false)
145
+ # a table to show chosen file-names and some controls
146
+ @table = Gtk::Table.new(1,5)
147
+ tframe = Gtk::Frame.new()
148
+ tframe.add(@table)
149
+ # organize all of the above created elements on the window
150
+ eml_vbox.pack_start(eml_hbox, :expand => false)
151
+ eml_vbox.pack_end(tframe, :expand => false)
152
+
153
+
154
+ @status_label = Gtk::Label.new()
155
+
156
+ top_vbox.pack_start(eml_vbox)
157
+ top_vbox.pack_end(@status_label)
158
+ top_vbox.pack_end(button_box)
159
+ # initialize the table
160
+ refresh_table
161
+ # display all
162
+ top_vbox.show_all
163
+ @window.add(top_vbox)
164
+ @mthr = nil
165
+ end
166
+
167
+ =begin
168
+ creates and allocates some static tool-tips
169
+ =end
170
+ def set_tooltips
171
+ @eml_button.set_tooltip_text(trl('Choose an eml-file to transform') )
172
+ @eml_input.set_tooltip_text trl('Enter or choose an eml-file to transform')
173
+ @eml_add_button.set_tooltip_text trl('First choose an eml-file, then add it to the list')
174
+ @quit_button.set_tooltip_text trl('Quit program')
175
+ @start_button.set_tooltip_text trl('Transform the active files')
176
+ @stop_button.set_tooltip_text trl('Terminate all transformations in progress')
177
+
178
+ @about_button.set_tooltip_text trl('About this program')
179
+ @howto_button.set_tooltip_text trl('Howto Crème Fraiche GUI')
180
+ end
181
+
182
+ =begin
183
+ unused for the time.
184
+ =end
185
+ def review_configuration()
186
+
187
+ end
188
+ =begin
189
+ connect the existing buttons to their functionality
190
+ =end
191
+ def connect_buttons
192
+ @eml_button.signal_connect(CLICKED) do
193
+ eml = choose_eml
194
+ if(eml)
195
+ @eml_input.text = eml
196
+ else
197
+ status_message(trl('No file chosen'), 2)
198
+ end
199
+ end
200
+ @eml_add_button.signal_connect(CLICKED) do
201
+ if @eml_input.text && !@eml_input.text.empty?
202
+ add_eml(@eml_input.text)
203
+ else
204
+ status_message(trl('No file chosen, none added'), 2 )
205
+ end
206
+ end
207
+ @quit_button.signal_connect(CLICKED) do
208
+ stop()
209
+ save()
210
+ Gtk::main_quit()
211
+ end
212
+ @window.signal_connect("destroy") do
213
+ stop()
214
+ save()
215
+ Gtk.main_quit
216
+ end
217
+ @about_button.signal_connect(CLICKED) do
218
+ @about_button.sensitive=false
219
+ db = Proc.new() { @about_button.sensitive=true }
220
+ ad = AboutDialog.new(:on_destroy => db)
221
+ end
222
+ @config_button.signal_connect(CLICKED) do
223
+ @config_button.sensitive=false
224
+ cb = Proc.new() do
225
+ @config_button.sensitive=true
226
+ review_configuration()
227
+ end
228
+ cd = ConfDialog.new(:on_destroy => cb)
229
+ end
230
+ @howto_button.signal_connect(CLICKED) do
231
+ @howto_button.sensitive=false
232
+ rb = Proc.new() { @howto_button.sensitive=true }
233
+ hd = HowtoDialog.new(:on_destroy => rb)
234
+ end
235
+ @start_button.signal_connect(CLICKED) do
236
+ @start_button.sensitive=false
237
+ @eml_files.each_value {|ctx| ctx.ok.set_file(nil)}
238
+ transform()
239
+ end
240
+ @stop_button.signal_connect(CLICKED) do
241
+ stop()
242
+ end
243
+ end
244
+
245
+ =begin
246
+ terminate all running transformations
247
+ =end
248
+ def stop( pause = 2)
249
+ # This only stops the busy indicator
250
+ # on the console
251
+ @cf.stop() if @cf
252
+ if(@threads && !@threads.empty?)
253
+ @threads.each do |th|
254
+ th.terminate
255
+ th.join
256
+ end
257
+ refresh_table
258
+ status_message(trl('transformation stopped'), 2)
259
+ @start_button.sensitive=true
260
+ else
261
+ status_message(trl('No transformations in progress'), 2)
262
+ end
263
+ end
264
+ =begin
265
+ restore the list of eml-files to transform from a previously saved
266
+ file.
267
+ =end
268
+ def read_list
269
+ # BUGFIX: make sure, that the list-file exists already
270
+ lf = File.open(LIST_FILE, 'a+')
271
+ lf.close
272
+ # END BUGFIX
273
+ # BUGFIX: do not split into arbitrary chunks of text, DUMBO!
274
+ list = File.readlines(LIST_FILE)
275
+ entry = []
276
+ list.each do |line|
277
+ entry = line.chomp.split(FIELD_SEPARATOR)
278
+ add_eml(entry[0], entry[1] == true.to_s)
279
+ end
280
+ #end BUGFIX
281
+ end
282
+
283
+ =begin
284
+ Save the list of files for later transformations, overwrite
285
+ previous file-content.
286
+ =end
287
+ def save()
288
+ list = []
289
+ @eml_files.each_pair do |eml, ctx|
290
+ # Ensure, that there is not more than one FIELD_SEPARATOR in the list-entry.
291
+ list << (eml.dup.gsub(FIELD_SEPARATOR, '*') << FIELD_SEPARATOR << ctx.active.to_s)
292
+ end
293
+ File.write(LIST_FILE, list.join(LN))
294
+ end
295
+ =begin
296
+ re-construct the table from the list of chosen file-names
297
+ or show a message, if no files have ben chosen yet.
298
+ =end
299
+ def refresh_table
300
+ # remove all contents from the current table
301
+ @table.each {|w| @table.remove(w) }
302
+ if(!@eml_files.empty?)
303
+ # create a table header in the cells of the first row
304
+ [trl('active'), trl('Ok'), trl('file'), trl('size'), trl('remove')].each_with_index do |t, i|
305
+ label = Gtk::Label.new
306
+ label.set_markup("<b>#{t}</b>")
307
+ @table.attach(label, i, i + 1, 0, 1)
308
+ end
309
+ # fill the remainder of the table with file-names and
310
+ # control-elements
311
+ @eml_files.each_pair do |file, ctx|
312
+ text = file.dup
313
+ filename = File::basename(file)
314
+ # shorten file-names, if need be
315
+ if text.length > MAX_FN_LEN + 3
316
+ num_del = text.length - MAX_FN_LEN - 3
317
+ text = "..." + text[num_del, text.length]
318
+ end
319
+ fl = Gtk::Label.new(text)
320
+ fl.set_alignment( 1, 0)
321
+ # store the reference to the label
322
+ ctx.label = fl
323
+ # show the full file-path in the tool-tip to the text-label
324
+ fl.set_tooltip_text(file)
325
+ # a check-button to activate the transformation of the very file
326
+ cb = Gtk::CheckButton.new()
327
+ # set checkbox active or not
328
+ cb.set_active(ctx.active)
329
+ cb.set_tooltip_text trl("Controls whether the file '%s' is transformed or not.") %filename
330
+ # an image which will indicate success
331
+ ctx.ok = Gtk::Image.new()
332
+ # a button to remove the file from the list
333
+ rb = Gtk::Button.new
334
+ rb.height_request = 5
335
+ rb.add(ButtonLabel.new('', @@GD + "gtk-remove.xpm" ))
336
+ rb.set_tooltip_text trl("Remove the file '%s' from the list") %filename
337
+ begin
338
+ fs = Gtk::Label.new(readable_size(File::size(file)) )
339
+ fs.set_alignment(0.8,0)
340
+ fs.set_tooltip_text trl("Size of %s") %filename
341
+ # add the above elements to the table
342
+ @table.n_rows = @table.n_rows + 1
343
+ @table.attach(cb, 0, 1, @table.n_rows - 1, @table.n_rows, :shrink )
344
+ @table.attach(ctx.ok, 1, 2, @table.n_rows - 1, @table.n_rows )
345
+ @table.attach(fl, 2, 3, @table.n_rows - 1, @table.n_rows )
346
+ @table.attach(fs, 3, 4, @table.n_rows - 1, @table.n_rows )
347
+ @table.attach(rb, 4, 5, @table.n_rows - 1, @table.n_rows, :shrink )
348
+ # connect the 'remove' button to its functionality
349
+ rb.signal_connect(CLICKED) do
350
+ del_eml(file)
351
+ end
352
+ cb.signal_connect(CLICKED) do
353
+ toggle_active(file)
354
+ end
355
+ rescue Exception => ex
356
+ msg = trl("File %s cannot be handled! (%s)" %[file, ex.message] )
357
+ end
358
+ end
359
+ else
360
+ # no files have been chosen yet, report this fact.
361
+ mlabel = Gtk::Label.new()
362
+ mlabel.set_markup("<span background='#f0a0a0'>#{trl('No files have been chosen for transformation') }</span>" )
363
+ @table.attach(mlabel, 0, 3, 0, 1)
364
+ end
365
+ # display the table
366
+ @table.show_all
367
+ end
368
+ =begin
369
+ exempt a file from the transformation, but leave it in the list.
370
+ =end
371
+ def toggle_active(file = nil)
372
+ if(file)
373
+ isso = @eml_files[file].active
374
+ @eml_files[file].active = (isso ? false : true)
375
+ end
376
+ end
377
+ =begin
378
+ remove a file from the list of files that can be transformed.
379
+ =end
380
+ def del_eml(file = nil)
381
+ if(file )
382
+ @eml_files.delete_if {|f, context| f == file }
383
+ refresh_table
384
+ status_message(trl('File removed'), 2 )
385
+ end
386
+ end
387
+ =begin
388
+ add a file to the list of files that can be transformed
389
+ =end
390
+ def add_eml(file = nil, activate = true)
391
+ if(file )
392
+ if( !@eml_files.keys.include?(file) )
393
+ msg = File_Checking::file_check(file, :exist?, :file?, :readable?)
394
+ if !msg
395
+ file_ctx = OpenStruct.new
396
+ file_ctx.active = activate
397
+ @eml_files[file] = file_ctx
398
+ refresh_table
399
+ status_message(trl('File added'), 2)
400
+ else
401
+ msg = trl("Cannot add the file %s (%s)") %[file, msg]
402
+ warn(msg)
403
+ msg_dialog(msg, DLG_ERROR)
404
+ end
405
+ else
406
+ status_message(trl('File is already in the list'))
407
+ end
408
+ end
409
+ end
410
+ =begin
411
+ open a file-chooser and allow the selection of a file for transformation.
412
+ =end
413
+ def choose_eml
414
+ # only if the dialog is not currently open
415
+ if(!@fdialog)
416
+ @fdialog = Gtk::FileChooserDialog.new(:title => trl("Choose EML-File"),
417
+ :parent => nil,
418
+ :action => :open,
419
+ :buttons => [[:cancel, :cancel],
420
+ [:open, :accept]])
421
+ if(@eml_input.text && ! @eml_input.text.empty?)
422
+ # start where the currently selected file has been located.
423
+ @fdialog.filename = @eml_input.text
424
+ else
425
+ # or start in the user's home-directory
426
+ @fdialog.filename = HOME
427
+ @fdialog.filename ||= Dir::pwd
428
+ end
429
+ # open the file-chooser, return the selected file-name
430
+ eml = (@fdialog.run == Gtk::ResponseType::ACCEPT ? @fdialog.filename : nil)
431
+ @fdialog.destroy
432
+ # verify that the file is useable
433
+ msg = File_Checking.file_check(eml, :exist?, :file?, :readable?)
434
+ if(msg)
435
+ error(msg)
436
+ msg_dialog(msg, DLG_ERROR)
437
+ eml = nil
438
+ end
439
+ @eml_add_button.set_tooltip_text( trl('Add file to the list of files to transform')) if eml
440
+ @fdialog = nil
441
+ # return the file-name
442
+ return eml
443
+ end
444
+ end
445
+
446
+ def status_wait(wait_message )
447
+ @mthr.terminate if @mthr
448
+ @mthr.join if @mthr
449
+ @mthr = Thread.new do
450
+ loop do
451
+ red = rand(0xe0...0xff)
452
+ green = rand(0xe0...0xff)
453
+ blue = 0xc0
454
+ @status_label.set_markup("<span background='#%02x%02x%02x'>#{wait_message}</span>" %[red, green, blue] )
455
+ sleep 0.3
456
+ end
457
+ end
458
+ end
459
+ def status_message(msg, time = 2)
460
+ @mthr.terminate if @mthr
461
+ @mthr.join if @mthr
462
+ @mthr = Thread.new do
463
+ @status_label.text = msg
464
+ if time && time > 0
465
+ sleep time
466
+ @status_label.text = ''
467
+ end
468
+ end
469
+ end
470
+
471
+ def transform()
472
+ @cf = nil
473
+ if !@eml_files.empty?
474
+ status_message(trl("Transforming, wait..."), nil)
475
+ @threads.clear if @threads && !@threads.empty?
476
+ active_files = @eml_files.values.count {|ctx| ctx.active}
477
+ if(active_files > 0)
478
+ @eml_files.each_pair do |file, ctx|
479
+ if(ctx.active)
480
+ ctx.label.set_markup(file)
481
+ @threads << Thread.new do
482
+ wait_th = status_wait(trl("Transforming, wait..."))
483
+ @cf = CremeFraiche.instance() if !@cf
484
+ @cf.process(file)
485
+ if(@cf.msg && !@cf.msg.empty?)
486
+ msg_dialog(cf.msg, DLG_ERROR)
487
+ end
488
+
489
+ wait_th.terminate
490
+ wait_th = nil
491
+ active_files -= 1;
492
+ ctx.label.set_markup("<span background='#c0f0c0'><b>#{file}</b></span>")
493
+ ctx.ok.set_file(@@GD + 'okay.xpm')
494
+ #status_message( trl("file %s has been transformed.") %File::basename(file), 2)
495
+ if(active_files == 0)
496
+ status_message( trl("All done"), 5 )
497
+ @threads.clear
498
+ @start_button.sensitive=true
499
+ @eml_files.values.each{|ctx| ctx.label.set_markup(ctx.label.text) }
500
+ end
501
+ end
502
+ end
503
+ @table.show_all
504
+ end
505
+ else
506
+ status_message(trl('No files have been selected for transformation'), 2)
507
+ @start_button.sensitive=true
508
+ end
509
+ else
510
+ status_message(trl('Empty file-list! Doing nothing!'), 2)
511
+ @start_button.sensitive=true
512
+ end
513
+ end
514
+
515
+ def run_reader(br, file = nil)
516
+ msg = nil
517
+ if(br && ! br.empty?)
518
+ begin
519
+ fork_sym = (RUBY_PLATFORM =~ /win/) ? '' : ' &'
520
+ if(file)
521
+ exec_command = "%s %s%s" %[br, file, fork_sym]
522
+ else
523
+ exec_command = "%s %s" %[br, fork_sym]
524
+ end
525
+ debug "exec-command will be %s" %exec_command
526
+ hr = system exec_command
527
+ if(!hr)
528
+ msg = trl("Cannot open the PDF-reader!") << "\n"
529
+ msg << trl("Please verify, that %s is correctly spelled or use another reader.", %("\" << br << "\"") )
530
+ else
531
+ @hdialog.destroy
532
+ end
533
+ rescue Exception => ex
534
+ msg = trl("Cannot open the PDF-reader XX", ex)
535
+ end
536
+ else
537
+ msg = trl('No reader selected, skipping Howto.')
538
+ end
539
+ error(msg) if msg
540
+ debug($?.to_s)
541
+ msg_dialog(msg, DLG_ERROR) if msg
542
+ end
543
+
544
+
545
+ def readable_size(size)
546
+ n_size = size
547
+ symbol = 'b'
548
+ if(size && size.respond_to?(:to_f))
549
+ if(size >= 1000000000)
550
+ n_size = size.to_f/1000000000
551
+ symbol = 'G'
552
+ elsif(size >= 1000000)
553
+ n_size = size.to_f/1000000
554
+ symbol = 'M'
555
+ elsif(size >= 1000)
556
+ n_size = size.to_f/1000
557
+ symbol = 'K'
558
+ end
559
+ end
560
+ return n_size.round(1).to_s << symbol
561
+ end
562
+ end
563
+
564
+ # execute if this script is the argument to the ruby-interpreter.
565
+ # CremeFraicheGui.new(ARGV)
566
+
567
+ # EOF
568
+
@@ -0,0 +1,90 @@
1
+ /* XPM */
2
+ static char * gtk_about_xpm[] = {
3
+ "22 22 65 1",
4
+ " c None",
5
+ ". c #A52C00",
6
+ "+ c #784911",
7
+ "@ c #9F6116",
8
+ "# c #B9711A",
9
+ "$ c #E19130",
10
+ "% c #E49C45",
11
+ "& c #E59D46",
12
+ "* c #E59E48",
13
+ "= c #E59F4A",
14
+ "- c #E5A04C",
15
+ "; c #E6A14D",
16
+ "> c #E6A353",
17
+ ", c #E7A454",
18
+ "' c #E7A75A",
19
+ ") c #E8AA5F",
20
+ "! c #E9AF68",
21
+ "~ c #E9B069",
22
+ "{ c #EAB06B",
23
+ "] c #EAB16D",
24
+ "^ c #EAB371",
25
+ "/ c #EBB472",
26
+ "( c #EBB574",
27
+ "_ c #ECB879",
28
+ ": c #EDBD82",
29
+ "< c #EDBE86",
30
+ "[ c #EEBF87",
31
+ "} c #EEC18B",
32
+ "| c #EFC38E",
33
+ "1 c #EFC490",
34
+ "2 c #EFC592",
35
+ "3 c #EFC694",
36
+ "4 c #F0C795",
37
+ "5 c #F0C897",
38
+ "6 c #F0C999",
39
+ "7 c #F0CA9B",
40
+ "8 c #F1CA9C",
41
+ "9 c #F1CB9E",
42
+ "0 c #F1CCA0",
43
+ "a c #F1CDA2",
44
+ "b c #F2CEA3",
45
+ "c c #F2D0A7",
46
+ "d c #F2D1A9",
47
+ "e c #F3D2AA",
48
+ "f c #F3D4AE",
49
+ "g c #F3D5B0",
50
+ "h c #F4D6B1",
51
+ "i c #F4D7B3",
52
+ "j c #F4D7B5",
53
+ "k c #F4D8B7",
54
+ "l c #F5D9B8",
55
+ "m c #F5DABA",
56
+ "n c #F5DBBC",
57
+ "o c #F5DCBE",
58
+ "p c #F6DDBF",
59
+ "q c #F6E0C5",
60
+ "r c #F7E2C8",
61
+ "s c #F7E3CA",
62
+ "t c #F8E4CD",
63
+ "u c #F8E5CF",
64
+ "v c #F8E6D1",
65
+ "w c #F9E8D4",
66
+ "x c #F9EAD8",
67
+ "y c #FAECDB",
68
+ "z c #FAEFE1",
69
+ " ",
70
+ " % ",
71
+ " %&% ",
72
+ " %*b*% ",
73
+ " %{z]% ",
74
+ " *lxn= ",
75
+ " %,ybz>% ",
76
+ " &8seu9= ",
77
+ " %&>vmnqw>*% ",
78
+ " %%=>|qonrrst5,&%% ",
79
+ " %-~7ecaenrrnhkm4!=% ",
80
+ " %&}og[<3binnib31cj<&%",
81
+ " %-)2ca67beebcfc['=% ",
82
+ " %%--/ab377fd(==%% ",
83
+ " %&=81[30*&% ",
84
+ " */3_2^& ",
85
+ " ..$;b3a-$.. ",
86
+ " .....%2g1%..... ",
87
+ " ......#'p'#...... ",
88
+ " .......%:%....... ",
89
+ " ......@%@...... ",
90
+ " ......+...... "};