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

GTK Canvas doesn't set font description correctly #1991

Closed
rmartin16 opened this issue Jun 18, 2023 · 0 comments · Fixed by #2029
Closed

GTK Canvas doesn't set font description correctly #1991

rmartin16 opened this issue Jun 18, 2023 · 0 comments · Fixed by #2029
Labels
bug A crash or error in behavior. linux The issue relates Linux support.

Comments

@rmartin16
Copy link
Member

rmartin16 commented Jun 18, 2023

Describe the bug

Canvas crashes with TypeError on Linux.

Traceback (most recent call last):
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app_packages/toga_gtk/app.py", line 98, in gtk_startup
    self.interface.startup()
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app/canvas/app.py", line 158, in startup
    self.render_drawing()
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app/canvas/app.py", line 378, in render_drawing
    self.draw_shape(context)
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app/canvas/app.py", line 388, in draw_shape
    drawing_instructions(context, factor)
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app/canvas/app.py", line 509, in draw_instructions
    width, height = self.canvas.measure_text(text, font, tight=True)
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app_packages/toga/widgets/canvas.py", line 748, in measure_text
    return self._impl.measure_text(text, font, tight=tight)
  File "/home/russell/github/beeware/toga/examples/canvas/build/canvas/pop/jammy/canvas-0.0.1/usr/lib/canvas/app_packages/toga_gtk/widgets/canvas.py", line 232, in measure_text
    layout.set_font_description(self.native)
TypeError: argument desc: Expected Pango.FontDescription, but got gi.repository.Gtk.DrawingArea

Steps to reproduce

Run briefcase run linux system for the canvas or tutorial4 examples.

Expected behavior

Does not crash.

Screenshots

No response

Environment

  • Operating System: pop os 22.04
  • Python version: 3.10.12
  • Software versions:
    • Briefcase: 0.3.15.dev361+g02f412be
    • Toga: toga-gtk-0.3.2.dev380+g7408a792.d20230618

Logs

briefcase.2023_06_18-16_23_56.run.log

Additional context

No response

@rmartin16 rmartin16 added bug A crash or error in behavior. linux The issue relates Linux support. labels Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. linux The issue relates Linux support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant