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

xdot/ui/elements: Bugfix: Check if GTK default settings are Null #124

Conversation

artyom-poptsov
Copy link
Contributor

When GTK default settings are not present in the system "xdot" fails with the following error:
AttributeError: 'NoneType' object has no attribute 'get_property'

This is because "Gtk.Settings.get_default()" return value can be "Null" when the GTK default settings are not present (see
https://docs.gtk.org/gtk3/type_func.Settings.get_default.html.) This patch fixes this error by adding additional check for Null object before setting the default font name.

  • xdot/ui/elements.py (TextShape): Don't set "DEFAULT_FONTNAME" constant. (TextShape.init): Set the default font name as "default_fontname" class field with an additional check for "Null" value. (TextShape._draw): Use "self.default_fontname".

When GTK default settings are not present in the system "xdot" fails with the
following error:
  AttributeError: 'NoneType' object has no attribute 'get_property'

This is because "Gtk.Settings.get_default()" return value can be "Null" when the
GTK default settings are not present (see
<https://docs.gtk.org/gtk3/type_func.Settings.get_default.html>.)  This patch
fixes this error by adding additional check for Null object before setting the
default font name.

* xdot/ui/elements.py (TextShape): Don't set "DEFAULT_FONTNAME" constant.
  (TextShape.__init__): Set the default font name as "default_fontname" class
  field with an additional check for "Null" value.
  (TextShape._draw): Use "self.default_fontname".
@jrfonseca
Copy link
Owner

Looks good. Thanks.

@jrfonseca jrfonseca merged commit 098010d into jrfonseca:master Apr 17, 2024
2 checks passed
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