preferences ($Date: 2008/23/04 $)
index
/home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap_v0.1/preferences.py

Preferences is a collection of utilities to read and write preferences.
 
To run preferences, install python 2.x on your machine, which is avaliable from http://www.python.org/download/
 
You'll also need Tkinter, which probably came with the python installation.  If it did not, look for it at:
www.tcl.tk/software/tcltk/
 
Then in the folder which preferences is in, type 'python' in a shell to run the python interpreter.  Finally type 'from preferences import *' to import this program.
 
Below is an example of preferences use.  This example is run in a terminal in the folder which contains Hollow Square.gcode and preferences.py.
 
>>> from preferences import *
>>> getFileText('Hollow Square.gcode')
'( GCode generated by April 17,2007 Skeinforge )
( Extruder Initialization )
M100 P210
M103
M105
M108 P0.7
M109 P0.654
M110 P0.654
G21
G90
G28
( Extruder Movement )
( Extruder paths for layer 0 of Hollow Square )
M113
G1 X2.727 Y-2.505 Z0.33 F600.0
 
..
many lines of text
..

 
Modules
       
cStringIO
gcodec
os
sys
_tkinter
webbrowser

 
Classes
       
BooleanPreference
Filename
FloatPreference
IntPreference
Radio
RadioLabel
PreferencesDialog

 
class BooleanPreference
    A class to display, read & write a boolean.
 
  Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
getFromValue(self, name, value)
Initialize.
getValueString(self)
Get the boolean as a string.
setToDisplay(self)
Set the boolean to the checkbox.
setValueToSplitLine(self, lineIndex, lines, splitLine)
Set the value to the second word of a split line.
setValueToString(self, valueString)
Set the boolean to the string.

 
class Filename(BooleanPreference)
     Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
execute(self)
getFilenameFirstTypes(self)
Get the file types with the file type of the filename moved to the front of the list.
getFromFilename(self, fileTypes, name, value)
Initialize.
setToDisplay(self)
Pass.
setValueToString(self, valueString)
Set the filename to the string.

Methods inherited from BooleanPreference:
getFromValue(self, name, value)
Initialize.
getValueString(self)
Get the boolean as a string.
setValueToSplitLine(self, lineIndex, lines, splitLine)
Set the value to the second word of a split line.

 
class FloatPreference(BooleanPreference)
    A class to display, read & write a float.
 
  Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
setToDisplay(self)
Set the float to the entry field.
setValueToString(self, valueString)
Set the boolean to the string.

Methods inherited from BooleanPreference:
getFromValue(self, name, value)
Initialize.
getValueString(self)
Get the boolean as a string.
setValueToSplitLine(self, lineIndex, lines, splitLine)
Set the value to the second word of a split line.

 
class IntPreference(FloatPreference)
    A class to display, read & write an int.
 
 
Method resolution order:
IntPreference
FloatPreference
BooleanPreference

Methods defined here:
setValueToString(self, valueString)
Set the boolean to the string.

Methods inherited from FloatPreference:
addToDialog(self, preferencesDialog)
Add this to the dialog.
setToDisplay(self)
Set the float to the entry field.

Methods inherited from BooleanPreference:
getFromValue(self, name, value)
Initialize.
getValueString(self)
Get the boolean as a string.
setValueToSplitLine(self, lineIndex, lines, splitLine)
Set the value to the second word of a split line.

 
class PreferencesDialog
     Methods defined here:
__init__(self, displayPreferences, master)
execute(self)
openBrowser(self)
savePreferences(self)
savePreferencesDestroy(self)

 
class Radio(BooleanPreference)
    A class to display, read & write a boolean with associated radio button.
 
  Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
getFromRadio(self, name, radio, value)
Initialize.
getIntVar(self)
Get the IntVar for this radio button group.
setToDisplay(self)
Set the boolean to the checkbox.

