rwdtinker 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/Readme.txt +57 -0
  2. data/bin/rwdtinker +19 -0
  3. data/code/ag1core/aa0begin.rb +17 -0
  4. data/code/al5languagefiles/alanguagehashbegin.rb +4 -0
  5. data/code/al5languagefiles/languagehash.rb +4 -0
  6. data/code/al5languagefiles/templangfile.rb +6 -0
  7. data/code/al5languagefiles/zlanguagehashend.rb +6 -0
  8. data/code/dd0viewphoto/dd0viewphoto.rb +4 -0
  9. data/code/ll0listapplets/05listinstalledfiles.rb +11 -0
  10. data/code/ll0listapplets/ll1openname.rb +18 -0
  11. data/code/ll0listapplets/mm1removeapplet.rb +28 -0
  12. data/code/lm1installapplets/ll5listzips.rb +14 -0
  13. data/code/lm1installapplets/lm1installapplet.rb +20 -0
  14. data/code/zz0applicationend/zz0end.rb +4 -0
  15. data/configuration/aa0rwdframework.cnf +11 -0
  16. data/ev/browser.rb +109 -0
  17. data/ev/ftools.rb +170 -0
  18. data/ev/net.rb +750 -0
  19. data/ev/ruby.rb +819 -0
  20. data/ev/rwd.rb +1848 -0
  21. data/ev/sgml.rb +236 -0
  22. data/ev/thread.rb +63 -0
  23. data/ev/tree.rb +343 -0
  24. data/ev/xml.rb +4 -0
  25. data/gui/en/aa2core/aa0rwdtop.rwd +3 -0
  26. data/gui/en/cc0viewphoto/cc0openphoto.rwd +17 -0
  27. data/gui/en/ll5listapplets/ll0rwdlistapplets.rwd +42 -0
  28. data/gui/en/ll9rwdlistzips/ll5rwdlistzips.rwd +33 -0
  29. data/gui/en/tt0documentsbegin/tt0documentbegin.rwd +5 -0
  30. data/gui/en/uu5rwddocuments/uu5documents.rwd +13 -0
  31. data/gui/en/ww0documentsend/ww0documentend.rwd +6 -0
  32. data/gui/en/wz6finaltabs/xx0rwdfirsttab.rwd +4 -0
  33. data/gui/en/xx9photoview/xx9photoview.rwd +3 -0
  34. data/gui/en/ya1helpbegin/ya0helpscreenstart.rwd +1 -0
  35. data/gui/en/yg5rwdhelp/yf0helpscreen.rwd +2 -0
  36. data/gui/en/yg5rwdhelp/yf6rwdtinker.rwd +3 -0
  37. data/gui/en/yg5rwdhelp/yg0helpscreen.rwd +1 -0
  38. data/gui/en/za1applicationend/yy9rwdend.rwd +2 -0
  39. data/gui/es/aa2core/aa0rwdtop.rwd +3 -0
  40. data/gui/es/cc0viewphoto/cc0openphoto.rwd +17 -0
  41. data/gui/es/ll5listapplets/ll0rwdlistapplets.rwd +41 -0
  42. data/gui/es/ll9rwdlistzips/ll5rwdlistzips.rwd +33 -0
  43. data/gui/es/tt0documentsbegin/tt0documentbegin.rwd +5 -0
  44. data/gui/es/uu5rwddocuments/uu5documents.rwd +13 -0
  45. data/gui/es/ww0documentsend/ww0documentend.rwd +6 -0
  46. data/gui/es/wz6finaltabs/xx0rwdfirsttab.rwd +4 -0
  47. data/gui/es/xx9photoview/xx9photoview.rwd +3 -0
  48. data/gui/es/ya1helpbegin/ya0helpscreenstart.rwd +1 -0
  49. data/gui/es/yg5rwdhelp/yf0helpscreen.rwd +2 -0
  50. data/gui/es/yg5rwdhelp/yf6rwdtinker.rwd +3 -0
  51. data/gui/es/yg5rwdhelp/yg0helpscreen.rwd +1 -0
  52. data/gui/es/za1applicationend/yy9rwdend.rwd +2 -0
  53. data/gui/nl/aa2core/aa0rwdtop.rwd +3 -0
  54. data/gui/nl/cc0viewphoto/cc0openphoto.rwd +17 -0
  55. data/gui/nl/ll5listapplets/ll0rwdlistapplets.rwd +41 -0
  56. data/gui/nl/ll9rwdlistzips/ll5rwdlistzips.rwd +33 -0
  57. data/gui/nl/tt0documentsbegin/tt0documentbegin.rwd +5 -0
  58. data/gui/nl/uu5rwddocuments/uu5documents.rwd +13 -0
  59. data/gui/nl/ww0documentsend/ww0documentend.rwd +6 -0
  60. data/gui/nl/wz6finaltabs/xx0rwdfirsttab.rwd +4 -0
  61. data/gui/nl/xx9photoview/xx9photoview.rwd +3 -0
  62. data/gui/nl/ya1helpbegin/ya0helpscreenstart.rwd +1 -0
  63. data/gui/nl/yg5rwdhelp/yf0helpscreen.rwd +2 -0
  64. data/gui/nl/yg5rwdhelp/yf6rwdtinker.rwd +3 -0
  65. data/gui/nl/yg5rwdhelp/yg0helpscreen.rwd +1 -0
  66. data/gui/nl/za1applicationend/yy9rwdend.rwd +2 -0
  67. data/init.rb +164 -0
  68. data/installed/rwdlistapplets-0.4.inf +5 -0
  69. data/installed/rwdlistzips-0.4.inf +4 -0
  70. data/installed/rwdviewphoto-0.3.inf +9 -0
  71. data/lang/en/rwdcore/languagefile.rb +6 -0
  72. data/lang/es/rwdcore/languagefile.rb +4 -0
  73. data/lang/nl/rwdcore/languagefile.rb +4 -0
  74. data/lib/temp.rb +1 -0
  75. data/rwd_files/HowTo_Tinker.html +365 -0
  76. data/rwd_files/HowTo_Tinker.txt +234 -0
  77. data/rwd_files/Readme.txt +57 -0
  78. data/rwd_files/favicon.ico +0 -0
  79. data/rwd_files/rdoc-style.css +175 -0
  80. data/rwd_files/rwdapplications.html +54 -0
  81. data/rwd_files/rwdindex.html +6 -0
  82. data/rwd_files/tinker.png +0 -0
  83. data/tests/rubyslippers-0.92.gemspec +17 -0
  84. data/tests/rwdtinker-1.2.gemspec +17 -0
  85. data/tests/rwdtinkertestEN.rb +87 -0
  86. data/tests/temptest.out +18 -0
  87. data/tests/totranslate.lang +93 -0
  88. data/zips/arubyslippers-0.7.zip +0 -0
  89. data/zips/rwdamovies-0.5.zip +0 -0
  90. data/zips/rwdaschedule-0.3.zip +0 -0
  91. data/zips/rwdaviewphoto-0.3.zip +0 -0
  92. data/zips/rwdhelloworld-0.2.zip +0 -0
  93. data/zips/rwdlistapplets-0.4.zip +0 -0
  94. data/zips/rwdlistzips-0.4.zip +0 -0
  95. data/zips/rwdrefreshacpi-0.1.zip +0 -0
  96. metadata +134 -0
