Skip to content

Commit

Permalink
Merge pull request #177 from dlyongemallo/no_demo_when_command_line_file
Browse files Browse the repository at this point in the history
Open demo graph only if no files specified on command line.
  • Loading branch information
jvdwetering authored Nov 10, 2023
2 parents c2e6d1c + 10a7e63 commit 7039f8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@pytest.fixture
def app(qtbot: QtBot) -> MainWindow:
mw = MainWindow()
mw.open_demo_graph()
qtbot.addWidget(mw)
return mw

Expand Down
7 changes: 5 additions & 2 deletions zxlive/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ def __init__(self) -> None:
parser.addVersionOption()
parser.addPositionalArgument("files", "File(s) to open.", "[files...]")
parser.process(self)
for f in parser.positionalArguments():
self.main_window.open_file_from_path(f)
if not parser.positionalArguments():
self.main_window.open_demo_graph()
else:
for f in parser.positionalArguments():
self.main_window.open_file_from_path(f)


def main() -> None:
Expand Down
1 change: 1 addition & 0 deletions zxlive/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def __init__(self) -> None:

self._reset_menus(False)

def open_demo_graph(self) -> None:
graph = construct_circuit()
self.new_graph(graph)

Expand Down

0 comments on commit 7039f8f

Please sign in to comment.