[Kde-bindings] KDE/kdebindings/qtruby

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Nov 23 17:56:32 UTC 2006


SVN commit 607212 by rdale:

* Made Qt::TreeWidgetItem and Qt::TreeWidget Enumerable
* Added a Qt::TreeWidgetItemIterator.current() method to get the
  current value of the iterator without needing to use 'operator*'
* Added inspect() and pretty_print() methods to Qt::TreeWidgetItem,
  Qt::ListWidgetItem and Qt::TableWidgetItem
* Removed instructions for creating a 'rubyw' executable in Mac OS X
  as it isn't needed anymore with Qt 4.x. Thanks to Hans Fugal for 
  pointing that out.

CCMAIL: kde-bindings at kde.org



 M  +11 -0     ChangeLog  
 M  +0 -17     INSTALL  
 M  +61 -2     rubylib/qtruby/lib/Qt/qtruby4.rb  


--- trunk/KDE/kdebindings/qtruby/ChangeLog #607211:607212
@@ -1,3 +1,14 @@
+2006-11-23  Richard Dale  <rdale at foton.es>
+
+	* Made Qt::TreeWidgetItem and Qt::TreeWidget Enumerable
+	* Added a Qt::TreeWidgetItemIterator.current() method to get the
+	  current value of the iterator without needing to use 'operator*'
+	* Added inspect() and pretty_print() methods to Qt::TreeWidgetItem,
+	  Qt::ListWidgetItem and Qt::TableWidgetItem
+	* Removed instructions for creating a 'rubyw' executable in Mac OS X
+	  as it isn't needed anymore with Qt 4.x. Thanks to Hans Fugal for 
+	  pointing that out.
+
 2006-11-21  Richard Dale  <rdale at foton.es>
 
 	* The rbuic and rbrcc tools were being built with a .app extension
--- trunk/KDE/kdebindings/qtruby/INSTALL #607211:607212
@@ -76,23 +76,6 @@
 $ make
 $ sudo make install
 
-To get Mac menus to appear, when a QtRuby program is run from the command line,
-link ruby against the carbon resource lib and call it 'rubyw', see:
-
-http://www.rubygarden.org/ruby?RubyTkOnOSX
-
-"Create rubyw executable for MacOS?: the Win32 distribution of ruby includes a 
-'rubyw.exe' so I decided to attempt creating a 'rubyw' executable:
-
-On my machine, ruby is installed at /usr/local/bin/ruby, so I did sudo 
-cp /usr/local/bin/ruby /usr/local/bin/rubyw 
-Using the suggestion directly above (on this page), I then ran 
-sudo /Developer/Tools/Rez -t APPL Carbon.r -o rubyw 
-I was then able to successfully run an example RubyTk app by 
-running /usr/local/bin/rubyw ruby-1.8.0/ext/tk/sample/tkmenubutton.rb 
-Everything worked as expected, and I was able to interact with the UI without 
-any SetFrontProcess errors. "
-
 Ryutaro Amano wrote this about creating a double clickable bundle:
 
 "Thanks all, I have succeeded make rubyw.
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/lib/Qt/qtruby4.rb #607211:607212
@@ -803,6 +803,16 @@
 		def type(*args)
 			method_missing(:type, *args)
 		end
+
+		def inspect
+			str = super
+			str.sub(/>$/, " text=%s>" % text)
+		end
+		
+		def pretty_print(pp)
+			str = to_s
+			pp.text str.sub(/>$/, " text=%s>" % text)
+		end
 	end
 
 	class Locale < Qt::Base
@@ -1286,6 +1296,16 @@
 		def type(*args)
 			method_missing(:type, *args)
 		end
+
+		def inspect
+			str = super
+			str.sub(/>$/, " text=%s>" % text)
+		end
+		
+		def pretty_print(pp)
+			str = to_s
+			pp.text str.sub(/>$/, " text=%s>" % text)
+		end
 	end
 
 	class TemporaryFile < Qt::Base
@@ -1396,15 +1416,40 @@
 		end
 	end
 
+	class TreeWidget < Qt::Base
+		include Enumerable
+
+		def each
+			it = Qt::TreeWidgetItemIterator.new(self)
+			while it.current
+				yield it.current
+				it += 1
+			end
+		end
+	end
+
 	class TreeWidgetItem < Qt::Base
+		include Enumerable
+
 		def inspect
 			str = super
-			str.sub(/>$/, " parent=%s>" % parent)
+			str.sub!(/>$/, "")
+			str << " parent=%s," % parent unless parent.nil?
+			for i in 0..(columnCount - 1)
+				str << " text%d=%s," % [i, self.text(i)]
+			end
+			str.sub!(/,?$/, ">")
 		end
 		
 		def pretty_print(pp)
 			str = to_s
-			pp.text str.sub(/>$/, " parent=%s>" % parent)
+			str.sub!(/>$/, "")
+			str << " parent=%s," % parent unless parent.nil?
+			for i in 0..(columnCount - 1)
+				str << " text%d=%s," % [i, self.text(i)]
+			end
+			str.sub!(/,?$/, ">")
+			pp.text str
 		end
 
 		def clone(*args)
@@ -1414,8 +1459,22 @@
 		def type(*args)
 			method_missing(:type, *args)
 		end
+
+		def each
+			it = Qt::TreeWidgetItemIterator.new(self)
+			while it.current
+				yield it.current
+				it += 1
+			end
+		end
 	end
 
+	class TreeWidgetItemIterator < Qt::Base
+		def current
+			return send("operator*".to_sym)
+		end
+	end
+
 	class UrlInfo < Qt::Base
 		def name(*args)
 			method_missing(:name, *args)



More information about the Kde-bindings mailing list