Top Level Namespace

Defined Under Namespace

Modules: FilePath Classes: Album, AliveCheck, CommentedFile, DirChooser, DirectoryContents, DirectoryDiffMainWindow, DirectoryDiffWidget, ExifrAdapter, ExifrDegreeComuter, FileInfo, FileName, FileRepository, FilteredFileList, FoxThumbnailPageGenerator, FtpAdapter, FtpBrowserDialog, FtpBrowserMainWindow, FtpBrowserWidget, Fullscreen, HtmlGenerationDialog, HtmlGenerator, HtmlOptionsWidget, ImageProcessor, ModalDialog, MultiImageCanvas, NconvertThumbnailPageGenerator, OptionsDialog, PiggyOptions, PiggyOptionsPersistence, PipeLog, Progress, ProgressWithDialog, RmagickThumbnailPageGenerator, ShellInterface, ThumbnailGenerator, ThumbnailPageGenerator, UploadInfo, WinShell

Constant Summary collapse

FOXLIB =
load_fox
FOXVERSION_GE_1_2 =
(FOXLIB != 'fox')
FXTooltip =
Fox::FXToolTip
FXToolbar =
Fox::FXToolBar
FXScrollbar =
Fox::FXScrollBar
FXMenubar =
Fox::FXMenuBar
FXStatusbar =
Fox::FXStatusBar
FXStatusline =
Fox::FXStatusLine
FXToolbarShell =
Fox::FXToolBarShell
FXToolbarGrip =
Fox::FXToolBarGrip
PIGGY_WINDOW_PLACEMENT =
Fox::PLACEMENT_DEFAULT
FXToolTip =
Fox::FXTooltip
FXToolBar =
Fox::FXToolbar
FXScrollBar =
Fox::FXScrollbar
FXMenuBar =
Fox::FXMenubar
FXStatusBar =
Fox::FXStatusbar
FXStatusLine =
Fox::FXStatusline
FXToolBarShell =
Fox::FXToolbarShell
FXToolBarGrip =
Fox::FXToolbarGrip

Instance Method Summary collapse

Instance Method Details

#begin_traceObject

Global methods temporaryly used for debugging. Inspired by the book “Programmieren mit Ruby” by R�hrl/Schmiedl/Weyss“



7
8
9
10
11
12
13
14
15
16
# File 'lib/piggy-core/debug.rb', line 7

def begin_trace
  $stderr.puts "Begin Trace in: #{caller.first}"
  set_trace_func proc {
    |event, file, line, id, binding, classname|
    unless File.basename(file) == 'debug.rb'
      $stderr.printf("%8s %s-, %-2d %10s %8s\n",
        event, file, line, id, classname)
    end
  }
end

#end_traceObject



18
19
20
21
# File 'lib/piggy-core/debug.rb', line 18

def end_trace
  $stderr.set_trace_func(nil)
  puts "End Trace in: #{caller.first}"
end

#exampleObject



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/piggy-core/winshell.rb', line 299

def example
  puts RUBY_PLATFORM
  shell = WinShell.instance
  puts shell.class
  h = "Example 1: WinShell.new.specialFolderListing"
  h_line = (1..h.size).collect { |c| '*'}
  puts "#{h_line}\n#{h}\n#{h_line}"
  shell.special_folder_listing
  h = "Example 2. Links on Desktop"
  puts "#{h_line}\n#{h}\n#{h_line}"
  desktop_dir = shell.desktop_directory
  links = Dir[desktop_dir + '/*'].select { |p| shell.link?(File.basename(p)) }
  links.each do |link_path|
    link_name = File.basename link_path
    puts "#{link_name} => \"#{shell.get_link_target link_name, desktop_dir}\""
  end
  h = "Example 3. Environment"
  puts "#{h_line}\n#{h}\n#{h_line}"
  ENV.each_pair { |key, val|
    puts("#{key}: #{val}")
  }
end

#fox_2_ruby(string) ⇒ Object



72
73
74
# File 'lib/piggy-gui/require-fox.rb', line 72

def fox_2_ruby(string)
  string
end

#FXSELTYPE(sel) ⇒ Object



66
67
68
# File 'lib/piggy-gui/require-fox.rb', line 66

