Permalink
Browse files

binding loader alpha

  • Loading branch information...
1 parent ad9d0e7 commit cb27aa1d9c2ed7dfd032c4fd9b426eed368c3df3 andrea@VEGETA committed Nov 18, 2009
View
@@ -9,7 +9,7 @@ require 'rake/testtask'
spec = Gem::Specification.new do |s|
s.name = 'freightrain'
- s.version = '0.4.0'
+ s.version = '0.4.1'
s.has_rdoc = false
s.summary = 'ruby desktop development made easy'
s.description = s.summary
@@ -34,7 +34,11 @@ def connect_signals()
end
def get_glade_file(file_name)
- search_path = File.join(Freightrain.app_path, "views", "**", file_name + ".glade")
+ search_path = File.join(
+ Freightrain.app_path,
+ "views",
+ "**",
+ file_name.to_convention + ".glade")
results = Dir.glob(search_path)
return results.first
end
@@ -51,7 +51,11 @@ def connect_signals()
end
def get_ui_files(file_name)
- search_path = File.join(Freightrain.app_path, "views", "**", file_name + ".ui")
+ search_path = File.join(
+ Freightrain.app_path,
+ "views",
+ "**",
+ file_name.to_convention + ".ui")
results = Dir.glob(search_path)
return results.first
end
@@ -11,16 +11,20 @@ def initialize(class_name)
"views",
Freightrain.toolkit.to_s,
"**",
- class_name + ".bnd.yml")
+ class_name.to_convention + ".bnd.yml")
result = Dir.glob(search_path)
@filename = result[0] if !result.empty?
end
def bind_widgets(widgets)
if @filename
bindings = YAML.load_file(@filename)
- bindings.each do |widget, options|
+ bindings.each do |widget, yaml_options|
target = widgets.select { |w| w.name == widget}.first
+ options = {}
+ yaml_options.each do |key, value|
+ options[key.to_sym] = value
+ end
target.bind(options)
end
end
@@ -3,10 +3,10 @@
class String
- def to_convention_sym
+ def to_convention
#TODO: use regexp instead
return nil if self.empty?
- clone = self
+ clone = self.clone
first_letter = clone.slice!(0)
result = first_letter.chr.downcase
clone.each_char do |letter|
@@ -17,6 +17,10 @@ def to_convention_sym
result += letter
end
end
- return result.downcase.to_sym
+ return result.downcase
+ end
+
+ def to_convention_sym
+ return self.to_convention.to_sym
end
end

0 comments on commit cb27aa1

Please sign in to comment.