# Python: module skeinforge_tools.skeinforge_utilities.preferences

skeinforge_tools.skeinforge_utilities.preferences ($Date: 2008/23/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/pyRepRap/skeinforge_tools/skeinforge_utilities/preferences.py

`Preferences is a collection of utilities to display, read & write preferences.`

Modules

``

Tkinter __init__ | cStringIO skeinforge_tools.skeinforge_utilities.gcodec | os webbrowser |

Classes

``

AddListboxSelection
  DeleteListboxSelection
DisplayToolButton
  DisplayToolButtonBesidePrevious
LabelDisplay
PreferencesDialog
StringPreference
  BooleanPreference
    Radio
      RadioCapitalized
  Filename
  FloatPreference
    IntPreference
  ListPreference
  ListboxPreference
  WindowPosition

class AddListboxSelection
`` | `A class to add the selection of a listbox preference.`

Methods defined here:

addSelection(self)
  `Add the selection of a listbox preference.`

addSelectionWithEvent(self, event)
  `Add the selection of a listbox preference, given an event.`

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

addToPreferenceTable(self, preferenceTable)
  `Do nothing because the add listbox selection is not archivable.`

getFromListboxPreference(self, listboxPreference)
  `Initialize.`

setToDisplay(self)
  `Do nothing because the add listbox selection is not archivable.`

writeToArchiveWriter(self, archiveWriter)
  `Do nothing because the add listbox selection is not archivable.`

class BooleanPreference(StringPreference)
`` | `A class to display, read & write a boolean.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

setStateToValue(self)
  `Set the checkbox to the boolean.`

setToDisplay(self)
  `Do nothing because toggleCheckbox is handling the value.`

setValueToString(self, valueString)
  `Set the boolean to the string.`

toggleCheckbox(self)
  `Workaround for Tkinter bug, toggle the value.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class DeleteListboxSelection(AddListboxSelection)
`` | `A class to delete the selection of a listbox preference.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

deleteSelection(self)
  `Delete the selection of a listbox preference.`

Methods inherited from AddListboxSelection:

addSelection(self)
  `Add the selection of a listbox preference.`

addSelectionWithEvent(self, event)
  `Add the selection of a listbox preference, given an event.`

addToPreferenceTable(self, preferenceTable)
  `Do nothing because the add listbox selection is not archivable.`

getFromListboxPreference(self, listboxPreference)
  `Initialize.`

setToDisplay(self)
  `Do nothing because the add listbox selection is not archivable.`

writeToArchiveWriter(self, archiveWriter)
  `Do nothing because the add listbox selection is not archivable.`

class DisplayToolButton
`` | `A class to display the tool preferences dialog.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

addToPreferenceTable(self, preferenceTable)
  `Do nothing because the add listbox selection is not archivable.`

displayTool(self)
  `Display the tool preferences dialog.`

getFromFolderName(self, folderName, moduleFilename, name)
  `Initialize.`

getLowerName(self)
  `Get the lower case name.`

setToDisplay(self)
  `Do nothing because the display tool button is not archivable.`

writeToArchiveWriter(self, archiveWriter)
  `Do nothing because the display tool button is not archivable.`

class DisplayToolButtonBesidePrevious(DisplayToolButton)
`` | `A class to display the tool preferences dialog beside the previous preference dialog element.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

Methods inherited from DisplayToolButton:

addToPreferenceTable(self, preferenceTable)
  `Do nothing because the add listbox selection is not archivable.`

displayTool(self)
  `Display the tool preferences dialog.`

getFromFolderName(self, folderName, moduleFilename, name)
  `Initialize.`

getLowerName(self)
  `Get the lower case name.`

setToDisplay(self)
  `Do nothing because the display tool button is not archivable.`

writeToArchiveWriter(self, archiveWriter)
  `Do nothing because the display tool button is not archivable.`

class Filename(StringPreference)

``

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)
  `Do nothing because the file dialog is handling the value.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

setValueToString(self, valueString)
  `Set the string to the value string.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class FloatPreference(StringPreference)
`` | `A class to display, read & write a float.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToString(self, valueString)
  `Set the float to the string.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setToDisplay(self)
  `Set the string to the entry field.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class IntPreference(FloatPreference)
`` | `A class to display, read & write an int.`

Method resolution order:
  IntPreference
  FloatPreference
  StringPreference

Methods defined here:

setValueToString(self, valueString)
  `Set the integer to the string.`

Methods inherited from FloatPreference:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setToDisplay(self)
  `Set the string to the entry field.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class LabelDisplay
`` | `A class to add a label.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

addToPreferenceTable(self, preferenceTable)
  `Do nothing because the label display is not archivable.`

getFromName(self, name)
  `Initialize.`

getName(self)
  `Get name for key sorting.`

setToDisplay(self)
  `Do nothing because the label display is not archivable.`

writeToArchiveWriter(self, archiveWriter)
  `Do nothing because the label display is not archivable.`

class ListPreference(StringPreference)

``

Methods defined here:

addToDialog(self, preferencesDialog)
  `Do nothing because the list preference does not have a graphical interface.`

setToDisplay(self)
  `Do nothing because the list preference does not have a graphical interface.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second and later words of a split line.`

setValueToString(self, valueString)
  `Do nothing because the list preference does not have a graphical interface.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and list to the archive writer.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

class ListboxPreference(StringPreference)

``

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

getFromListPreference(self, listPreference, name, value)
  `Initialize.`

setListboxItems(self)
  `Set the listbox items to the list preference.`

setToDisplay(self)
  `Set the selection value to the listbox selection.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

setValueToString(self, valueString)
  `Set the string to the value string.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class PreferencesDialog

``

Methods defined here:

__init__(self, displayPreferences, master)
  `Add display preferences to the dialog.`

execute(self)
  `The execute button was clicked.`

openBrowser(self)
  `Open the browser to the help page.`

savePreferences(self)
  `Set the preferences to the dialog then write them.`

savePreferencesDestroy(self)
  `Set the preferences to the dialog, write them, then destroy the window.`

setWindowPosition(self)
  `Set the window position if that preference exists.`

class Radio(BooleanPreference)
`` | `A class to display, read & write a boolean with associated radio button.`

Method resolution order:
  Radio
  BooleanPreference
  StringPreference

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

clickRadio(self)
  `Workaround for Tkinter bug, set the value.`

getFromRadio(self, name, radio, value)
  `Initialize.`

getIntVar(self)
  `Get the IntVar for this radio button group.`

setDisplayState(self, row)
  `Set the boolean to the checkbox.`

setToDisplay(self)
  `Set the boolean to the checkbox.`

Methods inherited from BooleanPreference:

setStateToValue(self)
  `Set the checkbox to the boolean.`

setValueToString(self, valueString)
  `Set the boolean to the string.`

toggleCheckbox(self)
  `Workaround for Tkinter bug, toggle the value.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class RadioCapitalized(Radio)
`` | `A class to display, read & write a boolean with associated radio button.`

Method resolution order:
  RadioCapitalized
  Radio
  BooleanPreference
  StringPreference

Methods defined here:

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

getLowerName(self)
  `Get the lower case name.`

Methods inherited from Radio:

clickRadio(self)
  `Workaround for Tkinter bug, set the value.`

getFromRadio(self, name, radio, value)
  `Initialize.`

getIntVar(self)
  `Get the IntVar for this radio button group.`

setDisplayState(self, row)
  `Set the boolean to the checkbox.`

setToDisplay(self)
  `Set the boolean to the checkbox.`

Methods inherited from BooleanPreference:

setStateToValue(self)
  `Set the checkbox to the boolean.`

setValueToString(self, valueString)
  `Set the boolean to the string.`

toggleCheckbox(self)
  `Workaround for Tkinter bug, toggle the value.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class StringPreference
`` | `A class to display, read & write a string.`

Methods defined here:

__init__(self)
  `Set the update function to none.`

addToDialog(self, preferencesDialog)
  `Add this to the dialog.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setToDisplay(self)
  `Set the string to the entry field.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

setValueToString(self, valueString)
  `Set the string to the value string.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

class WindowPosition(StringPreference)
`` | `A class to display, read & write a window position.`

Methods defined here:

addToDialog(self, preferencesDialog)
  `Set the master to later get the geometry.`

setToDisplay(self)
  `Set the string to the window position.`

setWindowPosition(self)
  `Set the window position.`

Methods inherited from StringPreference:

__init__(self)
  `Set the update function to none.`

addToPreferenceTable(self, preferenceTable)
  `Add this to the preference table.`

getFromValue(self, name, value)
  `Initialize.`

setStateToValue(self)
  `Set the entry to the value.`

setUpdateFunction(self, updateFunction)
  `Set the update function.`

setValueToSplitLine(self, lineIndex, lines, splitLine)
  `Set the value to the second word of a split line.`

setValueToString(self, valueString)
  `Set the string to the value string.`

writeToArchiveWriter(self, archiveWriter)
  `Write tab separated name and value to the archive writer.`

Functions

``

displayDialog(displayPreferences)
  `Display the preferences dialog.`

getArchiveText(archivablePreferences)
  `Get the text representation of the archive.`

getFileInGivenDirectory(directory, fileName)
  `Get the file from the fileName or the lowercase fileName in the given directory.`

getFileInGivenPreferencesDirectory(directory, fileName)
  `Get the file from the fileName or the lowercase fileName in the given directory, if there is no file look in the gcode_scripts folder in the preferences directory.`

getFileTextGivenDirectoryFileName(directory, fileName)
  `Get the entire text of a file with the given file name in the given directory.`

getPreferencesDirectoryPath()
  `Get the preferences directory path, which is the home directory joined with .skeinforge.`

getPreferencesFilePath(fileName)
  `Get the preferences file path, which is the home directory joined with .skeinforge and fileName.`

readPreferences(archivablePreferences)
  `Set an archive to the preferences read from a file.`

readPreferencesFromText(archivablePreferences, text)
  `Set an archive to the preferences read from a text.`

setArchiveToLine(lineIndex, lines, preferenceTable)
  `Set an archive to a preference line.`

setHelpPreferencesFileNameTitleWindowPosition(displayPreferences, fileNameHelp)
  `Set the help & preferences file path, the title and the window position archiver.`

writePreferences(archivablePreferences)
  `Write the preferences to a file.`

Data
`` |  | __author__ = 'Enrique Perez (perez_enrique@yahoo.com)' __date__ = '$Date: 2008/23/04 $' __license__ = 'GPL 3.0' absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384) globalIsMainLoopRunning = False globalSpreadsheetSeparator = '\t'

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)