[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gcmd-dev] Python plugins
From: |
Piotr Eljasiak |
Subject: |
Re: [gcmd-dev] Python plugins |
Date: |
Fri, 08 Dec 2006 01:46:35 +0100 |
> works.
Great!
> but is buggy:
This is why it is placed in gcmd-1-3 ;o)
> (1) gc $PATH is /usr/local/bin/gnome-commander here,
> and it can find the plugin only if started from a shell after
> cd /usr/local/bin. Starting from another pwd leads to load
> failure.
This is temporary solution - just to have ability to run python scripts.
There two environment variables (PYTHONHOME and
PYTHONPATH) that controls location of loaded python modules (plugins),
feel free to experiment ;o)
> (2) Staying left pane /usr/local/bin, right pane /tmp.
> The plugin reads files /tmp/t{1,2,3,4} correctly. But look:
>
> [PP] Calling sample-plugin.main()
> [PP] Selected files: 4
> [PP] Main window XID: 27263344 (0x1a00170)
> [PP] Active directory: /
> [PP] Inactive directory: /usr/local/bin
> main_wnd_xid: 27263344
> active_cwd: /
> inactive_cwd: /usr/local/bin
> selected_files: 4
> t1 0 2006-12-07 23:32:33
> t2 0 2006-12-07 23:32:33
> t3 0 2006-12-07 23:32:33
> t4 0 2006-12-07 23:32:33
> [PP] Result of call sample-plugin.main(): 1
>
> The active dir is /tmp, not / (and don't tell me again this
> is windows behaviour, i'm NOT running a windows here. ;)
That's strange - [PP] values are printed from inside of gcmd... I'll
have look at it a bit closer
> It was necessary to reformat the script. (Finally i remembered about
> the tab weirdness of python, buried deeply in some dark edge
> of my multiple universe brain) I think we really should attach files,
> than inline. ....uhm, Magnus ? How about a nicer size limit for postings ?
>
> Here's the refromatted thing inline, for comparison...this is
> not copy and paste, it's 'insert file' in the mailer (sylpheed).
>
> #! /usr/bin/env python
>
> #import pygtk; pygtk.require('2.0')
> #import gtk
>
> try:
> import gnomevfs
> except ImportError:
> import gnome.vfs as gnomevfs
>
> from datetime import datetime
>
> def main(main_wnd_xid, active_cwd, inactive_cwd,selected_files):
> print 'main_wnd_xid:', main_wnd_xid
> print 'active_cwd:', active_cwd
> print 'inactive_cwd:', inactive_cwd
> print 'selected_files:', len(selected_files)
> for uri in selected_files:
> f = gnomevfs.get_file_info(uri)
> print f.name, f.size, datetime.fromtimestamp(f.mtime)
> return True
>
I've sent it as an attachment, but list server got rid of it
> I think the right place to put plugins into would be the
> users ~/.gnome-commander anyway, if there are some
> shipped with the package they could be placed into /usr/lib,
> for example. I recommend to look at firefox extensions,
> that's how it should work, finally: You can install system-wide
> plugins (as root) which can>'t be modified by user, and may be
> updated by package managers regular system update.
> Or you can install as user into .gnome-commander manually,
> or maybe by some gcmd update manager realized as python plugin ;)
My candidates are:
~/.gnome-commander/plugins
/usr/lib64/gnome-commander/plugins
just in that order of path searching, where plugins will be placed in
their own subdirs. Those subdir names will be added to user/context menu
as plugins' names. What about it?
> btw. I notice a sample-plugin.pyc binary gets created in the plugin dir
> (/usr/local/bin, in my case) - what's this about ?
This is compiled plugin to binary, platform independent code. Python
interpreter loads it when found instead of reinterpreting
sample-plugin.py.
Piotr
- Re: [gcmd-dev] Python plugins, (continued)
Re: [gcmd-dev] Python plugins, Micha, 2006/12/04
Re: [gcmd-dev] Python plugins, Magnus Stålnacke, 2006/12/06
- Re: [gcmd-dev] Python plugins, Piotr Eljasiak, 2006/12/06
- Re: [gcmd-dev] Python plugins, Micha, 2006/12/07
- Re: [gcmd-dev] Python plugins, Micha, 2006/12/07
- Re: [gcmd-dev] Python plugins,
Piotr Eljasiak <=
- Re: [gcmd-dev] Python plugins, Micha, 2006/12/07
- Re: [gcmd-dev] Python plugins, Piotr Eljasiak, 2006/12/08
- Re: [gcmd-dev] Python plugins, Micha, 2006/12/08
Re: [gcmd-dev] Python plugins, Magnus Stålnacke, 2006/12/08
Re: [gcmd-dev] Python plugins, Piotr Eljasiak, 2006/12/12
Re: [gcmd-dev] Python plugins, Magnus Stålnacke, 2006/12/08
Re: [gcmd-dev] Python plugins, Piotr Eljasiak, 2006/12/08
Re: [gcmd-dev] Python plugins, Magnus Stålnacke, 2006/12/09
Re: [gcmd-dev] Python plugins, Micha, 2006/12/09
Re: [gcmd-dev] Python plugins, Magnus Stålnacke, 2006/12/10