Skip to content

Commit fafd230

Browse files
authored
Merge pull request #96 from highcharts-for-python/develop
PR for v.1.3.6
2 parents 6f09f83 + c06f055 commit fafd230

File tree

5 files changed

+115
-4
lines changed

5 files changed

+115
-4
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11

2+
Release 1.3.6
3+
=========================================
4+
5+
* **BUGFIX:** Adding missing ``menu...Style`` properties to `Navigation` class (#95).
6+
7+
---------------------
8+
29
Release 1.3.5
310
=========================================
411

highcharts_core/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.3.5'
1+
__version__ = '1.3.6'

highcharts_core/options/navigation/__init__.py

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,19 @@ def __init__(self, **kwargs):
2323
self._button_options = None
2424
self._events = None
2525
self._icons_url = None
26+
self._menu_item_hover_style = None
27+
self._menu_item_style = None
28+
self._menu_style = None
2629

2730
self.annotation_options = kwargs.get('annotation_options', None)
2831
self.bindings = kwargs.get('bindings', None)
2932
self.bindings_class_name = kwargs.get('bindings_class_name', None)
3033
self.button_options = kwargs.get('button_options', None)
3134
self.events = kwargs.get('events', None)
3235
self.icons_url = kwargs.get('icons_url', None)
36+
self.menu_item_hover_style = kwargs.get('menu_item_hover_style', None)
37+
self.menu_item_style = kwargs.get('menu_item_style', None)
38+
self.menu_style = kwargs.get('menu_style', None)
3339

3440
super().__init__(**kwargs)
3541

@@ -118,6 +124,74 @@ def icons_url(self) -> Optional[str]:
118124
def icons_url(self, value):
119125
self._icons_url = validators.string(value, allow_empty = True)
120126

127+
@property
128+
def menu_item_hover_style(self) -> Optional[str | dict]:
129+
"""CSS styles for the individual items within the popup menu when the user's mouse hovers over them.
130+
131+
.. note::
132+
133+
Font size defaults to 11px on desktop and 14px on touch devices.
134+
135+
Defaults to:
136+
``{"background": "#f2f2f2" }``.
137+
138+
:rtype: :class:`str <python:str>` or :class:`dict <python:dict>` or :obj:`None <python:None>`
139+
"""
140+
return self._menu_item_hover_style
141+
142+
@menu_item_hover_style.setter
143+
def menu_item_hover_style(self, value):
144+
try:
145+
self._menu_item_hover_style = validators.dict(value, allow_empty = True)
146+
except (ValueError, TypeError):
147+
self._menu_item_hover_style = validators.string(value,
148+
allow_empty = True,
149+
coerce_value = True)
150+
151+
@property
152+
def menu_item_style(self) -> Optional[str | dict]:
153+
"""CSS styles for the individual items within the popup menu.
154+
155+
.. note::
156+
157+
Font size defaults to 11px on desktop and 14px on touch devices.
158+
159+
Defaults to:
160+
``{"padding": "0.5em", "color": "#333333", "background": "none", "borderRadius": "3px", "fontSize": "0.8em", "transition": "background 250ms, color 250ms"}``.
161+
162+
:rtype: :class:`str <python:str>` or :class:`dict <python:dict>` or :obj:`None <python:None>`
163+
"""
164+
return self._menu_item_style
165+
166+
@menu_item_style.setter
167+
def menu_item_style(self, value):
168+
try:
169+
self._menu_item_style = validators.dict(value, allow_empty = True)
170+
except (ValueError, TypeError):
171+
self._menu_item_style = validators.string(value,
172+
allow_empty = True,
173+
coerce_value = True)
174+
175+
@property
176+
def menu_style(self) -> Optional[str | dict]:
177+
"""CSS styles for the popup menu appearing when the popup button is clicked.
178+
179+
Defaults to:
180+
``{"background": "#ffffff", "borderRadius": "3px", "padding": "0.5em"}``.
181+
182+
:rtype: :class:`str <python:str>` or :class:`dict <python:dict>` or :obj:`None <python:None>`
183+
"""
184+
return self._menu_style
185+
186+
@menu_style.setter
187+
def menu_style(self, value):
188+
try:
189+
self._menu_style = validators.dict(value, allow_empty = True)
190+
except (ValueError, TypeError):
191+
self._menu_style = validators.string(value,
192+
allow_empty = True,
193+
coerce_value = True)
194+
121195
@classmethod
122196
def _get_kwargs_from_dict(cls, as_dict):
123197
kwargs = {
@@ -127,6 +201,9 @@ def _get_kwargs_from_dict(cls, as_dict):
127201
'button_options': as_dict.get('buttonOptions', None),
128202
'events': as_dict.get('events', None),
129203
'icons_url': as_dict.get('iconsURL', None),
204+
'menu_item_hover_style': as_dict.get('menuItemHoverStyle', None),
205+
'menu_item_style': as_dict.get('menuItemStyle', None),
206+
'menu_style': as_dict.get('menuStyle', None),
130207
}
131208

132209
return kwargs
@@ -138,7 +215,10 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:
138215
'bindingsClassName': self.bindings_class_name,
139216
'buttonOptions': self.button_options,
140217
'events': self.events,
141-
'iconsURL': self.icons_url
218+
'iconsURL': self.icons_url,
219+
'menuItemHoverStyle': self.menu_item_hover_style,
220+
'menuItemStyle': self.menu_item_style,
221+
'menuStyle': self.menu_style,
142222
}
143223

144224
return untrimmed
@@ -194,6 +274,9 @@ def _get_kwargs_from_dict(cls, as_dict):
194274
'button_options': as_dict.get('buttonOptions', None),
195275
'events': as_dict.get('events', None),
196276
'icons_url': as_dict.get('iconsURL', None),
277+
'menu_item_hover_style': as_dict.get('menuItemHoverStyle', None),
278+
'menu_item_style': as_dict.get('menuItemStyle', None),
279+
'menu_style': as_dict.get('menuStyle', None),
197280

198281
'breadcrumbs': as_dict.get('breadcrumbs', None),
199282
}

tests/input_files/navigation/navigation/01.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,23 @@
3636
selectButton: function (event) {return true;},
3737
showPopup: function(event) {return true;}
3838
},
39-
iconsURL: 'https://www.somewhere.com/'
39+
iconsURL: 'https://www.somewhere.com/',
40+
menuItemHoverStyle: {
41+
'color': '#5f5e5e',
42+
'fontFamily': 'Roboto',
43+
'fontSize': '12px',
44+
'fontWeight': '400'
45+
},
46+
menuItemStyle: {
47+
'color': '#5f5e5e',
48+
'fontFamily': 'Roboto',
49+
'fontSize': '12px',
50+
'fontWeight': '400'
51+
},
52+
menuStyle: {
53+
'color': '#5f5e5e',
54+
'fontFamily': 'Roboto',
55+
'fontSize': '12px',
56+
'fontWeight': '400'
57+
}
4058
}

tests/options/navigation/test_navigation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@
9393
'selectButton': """function (event) {return true;}""",
9494
'showPopup': """function(event) {return true;}"""
9595
},
96-
'icons_url': 'https://www.somewhere.com/'
96+
'icons_url': 'https://www.somewhere.com/',
97+
'menu_item_style': {"fontWeight": "bold", "fontSize": "12px"},
98+
'menu_item_hover_style': {"fontWeight": "bold", "fontSize": "12px"},
99+
'menu_style': {"border-width": "1px"}
97100
}, None),
98101
]
99102

0 commit comments

Comments
 (0)