Methods inherited from BooleanPreference:
getFromValue(self, name, value)
Initialize.
getValueString(self)
Get the boolean as a string.
setValueToSplitLine(self, lineIndex, lines, splitLine)
Set the value to the second word of a split line.
setValueToString(self, valueString)
Set the boolean to the string.

 
class RadioLabel(Radio)
    A class to display, read & write a boolean with associated radio button.
 
 
Method resolution order:
RadioLabel
Radio
BooleanPreference

Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
getFromRadioLabel(self, name, labelText, radio, value)
Initialize.
getIntVar(self)
Get the IntVar for this radio button group.
setToDisplay(self)
Set the boolean to the checkbox.

Methods inherited from Radio:
getFromRadio(self, name, radio, value)
Initialize.

Methods inherited from BooleanPreference:
getFromValue(self, name, value)
Initialize.
getValueString(self)
Get the boolean as a string.
setValueToSplitLine(self, lineIndex, lines, splitLine)
Set the value to the second word of a split line.
setValueToString(self, valueString)
Set the boolean to the string.

 
Functions
       
displayDialog(displayPreferences)
Display the preferences dialog.
getArchiveText(preferences)
Get the text representation of the archive.
getPreferencesFilePath(filename, folderName)
Get the preferences file path, which is the home directory joined with the folder name and filename.
readPreferences(preferences)
Set an archive to the preferences read from a file.
setArchiveToLine(lineIndex, lines, preferenceTable)
Set an archive to a preference line.
writePreferences(preferences)
Write the preferences to a file.

 
Data
        ACTIVE = 'active'
ALL = 'all'
ANCHOR = 'anchor'
ARC = 'arc'
BASELINE = 'baseline'
BEVEL = 'bevel'
BOTH = 'both'
BOTTOM = 'bottom'
BROWSE = 'browse'
BUTT = 'butt'
CASCADE = 'cascade'
CENTER = 'center'
CHAR = 'char'
CHECKBUTTON = 'checkbutton'
CHORD = 'chord'
COMMAND = 'command'
CURRENT = 'current'
DISABLED = 'disabled'
DOTBOX = 'dotbox'
E = 'e'
END = 'end'
EW = 'ew'
EXCEPTION = 8
EXTENDED = 'extended'
FALSE = 0
FIRST = 'first'
FLAT = 'flat'
GROOVE = 'groove'
HIDDEN = 'hidden'
HORIZONTAL = 'horizontal'
INSERT = 'insert'
INSIDE = 'inside'
LAST = 'last'
LEFT = 'left'
MITER = 'miter'
MOVETO = 'moveto'
MULTIPLE = 'multiple'
N = 'n'
NE = 'ne'
NO = 0
NONE = 'none'
NORMAL = 'normal'
NS = 'ns'
NSEW = 'nsew'
NUMERIC = 'numeric'
NW = 'nw'
OFF = 0
ON = 1
OUTSIDE = 'outside'
PAGES = 'pages'
PIESLICE = 'pieslice'
PROJECTING = 'projecting'
RADIOBUTTON = 'radiobutton'
RAISED = 'raised'
READABLE = 2
RIDGE = 'ridge'
RIGHT = 'right'
ROUND = 'round'
S = 's'
SCROLL = 'scroll'
SE = 'se'
SEL = 'sel'
SEL_FIRST = 'sel.first'
SEL_LAST = 'sel.last'
SEPARATOR = 'separator'
SINGLE = 'single'
SOLID = 'solid'
SUNKEN = 'sunken'
SW = 'sw'
StringTypes = (<type 'str'>, <type 'unicode'>)
TOP = 'top'
TRUE = 1
TclVersion = 8.4000000000000004
TkVersion = 8.4000000000000004
UNDERLINE = 'underline'
UNITS = 'units'
VERTICAL = 'vertical'
W = 'w'
WORD = 'word'
WRITABLE = 4
X = 'x'
Y = 'y'
YES = 1
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/23/04 $'
__license__ = 'GPL 3.0'
wantobjects = 1

 
Author
        Enrique Perez (perez_enrique@yahoo.com)