UIData

(class from pyomo.contrib.viewer.ui_data)

class pyomo.contrib.viewer.ui_data.UIData(model=None, model_var_name_in_main=None)[source]

Bases: UIDataNoUi

__init__(model=None, model_var_name_in_main=None)[source]

This class holds the basic UI setup, but doesn’t depend on Qt. It shouldn’t really be used except for testing when Qt is not available.

Parameters:
  • model – The Pyomo model to view

  • model_var_name_in_main – if this is set, check that the model variable which points to a model object in __main__ has the same id when the UI is refreshed due to a command being executed in jupyter notebook or QtConsole, if not the same id, then update the model Since the model viewer is not necessarily pointed at a model in the __main__ namespace only set this if you want the model to auto update. Since the model selector dialog lets you choose models from the __main__ namespace it sets this when you select a model. This is useful if you run a script repeatedly that replaces a model preventing you from looking at a previous version of the model.

Methods

__init__([model, model_var_name_in_main])

This class holds the basic UI setup, but doesn't depend on Qt.

begin_update()

Lets the model setup be changed without emitting the updated signal until the end_update function is called.

calculate_constraints()

calculate_expressions()

emit_exec_refresh()

Don't forget to overloaded this, not raising a NotImplementedError so tests can run without Qt

emit_update()

Don't forget to overloaded this, not raising a NotImplementedError so tests can run without Qt

end_update([emit])

Sets the begin update flag to false.

Attributes

model

Member Documentation

begin_update()

Lets the model setup be changed without emitting the updated signal until the end_update function is called.

emit_exec_refresh()[source]

Don’t forget to overloaded this, not raising a NotImplementedError so tests can run without Qt

emit_update()[source]

Don’t forget to overloaded this, not raising a NotImplementedError so tests can run without Qt

end_update(emit=True)[source]

Sets the begin update flag to false. Needs to be overloaded to also emit an update signal in the full UIData class