phillipberndt / fakexrandr

Fake XRandR configurations for multi-head setups with crappy video drivers, like fakexinerama but with xrandr
270 stars 40 forks source link

Ubuntu 22.04 fakexrandr-manage crashes: 'gi.repository.Gtk' object has no attribute 'HBox' #72

Open p0pit0 opened 2 years ago

p0pit0 commented 2 years ago

Ubuntu 22.04 fakexrandr-manage crashes

fakexrandr-manage /usr/bin/fakexrandr-manage:27: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '4.0') before import to ensure that the right version gets loaded. from gi.repository import Gtk, Gdk Traceback (most recent call last): File "/usr/bin/fakexrandr-manage", line 318, in class ConfigurationWidget(Gtk.HBox): File "/usr/lib/python3/dist-packages/gi/overrides/init.py", line 32, in getattr return getattr(self._introspection_module, name) File "/usr/lib/python3/dist-packages/gi/module.py", line 123, in getattr raise AttributeError("%r object has no attribute %r" % ( AttributeError: 'gi.repository.Gtk' object has no attribute 'HBox'

BrutPitt commented 2 years ago

Same identical issue with Fedora 36 (Mate/Marco windows manager)

fakexrandr-manage 
/usr/bin/fakexrandr-manage:37: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '4.0') before import to ensure that the right version gets loaded.
  from gi.repository import Gtk, Gdk
Traceback (most recent call last):
  File "/usr/bin/fakexrandr-manage", line 328, in <module>
    class ConfigurationWidget(Gtk.HBox):
  File "/usr/lib/python3.10/site-packages/gi/overrides/__init__.py", line 32, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib64/python3.10/site-packages/gi/module.py", line 126, in __getattr__
    raise AttributeError("%r object has no attribute %r" % (
AttributeError: 'gi.repository.Gtk' object has no attribute 'HBox'
phillipberndt commented 2 years ago

Does adding import gi; gi.require_version('Gtk', '3.0') to the top of the script, straight before the first other Import, suffice to fix this?

BrutPitt commented 2 years ago

Thanks for the fast reply.

Yes, It works for me. Adding import gi; gi.require_version('Gtk', '3.0'), just after from __future__ import print_function, in fakexrandr-manage script

Thanks again.