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

« back to all changes in this revision

Viewing changes to SCRIBES/UseTabsMetadata.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/UseTabs.gdb"
 
2
basepath = "/Preferences/Languages/UseTabs.gdb"
3
3
 
4
 
def get_value():
 
4
def get_value(language):
5
5
        try:
6
 
                value = True
 
6
                use_tabs = True
7
7
                database = open_database(basepath, "r")
8
 
                value = database["use_tabs"]
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["use_tabs"] = value
 
8
                use_tabs = database[language]
 
9
        except KeyError:
 
10
                pass
 
11
        finally:
 
12
                database.close()
 
13
        return use_tabs
 
14
 
 
15
def set_value(data):
 
16
        try:
 
17
                language, use_tabs = data
 
18
                database = open_database(basepath, "w")
 
19
                database[language] = use_tabs
 
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