jangada.display.DisplaySettings#
- class jangada.display.DisplaySettings(*args, **kwargs)#
Bases:
PersistablePersistent configuration for terminal display formatting.
DisplaySettings provides centralized control over all visual aspects of terminal output, including console width, panel styling, and table formatting. Settings can be customized per-instance and saved as reusable themes.
All styling properties use Rich’s style syntax, supporting colors, attributes (bold, italic), and combinations.
- Attributes:
- console_widthint
Maximum console output width in characters. Default 150.
- property_stylestr
Style for property labels in forms. Default ‘bold bright_yellow’.
- panel_border_stylestr
Style for panel borders. Default ‘bright_cyan’.
- panel_boxstr
Box style name from rich.box. Default ‘ROUNDED’.
- panel_title_alignstr
Panel title alignment. Default ‘center’.
- table_index_stylestr or None
Style for table index column. Default None.
- table_header_stylestr or None
Style for table headers. Default ‘bold bright_yellow’.
- table_round_floatsint or None
Decimal places for float rounding. Default None.
- table_spacingint
Column spacing in characters. Default 4.
See also
DisplayableUses DisplaySettings for formatting
Notes
As a Persistable subclass, DisplaySettings can be saved to HDF5 files with the .disp extension, making themes portable and shareable.
Rich style strings support: - Colors: ‘red’, ‘blue’, ‘bright_yellow’, ‘#FF0000’ - Modifiers: ‘bold’, ‘italic’, ‘underline’, ‘dim’ - Combinations: ‘bold red’, ‘italic bright_cyan’
Examples
Create and customize settings:
settings = DisplaySettings() settings.panel_border_style = 'green' settings.console_width = 120 settings.table_spacing = 8
Save as theme:
settings.save('my_theme.disp')
Load theme:
settings = DisplaySettings.load('my_theme.disp') obj.display_settings = settings
- __init__(*args, **kwargs) None#
Initialize a Persistable object.
Supports three modes based on arguments:
Normal construction:
obj = MyClass(prop1=val1)Load from file:
obj = MyClass('/path/file.hdf5')Context manager prep:
obj = MyClass('/path/file.hdf5', mode='r')
- Parameters:
- *argstuple
If empty: normal Serializable construction with kwargs If single Path/str: load from that file If single Path/str with kwargs: prepare for context manager
- **kwargsdict
For mode 1: property values For mode 3: must include ‘mode’ parameter (HDF5 file mode)
- Raises:
- ValueError
If unknown kwargs are provided in context manager mode.
- FileNotFoundError
If loading from non-existent file.
Examples
Normal construction:
exp = Experiment(name="Test", temperature=300.0)
Load from file:
exp = Experiment('data.hdf5')
Prepare for context manager:
exp = Experiment('data.hdf5', mode='r+') with exp as e: # Use e pass
Or directly:
with Experiment('data.hdf5', mode='r+') as exp: # Use exp pass
Methods
__copy__()Support for the copy module.
__delattr__(name, /)Implement delattr(self, name).
__dir__(/)Default dir() implementation.
__enter__()Enter context manager mode.
__eq__(other)Compare equality based on copiable properties.
__exit__(exc_type, exc_val, exc_tb)Exit context manager mode.
__format__(format_spec, /)Default object formatter.
__ge__(value, /)Return self>=value.
__getattribute__(name, /)Return getattr(self, name).
__getstate__(/)Helper for pickle.
__gt__(value, /)Return self>value.
__init__(*args, **kwargs)Initialize a Persistable object.
__init_subclass__This method is called when a class is subclassed.
__le__(value, /)Return self<=value.
__lt__(value, /)Return self<value.
__ne__(value, /)Return self!=value.
__reduce__(/)Helper for pickle.
__reduce_ex__(protocol, /)Helper for pickle.
__repr__(/)Return repr(self).
__sizeof__(/)Size of object in memory, in bytes.
__str__(/)Return str(self).
__subclasshook__Abstract classes can override this to customize issubclass().
_initialize_from_data(data)Initialize object properties from a dictionary.
_load_data_from_h5py_tree(value[, ...])Recursively load data from HDF5 structure.
_save_data_in_group(key, value, group)Recursively save data to an HDF5 group.
copy()Create an independent copy of this object.
deserialize(data)Recursively deserialize data to reconstruct objects.
load(path)Load an object from an HDF5 file.
load_serialized_data(path)Load serialized data dictionary from HDF5 file.
save(path[, overwrite, use_default_extension])Save this object to an HDF5 file.
save_serialized_data(path, data)Save serialized data dictionary to HDF5 file.
serialize(obj[, is_copy])Recursively serialize an object to a dictionary structure.
Attributes
__abstractmethods____annotations____hash___abc_impl_dataset_types_primitive_types_serializable_properties_subclassesconsole_widthMaximum width for console output in characters.
extensionDefault file extension for saved files.
panel_border_styleRich color/style for panel borders.
panel_boxBox style name for panel borders.
panel_title_alignPanel title alignment within the top border.
property_styleRich style string for property labels in forms.
table_header_styleRich style for table column headers.
table_index_styleRich style for DataFrame index column.
table_round_floatsNumber of decimal places for float columns.
table_spacingHorizontal spacing between table columns in characters.