[Users] Python script access to file(s) inside folder?

Pierre Fortin pf at pfortin.com
Wed Aug 21 05:14:20 CEST 2013


On Tue, 20 Aug 2013 21:58:44 +0200 Holger Berndt wrote:

>On So, 11.08.2013 13:17, Pierre Fortin wrote:
>
>>Would this require replicating the os module functions, such as:
>>  clawsmail.listdir() etc...?   Or... could os.<function>() be hinted
>>to use #mh/Mailbox as a "symlink" to /home/pfortin/Mail?
>
>A mail folder inside Claws Mail may or may not correspond directly to a
>folder on your harddisk. For MH folders (Claws Mail's default storage
>format), it does. IMAP folders, on the other hand, live on your mail
>server. With mbox, a mail folder corresponds to a file (not a folder)
>on your harddisc (though implementations typically build their own
>folder infrastructure to be able to cope with nesting). Etc.
>
>Long story short - a mail folder in Claws Mail is an abstraction.
>
>On the other hand, Claws Mail associates a local folder to each mail
>folder, as a place to store its own book-keeping data. For MH folders,
>this is directly the corresponding folder on your harddisc, for IMAP
>it's the cache dir, etc. I guess that would be a suitable place for
>your folder-specific extra information.
>
>I just commited a patch that lets Folder objects of the Python plugin
>export this path via the "path" member:
>============================================================
>print clawsmail.get_folderview_selected_folder().path
>============================================================
>
>>Don't suppose there's a way to copy a file, such as:
>>  #mh/Mailbox/Linux/claws-mail/.signature into a compose window at
>> will..?
>
>In a compose script, you have access to the GtkTextView of the body, so
>you can do with it whatever you want, e.g. append the system MOTD to
>the end of the body:
>============================================================
>with open("/etc/motd") as fp:
>    file_contents = fp.read()
>buffer = clawsmail.compose_window.text.get_buffer()
>buffer.insert(buffer.get_end_iter(), file_contents)
>============================================================

THANK YOU!!!  Looking forward to taking this out for a spin...  :)

Pierre

>Holger




More information about the Users mailing list