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
shutil
webbrowser

 
Classes
       
AddListboxSelection
DeleteListboxSelection
AddProfile
DeleteProfile
DisplayToolButton
DisplayToolButtonBesidePrevious
LabelDisplay
MenuButtonDisplay
PreferencesDialog
ProfileList
ProfilePreferences
StringPreference
BooleanPreference
MenuRadio
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 AddProfile
    A class to add a profile.
 
  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 DeleteProfile(AddProfile)
    A class to delete the selection of a listbox profile.
 
  Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
deleteSelection(self)
Delete the selection of a listbox preference.

Methods inherited from AddProfile:
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)
    A class to display, read & write a fileName.
 
  Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
execute(self)
Open the file picker.
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.
setCancelledValue(self, fileName)
Set the value to the file name and wasCancelled true if a file was not picked.
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.
buttonReleaseOne(self, event)
Button one released.
getFromListPreference(self, listPreference, name, value)
Initialize.
getSelectedFolder(self)
Get the selected folder.
setListboxItems(self)
Set the listbox items to the list preference.
setToDisplay(self)
Set the selection value to the listbox selection.
setValueToIndex(self, index)
Set the selection value to the index.
setValueToString(self, valueString)
Set the string to the value 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.
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 MenuButtonDisplay
    A class to add a menu button.
 
  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 MenuRadio(BooleanPreference)
    A class to display, read & write a boolean with associated menu radio button.
 
 
Method resolution order:
MenuRadio
BooleanPreference
StringPreference

Methods defined here:
addToDialog(self, preferencesDialog)
Add this to the dialog.
clickRadio(self)
Workaround for Tkinter bug, invoke and set the value when clicked.
getFromMenuButtonDisplay(self, menuButtonDisplay, name, value)
Initialize.
getStringVar(self)
Get the StringVar for this radio button group.
invokeSetString(self)
Workaround for Tkinter bug, invoke and set the value.
setDisplayState(self)
Set the checkbox to the boolean.
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 PreferencesDialog
     Methods defined here:
__init__(self, displayPreferences, master)
Add display preferences to the dialog.
addButtons(self, displayPreferences, master)
Add buttons to the dialog.
execute(self)
The execute button was clicked.
openHelpPage(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.
setWindowPositionDeiconify(self)
Set the window position if that preference exists.

 
class ProfileList
    A class to list the profiles.
 
  Methods defined here:
__init__(self)
Set the update function to none.
addToDialog(self, preferencesDialog)
Do nothing because the profile list does not have a graphical interface.
addToPreferenceTable(self, preferenceTable)
Do nothing because the profile list is not archivable.
getFromName(self, name)
Initialize.
getName(self)
Get name for key sorting.
setToDisplay(self)
Do nothing because the profile list is not archivable.
setValueToFolders(self)
Set the value to the folders in the profiles directories.
writeToArchiveWriter(self, archiveWriter)
Do nothing because the profile list is not archivable.

 
class ProfilePreferences
    A class to handle the profile preferences.
 
  Methods defined here:
__init__(self)
Set the default preferences, execute title & preferences fileName.

 
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 checkbox to the boolean.
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 checkbox to the boolean.
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
       
deleteDirectory(directory, subfolderName)
Delete the directory if it exists.
displayDialog(displayPreferences)
Display the preferences dialog.
getArchiveText(archivablePreferences)
Get the text representation of the archive.
getDirectoryInAboveDirectory(directory)
Get the directory in the above directory.
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 alterations folder in the preferences directory.
getFileTextGivenDirectoryFileName(directory, fileName)
Get the entire text of a file with the given file name in the given directory.
getFolders(directory)
Get the folder list in a directory.
getLowerNameSetHelpTitleWindowPosition(displayPreferences, fileNameHelp)
Set the help & preferences file path, the title and the window position archiver.
getPreferencesDirectoryPath(subfolder='')
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.
getProfilesDirectoryPath(subfolder='')
Get the profiles directory path, which is the preferences directory joined with profiles.
getSelectedProfile()
Get the selected profile.
getSubfolderWithBasename(basename, directory)
Get the subfolder in the directory with the basename.
makeDirectory(directory)
Make a directory if it does not already exist.
openWebPage(webPagePath)
Open a web page in a browser.
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)