def FXSELTYPE(sel)
  SELTYPE(sel)
end

#get_style_listObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/piggy-core/environment.rb', line 55

def get_style_list
  style_dir = File.join(PIGGY_PATH, 'templates/styles')
  Dir[File.join(style_dir, '*')].entries.reject {
    |f|
    f =~ /^\.+$/
  }.collect {
    |folder|
    File.basename(folder)
  }
end

#in_path(path, &block) ⇒ Object

Temporary change working dir while executing a given block (deprecated)



38
39
40
41
42
43
44
45
46
# File 'lib/piggy-core/environment.rb', line 38

def in_path(path, &block)
  working_dir_sik = Dir.getwd
  begin
    Dir.chdir(path)
    block.call
  ensure
    Dir.chdir(working_dir_sik)
  end
end

#load_foxObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/piggy-gui/require-fox.rb', line 13

def load_fox
  begin
    ['fox16', 'fox14', 'fox12', 'fox'].each { |v|
      begin   
        require v
        return v
      rescue LoadError
      end
    }
    # can't find fox, throw ex
    require 'fox16'
  end
end

#new_combobox(p1, p2, p3, p4, p5, p6) ⇒ Object



46
47
48
49
50
# File 'lib/piggy-gui/require-fox.rb', line 46

def new_combobox(p1, p2, p3, p4, p5, p6)
  box = Fox::FXComboBox.new(p1, p2, p4, p5, p6)
  box.setNumVisible(p3)
  box
end

#new_hframe_without_padding(parent) ⇒ Object



97
98
99
100
101
102
# File 'lib/piggy-gui/require-fox.rb', line 97

def new_hframe_without_padding(parent)
  f = Fox::FXHorizontalFrame.new(parent)
  f.setFrameStyle(Fox::FRAME_NONE)
  remove_padding(f)
  return f
end

#remove_padding(frame) ⇒ Object



89
90
91
92
93
94
95
# File 'lib/piggy-gui/require-fox.rb', line 89

def remove_padding(frame)
  frame.padLeft=0
  frame.padRight=0
  frame.padTop=0
  frame.padBottom=0
  return frame
end

#ruby_2_fox(string) ⇒ Object



76
77
78
# File 'lib/piggy-gui/require-fox.rb', line 76

def ruby_2_fox(string)
  string
end

#run_directory_diffObject Also known as: runDirectoryDiff



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/directory_diff.rb', line 10

def run_directory_diff
  # Make application
  application = Fox::FXApp.new("Piggy Directory Diff", "Sascha D�rdelmann")

  option_store = PiggyOptionsPersistence.new
  options = option_store.load_yaml
 
  # Make window
  window = DirectoryDiffMainWindow.new(application, options)
  
  # Handle interrupts to terminate program gracefully
  application.addSignal("SIGINT", window.method(:on_terminate))
  
  # Create it
  application.create
  window.show
  
  # Run
  application.run
end

#run_uploaderObject Also known as: runUploader



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ftp_browser.rb', line 10

def run_uploader
  # Make application
  application = Fox::FXApp.new("Piggy FTP Browser", "Sascha D�rdelmann")

  option_store = PiggyOptionsPersistence.new
  options = option_store.load_yaml
 
  # Make window
  window = FtpBrowserMainWindow.new(application, options)
  
  # Handle interrupts to terminate program gracefully
  application.addSignal("SIGINT", window.method(:on_terminate))
  
  # Create it
  application.create
  window.show
  
  # Run
  application.run
end

#singletonObject

$Id: winshell.rb 176 2007-11-21 21:35:51Z Sascha $



4
# File 'lib/piggy-core/winshell.rb', line 4

require 'singleton'

#string_as_utf8(aString) ⇒ Object



8
9
10
# File 'lib/piggy-core/encoding.rb', line 8

def string_as_utf8(aString)
  aString.unpack("C*").pack("U*")
end

#utf8_as_string(aString) ⇒ Object

$Id: require-fox.rb 188 2007-12-16 14:10:39Z Sascha $



4
5
6
# File 'lib/piggy-core/encoding.rb', line 4

def utf8_as_string(aString)
  return aString.unpack("U*").pack("C*")
end