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

Open demo graph only if no files specified on command line. #177

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -171,6 +171,7 @@ def __init__(self) -> None:

self._reset_menus(False)

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

Expand Down