473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

preftree 0.3 released

Following up on a promise in the Config discussion ...

preftree has been released under the Python license.
You can get version 0.3 from
http://davidf.sjsoft.com/files/preftree-0.3.tar.gz

The README is below... any questions or feedback welcome, a more well
packaged release can be done later.

David
prefstree README

prefstree is a simple python package for managing application preferences.

Overview
--------

- prefs are stored in a text format
- prefs are in a hierarchical tree
- you can parse this tree, and get a object tree out of it
- the modified tree can be stored back into the file
- we try to make it pythonic...

Hello Prefs
-----------

Given the prefs file hello.prefs:

hello:
firstrun = 1
greet = "world"

the code:

from preftree import prefs
helloprefs = prefs.PrefsParser()
helloprefs.parse(open('hello.prefs', 'r'))
print "Hello %d" % helloprefs.hello.greet
helloprefs.hello.firstrun = 0
open('hello.prefs', 'w').write(helloprefs.getsource())

pref file format
----------------

this is an attempt to be python
pref names are "." separated
you can use them straight:

a.b.c = "hello"
a.b.d = "goodbye"
f.g = "someone"

or you can declare a node and indent children

a.b:
c = "hello"
d = "goodbye"

f.g = "someone"

you can also make a value/node based on another value/node:

a.q = a.b:
c = "yes"
e = f.g

this will result in the following values:

a.b.c = "hello"
a.b.d = "goodbye"
a.q.c = "yes"
a.q.d = "goodbye"
a.q.e = "someone"
f.g = "someone"

saving back to a file attempts to preserve sensibility and human
readability without modifying unmodified prefs
Jul 18 '05 #1
4 1134
David Fraser <da****@sjsoft.com> writes:
Following up on a promise in the Config discussion ...

preftree has been released under the Python license.
You can get version 0.3 from
http://davidf.sjsoft.com/files/preftree-0.3.tar.gz


thanks, it look a lot like yaml... Don't you think it could be a layer
on top of yaml ?

--
Wilk - http://flibuste.net
Jul 18 '05 #2
Wilk wrote:
David Fraser <da****@sjsoft.com> writes:

Following up on a promise in the Config discussion ...

preftree has been released under the Python license.
You can get version 0.3 from
http://davidf.sjsoft.com/files/preftree-0.3.tar.gz

thanks, it look a lot like yaml... Don't you think it could be a layer
on top of yaml ?

The example shows string, integers and (nested) dictionary types. I
presume floating point would be obvious, and is included but what about
lists?

Cheers, Pad.

Jul 18 '05 #3
Wilk wrote:
David Fraser <da****@sjsoft.com> writes:

Following up on a promise in the Config discussion ...

preftree has been released under the Python license.
You can get version 0.3 from
http://davidf.sjsoft.com/files/preftree-0.3.tar.gz

thanks, it look a lot like yaml... Don't you think it could be a layer
on top of yaml ?

I'd forgotten about yaml, it's pretty cool.
This is a bit simpler than yaml (and has less features) and meets our
current needs, but yaml is good too...
I'm not sure if it could be put on top of yaml as that may be more work
than doing it directly.

David
Jul 18 '05 #4
Donald 'Paddy' McCarthy wrote:
Wilk wrote:
David Fraser <da****@sjsoft.com> writes:

Following up on a promise in the Config discussion ...

preftree has been released under the Python license.
You can get version 0.3 from
http://davidf.sjsoft.com/files/preftree-0.3.tar.gz


thanks, it look a lot like yaml... Don't you think it could be a layer
on top of yaml ?

The example shows string, integers and (nested) dictionary types. I
presume floating point would be obvious, and is included but what about
lists?


Floating point? Never! :-) I should add that.
Lists aren't included (which is something yaml does with different
syntax), but the preftree approach would be to just have a number of
elements. The inspiration for preftree was from the Mozilla prefs, where
for example a list of mail accounts would contain account1, account2 etc.
What we need to do is make it easier to iterate over elements at a point
in a tree.

David
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Michael Sparks | last post by:
Kamaelia 0.1.2 has been released! What is it? =========== Kamaelia is a collection of Axon components designed for network protocol experimentation in a single threaded, select based...
22
by: Marc G. Fournier | last post by:
After almost 12 months of intense development, and testing, we are proud to announce the availability of PostgreSQL v7.4. An overview of the major changes in v7.4 include: IN/NOT IN subqueries...
18
by: techie | last post by:
I have a VC++ client that creates a COM object that is implemented in C#. The problem is the COM object doesn't get released, so I get a memory leak. I have no problems creating the COM object...
2
by: VinDotNet | last post by:
Here's the Scenario I am facing: I've got a winform managed c++ client which connects to my managed COM+ server application (by making createinstance, then typecasting the object to an interface,...
4
by: Devrim GUNDUZ | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, For RPM users, (S)RPMS for 7.4.4 was just built. We have (S)RPMS for: * Red Hat Linux 9 * Fedora Core 1
4
by: Michael | last post by:
Hi! (OK, slightly silly subject line :) I'm extremely pleased to say - Kamaelia 0.4.0 has been released! What's New & Changed? =====================
0
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm announcing the release of Python 2.3.6 (release candidate 1). Python 2.3.6 is a security bug-fix release. While Python 2.5...
0
by: Anthony Baxter | last post by:
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.3.6 (FINAL). Python 2.3.6 is a security bug-fix release. While Python 2.5 is the...
16
by: =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= | last post by:
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.5.2 (release candidate 1). This is the second bugfix release of Python 2.5. Python...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.