]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/tests/test6.py
added some more URLs
[wxWidgets.git] / utils / wxPython / tests / test6.py
1 #!/bin/env python
2 #----------------------------------------------------------------------------
3 # Name: test6.py
4 # Purpose: Testing wxConfig
5 #
6 # Author: Robin Dunn
7 #
8 # Created: 26-Nov-1998
9 # RCS-ID: $Id$
10 # Copyright: (c) 1998 by Total Control Software
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------------
13
14 import sys
15 from wxPython.utils import wxConfig
16
17
18 #----------------------------------------------------------------------------
19
20 def main():
21
22 cfg = wxConfig('test6', 'TCS')
23
24 cmd = ''
25 if len(sys.argv) > 1:
26 cmd = sys.argv[1]
27
28 if cmd == 'add':
29 cfg.SetPath('one/two/three')
30 cfg.Flush()
31
32 cfg.Write('aaa', 'The quick brown fox jummped over the lazy dog.')
33 cfg.Write('bbb', 'This is a test of the emergency broadcast system')
34
35 aList = ['one', 'two', 'buckle', 'my', 'shoe', 1966]
36 cfg.Write('ccc', str(aList))
37
38 cfg.Write('zzz/yyy', 'foobar')
39 cfg.Write('zzz/xxx', 'spam and eggs')
40
41 cfg.Flush()
42
43 elif cmd == 'enum':
44 traverse(cfg, '/')
45
46 elif cmd == 'del':
47 cfg.DeleteAll()
48
49 else:
50 print 'Specify command: add, enum, or del.'
51
52
53
54 def traverse(cfg, path):
55 print path
56 cont, val, idx = cfg.GetFirstEntry()
57 while cont:
58 print "%s/%s = %s" % (path, val, cfg.Read(val))
59 cont, val, idx = cfg.GetNextEntry(idx)
60
61 cont, val, idx = cfg.GetFirstGroup()
62 while cont:
63 if path == '/':
64 newpath = path+val
65 else:
66 newpath = path+'/'+val
67
68 cfg.SetPath(newpath)
69 traverse(cfg, newpath)
70 cfg.SetPath(path)
71 cont, val, idx = cfg.GetNextGroup(idx)
72
73
74
75 if __name__ == '__main__':
76 #import pdb
77 #pdb.run('main()')
78 main()
79
80
81 #----------------------------------------------------------------------------
82 #
83 # $Log$
84 # Revision 1.2 1999/02/25 07:09:51 RD
85 # wxPython version 2.0b5
86 #
87 # Revision 1.1 1998/12/15 20:44:37 RD
88 # Changed the import semantics from "from wxPython import *" to "from
89 # wxPython.wx import *" This is for people who are worried about
90 # namespace pollution, they can use "from wxPython import wx" and then
91 # prefix all the wxPython identifiers with "wx."
92 #
93 # Added wxTaskbarIcon for wxMSW.
94 #
95 # Made the events work for wxGrid.
96 #
97 # Added wxConfig.
98 #
99 # Added wxMiniFrame for wxGTK, (untested.)
100 #
101 # Changed many of the args and return values that were pointers to gdi
102 # objects to references to reflect changes in the wxWindows API.
103 #
104 # Other assorted fixes and additions.
105 #
106 #