lustr-wx 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +17 -0
- data/README.txt +6 -0
- data/Rakefile +93 -0
- data/lib/lustr-wx.rb +17 -0
- data/lib/lustr-wx/app.rb +49 -0
- data/lib/lustr-wx/box.rb +78 -0
- data/lib/lustr-wx/button.rb +42 -0
- data/lib/lustr-wx/divided_box.rb +53 -0
- data/lib/lustr-wx/field.rb +51 -0
- data/lib/lustr-wx/label.rb +50 -0
- data/lib/lustr-wx/list.rb +49 -0
- data/lib/lustr-wx/text_area.rb +57 -0
- data/lib/lustr-wx/version.rb +24 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- metadata +78 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
lib/lustr-wx.rb
|
6
|
+
lib/lustr-wx/version.rb
|
7
|
+
lib/lustr-wx/field.rb
|
8
|
+
lib/lustr-wx/label.rb
|
9
|
+
lib/lustr-wx/list.rb
|
10
|
+
lib/lustr-wx/button.rb
|
11
|
+
lib/lustr-wx/box.rb
|
12
|
+
lib/lustr-wx/app.rb
|
13
|
+
lib/lustr-wx/text_area.rb
|
14
|
+
lib/lustr-wx/divided_box.rb
|
15
|
+
scripts/txt2html
|
16
|
+
setup.rb
|
17
|
+
|
data/README.txt
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
Lustr is a Ruby DSL for GUI development. Lustr4Wx allows Lustr UIs to be
|
2
|
+
displayed via Ruby's wxRuby (using wxWidgets).
|
3
|
+
|
4
|
+
More details on Lustr can be found at {Lustr's home page}[http://www.codecorps.org/moinmoin/index.cgi/Lustr]
|
5
|
+
or on the {RubyForge}[http://rubyforge.org/projects/lustr] site.
|
6
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/contrib/rubyforgepublisher'
|
9
|
+
require 'fileutils'
|
10
|
+
require 'hoe'
|
11
|
+
include FileUtils
|
12
|
+
require File.join(File.dirname(__FILE__), 'lib', 'lustr-wx', 'version')
|
13
|
+
|
14
|
+
AUTHOR = 'FIXME full name' # can also be an array of Authors
|
15
|
+
EMAIL = "FIXME email"
|
16
|
+
DESCRIPTION = "description of gem"
|
17
|
+
GEM_NAME = 'lustr-wx' # what ppl will type to install your gem
|
18
|
+
RUBYFORGE_PROJECT = 'lustr' # The unix name for your project
|
19
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
20
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
21
|
+
|
22
|
+
NAME = "lustr-wx"
|
23
|
+
REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
24
|
+
VERS = Lustr4Wx::VERSION::STRING + (REV ? ".#{REV}" : "")
|
25
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
|
26
|
+
RDOC_OPTS = ['--quiet', '--title', 'lustr-wx documentation',
|
27
|
+
"--opname", "index.html",
|
28
|
+
"--line-numbers",
|
29
|
+
"--main", "README",
|
30
|
+
"--inline-source"]
|
31
|
+
|
32
|
+
class Hoe
|
33
|
+
def extra_deps
|
34
|
+
@extra_deps.reject { |x| Array(x).first == 'hoe' }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Generate all the Rake tasks
|
39
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
40
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
41
|
+
p.author = AUTHOR
|
42
|
+
p.description = DESCRIPTION
|
43
|
+
p.email = EMAIL
|
44
|
+
p.summary = DESCRIPTION
|
45
|
+
p.url = HOMEPATH
|
46
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
47
|
+
p.test_globs = ["test/**/test_*.rb"]
|
48
|
+
p.clean_globs = CLEAN #An array of file patterns to delete on clean.
|
49
|
+
|
50
|
+
# == Optional
|
51
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
52
|
+
p.extra_deps = [['lustr-core', '>=0.1'], ['wxruby2-preview', '>=0.0.40']] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
53
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
desc 'Generate website files'
|
58
|
+
task :website_generate do
|
59
|
+
Dir['website/**/*.txt'].each do |txt|
|
60
|
+
sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'Upload website files to rubyforge'
|
65
|
+
task :website_upload do
|
66
|
+
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
67
|
+
host = "#{config["username"]}@rubyforge.org"
|
68
|
+
remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
|
69
|
+
# remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
70
|
+
local_dir = 'website'
|
71
|
+
sh %{rsync -av #{local_dir}/ #{host}:#{remote_dir}}
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Generate and upload website files'
|
75
|
+
task :website => [:website_generate, :website_upload]
|
76
|
+
|
77
|
+
desc 'Release the website and new gem version'
|
78
|
+
task :deploy => [:check_version, :website, :release]
|
79
|
+
|
80
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
81
|
+
task :local_deploy => [:website_generate, :install_gem]
|
82
|
+
|
83
|
+
task :check_version do
|
84
|
+
unless ENV['VERSION']
|
85
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
86
|
+
exit
|
87
|
+
end
|
88
|
+
unless ENV['VERSION'] == VERS
|
89
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
90
|
+
exit
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
data/lib/lustr-wx.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
path=File::join(File::dirname(__FILE__), 'lustr-wx')
|
17
|
+
Dir[path+'/**'].sort.each {|f| require f if !File.directory?(f) && /.*\.rb$/.match(f) }
|
data/lib/lustr-wx/app.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'lustr'
|
17
|
+
require 'rubygems'
|
18
|
+
require "wx" # wxruby2
|
19
|
+
|
20
|
+
module Lustr4Wx
|
21
|
+
class Frame < Wx::Frame
|
22
|
+
include Lustr::WidgetBase
|
23
|
+
end
|
24
|
+
|
25
|
+
class App < Wx::App
|
26
|
+
include Lustr::WidgetBase
|
27
|
+
attr_reader :frame
|
28
|
+
attr_accessor :init_block
|
29
|
+
|
30
|
+
def on_init
|
31
|
+
self.controller=option(:controller) if option(:controller)
|
32
|
+
@frame=Lustr4Wx::Frame.new(nil, -1, option(:title))
|
33
|
+
frame.set_client_size(Wx::Size.new(option(:width), option(:height)))
|
34
|
+
init_block.call if init_block
|
35
|
+
frame.show
|
36
|
+
end
|
37
|
+
|
38
|
+
def resolve
|
39
|
+
return frame
|
40
|
+
end
|
41
|
+
|
42
|
+
def show
|
43
|
+
main_loop
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Lustr.declare(Lustr::SimpleBuilder.new(:app, Lustr4Wx::App))
|
49
|
+
|
data/lib/lustr-wx/box.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'lustr'
|
17
|
+
require 'rubygems'
|
18
|
+
require "wx" # wxruby2
|
19
|
+
include Wx
|
20
|
+
|
21
|
+
module Lustr4Wx
|
22
|
+
class Box < Wx::Panel
|
23
|
+
include Lustr::WidgetBase
|
24
|
+
|
25
|
+
def init_options(options)
|
26
|
+
super
|
27
|
+
|
28
|
+
self.label=option(:label)
|
29
|
+
sizerStyle=(option(:direction)==:vertical ? Wx::VERTICAL : Wx::HORIZONTAL)
|
30
|
+
|
31
|
+
set_sizer(Wx::BoxSizer.new(sizerStyle))
|
32
|
+
end
|
33
|
+
|
34
|
+
def is_vertical?
|
35
|
+
option(:direction)==:vertical
|
36
|
+
end
|
37
|
+
|
38
|
+
def <<(child)
|
39
|
+
super
|
40
|
+
|
41
|
+
axis=nil
|
42
|
+
off_axis=nil
|
43
|
+
|
44
|
+
if is_vertical?
|
45
|
+
axis=child.option(:height)
|
46
|
+
off_axis=child.option(:width)
|
47
|
+
else
|
48
|
+
axis=child.option(:width)
|
49
|
+
off_axis=child.option(:height)
|
50
|
+
end
|
51
|
+
|
52
|
+
flags=0
|
53
|
+
|
54
|
+
if off_axis=='100%'
|
55
|
+
flags |= Wx::GROW
|
56
|
+
end
|
57
|
+
|
58
|
+
if option(:align)==:center
|
59
|
+
flags |= (is_vertical? ? Wx::ALIGN_CENTER_HORIZONTAL : Wx::ALIGN_CENTER_VERTICAL)
|
60
|
+
else
|
61
|
+
flags |= (is_vertical? ? Wx::ALIGN_LEFT : Wx::ALIGN_TOP)
|
62
|
+
end
|
63
|
+
|
64
|
+
get_sizer.add(child.resolve, axis.to_i, flags, 2)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class BoxBuilder < Lustr::BuilderBase
|
69
|
+
def build(parent_widget)
|
70
|
+
w=Lustr4Wx::Box.new(parent_widget, -1)
|
71
|
+
|
72
|
+
return w
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
Lustr.declare(Lustr4Wx::BoxBuilder.new(:box))
|
78
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'lustr'
|
17
|
+
require 'rubygems'
|
18
|
+
require "wx" # wxruby2
|
19
|
+
include Wx
|
20
|
+
|
21
|
+
module Lustr4Wx
|
22
|
+
class Button < Wx::Button
|
23
|
+
include Lustr::WidgetBase
|
24
|
+
|
25
|
+
def init_options(options)
|
26
|
+
super
|
27
|
+
|
28
|
+
evt_button(get_id()) { |event| raise_event(option(:on_click), event) } if option(:on_click)
|
29
|
+
set_label(option(:text))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class ButtonBuilder < Lustr::BuilderBase
|
34
|
+
def build(parent_widget)
|
35
|
+
button=Lustr4Wx::Button.new(parent_widget, -1, '')
|
36
|
+
|
37
|
+
return button
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Lustr.declare(Lustr4Wx::ButtonBuilder.new(:button))
|
@@ -0,0 +1,53 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'lustr'
|
17
|
+
require 'rubygems'
|
18
|
+
require "wx" # wxruby2
|
19
|
+
include Wx
|
20
|
+
|
21
|
+
module Lustr4Wx
|
22
|
+
class DividedBox < Wx::SplitterWindow
|
23
|
+
include Lustr::WidgetBase
|
24
|
+
|
25
|
+
def init_options(options)
|
26
|
+
super
|
27
|
+
|
28
|
+
@direction=option(:direction)
|
29
|
+
self.label=option(:label)
|
30
|
+
end
|
31
|
+
|
32
|
+
def <<(child)
|
33
|
+
super
|
34
|
+
|
35
|
+
if children.size==2
|
36
|
+
if @direction==:vertical
|
37
|
+
split_horizontally(children[0].resolve, children[1].resolve)
|
38
|
+
else
|
39
|
+
split_vertically(children[0].resolve, children[1].resolve)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class DividedBoxBuilder < Lustr::BuilderBase
|
46
|
+
def build(parent_widget)
|
47
|
+
Lustr4Wx::DividedBox.new(parent_widget, -1)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
Lustr.declare(Lustr4Wx::DividedBoxBuilder.new(:divided_box))
|
53
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'lustr'
|
17
|
+
require 'rubygems'
|
18
|
+
require "wx" # wxruby2
|
19
|
+
include Wx
|
20
|
+
|
21
|
+
module Lustr4Wx
|
22
|
+
class Field < Wx::TextCtrl
|
23
|
+
include Lustr::WidgetBase
|
24
|
+
|
25
|
+
def text=(value)
|
26
|
+
set_value (value ? value : '')
|
27
|
+
end
|
28
|
+
|
29
|
+
def text
|
30
|
+
return get_value
|
31
|
+
end
|
32
|
+
|
33
|
+
def init_options(options)
|
34
|
+
super
|
35
|
+
|
36
|
+
text=option(:text)
|
37
|
+
evt_text(get_id()) { |e| raise_event(option(:on_change), e) } if option(:on_change)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
class FieldBuilder < Lustr::BuilderBase
|
42
|
+
def build(parent_widget)
|
43
|
+
field=Lustr4Wx::Field.new(parent_widget, -1)
|
44
|
+
|
45
|
+
return field
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
Lustr.declare(Lustr4Wx::FieldBuilder.new(:field))
|
51
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Lustr (http://rubyforge.org/projects/lustr).
|
3
|
+
|
4
|
+
Copyright (c) 2007 Mark L. Murphy.
|
5
|
+
|
6
|
+
Lustr is free software; you can redistribute it and/or modify it under the
|
7
|
+
terms of the GNU General Public License as published by the Free Software
|
8
|
+
Foundation; either version 2 of the License.
|
9
|
+
|
10
|
+
Lustr is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
13
|
+
details. This file is included in the Ruby gem as License.txt.
|
14
|
+
=end
|
15
|
+
|
16
|
+
require 'lustr'
|
17
|
+
require 'rubygems'
|
18
|
+
require "wx" # wxruby2
|
19
|
+
include Wx
|
20
|
+
|
21
|
+
module Lustr4Wx
|
22
|
+
class Label < Wx::StaticText
|
23
|
+
include Lustr::WidgetBase
|
24
|
+
|
25
|
+
def text=(value)
|
26
|
+
set_label value
|
27
|
+
end
|
28
|
+
|
29
|
+
def text
|
30
|
+
return get_label
|
31
|
+
end
|
32
|
+
|
33
|
+
def init_options(options)
|
34
|
+
super
|
35
|
+
|
36
|
+
self.text=option(:text)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class LabelBuilder < Lustr::BuilderBase
|
41
|
+
def build(parent_widget)
|
42
|
+
result=Lustr4Wx::Label.new(parent_widget, -1, '')
|
43
|
+
|
44
|
+
return result
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Lustr.declare(Lustr4Wx::LabelBuilder.new(:label))
|
50
|
+
|