maoschanz / maoschanz/drawing

Drawing 0.8.5 fails to open images due to KeyError('outline') in text tool settings

Open
#698 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
869
Forks
106
PR merge metrics
No merged PRs in 30d

Description

# Drawing 0.8.5 fails to open images due to KeyError('outline') in text tool settings

## Environment

* Application: Drawing
* Version: 0.8.5-2
* Installation source: Ubuntu Jammy repository
* Distribution: Zorin OS Lite 17.3 (Ubuntu Jammy based)
* Architecture: amd64

## Summary

Drawing stopped opening image files correctly after recent system updates (Drawing itself was not updated).

Previously, double-clicking an image in the file manager opened it immediately in Drawing. Now, double-clicking launches Drawing but only shows a blank canvas. Images can no longer be opened directly from the file manager.

Running Drawing from the terminal with an image path reproduces the issue and reveals a traceback.

## Steps to Reproduce

1. Set Drawing as the default application for PNG files.
2. Double-click an image file, or run:

```bash
drawing image.png
```

3. Observe that Drawing opens but does not load the image.

## Expected Behavior

The image should open normally.

If a stored preference is invalid or unsupported, Drawing should fall back to a default value instead of preventing image loading.

## Actual Behavior

Drawing fails while restoring tool settings and raises:

```text
KeyError: 'outline'
```

A second exception then occurs in the error-handling code:

```text
AttributeError: 'KeyError' object has no attribute 'message'
```

## Relevant dconf Settings

Output of:

```bash
dconf dump /com/github/maoschanz/drawing/
```

```text
[/]
last-active-tool='text'
last-version='0.8.5'
maximized=true

[tools-options]
last-active-shape='polygon'
last-delete-replace='alpha'
last-font-name='Uroob'
last-left-rgba=['0.2', '0.8196078431372549', '0.47843137254901963', '1.0']
last-right-rgba=['0.9764705882352941', '0.9411764705882353', '0.4196078431372549', '1.0']
last-shape-filling='empty'
last-size=7
last-text-background='outline'
use-antialiasing=true
```

The string value `outline` appears to be directly related to the exception.

## Full Traceback

```text
Error opening this file. /usr/bin/drawing isn't an image.

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/drawing/window.py", line 156, in init_window_content_async
self.build_new_image()
File "/usr/lib/python3/dist-packages/drawing/window.py", line 302, in build_new_image
self.set_picture_title()
File "/usr/lib/python3/dist-packages/drawing/window.py", line 641, in set_picture_title
subtitle = self.active_tool().get_edition_status()
File "/usr/lib/python3/dist-packages/drawing/tool_text.py", line 87, in get_edition_status
bg_label = {
KeyError: 'outline'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/drawing/main.py", line 197, in on_cli
self.open_window_with_content(f, False)
File "/usr/lib/python3/dist-packages/drawing/main.py", line 119, in open_window_with_content
win.init_window_content_async(content_params)
File "/usr/lib/python3/dist-packages/drawing/window.py", line 158, in init_window_content_async
self.prompt_message(True, excp.message)
AttributeError: 'KeyError' object has no attribute 'message'
```

## Additional Notes

* The issue appeared after recent system updates.
* Drawing itself was not intentionally updated.
* No `~/.config/drawing` directory exists on this system.
* Settings appear to be stored in dconf.
* It seems possible that a previously valid value (`last-text-background='outline'`) is no longer handled correctly by `tool_text.py`.
* Even if the stored value is unsupported, the application should ideally fall back to a default state rather than fail to open images.

Contributor guide

Open the contributing guide

Research direction

Start with drawing/tool_text.py at get_edition_status(), then trace the image-opening path through drawing/window.py and drawing/main.py using the supplied traceback. Reproduce with `drawing image.png` and the shown dconf value; done means images open when that stored text-background value is present and the error handler does not raise a second exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.