Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weather description #92

Closed
Silvanfelix opened this issue Nov 22, 2024 · 5 comments
Closed

Weather description #92

Silvanfelix opened this issue Nov 22, 2024 · 5 comments

Comments

@Silvanfelix
Copy link

How can I add another line for the description?
I managed to get the language to german, but now the description is too long.
I changed the max_lines=3 but it still only shoes two lines. Where do I need to change the code aswell?

ef format_weather_description(weather_description):
if len(weather_description) < 20:
return {1: weather_description, 2: '', 3: ''}

splits = textwrap.fill(weather_description, 20, break_long_words=False,
                       max_lines=3, placeholder='...').split('\n')
weather_dict = {1: splits[0]}
weather_dict[2] = splits[1] if len(splits) > 1 else ''
return weather_dict
@mendhak
Copy link
Owner

mendhak commented Nov 22, 2024

Try this:

def format_weather_description(weather_description):
    if len(weather_description) < 20:
        return {1: weather_description, 2: '', 3: ''}

    splits = textwrap.fill(weather_description, 20, break_long_words=False,
                           max_lines=3, placeholder='...').split('\n')
    weather_dict = {1: splits[0]}
    weather_dict[2] = splits[1] if len(splits) > 1 else ''
    weather_dict[3] = splits[2] if len(splits) > 2 else ''
    return weather_dict

You'll need to add the third line here:

'WEATHER_DESC_2': weather_desc[2],

And also in the SVG layout file.

@Silvanfelix
Copy link
Author

image

Is it the screen-output-weather.svg file or which file do you mean, to edit the layout?

@mendhak
Copy link
Owner

mendhak commented Nov 22, 2024

By default it should be screen-template.1.svg but if you picked any other LAYOUT variable from here, then the corresponding number. eg if you did SCREEN_LAYOUT=2, then edit screen-template.2.svg.

@Silvanfelix
Copy link
Author

It worked perfect
thanks a lot

@mendhak
Copy link
Owner

mendhak commented Nov 22, 2024

Very good!

@mendhak mendhak closed this as completed Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants