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

Parse png buttons #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Parse png buttons #2

wants to merge 2 commits into from

Conversation

johanmalm
Copy link
Collaborator

@Consolatis - any high level review comments?

TODO

  • Parse svg icons (come themes contain a file:///.....svg instead of the base64)
  • Remove old icons when parsing new theme

@Consolatis
Copy link
Member

Consolatis commented Aug 16, 2023

Maybe you could try to also parse the mime type, e.g. image/png to either

  • ensure you got some actual png file there
  • or if its in a different format, you could try to load it with some external library (Pillow for example, should be packaged basically everywhere) and then save it as png.

The b64decode part (or the whole line parsing) should likely be encapsulated in a try / except block.

When looking at it from a higher level, maybe something generic like get_attribute_value(lines, "button.close.titlebutton", "background-image") might be useful. That could then be called by create_one_icon() so all that is left to do there is parse the actual value / do the b64 decoding / store as png.

@johanmalm
Copy link
Collaborator Author

Thanks. Will carry on another day.

Re: svg icons, we could add svg support directly to labwc too. Following recent refactoring it wouldn't be many lines 😄

Probably just this:

https://github.com/jgmenu/jgmenu/blob/95019972da73cc71680ea30ebb4f8a8a3212f1b4/src/icon.c#L101-L136

@Consolatis
Copy link
Member

Re: svg icons, we could add svg support directly to labwc too. Following recent refactoring it wouldn't be many lines 😄

Sounds good to me, doing it in labwc might even be beneficial because we could link this up to the autoscaling buffer and thus newly render it based on output scale changes, similar to the title. Just an idea, we don't have to do that.

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

Successfully merging this pull request may close these issues.

2 participants