lib.config module¶
Module with global configuration of pychemqt
Variables:
conf_dir: User configuration path
Preferences: ConfigParser instance with pychemqt preferences
currentConfig: ConfigParser instance with the configuration of current pychemqt project open or the last open project
Configuration tools
getComponents(): Get component list from project
getMainWindowConfig(): Return config of current project
setMainWindowConfig(): Update currentconfig variable
Entity: General class for model object
- lib.config.getComponents(solidos=False, config=None, name=True)[source]¶
Procedure to get index of component in current project
- Parameters:
- solidosbool
Return too solids components
- configConfigParser
It’s possible use a custom config instance
- namebool
Return too the name and molecular weight of components
- Returns:
- idlist
List of index of components
- namelist
List of name of components
- Mlist
List of molecular weight of components
- class lib.config.Entity(**kwargs)[source]¶
Bases:
objectGeneral class for model object, with basic functionality:
clear object
definition of boolean characteristic of object
input used for definition
note properties with description
save/load from file
properties for report, tooltip
Child class include:
Corriente, Mezcla, Solids
equipment
- Attributes:
numInputsInput count in kwargs
Methods
__call__(**kwargs)Add callable functionality, so it can be possible add kwargs, advanced functionality can be added in subclass
cleanOldValues(**kwargs)Update kwargs with new input kwargs, defined in child class, here can be implemented kwarg incompatibiity input and more
clear()Clear entity and stay as new instance
popup(preferences)Return a list with properties of entity to show in a puput preferences: ConfigParser instance with selected properties to show
Extract keys from properties available
propertiesListTitle(index)Define titles for list properties in popup
List with properties availables for show in poput
Extract titles from properties available
propertiesToText([index, linesep, suffix, ...])Return a string representation of properties for report index: Index of properties in propertiesList None: Return all properties array: Return the selected properties int: Return only the indexed property linesep: Boolean to add a linesep at end line suffix: Optional suffix text
Extract units from properties available
readFromJSON(data)Read entity from file
readListFromJSON(data, key)Read list from file, customize in entities with complex list
readStatefromJSON(data)Read entity state from JSON file
setNotas(html, txt)Set notas property of instance
show()General function to show entity properties as key: value text
writeListtoJSON(data, key, value)Write list to file, Customize in entities with complex list
writeStatetoJSON(data)Write entity state to JSON file
writeToJSON(data)Save kwargs properties of entity to file
properties
- _bool = False¶
- kwargs_forbidden = ['entrada']¶
- notas = ''¶
- notasPlain = ''¶
- _dependence = ''¶
- __init__(**kwargs)[source]¶
Class constructor, copy kwargs for child class, it can be customize for child class to add functionality
- cleanOldValues(**kwargs)[source]¶
Update kwargs with new input kwargs, defined in child class, here can be implemented kwarg incompatibiity input and more
- property numInputs¶
Input count in kwargs
- writeListtoJSON(data, key, value)[source]¶
Write list to file, Customize in entities with complex list
- popup(preferences)[source]¶
Return a list with properties of entity to show in a puput preferences: ConfigParser instance with selected properties to show
- propertiesToText(index=None, linesep=True, suffix='', kwCheck=False, kwKey='', kwSuffix='', kwValue='')[source]¶
Return a string representation of properties for report index: Index of properties in propertiesList
None: Return all properties array: Return the selected properties int: Return only the indexed property
linesep: Boolean to add a linesep at end line suffix: Optional suffix text