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

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

lib.config.getMainWindowConfig()[source]

Return config of current project

lib.config.setMainWindowConfig(config=None)[source]

Set config as current project

class lib.config.Entity(**kwargs)[source]

Bases: object

General 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:
numInputs

Input 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

propertiesAttribute()

Extract keys from properties available

propertiesListTitle(index)

Define titles for list properties in popup

propertiesNames()

List with properties availables for show in poput

propertiesTitle()

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

propertiesUnit()

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

clear()[source]

Clear entity and stay as new instance

show()[source]

General function to show entity properties as key: value text

setNotas(html, txt)[source]

Set notas property of instance

property numInputs

Input count in kwargs

writeToJSON(data)[source]

Save kwargs properties of entity to file

writeListtoJSON(data, key, value)[source]

Write list to file, Customize in entities with complex list

readFromJSON(data)[source]

Read entity from file

readListFromJSON(data, key)[source]

Read list from file, customize in entities with complex list

writeStatetoJSON(data)[source]

Write entity state to JSON file

readStatefromJSON(data)[source]

Read entity state from JSON file

classmethod propertiesNames()[source]

List with properties availables for show in poput

properties()[source]
_prop(attr)[source]
propertiesListTitle(index)[source]

Define titles for list properties in popup

propertiesTitle()[source]

Extract titles from properties available

propertiesAttribute()[source]

Extract keys from properties available

propertiesUnit()[source]

Extract units from properties available

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