~sir-rainbow/+junk/scribes-on-win

« back to all changes in this revision

Viewing changes to SCRIBES/TextWrappingMetadata.py

  • Committer: lateef
  • Date: 2009-11-07 22:21:32 UTC
  • Revision ID: teef@submission-20091107222132-sfz2ji4nzk130wth
Customize preferences based on source code type. Press F12 to show the new preferences GUI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from Utils import open_database
2
 
basepath = "/Preferences/TextWrapping.gdb"
 
2
basepath = "/Preferences/Languages/TextWrapping.gdb"
3
3
 
4
 
def get_value():
 
4
def get_value(language):
5
5
        try:
6
 
                value = True
 
6
                text_wrapping = True
7
7
                database = open_database(basepath, "r")
8
 
                value = database["text_wrapping"]
9
 
        except KeyError:
10
 
                pass
11
 
        finally:
12
 
                database.close()
13
 
        return value
14
 
 
15
 
def set_value(value):
16
 
        try:
17
 
                database = open_database(basepath, "w")
18
 
                database["text_wrapping"] = value
 
8
                text_wrapping = database[language]
 
9
        except KeyError:
 
10
                pass
 
11
        finally:
 
12
                database.close()
 
13
        return text_wrapping
 
14
 
 
15
def set_value(data):
 
16
        try:
 
17
                language, text_wrapping = data
 
18
                database = open_database(basepath, "w")
 
19
                database[language] = text_wrapping
 
20
        finally:
 
21
                database.close()
 
22
        return
 
23
 
 
24
def reset(language):
 
25
        try:
 
26
                database = open_database(basepath, "w")
 
27
                del database[language]
 
28
        except KeyError:
 
29
                pass
19
30
        finally:
20
31
                database.close()
21
32
        return