[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gcmd-dev] Ruby plugins
From: |
Antono Vasiljev |
Subject: |
Re: [gcmd-dev] Ruby plugins |
Date: |
Thu, 21 Jun 2007 01:38:53 +0300 |
On Wed, 2007-06-20 at 23:11 +0200, Piotr Eljasiak wrote:
> > def main(main_wnd_xid, active_cwd, inactive_cwd, selected_files):
> >
> > I wonder what means every parameter. who pass them to the main
> > method/function? Can they be predefined? Is there any standard on naming
> > of the main method? Please say some words about information which can be
> > taken from gcmd to feed my plugin.
>
> main() is a function, and it has no special meaning in python - for gcmd
> it serves as an entry point for every python plugin (so for gcmd main()
> is predefined). When gcmd launches pyplugin, in fact it calls main()
> function in it. The parameters have predefined (for gcmd) names and
> contain values passed from gcmd:
>
> main_wnd_xid XID of GNOME Commander main toplevel window
> active_cwd full path of current dir of active pane
> inactive_cwd full path of current dir of inactive pane
> selected_files list of selected file uris in active pane
>
> You can see the values passed to pyplugin when starting gcmd in console
> with -d=p parameter. Here goes my log for md5sum:
>
> [PP] Calling md5sum.main()
> [PP] Selected files: 2
> [PP] Main window XID: 56623336 (0x36000e8)
> [PP] Active directory: /home/piotr/download/Szkocja
> [PP] Inactive directory: /home/piotr/devel/EAL
> [PP] Result of call md5sum.main(): 1
>
Wow! It's much more clear for me now. One thing wich i want to
understand is XID. Where it can be used?
It will be nice to have one module for all ruby plugins and every plugin
will be a ruby class with predefined singleton method(like main in
python). It will be more nice then chunks of ruby code. Module methods
can be reused in different classes-plugins. It will be more
object-oriented then to create every time top level methods of Object
class.
Ok. I think it's time to write some strings of pure ruby code! :))
Thank you for your explanations!
--
Amike, Antono Vasiljev.
http://antono.info
http://esperanto.by