This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Ruby Konqueror-Plugin?

Tags: None
(comma "," separated)
The User
KDE Developer
Posts
647
Karma
0
OS

Ruby Konqueror-Plugin?

Sun Aug 02, 2009 8:31 pm
Hi!
Could it be possible to write Konqueror-Plugins in Ruby or Python?
I've found the PluginFactories for these language and Plasma-enhancements implemented in a similar way. Well, I'm not experienced in writing Plugins so my test doesn't work.

install.sh:
Code: Select all
sudo cp ruby_konqueror_plugin.desktop `kde4-config --install services`
sudo mkdir -p `kde4-config --install data`/ruby_konqueror_plugin/
sudo install ruby_konqueror_plugin.rb `kde4-config --install data`/ruby_konqueror_plugin/
sudo install ruby_konqueror_plugin.rc `kde4-config --install data`/ruby_konqueror_plugin/


ruby_konqueror_plugin.desktop:
Code: Select all
[Desktop Entry]
Name=Ruby Konqueror Plugin
Icon=internet-web-browser
X-KDE-Library=krubypluginfactory
X_KDE-PluginKeyword=rubykonquerorplugin/rubykonquerorplugin.rb
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Category=Web
X-KDE-PluginInfo-Depends=QtRuby
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-ParentApp=konqueror
Comment=You can write Konqueror-Plugins in Ruby


ruby_konqueror_plugin.rb:
Code: Select all
#!/usr/bin/ruby
require 'Qt'
require 'korundum4'

module RubyKonquerorPlugin

class RubyKonquerorPlugin < KDE::Parts::Plugin
   slots 'helloWorld()'
   def initialize(parent, args)
      super(parent)
      @action = Qt::Action.new("Hello World", self)
      actionCollection().addAction("rubyHelloWorld", @action)
      createGUI(Dir.getwd + "/ruby_konqueror_plugin.rc")
      connect(@action, SIGNAL('triggered()'), self, SLOT('helloWorld()'))
   end
   def helloWorld()
      Qt::MessageBox::information(nil, "Greetings from Ruby", "Hello World!");
   end
end

end


ruby_konqueror_plugin.rc:
Code: Select all
<!DOCTYPE kpartgui>
<gui name="ruby_konqueror_plugin" version="0.1">
<MenuBar>
 <Menu name="tools"><text>&amp;Tools</text>
  <Action name="rubyHelloWorld"/>
 </Menu>
</MenuBar>
</gui>


Do you see any obvious mistake?
Or is it impossible?

The User
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Ruby Konqueror-Plugin?

Mon Aug 03, 2009 6:42 am
The following line is missing the underscores I believe:
Code: Select all
X_KDE-PluginKeyword=rubykonquerorplugin/rubykonquerorplugin.rb


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
The User
KDE Developer
Posts
647
Karma
0
OS

Re: Ruby Konqueror-Plugin?

Mon Aug 03, 2009 10:38 am
It still doesn't get loaded.
No errors in .xsession-errors.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Ruby Konqueror-Plugin?

Tue Aug 04, 2009 4:58 am
Did you run "kbuildsycoca4" after copying the files?
You may also wish to check the desktop file code for one of the C++ plugins. In all likelihood you are missing something essential.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
The User
KDE Developer
Posts
647
Karma
0
OS

Re: Ruby Konqueror-Plugin?

Sat Aug 08, 2009 7:43 am
Of course I use kbuildsycoca4.
The User
KDE Developer
Posts
647
Karma
0
OS

Re: Ruby Konqueror-Plugin?

Sun Aug 09, 2009 9:31 pm
When I look at Plasmoids, there are such lines of code:
Code: Select all
X-Plasma-API=ruby-script
X-Plasma-MainScript=code/main.rb


Is this necessary?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Ruby Konqueror-Plugin?

Mon Aug 10, 2009 4:23 am
I believe you may need to look into MergeActions, which are part of XMLGUI, since you do not appear to be specifying a merge location in your XMLGUI file.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
The User
KDE Developer
Posts
647
Karma
0
OS

Re: Ruby Konqueror-Plugin?

Wed Aug 12, 2009 9:04 pm
The XMLGUI is loaded from the script and the script isn't loaded. So errors in the XMLGUI can't be the reason. ;)

But it should theoretically be possible?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Ruby Konqueror-Plugin?

Thu Aug 13, 2009 4:21 am
Theoretically it should be possible. However it may be that Konqueror is not searching for, and is therefore not loading Ruby plugins. I believe the same will apply for System Settings views ( I can't recall doing anything special for Ruby plugins )


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
The User
KDE Developer
Posts
647
Karma
0
OS

Re: Ruby Konqueror-Plugin?

Sun Sep 13, 2009 1:02 am
When I place the .desktop-file at /usr/share/apps/konqueror/kaprtplugins, the extension is displayed. But the KRubyPluginFactory is not loaded. What could be the reason?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Ruby Konqueror-Plugin?

Sun Sep 13, 2009 9:37 am
Unfortunately I do not know much further about loading plugins.
Usually them not loading indicates an issue with the file reference.

After ensuring that files are in the correct locations, executable, and have no typos, you may wish to ask on the kde-bindings@kde.org mailing list.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
The User
KDE Developer
Posts
647
Karma
0
OS

Re: Ruby Konqueror-Plugin?

Mon Apr 19, 2010 9:04 pm
I was able to fix it, it was a bug in KParts::Plugin.
Now Ruby- and Python-plugins work. :)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]