File MIES_PackageSettings.ipf¶
LOG Routines for dealing with JSON log files
PS Routines for dealing with JSON settings
See https://jsonlines.org and Line-delimited JSON for background.
In short the log will contain a complete JSON document in each line. The lines are separated by \n.
Functions
- 
variable PS_Initialize(string package)¶
- Initialize the - PackageFoldersymbolic path.
- 
variable PS_GenerateSettingsDefaults()¶
- This functions should return a JSON ID with the default settings. 
- 
variable PS_ReadSettings(string package, PS_GenerateSettingsDefaults generateDefaults)¶
- Return a JSON ID with an opened JSON settings file. - Caller is responsible for releasing the document. 
- 
variable PS_WriteSettings(string package, variable JSONid)¶
- Write the settings from - JSONidfor- packageto disc.- Call this function in - BeforeExperimentSaveHookto write the settings to disc
- 
string PS_GetSettingsFolder_TS(string package)¶
- Return the absolute path to the settings folder for - package- Threadsafe variant which requires the symbolic path `PackageFolder` created by PS_Initialize() to exist. The returned folder location includes a trailing colon (":")
- 
string PS_GetSettingsFolder(string package)¶
- Return the absolute path to the settings folder for - packagecreating it when necessary.- The returned folder location includes a trailing colon (“:”) 
- 
static string PS_GetSettingsFile(string package)¶
- Return the absolute path to the JSON settings file for - package
- 
static wave PS_GetAllWindowsExt(string win)¶
- 
static string PS_BuildWindowPath(string win)¶
- 
static variable PS_ApplyStoredWindowCoordinate(variable JSONid, string win, variable orientation)¶
- Move the window to the stored location. 
- 
static variable PS_RegisterForCoordinateSaving(string win)¶
- Add user data to mark the window as using coordinate saving. 
- 
variable PS_RemoveCoordinateSaving(string win)¶
- Remove user data related to coordinate saving. 
- 
static variable PS_StoreWindowCoordinates(variable JSONid)¶
- Store the coordinates of all registered windows in the JSON settings file. - The windows must have been registered beforehand with PS_InitCoordinates(). 
- 
variable PS_StoreWindowCoordinate(variable JSONid, string win)¶
- Store the window coordinates of - winin the JSON settings file.- The window must have been registered beforehand with PS_InitCoordinates(). 
- 
variable PS_InitCoordinates(variable JSONid, string win, variable recursive = defaultValue, variable addHook = defaultValue)¶
- Add support for window coordinate storing and loading. - Takes care of: - Marking the window as using it with the given name 
- Adding a hook to store the coordinates on window killing 
- Read the current coordinates from the JSON settings file and applying them 
 - Parameters:
- JSONid – JSON document with settings 
- win – window name, must be the one before locking 
- recursive – [optional, defaults to false] Add hook also to all exterior subwindows 
- addHook – [optional, defaults to true] Add a window hook to store the coordinates on window killing. Users with their own kill event handling must pass - addHook=0.
 
 
- 
variable PS_SerializeSettings(string package, variable JSONid)¶
- Write the current JSON settings to disc. - Caller must invalidate JSONid after return. 
- 
variable PS_OpenNotebook(string package, variable JSONid)¶
- Caller must invalidate JSONid after return. 
- 
variable PS_FixPackageLocation(string package)¶
- Fixup the settings and log file location for Igor Pro prior to 0855279d (Fix package folder location on disk, 2021-04-01). - Package JSON: - Incorrect is moved to the correct location 
 - JSONL logfile: - Incorrect is moved to the correct location only if the correct does not exists 
- If the correct does exist as well, the incorrect is read and appened to to the correct one