BreezeStyleSheets icon indicating copy to clipboard operation
BreezeStyleSheets copied to clipboard

Can't find dark.qss?

Open antongonz opened this issue 2 years ago • 2 comments

Hello,

When I try to build, I get the following error:

P:\BreezeStyleSheets>python configure.py --compiled-resource breeze_resources.py Traceback (most recent call last): File "configure.py", line 371, in sys.exit(main()) File "configure.py", line 368, in main configure(parse_args(argv)) File "configure.py", line 358, in configure subprocess.check_call( File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 359, in check_call retcode = call(*popenargs, **kwargs) File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 340, in call with Popen(*popenargs, **kwargs) as p: File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

UPDATE: I got this working by getting rid of "--compiled-resource breeze_resources.py" This worked, however the window title bar is still white. Any idea why that is?

Thanks!

antongonz avatar Jun 24 '22 12:06 antongonz

For the first issue, it's possible it's a bug on my end. As for the second one, Windows does not allow you to change the Window titlebar style through Qt. The only solution is to remove it entirely, and implement your own. This is a lot of work, so I've done most of it for you. You're free to copy and paste the code with the same license as the project uses (MIT, requires attribution and reproduction of the license but allows commercial use).

An example doing so can be found here. Please note the caveats described here:

https://github.com/Alexhuszagh/BreezeStyleSheets/blob/9ade91d4da1dd0eaf885793d61f8455ca08065d3/example/titlebar.py#L98-L100

Alexhuszagh avatar Jun 24 '22 19:06 Alexhuszagh

FYI: if you're on Windows, then you might be able to use platform-specific APIs (the WinAPI) to change the titlebar style, but this isn't cross-platform nor available in Qt. As far as implementing your own custom titlebar, if you ever plan on having Linux users, it's a terrible idea due to design choices in Wayland (X11 works fine).

Note you can test if your application is using Wayland or X11 via environment variables:

# Use `XDG_SESSION_TYPE`, since we can override it for X11.
IS_WAYLAND = os.environ.get('XDG_SESSION_TYPE') == 'wayland'
IS_XWAYLAND = os.environ.get('XDG_SESSION_TYPE') == 'xwayland'
IS_X11 = os.environ.get('XDG_SESSION_TYPE') == 'x11'
# We can run X11 on Wayland, but this doesn't support certain
# features like mouse grabbing, so we don't use it here.
IS_TRUE_WAYLAND = 'WAYLAND_DISPLAY' in os.environ

So if you really want to, you can have a custom titlebar for everything besides Wayland.

Alexhuszagh avatar Jun 24 '22 20:06 Alexhuszagh

Closed since this is now documented, with an example provided, and the rest is platform limitations with how title bars work.

Alexhuszagh avatar Nov 18 '22 23:11 Alexhuszagh