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

Question: How are end users using qtawesome ? #234

Open
pedromorgan opened this issue May 4, 2023 · 3 comments
Open

Question: How are end users using qtawesome ? #234

pedromorgan opened this issue May 4, 2023 · 3 comments

Comments

@pedromorgan
Copy link

assume its .py

  • hardcoded strings
  • qt-resource files hacking
  • python classes, mods etc ?

A Cat can be skinned in many ways..

@dalthviz
Copy link
Member

Hi @pedromorgan ! At least from the Spyder side what we do is that we use QtAwesome through some utility functions that helps us either load a custom iconic font or use the ones bundled with QtAwesome. There we also have a mapping to name a specific set ofarguments for how an icon should look (identifier, color, scale, positioning, etc). For more info you can check https://github.com/spyder-ide/spyder/blob/518f8d1c663735d296d1eb784aa503df1654ea9d/spyder/utils/icon_manager.py and more specifically https://github.com/spyder-ide/spyder/blob/518f8d1c663735d296d1eb784aa503df1654ea9d/spyder/utils/icon_manager.py#L106 and https://github.com/spyder-ide/spyder/blob/518f8d1c663735d296d1eb784aa503df1654ea9d/spyder/utils/icon_manager.py#L340

Let us know if the info above helps!

@zkovari
Copy link

zkovari commented Oct 18, 2023

@dalthviz I used to do the same for years - using some utility functions - but it doesn't scale for me anymore. Don't you experience similar problems in Spyder as the application grows? I already have hundreds of icons with different colors and parameters in my application, and I feel like I'll soon need my own separate GUI just for managing my icons (and colors).

It does sound a bit ridiculous, I must admit :) having a separate GUI for icons only but here's the thing: sometimes I need to refer to the icon (QIcon), sometimes to the icon alias (str), sometimes to its color, while sometimes to the same icon but with different color themes (using my general application theme, for instance). I seldom even need to refer to the same icon but with different options, e.g. different scaling. Plus, I haven't even bothered with dark mode yet...

So what I'll probably implement for myself is a simple Qt GUI where:

  • I can browse all the icons and select the ones I want to use in my application
  • For each selected icon, I can associate a name and customize their look: color, offsets, scales, etc.
    • for offsets and scales, or any stacked icons, I could use a visual editor (e.g., through a QGraphicsView) where I can nicely position the icons as needed
  • I can create an application theme with default colors (e.g., primary, secondary, tertiary). All these colors would be available for all my icons in my pool
  • Furthermore, I could add unique colors to each icon, and all the unique colors would be displayed in one place together - so I could also overview and manage my colors easily
  • Finally, all my configuration would be persisted into a json file and then generated into python. The generated code would be flexible enough so I could refer to the icons (QIcon), to their aliases (e.g., 'save'), to their icon names ('fa.save'), or to their colors (SAVE_COLOR), etc.

Anyway, I just wanted to share. The more I think about it, the more I realize I need this for my project. If you're interested in this, let me know. I could ping you once it's done.

@dalthviz
Copy link
Member

Hi @zkovari thank you for sharing your ideas! And although for the moment I think we have been able to handle things with the icon_manager module mentioned + QtAwesome (as well as other packages to style things like QDarkStyle and QStylizer), is true that when you start to think about it there are quite a good amount of things involved for the icon handling 🤔

Also, pinging @ccordoba12 maybe he could have some perspective/ideas about this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants