[Kde-bindings] KDE/kdebindings/ruby/plasma
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Sat Jun 28 15:27:37 UTC 2008
SVN commit 825538 by rdale:
* Make the Ruby ScriptEngine based plugins work
* Add a Ruby version of the Javascript Tiger applet
CCMAIL: kde-bindings at kde.org
A ChangeLog
A examples/applets/tiger (directory)
A examples/applets/tiger/contents (directory)
A examples/applets/tiger/contents/code (directory)
A examples/applets/tiger/contents/code/main.rb
A examples/applets/tiger/metadata.desktop
M +7 -5 src/applet.rb
M +22 -1 src/data_engine.rb
M +3 -0 src/lib/KDE/plasma.rb
M +2 -2 src/package_ruboid.rb
--- trunk/KDE/kdebindings/ruby/plasma/src/applet.rb #825537:825538
@@ -1,9 +1,9 @@
require 'plasma_applet'
-module RubyScriptEngine
+module RubyAppletScript
class Applet < Plasma::AppletScript
- def initialize(parent = nil)
- super
+ def initialize(parent, args)
+ super(parent)
end
def camelize(str)
@@ -12,14 +12,16 @@
def init
applet.resize(200, 200)
- puts "Applet.init mainScript: #{mainScript}"
+ puts "RubyAppletScript::Applet#init mainScript: #{mainScript}"
program = Qt::FileInfo.new(mainScript)
load Qt::File.encodeName(program.filePath).to_s
moduleName = camelize(package.metadata.name)
className = camelize(program.baseName)
- puts "Applet.init instantiating: #{moduleName}::#{className}"
+ puts "RubyAppletScript::Applet#init instantiating: #{moduleName}::#{className}"
klass = Object.const_get(moduleName.to_sym).const_get(className.to_sym)
@applet_script = klass.new(self)
+ @applet_script.init
+ return true
end
def paintInterface(painter, option, contentsRect)
--- trunk/KDE/kdebindings/ruby/plasma/src/data_engine.rb #825537:825538
@@ -1,7 +1,28 @@
require 'plasma_applet'
-module Ruby_Script_Engine
+module RubyAppletScript
class DataEngine < Plasma::DataEngineScript
+ def initialize(parent, args)
+ super(parent)
+ end
+
+ def camelize(str)
+ str.gsub(/(^|[_-])(.)/) { $2.upcase }
+ end
+
+ def init
+ puts "RubyAppletScript::DataEngine#init mainScript: #{mainScript}"
+ program = Qt::FileInfo.new(mainScript)
+ load Qt::File.encodeName(program.filePath).to_s
+ moduleName = camelize(package.metadata.name)
+ className = camelize(program.baseName)
+ puts "RubyAppletScript::DataEngine#init instantiating: #{moduleName}::#{className}"
+ klass = Object.const_get(moduleName.to_sym).const_get(className.to_sym)
+ @data_engine_script = klass.new(self)
+ @data_engine_script.init
+ return true
+ end
+
def sourceRequestEvent(name)
@data_engine.sourceRequestEvent(name)
end
--- trunk/KDE/kdebindings/ruby/plasma/src/lib/KDE/plasma.rb #825537:825538
@@ -17,6 +17,8 @@
***************************************************************************/
=end
+require 'qtwebkit'
+
module Plasma
module Internal
@@ -70,6 +72,7 @@
def initialize(parent, args = nil)
super(parent)
+ @applet_script = parent
end
def paintInterface(painter, option, contentsRect)
--- trunk/KDE/kdebindings/ruby/plasma/src/package_ruboid.rb #825537:825538
@@ -1,8 +1,8 @@
require 'plasma_applet'
-module RubyScriptEngine
+module RubyAppletScript
class PackageRuboid < Plasma::PackageStructure
- def initialize(parent = nil)
+ def initialize(parent, args)
super(parent, "Ruboid")
addDirectoryDefinition("images", "images", KDE::i18n("Images"))
mimetypes = []
More information about the Kde-bindings
mailing list