shlomif / PySolFC

A comprehensive, feature-rich, open source, and portable, collection of Solitaire games.
http://pysolfc.sourceforge.net/
GNU General Public License v3.0
445 stars 99 forks source link

Implement GTTK support #237

Open daemonspudguy opened 2 years ago

daemonspudguy commented 2 years ago

GTTK is a project that allows Tkinter programs written in Python to use the GTK theme of a Linux system. This would make PySolFC fit in far better with other programs on the system.

https://github.com/TkinterEP/python-gttk

MorsMortium commented 2 years ago

Not sure if this is needed. I'm using gtkTtk https://github.com/Geballin/gtkTtk which themes every tk application. LLW9pWF

daemonspudguy commented 2 years ago

I have gtkTtk installed and set as default, but PySol isn't using it.

MorsMortium commented 2 years ago

PySol has its own theme chooser, in Options/set theme. Though that would be an improvement, if it took the default theme, if it's set

daemonspudguy commented 2 years ago

It doesn't see gtkTtk, either.

MorsMortium commented 2 years ago

There's a single problem, that I had with it. But thats only if even the ttk theme chooser doesn't display the theme. Like this: Screenshot_20220411_211313 That means it can't find your gtk theme, because it looks for the .gtkrc-2.0 file, in your home directory Mine is like this, but with a dot in the beginning and without ".txt", github is weird. gtkrc-2.0.txt But if that's not your problem I'm not really sure, because this is the only problem i had with it.

joeraz commented 2 years ago

I tested this and was able to use the gtkTtk theme fine. Installing gtkTtk added it to the Set Theme menu without issue. I'll add looking into using the ttk theme chooser's default theme to my to do list, though I'd probably need to do a bit more research as to how that works before I'd be able to do that.

daemonspudguy commented 2 years ago

I think I know what I've been doing wrong. I've been installing PySolFC into a venv, as I couldn't figure out how else to install it.

ssokolow commented 1 year ago

It's a shame gtkTtk (and thus python-gttk) uses GTK+ 2.x or I'd include it in the Flatpak I'm working on to make a better first impression.

(Geeqie has taught me that Flatpak doesn't provide an auto-loadable theme package for the GTK 2.x version of Breeze, so GTK+ 2.x apps under Flatpak on KDE use the CDE-esque fallback theme and look terrible.)

I wonder how much work it'd be to resurrect the experimental GTK backend by porting it from PyGTK to PyGObject and then adding a copy of gtk-nocsd to the Flatpak image to ensure that it can find it if the host desktop specifies LD_PRELOAD=libgtk3-nocsd.so.0. (I imagine that'd also automatically give it native Wayland support since it shouldn't need to do the kind of X11-specific stuff my own ported project does.)

MorsMortium commented 1 year ago

I actually made some issues in the most recent fork of gtkTtk (which is the same that is available from AUR). The developer still works on it, and made a release which fixed one bug I had and half fixed another. But I haven't made an issue with GTK3 yet. I am also not sure if they accept PRs.

hifron commented 5 months ago

time to purge old themes and not let user think and if android needs something it would be exception if not found other solution... Time for GTK2(and maybe even 3) is up. If PyGTK make development a breeze, why not? There should be a lot of users of it...

ssokolow commented 5 months ago

time to purge old themes and not let user think and if android needs something it would be exception if not found other solution... Time for GTK2(and maybe even 3) is up. If PyGTK make development a breeze, why not? There should be a lot of users of it...

Could you rephrase that? I understand your individual sentences, but I'm sure what stance they're all in support of.

hifron commented 5 months ago

https://github.com/shlomif/PySolFC/blob/master/docs/README.SOURCE

A very experimental version for GTK+ 2 (using the pygnome and pygtk bindings) did exist as well. Due to pygnome and pygtk being obsoleted, a rewrite against GObject Introspection Python API would be needed to make the abandoned code work with GTK+ 3 or 4.

PySol has been designed so that it can run under multiple UI toolkits -
  due to the dynamic nature of Python this can even be under control
  of a runtime option.

  The preferred toolkit is Tcl/Tk using the Tkinter bindings which
  ship with every Python installation.

  The Kivy UI adapts PySol for mobile devices and is mainly used for
  PySolFC's Android port. See README.kivy for more details.

  A very experimental version for GTK+ 2 (using the pygnome and pygtk
  bindings) did exist as well. Due to pygnome and pygtk being obsoleted,
  a rewrite against GObject Introspection Python API would be needed
  to make the abandoned code work with GTK+ 3 or 4.

  Another exciting idea is to use JPython to make PySol run under a
  Java VM using Swing as the toolkit.

  Because Tkinter is the "main" interface other toolkit layers have
  to emulate a limited subset of Tkinter's API. This should hopefully
  not prove too difficult in practice.
ssokolow commented 5 months ago

I'm aware of that. I'm asking what you meant by what you said. For example:

"time to purge old themes and not let user think and if android needs something it would be exception if not found other solution" is hard to make sense of.

For example, the "and not let users think" sounds like it's sarcastic, but I know some people whose first language isn't English who have used similar phrasings and intended them to mean "and protect users who just want to play the game from stepping on landmines" instead.

hifron commented 5 months ago

It shouldn't look like 8-bits and installed like it predecessor...

ssokolow commented 5 months ago

While I still don't feel confident I understand what thesis all of this is in support of, I think I understand enough to guess that this is off-topic and you should be opening a new issue that says something like "Delete GTK+ 2.x backend".

hifron commented 5 months ago

I would say find new programmers to make it happen their way and let Tk go. Flutter missing but don't know how make it the Python way.

ssokolow commented 5 months ago

I would say find new programmers to make it happen their way and let Tk go. Flutter missing but don't know how make it the Python way.

Doesn't matter. It's still off-topic for this issue thread.

MorsMortium commented 5 months ago

I tested this and was able to use the gtkTtk theme fine. Installing gtkTtk added it to the Set Theme menu without issue. I'll add looking into using the ttk theme chooser's default theme to my to do list, though I'd probably need to do a bit more research as to how that works before I'd be able to do that.

~/.Xresources has this line for me: *TkTheme: gtkTtk

daemonspudguy commented 5 months ago

Seeing this issue be revived 2 years after I wrote it with irrelevant nonsense outside the scope of the project was not something I expected to wake up to this morning.

joeraz commented 5 months ago

@MorsMortium - Was mostly thinking about how to pull the name of the theme from in the PySol code itself.

@hifron - Yes, make a new issue for this. It would make it easier to track.

MorsMortium commented 5 months ago

@joeraz If you take a look at the actual theme chooser code, even that gets it from the file, I mentioned: https://github.com/Geballin/TTK-Theme-chooser/blob/master/ttk-theme-chooser.tcl line 45 proc actual_default_theme {} {