Mailinglist Archive: yast-commit (210 mails)

< Previous Next >
[yast-commit] r63359 - in /trunk/ruby-bindings: examples/ruby/ui.rb src/ruby/CMakeLists.txt src/ruby/Y2RubyTypeConv.cc src/ruby/ycp.rb
Author: mvidner
Date: Sun Feb 6 14:36:08 2011
New Revision: 63359

URL: http://svn.opensuse.org/viewcvs/yast?rev=63359&view=rev
Log:
Made UI work again.

- Crude fix of the example
But the intended usage is still unclear to me
- ycpx.so needs to link the UI plugin
otherwise YUIComponent::uiComponent will not be found at run time
(unless called from y2base)
- Fixed YaST::Term construction
Use the C implementation
Renamed the Ruby class to YaST::TermBuilder.

Modified:
trunk/ruby-bindings/examples/ruby/ui.rb
trunk/ruby-bindings/src/ruby/CMakeLists.txt
trunk/ruby-bindings/src/ruby/Y2RubyTypeConv.cc
trunk/ruby-bindings/src/ruby/ycp.rb

Modified: trunk/ruby-bindings/examples/ruby/ui.rb
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/examples/ruby/ui.rb?rev=63359&r1=63358&r2=63359&view=diff
==============================================================================
--- trunk/ruby-bindings/examples/ruby/ui.rb (original)
+++ trunk/ruby-bindings/examples/ruby/ui.rb Sun Feb 6 14:36:08 2011
@@ -1,23 +1,16 @@
require 'ycp'
-require 'ycp/ui'
-
YCP::Ui::init("qt")
-include YaST::Ui
+include YCP::Ui

t = HBox( Label("Welcome to Ruby!"), PushButton("Push me") )
-
-puts "#{t.to_s} #{t.class}"
-
-ui.OpenDialog(t)
-ui.UserInput()
-
# You can also use downcase, as the symbols are aliased
-t = hbox( label("Welcome to Ruby!"), pushbutton("Push me") )
+#t = hbox( label("Welcome to Ruby!"), pushbutton("Push me") )

puts "#{t.to_s} #{t.class}"

-ui.OpenDialog(t)
-ui.UserInput()
-
+# how should this work?
+# ui.OpenDialog(t)
+# ui.UserInput()

-exit
+p YCP::call_ycp_function( "UI", "OpenDialog", t )
+p YCP::call_ycp_function( "UI", "UserInput" )

Modified: trunk/ruby-bindings/src/ruby/CMakeLists.txt
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/CMakeLists.txt?rev=63359&r1=63358&r2=63359&view=diff
==============================================================================
--- trunk/ruby-bindings/src/ruby/CMakeLists.txt (original)
+++ trunk/ruby-bindings/src/ruby/CMakeLists.txt Sun Feb 6 14:36:08 2011
@@ -76,6 +76,7 @@
#
TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_WFM_LIBRARY} )
TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_SCR_LIBRARY} )
+TARGET_LINK_LIBRARIES( ycpx ${YAST_PLUGIN_UI_LIBRARY} )
TARGET_LINK_LIBRARIES( ycpx ${RUBY_LIBRARY} )



Modified: trunk/ruby-bindings/src/ruby/Y2RubyTypeConv.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/Y2RubyTypeConv.cc?rev=63359&r1=63358&r2=63359&view=diff
==============================================================================
--- trunk/ruby-bindings/src/ruby/Y2RubyTypeConv.cc (original)
+++ trunk/ruby-bindings/src/ruby/Y2RubyTypeConv.cc Sun Feb 6 14:36:08 2011
@@ -225,11 +225,11 @@
VALUE cname = rb_funcall(rb_funcall(value, rb_intern("class"), 0),
rb_intern("to_s"), 0);
const char *class_name = StringValuePtr(cname);
/* get the Term class object */
- if ( !strcmp(class_name, "Yast::Term") )
+ if ( !strcmp(class_name, "YaST::Term") )
{
return ryast_yterm_from_rterm(value);
}
- rb_raise( rb_eTypeError, "Conversion of Ruby type not supported");
+ rb_raise( rb_eTypeError, "Conversion of Ruby type %s not supported",
class_name);
return YCPValue();
}
}

Modified: trunk/ruby-bindings/src/ruby/ycp.rb
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/ycp.rb?rev=63359&r1=63358&r2=63359&view=diff
==============================================================================
--- trunk/ruby-bindings/src/ruby/ycp.rb (original)
+++ trunk/ruby-bindings/src/ruby/ycp.rb Sun Feb 6 14:36:08 2011
@@ -163,7 +163,7 @@
#

module YaST
- class Term
+ class TermBuilder
# blank slate
instance_methods.each { |m| undef_method m unless (m =~
/^__|instance_eval$/)}


--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages