gcmd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gcmd-dev] Python plugins


From: Micha
Subject: Re: [gcmd-dev] Python plugins
Date: Fri, 8 Dec 2006 00:26:52 +0100
User-agent: Alpenglühn 7.2

works.

but is buggy:

(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.

(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 wndows behavior, i'm NOT running a windows here. ;)


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 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 ;)



btw. I notice a samplke-plugin.pyc bninary gets created in the plugin dir
(/usr/local/bin, in my case) - what's this about ?









reply via email to

[Prev in Thread] Current Thread [Next in Thread]