Module preferences
A module to make the interface to the mmpref library more Pythonic.
It contains a single class that can be created once and then used to
access preference data.
This class also provides data type-free .get(), .set() and
.getAllPreferences() methods.
Simple script usage might look like this:
import preferences
# Initialize the preference handler
pref_handler = preferences.Preferences(preferences.SCRIPTS)
# Store and get all preferences from a group specific to this script
pref_handler.beginGroup('my_script')
# Set the preference 'hosts' to 5
pref_handler.set('hosts', 5)
# Get the value of the hosts preference
num_hosts = pref_handler.get('hosts', default=8)
# Get the value of the jobname preference, with myjob as the default
# name if no preference is set
jobname = pref_handler.get('jobname', default='myjob')
Slightly more complex script usage using groups might look like
this:
import preferences
# Initialize the preference handler
pref_handler = preferences.Preferences(preferences.SCRIPTS)
# Store and get all preferences from a group specific to this script
pref_handler.beginGroup('my_script')
# Set the preference 'hosts' to 5
pref_handler.set('hosts', 5)
# Switch to the group 'my_script/dialogs'
pref_handler.beginGroup('dialogs')
# Set the value of the 'my_script/dialogs/import_directory preference
pref_handler.set('import_directory', directory)
# Reset the current group to the 'my_script' group
pref_handler.resetGroup(retain=1)
# Get the value of the hosts preference
num_hosts = pref_handler.get('hosts', default=8)
# Change the value of the 'my_script/dialogs/import_directory' preference
pref_handler.set('dialogs/import_directory', directory2)
# Switch to the group 'my_script/dialogs'
pref_handler.beginGroup('dialogs')
# Get the import directory
imdir = pref_handler.get('import_directory')
|
Preferences
A class that allows Pythonic access to the mmpref library.
|
|
CANVAS = 0
hash(x)
|
|
COMBIGLIDE = 1
|
|
DESMOND = 2
|
|
EPIK = 3
hash(x)
|
|
IMPACT = 4
|
|
JAGUAR = 5
|
|
KNIME = 6
|
|
MACROMODEL = 7
|
|
MAESTRO = 8
|
|
MCPRO = 9
|
|
PHASE = 10
|
|
PSP = 11
|
|
PYMOL = 12
|
|
QIKPROP = 13
|
|
SCRIPTS = 14
|
|
SHARED = 15
|
|
WATERMAP = 16
|
|
OK = 0
hash(x)
|
|
NO_OS = 0
hash(x)
|
|
WINDOWS = 1
|
|
LINUX = 2
|
|
DARWIN = 3
hash(x)
|
|
OS_TYPES = [ 0, 1, 2, 3]
|
|
NO_TYPE = 0
hash(x)
|
|
INT = 1
|
|
STRING = 2
|
|
FLOAT = 3
hash(x)
|
|
BOOL = 4
|
|
DATA_TYPES = [ 4, 1, 2, 3]
|
|
ALL_TYPES = [ 4, 1, 2, 3, 0]
|
|
NODEFAULT = object()
|
|
__package__ = ' schrodinger.utils '
|