File: flatfileDatabase.py

package info (click to toggle)
pythoncard 0.8.2-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,452 kB
  • sloc: python: 56,787; makefile: 56; sh: 22
file content (36 lines) | stat: -rw-r--r-- 1,148 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python

"""
__version__ = "$Revision: 1.21 $"
__date__ = "$Date: 2004/08/03 15:57:05 $"

flatfileDatabase was derived from the addresses sample.

"""

from PythonCard import flatfileDatabase, model
import os, sys
import ConfigParser

CONFIG_FILE = 'flatfileDatabase.ini'

class FlatfileDatabase(flatfileDatabase.FlatfileDatabase):
    def on_initialize(self, event):
        # override the config filename
        self.configFilename = CONFIG_FILE
        flatfileDatabase.FlatfileDatabase.on_initialize(self, event)

if __name__ == '__main__':
    # assume the ini file is in the same directory as the script
    path = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), CONFIG_FILE)
    parser = ConfigParser.ConfigParser()
    parser.read(path)
    # the resourceFile is settable via the ini file
    resourceFile = parser.get('ConfigData', 'resourceFile')

    # KEA 2002-07-16
    # since all of the needed functionality is in the framework
    # classes, we don't have to subclass in this module, we can
    # just use the base class directly
    app = model.Application(FlatfileDatabase, resourceFile)
    app.MainLoop()