Wiki

Clone wiki

VW DLibrary / 2016 / api / utility

MODULE dlibrary.utility

Used for all other, utility, stuff that can't be placed in one of the other modules.

CLASSES

builtins.BaseException(builtins.object)
........VSException(builtins.BaseException)
builtins.object
........AbstractObservableWithDependencies(builtins.object)
................ObservableCommand(AbstractObservableWithDependencies)
................ObservableMethod(AbstractObservableWithDependencies)
........AbstractPropertyClassDecorator(builtins.object)
........AbstractViewModel(builtins.object)
........AbstractXmlFile(builtins.object)
........Convert(builtins.object)
........Event(builtins.object)
........If(builtins.object)
........Math(builtins.object)
........ObservableField(builtins.object)
................LinkedObservableField(ObservableField)
........ViewModelList(builtins.object)
........XmlDict(builtins.object)
........XmlFileDefaults(builtins.object)
........XmlFileLists(builtins.object)
........XmlFileVersioning(builtins.object)
builtins.type(builtins.object)
........SingletonMeta(builtins.type)
................SingletonABCMeta(SingletonMeta, abc.ABCMeta)
collections.UserList(collections.abc.MutableSequence)
........ObservableList(collections.UserList)
................LinkedObservableList(ObservableList)


class AbstractObservableWithDependencies(builtins.object)

__init__(self, dependant_observables: list=None)


class AbstractPropertyClassDecorator(builtins.object)

Abstract base class for class decorators which adds a property to the class.

__init__(self, property_value)

has_decorator(cls, obj: object) from abc.ABCMeta


class AbstractViewModel(builtins.object)

__init__(self, model: object)

model GET ``


class AbstractXmlFile(builtins.object)

Class used for setting up files with properties through decorators. This way, plugins can decide how their xml files will behave by just setting the appropriate decorators, as these settings can be plugin version dependant. Loading will correct xmltodict output, so we can expect always the same things: - If an element has nothing (empty), xmltodict gives back None, we prefer an empty dict. - If an element has only inner text, xmltodict gives back a str, we prefer a dict with #text. So the contents will start with a dict and contains only dicts and lists down the road with no lists in lists!

__init__(self, path: str)

load(self, create_if_not_found: bool=False) -> dict

path GET ``

save(self, content: dict)


class Convert(builtins.object)

str2bool(value: str) -> bool


class Event(builtins.object)

__init__(self)

raise_event(self, args, *kwargs)

subscribe(self, handler: <built-in function callable>)

unsubscribe(self, handler: <built-in function callable>)


class If(builtins.object)

Decorator for conditionally apply the given decorator.

__init__(self, condition: bool, decorator: <built-in function callable>)


class LinkedObservableField(ObservableField)

> ObservableField > builtins.object

__init__(self, model: dict, key: str)

field_changed_event GET ``

value GET/SET ``


class LinkedObservableList(ObservableList)

> ObservableList > collections.UserList > collections.abc.MutableSequence > collections.abc.Sequence > collections.abc.Sized > collections.abc.Iterable > collections.abc.Container > builtins.object

__init__(self, model_list: list, pack: <built-in function callable>, unpack: <built-in function callable>)

append(self, item)

clear(self)

copy(self)

count(self, item)

extend(self, other)

index(self, item, *args)

insert(self, i, item)

list_changed_event GET ``

list_reordered_event GET ``

pop(self, i=-1)

remove(self, item)

resume_events(self)

reverse(self)

sort(self, args, *kwds)

suspend_events(self)


class Math(builtins.object)

float_equal(float_a: float, float_b: float) -> bool

point_equal(point_a: tuple, point_b: tuple) -> bool


class ObservableCommand(AbstractObservableWithDependencies)

> AbstractObservableWithDependencies > builtins.object

__init__(self, execute: <built-in function callable>, can_execute: <built-in function callable>=None, dependant_observables: list=None)

can_execute(self)

can_execute_changed_event GET ``

execute(self)


class ObservableField(builtins.object)

__init__(self, default_value=None)

field_changed_event GET ``

value GET/SET ``


class ObservableList(collections.UserList)

> collections.UserList > collections.abc.MutableSequence > collections.abc.Sequence > collections.abc.Sized > collections.abc.Iterable > collections.abc.Container > builtins.object

__init__(self, default_list=None)

append(self, item)

clear(self)

copy(self)

count(self, item)

extend(self, other)

index(self, item, *args)

insert(self, i, item)

list_changed_event GET ``

list_reordered_event GET ``

pop(self, i=-1)

remove(self, item)

resume_events(self)

reverse(self)

sort(self, args, *kwds)

suspend_events(self)


class ObservableMethod(AbstractObservableWithDependencies)

> AbstractObservableWithDependencies > builtins.object

__init__(self, method: <built-in function callable>, dependant_observables: list=None)

apply(self, *args)

method_changed_event GET ``


class SingletonABCMeta(SingletonMeta, abc.ABCMeta)

For singletons that are derived from abstract classes.

> SingletonMeta > abc.ABCMeta > builtins.type > builtins.object

mro(...)

mro() -> list
return a type's method resolution order

register(cls, subclass)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.


class SingletonMeta(builtins.type)

> builtins.type > builtins.object

mro(...)

mro() -> list
return a type's method resolution order


class VSException(builtins.BaseException)

> builtins.BaseException > builtins.object

__init__(self, function: str)

args

with_traceback(...)

Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.


class ViewModelList(builtins.object)

__init__(self, model_list: list, abstract_view_model: <built-in function callable>, create_new_model: <built-in function callable>, can_add_new_model: <built-in function callable>=None, can_add_dependent_property_observables: set={})

noinspection PyDefaultArgument

add_item GET ``

items GET ``

new_item GET ``

selected_items GET ``


class XmlDict(builtins.object)

get_element_keys(element: dict) -> set

get_elements(element: dict) -> dict


class XmlFileDefaults(builtins.object)

Decorator to specify default values for items, so they can be applied if no value is present.

__init__(self, defaults: dict)


class XmlFileLists(builtins.object)

Decorator to correct the contents of an xml file, so that we got actual lists where we expect them. Else, xmltodict will set different types for it depending on how many times it appears in the file.

__init__(self, lists: set)


class XmlFileVersioning(builtins.object)

Decorator to facilitate xml file versioning and to convert to the latest version if needed.

__init__(self, converters: dict)

:type converters: dict {int: callable}, which represents version number and converter from previous version.

FILE

d:\development\vw libraries\dlibrary\dlibrary\utility.py

Updated