Skip to content

Commit

Permalink
feat(weather): add units configuration and enhance weather card settings
Browse files Browse the repository at this point in the history
Added a 'units' configuration option to allow selection between metric and imperial units. Enhanced the weather card settings with additional properties including blur effect, round corners, border color, alignment, direction, distance, and icon size for improved customization.
  • Loading branch information
amnweb committed Jan 10, 2025
1 parent 68f7ef8 commit a8dbf79
Show file tree
Hide file tree
Showing 2 changed files with 308 additions and 51 deletions.
55 changes: 55 additions & 0 deletions src/core/validation/widgets/yasb/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'hide_decimal': False,
'location': 'London',
'api_key': '0',
'units': 'metric',
'icons': {
'sunnyDay': '\ue30d',
'clearNight': '\ue32b',
Expand All @@ -17,6 +18,16 @@
'blizzard': '\uebaa',
'default': '\uebaa'
},
'weather_card': {
'blur': True,
'round_corners': True,
'round_corners_type': 'normal',
'border_color': 'System',
'alignment': 'right',
'direction': 'down',
'distance': 6,
'icon_size': 64
},
'callbacks': {
'on_left': 'do_nothing',
'on_middle': 'do_nothing',
Expand Down Expand Up @@ -51,6 +62,11 @@
'type': 'string',
'default': DEFAULTS['api_key']
},
'units': {
'type': 'string',
'default': DEFAULTS['units'],
'allowed': ['metric', 'imperial']
},
'icons': {
'type': 'dict',
'required': False,
Expand Down Expand Up @@ -98,6 +114,45 @@
},
'default': DEFAULTS['icons']
},
'weather_card': {
'type': 'dict',
'schema': {
'blur': {
'type': 'boolean',
'default': DEFAULTS['weather_card']['blur']
},
'round_corners': {
'type': 'boolean',
'default': DEFAULTS['weather_card']['round_corners']
},
'round_corners_type': {
'type': 'string',
'default': DEFAULTS['weather_card']['round_corners_type'],
'allowed': ['normal', 'small']
},
'border_color': {
'type': 'string',
'default': DEFAULTS['weather_card']['border_color']
},
'alignment': {
'type': 'string',
'default': DEFAULTS['weather_card']['alignment']
},
'direction': {
'type': 'string',
'default': DEFAULTS['weather_card']['direction']
},
'distance': {
'type': 'integer',
'default': DEFAULTS['weather_card']['distance']
},
'icon_size': {
'type': 'integer',
'default': DEFAULTS['weather_card']['icon_size']
}
},
'default': DEFAULTS['weather_card']
},
'callbacks': {
'type': 'dict',
'schema': {
Expand Down
Loading

0 comments on commit a8dbf79

Please sign in to comment.