Skip to content

Commit

Permalink
Fix crash due to wrong type for snap-granularity combo pref dict key.
Browse files Browse the repository at this point in the history
Fixes #214.
  • Loading branch information
dlyongemallo committed Dec 16, 2023
1 parent 9822dda commit 949ac00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions test/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from zxlive.edit_panel import GraphEditPanel
from zxlive.mainwindow import MainWindow
from zxlive.proof_panel import ProofPanel
from zxlive.settings_dialog import SettingsDialog


@pytest.fixture
Expand Down Expand Up @@ -89,3 +90,8 @@ def test_start_derivation(app: MainWindow, qtbot: QtBot) -> None:
app.close_action.trigger()
assert app.tab_widget.count() == 1
assert not app.export_tikz_proof.isEnabled()

def test_settings_dialog(app: MainWindow) -> None:
dialog = SettingsDialog(app)
dialog.show()
dialog.close()
2 changes: 1 addition & 1 deletion zxlive/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ToolType(IntEnum):
defaults: Dict[str,Any] = {
"path/custom-rules": "lemmas/",
"color-scheme": "modern-red-green",
"snap-granularity": 4,
"snap-granularity": '4',

"tikz/boundary-export": pyzx.settings.tikz_classes['boundary'],
"tikz/Z-spider-export": pyzx.settings.tikz_classes['Z'],
Expand Down
4 changes: 2 additions & 2 deletions zxlive/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __init__(self, main_window: MainWindow) -> None:
vlayout.addWidget(w)
self.add_setting(form_general, "path/custom-rules", "Custom rules path", 'folder')
self.add_setting(form_general, "color-scheme", "Color scheme", 'combo',data=color_schemes)
self.add_setting(form_general, "snap-granularity", "Snap-to-grid granularity", 'combo',
data={2: "2", 4: "4", 8: "8", 16: "16"})
self.add_setting(form_general, "snap-granularity", "Snap-to-grid granularity", 'combo',
data = {'2': "2", '4': "4", '8': "8", '16': "16"})
self.prev_color_scheme = self.settings.value("color-scheme")
vlayout.addStretch()

Expand Down

0 comments on commit 949ac00

Please sign in to comment.