dhxpyt.ribbon

 1from .ribbon import Ribbon
 2from .ribbon_config import BlockConfig, CustomHTMLButtonConfig, ButtonConfig, DatepickerConfig, ImageButtonConfig, NavItemConfig, SelectButtonConfig, TitleConfig, InputConfig, SeparatorConfig, SpacerConfig, RibbonConfig
 3
 4__all__ = [
 5    'Ribbon',
 6    'BlockConfig',
 7    'CustomHTMLButtonConfig',
 8    'ButtonConfig',
 9    'DatepickerConfig',
10    'ImageButtonConfig',
11    'NavItemConfig',
12    'SelectButtonConfig',
13    'TitleConfig',
14    'InputConfig',
15    'SeparatorConfig',
16    'SpacerConfig',
17    'RibbonConfig'
18]
class Ribbon:
 14class Ribbon:
 15    def __init__(self, config: RibbonConfig = None, widget_parent: str = None):
 16        """
 17        Initializes the Ribbon widget.
 18
 19        :param config: (Optional) The RibbonConfig object containing the ribbon configuration.
 20        :param widget_parent: (Optional) The ID of the HTML element where the ribbon will be attached.
 21        """
 22        if config is None:
 23            config = RibbonConfig()
 24        config_dict = config.to_dict()
 25        # Create the Ribbon instance
 26        self.ribbon = js.dhx.Ribbon.new(widget_parent, js.JSON.parse(json.dumps(config_dict)))
 27
 28    """ Ribbon API Functions """
 29
 30    def destructor(self) -> None:
 31        """Destroys the Ribbon instance and releases resources."""
 32        self.ribbon.destructor()
 33
 34    def disable(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
 35        """Disables and dims an item(s) of Ribbon."""
 36        self.ribbon.disable(ids)
 37
 38    def enable(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
 39        """Enables a disabled item(s) of Ribbon."""
 40        self.ribbon.enable(ids)
 41
 42    def get_selected(self) -> List[Union[str, int]]:
 43        """Returns an array of IDs of selected items."""
 44        selected = self.ribbon.getSelected()
 45        return [item for item in selected.to_py()]
 46
 47    def get_state(self) -> Dict[str, Any]:
 48        """Gets current values/states of controls."""
 49        state = self.ribbon.getState()
 50        return state.to_py()
 51
 52    def hide(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
 53        """Hides an item of Ribbon."""
 54        self.ribbon.hide(ids)
 55
 56    def is_disabled(self, id: Union[str, int]) -> bool:
 57        """Checks whether an item of Ribbon is disabled."""
 58        return self.ribbon.isDisabled(id)
 59
 60    def is_selected(self, id: Union[str, int]) -> bool:
 61        """Checks whether a specified Ribbon item is selected."""
 62        return self.ribbon.isSelected(id)
 63
 64    def paint(self) -> None:
 65        """Repaints Ribbon on a page."""
 66        self.ribbon.paint()
 67
 68    def select(self, id: Union[str, int], unselect: bool = True) -> None:
 69        """Selects a specified item of Ribbon."""
 70        self.ribbon.select(id, unselect)
 71
 72    def set_state(self, state: Dict[str, Any]) -> None:
 73        """Sets values/states of controls."""
 74        self.ribbon.setState(js.JSON.parse(json.dumps(state)))
 75
 76    def show(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
 77        """Shows an item of Ribbon."""
 78        self.ribbon.show(ids)
 79
 80    def unselect(self, id: Union[str, int] = None) -> None:
 81        """Unselects a selected Ribbon item."""
 82        self.ribbon.unselect(id)
 83
 84    """ Ribbon Event Handlers """
 85
 86    def add_event_handler(self, event_name: str, handler: Callable) -> None:
 87        """
 88        Adds an event handler for the specified event.
 89
 90        :param event_name: The name of the event.
 91        :param handler: The handler function to attach.
 92        """
 93        event_proxy = create_proxy(handler)
 94        self.ribbon.events.on(event_name, event_proxy)
 95
 96    def on_click(self, handler: Callable[[Union[str, int], Any], None]) -> None:
 97        """
 98        Fires after a click on a control.
 99
100        :param handler: The handler function with parameters id (str or int), events (Event).
101        """
102        def event_handler(id, events):
103            handler(id, events)
104        self.ribbon.events.on('click', create_proxy(event_handler))
105
106    def on_input(self, handler: Callable[[str, str], None]) -> None:
107        """
108        Fires on entering text into the input field.
109
110        :param handler: The handler function with parameters id (str), value (str).
111        """
112        def event_handler(id, value):
113            handler(id, value)
114        self.ribbon.events.on('input', create_proxy(event_handler))
115
116    def on_input_blur(self, handler: Callable[[Union[str, int]], None]) -> None:
117        """
118        Fires when a control is blurred.
119
120        :param handler: The handler function with parameter id (str or int).
121        """
122        self.add_event_handler('inputBlur', handler)
123
124    def on_input_change(self, handler: Callable[[Union[str, int], str], None]) -> None:
125        """
126        Fires on changing the value in the Input control of Ribbon.
127
128        :param handler: The handler function with parameters id (str or int), newValue (str).
129        """
130        def event_handler(id, newValue):
131            handler(id, newValue)
132        self.ribbon.events.on('inputChange', create_proxy(event_handler))
133
134    def on_input_created(self, handler: Callable[[Union[str, int], Any], None]) -> None:
135        """
136        Fires when a new input is added.
137
138        :param handler: The handler function with parameters id (str or int), input (HTMLInputElement).
139        """
140        def event_handler(id, input):
141            handler(id, input)
142        self.ribbon.events.on('inputCreated', create_proxy(event_handler))
143
144    def on_input_focus(self, handler: Callable[[Union[str, int]], None]) -> None:
145        """
146        Fires when a control is focused.
147
148        :param handler: The handler function with parameter id (str or int).
149        """
150        self.add_event_handler('inputFocus', handler)
151
152    def on_keydown(self, handler: Callable[[Any, Optional[str]], None]) -> None:
153        """
154        Fires when any key is pressed and a control of Ribbon is in focus.
155
156        :param handler: The handler function with parameters event (KeyboardEvent), id (str or None).
157        """
158        def event_handler(event, id=None):
159            handler(event, id)
160        self.ribbon.events.on('keydown', create_proxy(event_handler))
161
162    def on_open_menu(self, handler: Callable[[Union[str, int]], None]) -> None:
163        """
164        Fires on expanding a menu control.
165
166        :param handler: The handler function with parameter id (str or int).
167        """
168        self.add_event_handler('openMenu', handler)
Ribbon( config: RibbonConfig = None, widget_parent: str = None)
15    def __init__(self, config: RibbonConfig = None, widget_parent: str = None):
16        """
17        Initializes the Ribbon widget.
18
19        :param config: (Optional) The RibbonConfig object containing the ribbon configuration.
20        :param widget_parent: (Optional) The ID of the HTML element where the ribbon will be attached.
21        """
22        if config is None:
23            config = RibbonConfig()
24        config_dict = config.to_dict()
25        # Create the Ribbon instance
26        self.ribbon = js.dhx.Ribbon.new(widget_parent, js.JSON.parse(json.dumps(config_dict)))

Initializes the Ribbon widget.

Parameters
  • config: (Optional) The RibbonConfig object containing the ribbon configuration.
  • widget_parent: (Optional) The ID of the HTML element where the ribbon will be attached.
ribbon

Ribbon API Functions

def destructor(self) -> None:
30    def destructor(self) -> None:
31        """Destroys the Ribbon instance and releases resources."""
32        self.ribbon.destructor()

Destroys the Ribbon instance and releases resources.

def disable(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
34    def disable(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
35        """Disables and dims an item(s) of Ribbon."""
36        self.ribbon.disable(ids)

Disables and dims an item(s) of Ribbon.

def enable(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
38    def enable(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
39        """Enables a disabled item(s) of Ribbon."""
40        self.ribbon.enable(ids)

Enables a disabled item(s) of Ribbon.

def get_selected(self) -> List[Union[str, int]]:
42    def get_selected(self) -> List[Union[str, int]]:
43        """Returns an array of IDs of selected items."""
44        selected = self.ribbon.getSelected()
45        return [item for item in selected.to_py()]

Returns an array of IDs of selected items.

def get_state(self) -> Dict[str, Any]:
47    def get_state(self) -> Dict[str, Any]:
48        """Gets current values/states of controls."""
49        state = self.ribbon.getState()
50        return state.to_py()

Gets current values/states of controls.

def hide(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
52    def hide(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
53        """Hides an item of Ribbon."""
54        self.ribbon.hide(ids)

Hides an item of Ribbon.

def is_disabled(self, id: Union[str, int]) -> bool:
56    def is_disabled(self, id: Union[str, int]) -> bool:
57        """Checks whether an item of Ribbon is disabled."""
58        return self.ribbon.isDisabled(id)

Checks whether an item of Ribbon is disabled.

def is_selected(self, id: Union[str, int]) -> bool:
60    def is_selected(self, id: Union[str, int]) -> bool:
61        """Checks whether a specified Ribbon item is selected."""
62        return self.ribbon.isSelected(id)

Checks whether a specified Ribbon item is selected.

def paint(self) -> None:
64    def paint(self) -> None:
65        """Repaints Ribbon on a page."""
66        self.ribbon.paint()

Repaints Ribbon on a page.

def select(self, id: Union[str, int], unselect: bool = True) -> None:
68    def select(self, id: Union[str, int], unselect: bool = True) -> None:
69        """Selects a specified item of Ribbon."""
70        self.ribbon.select(id, unselect)

Selects a specified item of Ribbon.

def set_state(self, state: Dict[str, Any]) -> None:
72    def set_state(self, state: Dict[str, Any]) -> None:
73        """Sets values/states of controls."""
74        self.ribbon.setState(js.JSON.parse(json.dumps(state)))

Sets values/states of controls.

def show(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
76    def show(self, ids: Union[str, int, List[Union[str, int]]] = None) -> None:
77        """Shows an item of Ribbon."""
78        self.ribbon.show(ids)

Shows an item of Ribbon.

def unselect(self, id: Union[str, int] = None) -> None:
80    def unselect(self, id: Union[str, int] = None) -> None:
81        """Unselects a selected Ribbon item."""
82        self.ribbon.unselect(id)

Unselects a selected Ribbon item.

def add_event_handler(self, event_name: str, handler: Callable) -> None:
86    def add_event_handler(self, event_name: str, handler: Callable) -> None:
87        """
88        Adds an event handler for the specified event.
89
90        :param event_name: The name of the event.
91        :param handler: The handler function to attach.
92        """
93        event_proxy = create_proxy(handler)
94        self.ribbon.events.on(event_name, event_proxy)

Adds an event handler for the specified event.

Parameters
  • event_name: The name of the event.
  • handler: The handler function to attach.
def on_click(self, handler: Callable[[Union[str, int], Any], NoneType]) -> None:
 96    def on_click(self, handler: Callable[[Union[str, int], Any], None]) -> None:
 97        """
 98        Fires after a click on a control.
 99
100        :param handler: The handler function with parameters id (str or int), events (Event).
101        """
102        def event_handler(id, events):
103            handler(id, events)
104        self.ribbon.events.on('click', create_proxy(event_handler))

Fires after a click on a control.

Parameters
  • handler: The handler function with parameters id (str or int), events (Event).
def on_input(self, handler: Callable[[str, str], NoneType]) -> None:
106    def on_input(self, handler: Callable[[str, str], None]) -> None:
107        """
108        Fires on entering text into the input field.
109
110        :param handler: The handler function with parameters id (str), value (str).
111        """
112        def event_handler(id, value):
113            handler(id, value)
114        self.ribbon.events.on('input', create_proxy(event_handler))

Fires on entering text into the input field.

Parameters
  • handler: The handler function with parameters id (str), value (str).
def on_input_blur(self, handler: Callable[[Union[str, int]], NoneType]) -> None:
116    def on_input_blur(self, handler: Callable[[Union[str, int]], None]) -> None:
117        """
118        Fires when a control is blurred.
119
120        :param handler: The handler function with parameter id (str or int).
121        """
122        self.add_event_handler('inputBlur', handler)

Fires when a control is blurred.

Parameters
  • handler: The handler function with parameter id (str or int).
def on_input_change(self, handler: Callable[[Union[str, int], str], NoneType]) -> None:
124    def on_input_change(self, handler: Callable[[Union[str, int], str], None]) -> None:
125        """
126        Fires on changing the value in the Input control of Ribbon.
127
128        :param handler: The handler function with parameters id (str or int), newValue (str).
129        """
130        def event_handler(id, newValue):
131            handler(id, newValue)
132        self.ribbon.events.on('inputChange', create_proxy(event_handler))

Fires on changing the value in the Input control of Ribbon.

Parameters
  • handler: The handler function with parameters id (str or int), newValue (str).
def on_input_created(self, handler: Callable[[Union[str, int], Any], NoneType]) -> None:
134    def on_input_created(self, handler: Callable[[Union[str, int], Any], None]) -> None:
135        """
136        Fires when a new input is added.
137
138        :param handler: The handler function with parameters id (str or int), input (HTMLInputElement).
139        """
140        def event_handler(id, input):
141            handler(id, input)
142        self.ribbon.events.on('inputCreated', create_proxy(event_handler))

Fires when a new input is added.

Parameters
  • handler: The handler function with parameters id (str or int), input (HTMLInputElement).
def on_input_focus(self, handler: Callable[[Union[str, int]], NoneType]) -> None:
144    def on_input_focus(self, handler: Callable[[Union[str, int]], None]) -> None:
145        """
146        Fires when a control is focused.
147
148        :param handler: The handler function with parameter id (str or int).
149        """
150        self.add_event_handler('inputFocus', handler)

Fires when a control is focused.

Parameters
  • handler: The handler function with parameter id (str or int).
def on_keydown(self, handler: Callable[[Any, Optional[str]], NoneType]) -> None:
152    def on_keydown(self, handler: Callable[[Any, Optional[str]], None]) -> None:
153        """
154        Fires when any key is pressed and a control of Ribbon is in focus.
155
156        :param handler: The handler function with parameters event (KeyboardEvent), id (str or None).
157        """
158        def event_handler(event, id=None):
159            handler(event, id)
160        self.ribbon.events.on('keydown', create_proxy(event_handler))

Fires when any key is pressed and a control of Ribbon is in focus.

Parameters
  • handler: The handler function with parameters event (KeyboardEvent), id (str or None).
def on_open_menu(self, handler: Callable[[Union[str, int]], NoneType]) -> None:
162    def on_open_menu(self, handler: Callable[[Union[str, int]], None]) -> None:
163        """
164        Fires on expanding a menu control.
165
166        :param handler: The handler function with parameter id (str or int).
167        """
168        self.add_event_handler('openMenu', handler)

Fires on expanding a menu control.

Parameters
  • handler: The handler function with parameter id (str or int).
class BlockConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
10class BlockConfig(ControlConfig):
11    def __init__(self,
12                 id: Optional[str] = None,
13                 parent: Optional[str] = None,
14                 items: Optional[List['ControlConfig']] = None,
15                 direction: Optional[str] = None,
16                 title: Optional[str] = None,
17                 css: Optional[str] = None,
18                 disabled: Optional[bool] = None,
19                 hidden: Optional[bool] = None):
20        self.type = "block"
21        self.id = id
22        self.parent = parent
23        self.items = items
24        self.direction = direction
25        self.title = title
26        self.css = css
27        self.disabled = disabled
28        self.hidden = hidden
29
30    def to_dict(self) -> Dict[str, Any]:
31        config = {k: v for k, v in self.__dict__.items() if v is not None}
32        # Convert items to dicts if they are present
33        if self.items:
34            config['items'] = [item.to_dict() for item in self.items]
35        return config
BlockConfig( id: Optional[str] = None, parent: Optional[str] = None, items: Optional[List[dhxpyt.ribbon.ribbon_config.ControlConfig]] = None, direction: Optional[str] = None, title: Optional[str] = None, css: Optional[str] = None, disabled: Optional[bool] = None, hidden: Optional[bool] = None)
11    def __init__(self,
12                 id: Optional[str] = None,
13                 parent: Optional[str] = None,
14                 items: Optional[List['ControlConfig']] = None,
15                 direction: Optional[str] = None,
16                 title: Optional[str] = None,
17                 css: Optional[str] = None,
18                 disabled: Optional[bool] = None,
19                 hidden: Optional[bool] = None):
20        self.type = "block"
21        self.id = id
22        self.parent = parent
23        self.items = items
24        self.direction = direction
25        self.title = title
26        self.css = css
27        self.disabled = disabled
28        self.hidden = hidden
type
id
parent
items
direction
title
css
disabled
hidden
def to_dict(self) -> Dict[str, Any]:
30    def to_dict(self) -> Dict[str, Any]:
31        config = {k: v for k, v in self.__dict__.items() if v is not None}
32        # Convert items to dicts if they are present
33        if self.items:
34            config['items'] = [item.to_dict() for item in self.items]
35        return config
class CustomHTMLButtonConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
 95class CustomHTMLButtonConfig(ControlConfig):
 96    def __init__(self,
 97                 id: Optional[str] = None,
 98                 parent: Optional[str] = None,
 99                 html: Optional[str] = None,
100                 css: Optional[str] = None,
101                 hidden: Optional[bool] = None):
102        self.type = "customHTML"
103        self.id = id
104        self.parent = parent
105        self.html = html
106        self.css = css
107        self.hidden = hidden
CustomHTMLButtonConfig( id: Optional[str] = None, parent: Optional[str] = None, html: Optional[str] = None, css: Optional[str] = None, hidden: Optional[bool] = None)
 96    def __init__(self,
 97                 id: Optional[str] = None,
 98                 parent: Optional[str] = None,
 99                 html: Optional[str] = None,
100                 css: Optional[str] = None,
101                 hidden: Optional[bool] = None):
102        self.type = "customHTML"
103        self.id = id
104        self.parent = parent
105        self.html = html
106        self.css = css
107        self.hidden = hidden
type
id
parent
html
css
hidden
class ButtonConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
38class ButtonConfig(ControlConfig):
39    def __init__(self,
40                 id: Optional[str] = None,
41                 parent: Optional[str] = None,
42                 value: Optional[str] = None,
43                 items: Optional[List['ControlConfig']] = None,
44                 active: Optional[bool] = None,
45                 circle: Optional[bool] = None,
46                 color: Optional[str] = None,
47                 count: Optional[int] = None,
48                 countColor: Optional[str] = None,
49                 full: Optional[bool] = None,
50                 group: Optional[str] = None,
51                 hotkey: Optional[str] = None,
52                 html: Optional[str] = None,
53                 icon: Optional[str] = None,
54                 loading: Optional[bool] = None,
55                 multiClick: Optional[bool] = None,
56                 size: Optional[str] = None,
57                 tooltip: Optional[str] = None,
58                 twoState: Optional[bool] = None,
59                 view: Optional[str] = None,
60                 css: Optional[str] = None,
61                 disabled: Optional[bool] = None,
62                 hidden: Optional[bool] = None):
63        self.type = "button"
64        self.id = id
65        self.parent = parent
66        self.value = value
67        self.items = items
68        self.active = active
69        self.circle = circle
70        self.color = color
71        self.count = count
72        self.countColor = countColor
73        self.full = full
74        self.group = group
75        self.hotkey = hotkey
76        self.html = html
77        self.icon = icon
78        self.loading = loading
79        self.multiClick = multiClick
80        self.size = size
81        self.tooltip = tooltip
82        self.twoState = twoState
83        self.view = view
84        self.css = css
85        self.disabled = disabled
86        self.hidden = hidden
87
88    def to_dict(self) -> Dict[str, Any]:
89        config = {k: v for k, v in self.__dict__.items() if v is not None}
90        if self.items:
91            config['items'] = [item.to_dict() for item in self.items]
92        return config
ButtonConfig( id: Optional[str] = None, parent: Optional[str] = None, value: Optional[str] = None, items: Optional[List[dhxpyt.ribbon.ribbon_config.ControlConfig]] = None, active: Optional[bool] = None, circle: Optional[bool] = None, color: Optional[str] = None, count: Optional[int] = None, countColor: Optional[str] = None, full: Optional[bool] = None, group: Optional[str] = None, hotkey: Optional[str] = None, html: Optional[str] = None, icon: Optional[str] = None, loading: Optional[bool] = None, multiClick: Optional[bool] = None, size: Optional[str] = None, tooltip: Optional[str] = None, twoState: Optional[bool] = None, view: Optional[str] = None, css: Optional[str] = None, disabled: Optional[bool] = None, hidden: Optional[bool] = None)
39    def __init__(self,
40                 id: Optional[str] = None,
41                 parent: Optional[str] = None,
42                 value: Optional[str] = None,
43                 items: Optional[List['ControlConfig']] = None,
44                 active: Optional[bool] = None,
45                 circle: Optional[bool] = None,
46                 color: Optional[str] = None,
47                 count: Optional[int] = None,
48                 countColor: Optional[str] = None,
49                 full: Optional[bool] = None,
50                 group: Optional[str] = None,
51                 hotkey: Optional[str] = None,
52                 html: Optional[str] = None,
53                 icon: Optional[str] = None,
54                 loading: Optional[bool] = None,
55                 multiClick: Optional[bool] = None,
56                 size: Optional[str] = None,
57                 tooltip: Optional[str] = None,
58                 twoState: Optional[bool] = None,
59                 view: Optional[str] = None,
60                 css: Optional[str] = None,
61                 disabled: Optional[bool] = None,
62                 hidden: Optional[bool] = None):
63        self.type = "button"
64        self.id = id
65        self.parent = parent
66        self.value = value
67        self.items = items
68        self.active = active
69        self.circle = circle
70        self.color = color
71        self.count = count
72        self.countColor = countColor
73        self.full = full
74        self.group = group
75        self.hotkey = hotkey
76        self.html = html
77        self.icon = icon
78        self.loading = loading
79        self.multiClick = multiClick
80        self.size = size
81        self.tooltip = tooltip
82        self.twoState = twoState
83        self.view = view
84        self.css = css
85        self.disabled = disabled
86        self.hidden = hidden
type
id
parent
value
items
active
circle
color
count
countColor
full
group
hotkey
html
icon
loading
multiClick
size
tooltip
twoState
view
css
disabled
hidden
def to_dict(self) -> Dict[str, Any]:
88    def to_dict(self) -> Dict[str, Any]:
89        config = {k: v for k, v in self.__dict__.items() if v is not None}
90        if self.items:
91            config['items'] = [item.to_dict() for item in self.items]
92        return config
class DatepickerConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
110class DatepickerConfig(ControlConfig):
111    def __init__(self,
112                 id: Optional[str] = None,
113                 parent: Optional[str] = None,
114                 value: Optional[str] = None,
115                 valueFormat: Optional[str] = None,
116                 dateFormat: Optional[str] = None,
117                 disabledDates: Optional[List[Any]] = None,
118                 icon: Optional[str] = None,
119                 label: Optional[str] = None,
120                 mark: Optional[List[Any]] = None,
121                 mode: Optional[str] = None,
122                 placeholder: Optional[str] = None,
123                 thisMonthOnly: Optional[bool] = None,
124                 timeFormat: Optional[str] = None,
125                 timePicker: Optional[bool] = None,
126                 weekNumbers: Optional[bool] = None,
127                 weekStart: Optional[int] = None,
128                 css: Optional[str] = None,
129                 disabled: Optional[bool] = None,
130                 editable: Optional[bool] = None,
131                 hidden: Optional[bool] = None,
132                 width: Optional[int] = None):
133        self.type = "datePicker"
134        self.id = id
135        self.parent = parent
136        self.value = value
137        self.valueFormat = valueFormat
138        self.dateFormat = dateFormat
139        self.disabledDates = disabledDates
140        self.icon = icon
141        self.label = label
142        self.mark = mark
143        self.mode = mode
144        self.placeholder = placeholder
145        self.thisMonthOnly = thisMonthOnly
146        self.timeFormat = timeFormat
147        self.timePicker = timePicker
148        self.weekNumbers = weekNumbers
149        self.weekStart = weekStart
150        self.css = css
151        self.disabled = disabled
152        self.editable = editable
153        self.hidden = hidden
154        self.width = width
DatepickerConfig( id: Optional[str] = None, parent: Optional[str] = None, value: Optional[str] = None, valueFormat: Optional[str] = None, dateFormat: Optional[str] = None, disabledDates: Optional[List[Any]] = None, icon: Optional[str] = None, label: Optional[str] = None, mark: Optional[List[Any]] = None, mode: Optional[str] = None, placeholder: Optional[str] = None, thisMonthOnly: Optional[bool] = None, timeFormat: Optional[str] = None, timePicker: Optional[bool] = None, weekNumbers: Optional[bool] = None, weekStart: Optional[int] = None, css: Optional[str] = None, disabled: Optional[bool] = None, editable: Optional[bool] = None, hidden: Optional[bool] = None, width: Optional[int] = None)
111    def __init__(self,
112                 id: Optional[str] = None,
113                 parent: Optional[str] = None,
114                 value: Optional[str] = None,
115                 valueFormat: Optional[str] = None,
116                 dateFormat: Optional[str] = None,
117                 disabledDates: Optional[List[Any]] = None,
118                 icon: Optional[str] = None,
119                 label: Optional[str] = None,
120                 mark: Optional[List[Any]] = None,
121                 mode: Optional[str] = None,
122                 placeholder: Optional[str] = None,
123                 thisMonthOnly: Optional[bool] = None,
124                 timeFormat: Optional[str] = None,
125                 timePicker: Optional[bool] = None,
126                 weekNumbers: Optional[bool] = None,
127                 weekStart: Optional[int] = None,
128                 css: Optional[str] = None,
129                 disabled: Optional[bool] = None,
130                 editable: Optional[bool] = None,
131                 hidden: Optional[bool] = None,
132                 width: Optional[int] = None):
133        self.type = "datePicker"
134        self.id = id
135        self.parent = parent
136        self.value = value
137        self.valueFormat = valueFormat
138        self.dateFormat = dateFormat
139        self.disabledDates = disabledDates
140        self.icon = icon
141        self.label = label
142        self.mark = mark
143        self.mode = mode
144        self.placeholder = placeholder
145        self.thisMonthOnly = thisMonthOnly
146        self.timeFormat = timeFormat
147        self.timePicker = timePicker
148        self.weekNumbers = weekNumbers
149        self.weekStart = weekStart
150        self.css = css
151        self.disabled = disabled
152        self.editable = editable
153        self.hidden = hidden
154        self.width = width
type
id
parent
value
valueFormat
dateFormat
disabledDates
icon
label
mark
mode
placeholder
thisMonthOnly
timeFormat
timePicker
weekNumbers
weekStart
css
disabled
editable
hidden
width
class ImageButtonConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
157class ImageButtonConfig(ControlConfig):
158    def __init__(self,
159                 id: Optional[str] = None,
160                 parent: Optional[str] = None,
161                 src: str = None,
162                 active: Optional[bool] = None,
163                 count: Optional[int] = None,
164                 countColor: Optional[str] = None,
165                 group: Optional[str] = None,
166                 hotkey: Optional[str] = None,
167                 size: Optional[str] = None,
168                 tooltip: Optional[str] = None,
169                 twoState: Optional[bool] = None,
170                 css: Optional[str] = None,
171                 disabled: Optional[bool] = None,
172                 hidden: Optional[bool] = None):
173        self.type = "imageButton"
174        self.id = id
175        self.parent = parent
176        self.src = src
177        self.active = active
178        self.count = count
179        self.countColor = countColor
180        self.group = group
181        self.hotkey = hotkey
182        self.size = size
183        self.tooltip = tooltip
184        self.twoState = twoState
185        self.css = css
186        self.disabled = disabled
187        self.hidden = hidden
ImageButtonConfig( id: Optional[str] = None, parent: Optional[str] = None, src: str = None, active: Optional[bool] = None, count: Optional[int] = None, countColor: Optional[str] = None, group: Optional[str] = None, hotkey: Optional[str] = None, size: Optional[str] = None, tooltip: Optional[str] = None, twoState: Optional[bool] = None, css: Optional[str] = None, disabled: Optional[bool] = None, hidden: Optional[bool] = None)
158    def __init__(self,
159                 id: Optional[str] = None,
160                 parent: Optional[str] = None,
161                 src: str = None,
162                 active: Optional[bool] = None,
163                 count: Optional[int] = None,
164                 countColor: Optional[str] = None,
165                 group: Optional[str] = None,
166                 hotkey: Optional[str] = None,
167                 size: Optional[str] = None,
168                 tooltip: Optional[str] = None,
169                 twoState: Optional[bool] = None,
170                 css: Optional[str] = None,
171                 disabled: Optional[bool] = None,
172                 hidden: Optional[bool] = None):
173        self.type = "imageButton"
174        self.id = id
175        self.parent = parent
176        self.src = src
177        self.active = active
178        self.count = count
179        self.countColor = countColor
180        self.group = group
181        self.hotkey = hotkey
182        self.size = size
183        self.tooltip = tooltip
184        self.twoState = twoState
185        self.css = css
186        self.disabled = disabled
187        self.hidden = hidden
type
id
parent
src
active
count
countColor
group
hotkey
size
tooltip
twoState
css
disabled
hidden
class SelectButtonConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
263class SelectButtonConfig(ControlConfig):
264    def __init__(self,
265                 id: Optional[str] = None,
266                 parent: Optional[str] = None,
267                 value: Optional[str] = None,
268                 items: Optional[List['ControlConfig']] = None,
269                 count: Optional[int] = None,
270                 countColor: Optional[str] = None,
271                 icon: Optional[str] = None,
272                 size: Optional[str] = None,
273                 tooltip: Optional[str] = None,
274                 css: Optional[str] = None,
275                 disabled: Optional[bool] = None,
276                 hidden: Optional[bool] = None):
277        self.type = "selectButton"
278        self.id = id
279        self.parent = parent
280        self.value = value
281        self.items = items
282        self.count = count
283        self.countColor = countColor
284        self.icon = icon
285        self.size = size
286        self.tooltip = tooltip
287        self.css = css
288        self.disabled = disabled
289        self.hidden = hidden
290
291    def to_dict(self) -> Dict[str, Any]:
292        config = {k: v for k, v in self.__dict__.items() if v is not None}
293        if self.items:
294            config['items'] = [item.to_dict() for item in self.items]
295        return config
SelectButtonConfig( id: Optional[str] = None, parent: Optional[str] = None, value: Optional[str] = None, items: Optional[List[dhxpyt.ribbon.ribbon_config.ControlConfig]] = None, count: Optional[int] = None, countColor: Optional[str] = None, icon: Optional[str] = None, size: Optional[str] = None, tooltip: Optional[str] = None, css: Optional[str] = None, disabled: Optional[bool] = None, hidden: Optional[bool] = None)
264    def __init__(self,
265                 id: Optional[str] = None,
266                 parent: Optional[str] = None,
267                 value: Optional[str] = None,
268                 items: Optional[List['ControlConfig']] = None,
269                 count: Optional[int] = None,
270                 countColor: Optional[str] = None,
271                 icon: Optional[str] = None,
272                 size: Optional[str] = None,
273                 tooltip: Optional[str] = None,
274                 css: Optional[str] = None,
275                 disabled: Optional[bool] = None,
276                 hidden: Optional[bool] = None):
277        self.type = "selectButton"
278        self.id = id
279        self.parent = parent
280        self.value = value
281        self.items = items
282        self.count = count
283        self.countColor = countColor
284        self.icon = icon
285        self.size = size
286        self.tooltip = tooltip
287        self.css = css
288        self.disabled = disabled
289        self.hidden = hidden
type
id
parent
value
items
count
countColor
icon
size
tooltip
css
disabled
hidden
def to_dict(self) -> Dict[str, Any]:
291    def to_dict(self) -> Dict[str, Any]:
292        config = {k: v for k, v in self.__dict__.items() if v is not None}
293        if self.items:
294            config['items'] = [item.to_dict() for item in self.items]
295        return config
class TitleConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
312class TitleConfig(ControlConfig):
313    def __init__(self,
314                 id: Optional[str] = None,
315                 parent: Optional[str] = None,
316                 value: Optional[str] = None,
317                 html: Optional[str] = None,
318                 tooltip: Optional[str] = None,
319                 css: Optional[str] = None,
320                 disabled: Optional[bool] = None,
321                 hidden: Optional[bool] = None):
322        self.type = "title"
323        self.id = id
324        self.parent = parent
325        self.value = value
326        self.html = html
327        self.tooltip = tooltip
328        self.css = css
329        self.disabled = disabled
330        self.hidden = hidden
TitleConfig( id: Optional[str] = None, parent: Optional[str] = None, value: Optional[str] = None, html: Optional[str] = None, tooltip: Optional[str] = None, css: Optional[str] = None, disabled: Optional[bool] = None, hidden: Optional[bool] = None)
313    def __init__(self,
314                 id: Optional[str] = None,
315                 parent: Optional[str] = None,
316                 value: Optional[str] = None,
317                 html: Optional[str] = None,
318                 tooltip: Optional[str] = None,
319                 css: Optional[str] = None,
320                 disabled: Optional[bool] = None,
321                 hidden: Optional[bool] = None):
322        self.type = "title"
323        self.id = id
324        self.parent = parent
325        self.value = value
326        self.html = html
327        self.tooltip = tooltip
328        self.css = css
329        self.disabled = disabled
330        self.hidden = hidden
type
id
parent
value
html
tooltip
css
disabled
hidden
class InputConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
190class InputConfig(ControlConfig):
191    def __init__(self,
192                 id: Optional[str] = None,
193                 parent: Optional[str] = None,
194                 value: Optional[str] = None,
195                 icon: Optional[str] = None,
196                 label: Optional[str] = None,
197                 placeholder: Optional[str] = None,
198                 tooltip: Optional[str] = None,
199                 width: Optional[int] = None,
200                 css: Optional[str] = None,
201                 disabled: Optional[bool] = None,
202                 hidden: Optional[bool] = None):
203        self.type = "input"
204        self.id = id
205        self.parent = parent
206        self.value = value
207        self.icon = icon
208        self.label = label
209        self.placeholder = placeholder
210        self.tooltip = tooltip
211        self.width = width
212        self.css = css
213        self.disabled = disabled
214        self.hidden = hidden
InputConfig( id: Optional[str] = None, parent: Optional[str] = None, value: Optional[str] = None, icon: Optional[str] = None, label: Optional[str] = None, placeholder: Optional[str] = None, tooltip: Optional[str] = None, width: Optional[int] = None, css: Optional[str] = None, disabled: Optional[bool] = None, hidden: Optional[bool] = None)
191    def __init__(self,
192                 id: Optional[str] = None,
193                 parent: Optional[str] = None,
194                 value: Optional[str] = None,
195                 icon: Optional[str] = None,
196                 label: Optional[str] = None,
197                 placeholder: Optional[str] = None,
198                 tooltip: Optional[str] = None,
199                 width: Optional[int] = None,
200                 css: Optional[str] = None,
201                 disabled: Optional[bool] = None,
202                 hidden: Optional[bool] = None):
203        self.type = "input"
204        self.id = id
205        self.parent = parent
206        self.value = value
207        self.icon = icon
208        self.label = label
209        self.placeholder = placeholder
210        self.tooltip = tooltip
211        self.width = width
212        self.css = css
213        self.disabled = disabled
214        self.hidden = hidden
type
id
parent
value
icon
label
placeholder
tooltip
width
css
disabled
hidden
class SeparatorConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
298class SeparatorConfig(ControlConfig):
299    def __init__(self,
300                 id: Optional[str] = None):
301        self.type = "separator"
302        self.id = id
SeparatorConfig(id: Optional[str] = None)
299    def __init__(self,
300                 id: Optional[str] = None):
301        self.type = "separator"
302        self.id = id
type
id
class SpacerConfig(dhxpyt.ribbon.ribbon_config.ControlConfig):
305class SpacerConfig(ControlConfig):
306    def __init__(self,
307                 id: Optional[str] = None):
308        self.type = "spacer"
309        self.id = id
SpacerConfig(id: Optional[str] = None)
306    def __init__(self,
307                 id: Optional[str] = None):
308        self.type = "spacer"
309        self.id = id
type
id
class RibbonConfig:
333class RibbonConfig:
334    """
335    Configuration class for the Ribbon widget.
336    """
337    def __init__(self,
338                 data: Optional[List[ControlConfig]] = None,
339                 css: Optional[str] = None,
340                 menuCss: Optional[str] = None):
341        """
342        Initializes the RibbonConfig.
343
344        :param data: (Optional) List of control configurations to set into Ribbon.
345        :param css: (Optional) Adds style classes to Ribbon.
346        :param menuCss: (Optional) Adds style classes to all containers of Ribbon controls with nested items.
347        """
348        self.data = data
349        self.css = css
350        self.menuCss = menuCss
351
352    def to_dict(self) -> Dict[str, Any]:
353        """
354        Converts the RibbonConfig into a dictionary format.
355        """
356        data_dicts = [item.to_dict() for item in self.data] if self.data else None
357        config_dict = {
358            'data': data_dicts,
359            'css': self.css,
360            'menuCss': self.menuCss
361        }
362        return {k: v for k, v in config_dict.items() if v is not None}

Configuration class for the Ribbon widget.

RibbonConfig( data: Optional[List[dhxpyt.ribbon.ribbon_config.ControlConfig]] = None, css: Optional[str] = None, menuCss: Optional[str] = None)
337    def __init__(self,
338                 data: Optional[List[ControlConfig]] = None,
339                 css: Optional[str] = None,
340                 menuCss: Optional[str] = None):
341        """
342        Initializes the RibbonConfig.
343
344        :param data: (Optional) List of control configurations to set into Ribbon.
345        :param css: (Optional) Adds style classes to Ribbon.
346        :param menuCss: (Optional) Adds style classes to all containers of Ribbon controls with nested items.
347        """
348        self.data = data
349        self.css = css
350        self.menuCss = menuCss

Initializes the RibbonConfig.

Parameters
  • data: (Optional) List of control configurations to set into Ribbon.
  • css: (Optional) Adds style classes to Ribbon.
  • menuCss: (Optional) Adds style classes to all containers of Ribbon controls with nested items.
data
css
menuCss
def to_dict(self) -> Dict[str, Any]:
352    def to_dict(self) -> Dict[str, Any]:
353        """
354        Converts the RibbonConfig into a dictionary format.
355        """
356        data_dicts = [item.to_dict() for item in self.data] if self.data else None
357        config_dict = {
358            'data': data_dicts,
359            'css': self.css,
360            'menuCss': self.menuCss
361        }
362        return {k: v for k, v in config_dict.items() if v is not None}

Converts the RibbonConfig into a dictionary format.