rhyton.main

Base module for the rthyton package.

class Rhyton(extensionName=None)[source]

Bases: object

Base class to provide a shared data environment between sub-classes. This is particularly useful share extension specific settings across all of self’s classes while maintaining a single point of entry for developers using self as a base of their extension.

Instead of having a variables.py, this class contains all module-wide variables.

The init of this class is typically called when instanciating a sub-class. The classes in the ‘ui’ module are a good example of this.

Example:

self.Visualize('<name_of_extension>').byGroup()

This will trigger Rhyton to load the settings for the specified extension and provide them as a class variable.

Note

Create a Rhyton instance and provide you extension name before using any other self functionality.

COLOR = 'color'
COLOR_SCHEMES = '.colorSchemes'
COLOR_SOURCE = 'colorSource'
CSV = 'CSV'
DELIMITER = '_'
EMPTY = '<empty>'
EXPORT_CHECKBOXES = 'exportCheckboxes'
EXTENSION_NAME = 'rhyton'
FONT = 'Arial'
GROUP = '.group'
GUID = 'guid'
HDM_DT_DIR = 'C:/HdM-DT'
HEX_WHITE = '#FFFFFF'
JSON = 'JSON'
KEY_PREFIX_NAME = 'key_prefix'
LAYER_HIERARCHY = 'layer_hierarchy'
NAME = 'name'
NOT_AVAILABLE = 'n/a'
ORIGINAL_COLORS = '.originalColors'
POWERBI = '.powerbi'
RHYTON_CONFIG = 'RHYTON_CONFIG'
ROUNDING_DECIMALS = 2
ROUNDING_DECIMALS_NAME = 'rounding_decimals'
SETTINGS = '.settings'
STANDARD_COLOR_1 = (200, 200, 255)
STANDARD_COLOR_2 = (50, 50, 255)
TEXTDOTS = '.textDots'
UNIT_SUFFIX_NAME = 'unit_suffix'
WHITESPACE = ' '
__init__(extensionName=None)[source]

Inits a new Rhyton instance and loads the settings for given extension. Adds some shorthands to the settings as class variables.

Parameters

extensionName (str) – The name of the extension that is calling Rhyton.

property extensionColorSchemes

The global color scheme identifier prefixied with the current extension.

Returns

The color scheme identifier

Return type

string

property extensionGroup

The global group identifier prefixied with the current extension.

Returns

The group identifier

Return type

string

property extensionName

The current extension name.

Returns

The name of the currently active extension

Return type

string

property extensionOriginalColors

The global original colors identifier prefixied with the current extension.

Returns

The original colors identifier

Return type

string

property extensionPowerbi

The global powerbi identifier prefixied with the current extension.

Returns

The powerbi identifier

Return type

string

property extensionSettings

The global settings identifier prefixied with the current extension.

Returns

The settings identifier

Return type

string

property extensionTextdots

The global text dot identifier prefixied with the current extension.

Returns

The text dot identifier

Return type

string

generateSettings()[source]

Generates a settings configuration.

Returns

The resulting configuration.

Return type

dict

getSettings()[source]

Gets a settings configuration from the document text.

Returns

The configuration.

Return type

dict

saveSettings(settings)[source]

Saves a configuration to the document text.

Parameters

settings (dict) – The configuration to save.