data/Readme.txt ADDED
@@ -0,0 +1,57 @@
1
+ rwdapplications are web brower applications
2
+
3
+ The GUI interface used is RubyWebDialogs
4
+
5
+ RubyWebDialogs is a platform independent graphical user interface for Ruby applications. It generates HTML and serves it with an internal HTTP server, so you can use your favorite web browser as the front end for your Ruby application. All this means, that it can be used on almost every platform, like Ruby itself. http://www.erikveen.dds.nl/rubywebdialogs/
6
+
7
+
8
+ Start the program by:
9
+ changing to the directory and
10
+ ruby init.rb
11
+
12
+ Then point your web browser to:
13
+ http://localhost:7701/
14
+
15
+ Or to the port that shows on the console or in the config.cnf file
16
+
17
+ Requirements:
18
+ RubyWebDialogs - I am using 0.0.11 2004-3-9
19
+ This package you downloaded should have a runtime version of
20
+ the needed rubywebdialog files
21
+
22
+ Ruby I am using version 1.8.2
23
+
24
+ I have tested this under Linux-Debian kernel 2.6.9
25
+
26
+ Operation:
27
+ The code files reside in the code directory and are combined before
28
+ the main Class is loaded
29
+
30
+ The rwd files in gui are combined before the gui is activated
31
+
32
+ Trouble shooting:
33
+
34
+ untar the file
35
+ tar zxvf rwdapplication-x.y.tar.gz
36
+ then cd to the directory
37
+ cd rwdapplication-x.y
38
+ then start the init.rb program file
39
+ ruby init.rb
40
+
41
+
42
+ If the program is not working, try looking at the ev subdirectory. That is where
43
+ the runtime of rubywebdialogs are.
44
+
45
+ for long term installation, I would suggest putting most files in a lib directory
46
+ like /usr/lib/rwdshell
47
+ then make a writable directory the local directory for command files to be written
48
+ like ~/rwdshell
49
+
50
+
51
+ Closing the browser doesn't terminate the application. You have to use the application's close-button And terminating the application doesn't terminate the application when running in network mode. You just log out.
52
+
53
+ Don't use the back-button of the browser! Strange and unpredictable things may and will happen!
54
+
55
+ Steven Gibson
56
+ stevengibson@superant.com
57
+ http://rwdapplications.rubyforge.org/
data/bin/rwdtinker ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Copyright 2004 Steven Gibson <steven@superant.com>
4
+ # RwdTinker application
5
+ #
6
+ # This program is free software. It may be redistributed and/or modified under
7
+ # the terms of the GPL version 2 (or later), or the
8
+ # Ruby licence.
9
+ #
10
+ #++
11
+
12
+
13
+ $progdir = File::expand_path( File.dirname(__FILE__))
14
+
15
+ Dir.chdir($progdir)
16
+
17
+ Dir.chdir("..")
18
+
19
+ `ruby init.rb`
@@ -0,0 +1,17 @@
1
+ # Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
2
+ # This application is a framework for writing programs from RubyWebDialogs
3
+ # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
+ # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
+ # This class is the top class for the RwdTinker application
6
+
7
+ class RwdTinker < RWDialog
8
+
9
+ def main
10
+ @result = "idle"
11
+ @display= "idle"
12
+ end
13
+
14
+ def inspect
15
+ "Rwdtinker Application "
16
+ end
17
+
@@ -0,0 +1,4 @@
1
+
2
+
3
+ Message = Hash.new { |hh, kk| hh[kk] = "ERROR: Identificador de mensaje desconocido: #{kk.inspect}."; hh[kk] }
4
+ langmessage = {
@@ -0,0 +1,4 @@
1
+ # The encoding for the webpages. This should match the encoding used
2
+ # to create these messages.
3
+
4
+
@@ -0,0 +1,6 @@
1
+ # English Language files for RwdTinker core
2
+
3
+ :module_unknown => "Module unknown",
4
+ :applet_installed => "applet installed!.",
5
+
6
+
@@ -0,0 +1,6 @@
1
+
2
+ }
3
+ langmessage.each { |kk, vv| Message[kk] = vv }
4
+
5
+
6
+
@@ -0,0 +1,4 @@
1
+ def viewphoto
2
+ @rwd_window = "photo"
3
+
4
+ end
@@ -0,0 +1,11 @@
1
+ # this code is to list the applets that are installed
2
+ def listinstalledfiles
3
+ fileList = Dir.new("installed").entries.sort.reverse.delete_if { |x| ! (x =~ /inf$/) }
4
+ @filesresult = fileList.rwd_method("fillappletname")
5
+ end
6
+
7
+ def fillappletname(inffile)
8
+ applet = inffile.gsub(/\.inf$/, "")
9
+ @a_installlist = applet
10
+ @a_removeapplet = applet
11
+ end
@@ -0,0 +1,18 @@
1
+ def openname
2
+ require 'fileutils'
3
+ nametext = "%s" % [@a_installlist]
4
+
5
+ begin # exception trapped block
6
+ fileName = "installed/" + nametext + ".inf"
7
+
8
+ fd = File.open(fileName,"r")
9
+ @displaytext = " "
10
+ while ! fd.eof?
11
+ @displaytext = fd.read
12
+ end
13
+ fd.close
14
+ rescue
15
+ @displaytext = "\n" + "error"
16
+ end # exception rescue
17
+
18
+ end
@@ -0,0 +1,28 @@
1
+ def removeapplet
2
+ require 'fileutils'
3
+ nametext = "%s" % [@a_removeapplet]
4
+
5
+ begin # exception trapped block
6
+ fileName = "installed/" + nametext + ".inf"
7
+ count = 0
8
+ fd = File.open(fileName,"r")
9
+
10
+
11
+ fd.each { |oneline|
12
+ if count == 1
13
+ commandline = "rm -r " + oneline
14
+ system( commandline+' > temp.output' )
15
+ end
16
+ count = 1
17
+ }
18
+ fd.close
19
+ commandline = "rm " + fileName
20
+
21
+ system(commandline)
22
+ @removeapplettext = "applet files removed! - restart rwd to finish uninstalling"
23
+
24
+ rescue
25
+ @removeapplettext = "\n" + "error"
26
+ end # exception rescue
27
+
28
+ end
@@ -0,0 +1,14 @@
1
+ # this code is to list the zipped applets that can be installed
2
+ def listzipfilestoinstall
3
+ fileList = Dir.new("zips").entries.sort.reverse.delete_if { |x| ! (x =~ /zip$/) }
4
+ @zipslistresult = fileList.rwd_method("fillziptoinstallname")
5
+ end
6
+
7
+ def fillziptoinstallname(inffile)
8
+ applet = inffile.gsub(/\.zip$/, "")
9
+ @a_installapplet = applet
10
+
11
+ end
12
+
13
+
14
+
@@ -0,0 +1,20 @@
1
+ def installapplet
2
+ require 'fileutils'
3
+ nametext = "%s" % [@a_installapplet]
4
+
5
+ begin # exception trapped block
6
+ fileName = "zips/" + nametext + ".zip"
7
+
8
+ commandline = "unzip -o " + fileName
9
+ system( commandline+' > temp.output' )
10
+
11
+
12
+
13
+ system(commandline)
14
+ @installapplettext = Message[:applet_installed]
15
+
16
+ rescue
17
+ @installapplettext = "Done! - Check applet list - restart rwd to activate the new applet"
18
+ end # exception rescue
19
+
20
+ end
@@ -0,0 +1,4 @@
1
+
2
+
3
+ end # end of rwdtinker class
4
+
@@ -0,0 +1,11 @@
1
+
2
+ CodeName = "rwdtinker"
3
+ CodeNameFile = CodeName + ".rb"
4
+ RWDFile = "rwdtinker.rwd"
5
+ $lang = "en"
6
+ @@codedir = "code"
7
+ @@guidir = "gui" + "/" + $lang
8
+ @@langdir = "lang"
9
+
10
+ TempLangHashFile = @@codedir + "/" + "al5languagefiles" + "/" + "templangfile.rb"
11
+ $port = 7705
data/ev/browser.rb ADDED
@@ -0,0 +1,109 @@
1
+ require "ev/ruby"
2
+ require "ev/net"
3
+
4
+ begin
5
+ require "win32ole"
6
+ require "win32/registry"
7
+ rescue LoadError
8
+ $".push "win32ole.so"
9
+ $".push "win32/registry.rb"
10
+ end
11
+
12
+ def windowsbrowser
13
+ $stderr.puts "Looking for default browser..."
14
+
15
+ filetype = "htmlfile"
16
+ application = nil
17
+
18
+ begin
19
+ Win32::Registry::HKEY_CLASSES_ROOT.open('.html') do |reg|
20
+ filetype = reg[""]
21
+ end
22
+
23
+ Win32::Registry::HKEY_CLASSES_ROOT.open(filetype + '\shell\open\command') do |reg|
24
+ application = reg[""]
25
+ end
26
+ rescue NameError
27
+ $stderr.puts "Only available for Windows."
28
+ end
29
+
30
+ application
31
+ end
32
+
33
+ def linuxbrowser
34
+ application = ""
35
+
36
+ application = `which galeon 2> /dev/null`.chomp if application.empty?
37
+ application = `which mozilla 2> /dev/null`.chomp if application.empty?
38
+ application = `which firefox 2> /dev/null`.chomp if application.empty?
39
+ application = `which opera 2> /dev/null`.chomp if application.empty?
40
+ application = `which konqueror 2> /dev/null`.chomp if application.empty?
41
+ application = `which htmlview 2> /dev/null`.chomp if application.empty?
42
+ application = nil if application.empty?
43
+
44
+ application
45
+ end
46
+
47
+ def defaultbrowser
48
+ res = nil
49
+ res = windowsbrowser if windows?
50
+ res = linuxbrowser if linux?
51
+ res
52
+ end
53
+
54
+ def showinbrowser(html, browser=defaultbrowser)
55
+ port, io = TCPServer.freeport(7701, 7709)
56
+
57
+ unless browser.nil?
58
+ Thread.new do
59
+ begin
60
+ #command = "1234 \"http://localhost:#{port}\"" if linux?
61
+ #command = "L:/prog/MozillaFirefox/firefox.exe \"http://localhost:#{port}\"" if cygwin?
62
+ #command = Win32::Registry::HKEY_CLASSES_ROOT.open('htmlfile\shell\open\command')[0] + " \"http://localhost:#{port}/\"" if windows?
63
+
64
+ command = "#{browser} \"http://localhost:#{port}\""
65
+
66
+ Thread.pass
67
+
68
+ system(command)
69
+ rescue
70
+ end
71
+ end
72
+ end
73
+
74
+ HTTPServer.serve([port, io]) do |req, resp|
75
+ resp << html
76
+
77
+ resp.stop
78
+ end
79
+ end
80
+
81
+ def tab2html(tab)
82
+ res = ""
83
+
84
+ tab = tab.to_html(false)
85
+
86
+ res << "<html>\n"
87
+ res << "<body>\n"
88
+ res << "<table align='center' border='1' cellspacing='0' cellpadding='3'>\n"
89
+ res << "<tbody>\n"
90
+
91
+ tab.split(/\r*\n/).each do |line|
92
+ res << "<tr>\n"
93
+
94
+ line.split(/\t/, -1).each do |veld|
95
+ veld = "&nbsp;" if veld.compress.empty?
96
+
97
+ res << "<td>%s</td>\n" % veld
98
+ end
99
+
100
+ res << "</tr>\n"
101
+ end
102
+
103
+ res << "</tbody>\n"
104
+ res << "</table>\n"
105
+ res << "</body>\n"
106
+ res << "</html>\n"
107
+
108
+ res
109
+ end
data/ev/ftools.rb ADDED
@@ -0,0 +1,170 @@
1
+ require "ftools"
2
+
3
+ class Dir
4
+ def self.mkdirrec(dir)
5
+ pdir = File.dirname(dir)
6
+
7
+ if not pdir.empty? and not File.directory?(pdir)
8
+ Dir.mkdirrec(pdir)
9
+ end
10
+
11
+ Dir.mkdir(dir) rescue nil
12
+ end
13
+
14
+ def self.copy(from, to)
15
+ if File.directory?(from)
16
+ pdir = Dir.pwd
17
+ todir = File.expand_path(to)
18
+
19
+ mkdirrec(todir)
20
+
21
+ Dir.chdir(from)
22
+ Dir.new(".").each do |e|
23
+ Dir.copy(e, todir+"/"+e) if not [".", ".."].include?(e)
24
+ end
25
+ Dir.chdir(pdir)
26
+ else
27
+ todir = File.dirname(File.expand_path(to))
28
+
29
+ mkdirrec(todir)
30
+
31
+ File.copy(from, to)
32
+ end
33
+ end
34
+
35
+ def self.move(from, to)
36
+ Dir.copy(from, to)
37
+ Dir.rm_rf(from)
38
+ end
39
+
40
+ def self.rm_rf(entry)
41
+ if File.ftype(entry) == "directory"
42
+ pdir = Dir.pwd
43
+
44
+ Dir.chdir(entry)
45
+ Dir.new(".").each do |e|
46
+ Dir.rm_rf(e) if not [".", ".."].include?(e)
47
+ end
48
+ Dir.chdir(pdir)
49
+
50
+ Dir.delete(entry)
51
+ else
52
+ File.delete(entry)
53
+ end
54
+ end
55
+
56
+ def self.find(entry=nil, mask=nil)
57
+ entry = "." if entry.nil?
58
+
59
+ entry = entry.gsub!(/[\/\\]*$/, "") unless entry.nil?
60
+
61
+ mask = /^#{mask}$/i if mask.kind_of?(String)
62
+
63
+ res = []
64
+
65
+ if File.directory?(entry)
66
+ pdir = Dir.pwd
67
+
68
+ res += ["%s/" % entry] if mask.nil? or entry =~ mask
69
+
70
+ begin
71
+ Dir.chdir(entry)
72
+
73
+ begin
74
+ Dir.new(".").each do |e|
75
+ res += Dir.find(e, mask).collect{|e| entry+"/"+e} unless [".", ".."].include?(e)
76
+ end
77
+ ensure
78
+ Dir.chdir(pdir)
79
+ end
80
+ rescue Errno::EACCES => error
81
+ puts error
82
+ end
83
+ else
84
+ res += [entry] if mask.nil? or entry =~ mask
85
+ end
86
+
87
+ res
88
+ end
89
+ end
90
+
91
+ class File
92
+ def self.rollbackup(file, mode=nil)
93
+ backupfile = file + ".RB.BACKUP"
94
+ controlfile = file + ".RB.CONTROL"
95
+ res = nil
96
+
97
+ File.touch(file) unless File.file?(file)
98
+
99
+ # Rollback
100
+
101
+ if File.file?(backupfile) and File.file?(controlfile)
102
+ $stdout.puts "Restoring #{file}..."
103
+
104
+ File.copy(backupfile, file) # Rollback from phase 3
105
+ end
106
+
107
+ # Reset
108
+
109
+ File.delete(backupfile) if File.file?(backupfile) # Reset from phase 2 or 3
110
+ File.delete(controlfile) if File.file?(controlfile) # Reset from phase 3 or 4
111
+
112
+ # Backup
113
+
114
+ File.copy(file, backupfile) # Enter phase 2
115
+ File.touch(controlfile) # Enter phase 3
116
+
117
+ # The real thing
118
+
119
+ if block_given?
120
+ if mode.nil?
121
+ res = yield
122
+ else
123
+ File.open(file, mode) do |f|
124
+ res = yield(f)
125
+ end
126
+ end
127
+ end
128
+
129
+ # Cleanup
130
+
131
+ File.delete(backupfile) # Enter phase 4
132
+ File.delete(controlfile) # Enter phase 5
133
+
134
+ # Return, like File.open
135
+
136
+ res = File.open(file, (mode or "r")) unless block_given?
137
+
138
+ res
139
+ end
140
+
141
+ def self.touch(file)
142
+ File.open(file, "a"){|f|}
143
+ end
144
+
145
+ def self.which(file)
146
+ res = nil
147
+
148
+ if windows?
149
+ file = file.gsub(/\.exe$/i, "") + ".exe"
150
+ sep = ";"
151
+ else
152
+ sep = ":"
153
+ end
154
+
155
+ catch :stop do
156
+ ENV["PATH"].split(/#{sep}/).reverse.each do |d|
157
+ if File.directory?(d)
158
+ Dir.new(d).each do |e|
159
+ if e.downcase == file.downcase
160
+ res = File.expand_path(e, d)
161
+ throw :stop
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
167
+
168
+ res
169
+ end
170
+ end