Re[4]: Re: TreePad Lite <=> Pdesk/Progect
[email protected] Mon, 24 Jul 2006 11:00:14 +0400
| Newsgroups | gmane.comp.handhelds.palm.progect |
|---|---|
| Message-ID | <[email protected]> |
Judd,
Progect - TreePad converter TreepadInOut.py only exports a project to
Treepad format but not imports from TreePad files.
Сan anyone add import to a project from TreePad files?
Saturday, July 22, 2006, 10:28:08 AM, you wrote:
JR> *Progect - TreePad converter
JR> (Palm)<http://www.treepad.com/download/TreepadInOut.zip>
JR> *
JR> Make your TreePad 2.x files available on Palm (in the free Progect
JR> Outliner<http://www.alawa.ch/>),
JR> and export your Progect/PDesk outlines back to
JR> TreePad<http://www.treepad.com/>files.
JR> *Created by:* Tomas Drahokoupil
JR> That sounds like you can convert treepad to progect and progect to tree pad.
JR> Not so?
Michael
Text of Progect - TreePad converter TreepadInOut.py:
------------------------------------------------------
#!/usr/bin/env python
__author__ = "Tomas Drahokoupil <[email protected]>"
__version__ = "$Revision: 1.0$"
__date__ = "2002-4-18"
from __future__ import nested_scopes
from PDeskPlugin import PDeskPlugin
from Db import Db
from RecordFactory import *
from string import *
import re
import sys
class TreepadInOut(PDeskPlugin):
"""
Export a project to Treepad format.
@author Tomas Drahokoupil <[email protected]>
@since 1.0
@version $Revision: 1.0$
"""
def __init__(self, db, tree):
"""
Constructor.
@param Db db Database to read/write
@param string filename Filename
@since 1.0
"""
PDeskPlugin.__init__(self, db, tree)
def getPluginSystemVersion():
"""
Don't change this method.
It's used internally to determine the version of the plugin system.
@return int : Minimum plugin system version to use this plugin.
"""
return 1 # corresponding to the beta 3
def getName():
"""
This method returns the name of the plugin.
@return string
@since 1.2
"""
return "Treepad export plugin"
def getAuthor():
"""
This method returns the author of the plugin.
@return string
@since 1.2
"""
return "Tomas Drahokoupil <[email protected]>"
def getVersion():
"""
This method returns the version of the plugin.
@return string
@since 1.2
"""
return "1.0"
def getOutputFormat():
"""
Return a specification tupple.
@return tupple
@since 1.2
"""
# return None if this plugin can't write.
# otherwise, return a tupple with
# - name of the output format
# - extension of the output format
# - textual description of the plugin output format
# example : return ("Text", "txt", "Tabbed text...")
return ("Treepad outline", "hjt", "Treepad text outline")
# make these methods static
# Remember to remove the ones you haven't defined in your plugin !
getName = staticmethod(getName)
getAuthor = staticmethod(getAuthor)
getVersion = staticmethod(getVersion)
getOutputFormat = staticmethod(getOutputFormat)
getPluginSystemVersion = staticmethod(getPluginSystemVersion)
def write(self, file, db, tree):
"""
Write the db to filename.
@since 1.0
"""
self.printTree(tree, file)
def printTree(self, node, file=sys.stdout, indent=0):
# Treepad 3.1 and higher introduced 'unique identifier' to its file format
# This 1.0 version of export plugin omits adding unique identifier tag to each node,
# as it will be automatically generated later by Treepad when saving file first time.
while node != None:
file.write("dt=Text" + "\r\n")
file.write("<node>" + "\r\n")
file.write(node.data.description + "\r\n")
file.write("%d" % indent + "\r\n")
file.write(node.data.note + "\r\n")
file.write("<end node> 5P9i0s8y19Z" + "\r\n")
self.printTree(node.child, file, indent+1)
node = node.next
------------------------ Yahoo! Groups Sponsor --------------------~-->
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/b2FxlB/TM
--------------------------------------------------------------------~->
Remember to visit Polls, Files and Bookmarks sections at http://groups.yahoo.com/group/progect. You are welcome to vote, upload your files and submit bookmarks.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/progect/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/