zxcalc / zxlive

A graphical tool for the ZX calculus
Apache License 2.0
51 stars 20 forks source link

Multiple runs on Linux crash due to issues with loading config #331

Closed caldwellb closed 4 months ago

caldwellb commented 4 months ago

when running zxlive on linux, the first run will properly grab the system font size setting. on exiting the program, it saves to a file ~/.config/zxlive/zxlive.conf, and on subsequent runs the error message below appears.

  File "/usr/local/bin/zxlive", line 5, in <module>
    from zxlive.app import main
  File "/usr/local/lib/python3.12/site-packages/zxlive/__init__.py", line 17, in <module>
    from . import app
  File "/usr/local/lib/python3.12/site-packages/zxlive/app.py", line 25, in <module>
    from .mainwindow import MainWindow
  File "/usr/local/lib/python3.12/site-packages/zxlive/mainwindow.py", line 30, in <module>
    from .base_panel import BasePanel
  File "/usr/local/lib/python3.12/site-packages/zxlive/base_panel.py", line 10, in <module>
    from .eitem import EItem
  File "/usr/local/lib/python3.12/site-packages/zxlive/eitem.py", line 28, in <module>
    from .vitem import VItem, EITEM_Z
  File "/usr/local/lib/python3.12/site-packages/zxlive/vitem.py", line 32, in <module>
    from .settings import display_setting
  File "/usr/local/lib/python3.12/site-packages/zxlive/settings.py", line 212, in <module>
    display_setting = DisplaySettings()
                      ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zxlive/settings.py", line 190, in __init__
    self.update()
  File "/usr/local/lib/python3.12/site-packages/zxlive/settings.py", line 199, in update
    get_settings_value("font/size", int)
  File "/usr/local/lib/python3.12/site-packages/zxlive/common.py", line 30, in get_settings_value
    raise ValueError(f"Unexpected type for {val}: expected {_type}, got {type(val)}")
ValueError: Unexpected type for 11: expected <class 'int'>, got <class 'str'>

The ValueError for 11 refers to the font size loaded from ~/.config/zxlive/zxlive.conf. Deleting the folder ~/.config/zxlive will fix this issue temporarily.