This repository was archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Implement APRProofViewer as an APRProof specific TUI #507
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
efaaa8a
kcfg/tui: switch to new NodePrinter technique
ehildenb 2f43001
proof/{tui,style}: implement APRProof specific TUI viewer
ehildenb ac303c1
Merge 2f43001453b903fc1d5f082e63f3baed9d7601a1 into b596b753413203160…
ehildenb 4812d49
Set Version: 0.1.343
rv-auditor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0.1.342 | ||
| 0.1.343 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
|
||
| [tool.poetry] | ||
| name = "pyk" | ||
| version = "0.1.342" | ||
| version = "0.1.343" | ||
| description = "" | ||
| authors = [ | ||
| "Runtime Verification, Inc. <[email protected]>", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #navigation { | ||
| dock: left; | ||
| width: 35%; | ||
| height: 100%; | ||
| layout: vertical; | ||
| } | ||
| #behavior { | ||
| height: 1fr; | ||
| border: solid; | ||
| overflow-x: auto; | ||
| overflow-y: auto; | ||
| } | ||
|
|
||
| .cfg-node { | ||
| height: auto; | ||
| width: auto; | ||
| } | ||
|
|
||
| .hidden { | ||
| display: none; | ||
| } | ||
|
|
||
| #display { | ||
| layout: vertical; | ||
| } | ||
| #info-view { | ||
| height: 2fr; | ||
| border: solid; | ||
| overflow: auto scroll; | ||
| } | ||
| #term-view { | ||
| height: 15fr; | ||
| border: solid; | ||
| overflow: auto scroll; | ||
| } | ||
| #constraint-view { | ||
| height: 5fr; | ||
| border: solid; | ||
| overflow: auto scroll; | ||
| } | ||
| #custom-view { | ||
| height: 15fr; | ||
| border: solid; | ||
| overflow: auto scroll; | ||
| } | ||
| #info { | ||
| width: auto; | ||
| height: auto; | ||
| } | ||
| #term { | ||
| width: auto; | ||
| height: auto; | ||
| } | ||
| #constraint { | ||
| width: auto; | ||
| height: auto; | ||
| } | ||
| #custom { | ||
| width: auto; | ||
| height: auto; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
| from textual.containers import Horizontal, Vertical | ||
| from textual.widget import Widget | ||
| from textual.widgets import Footer | ||
|
|
||
| from ..kcfg.tui import GraphChunk, KCFGViewer, NodeView | ||
| from .show import APRProofShow | ||
|
|
||
| if TYPE_CHECKING: | ||
| from collections.abc import Callable, Iterable | ||
|
|
||
| from textual.app import ComposeResult | ||
|
|
||
| from ..kcfg.show import NodePrinter | ||
| from ..kcfg.tui import KCFGElem | ||
| from ..ktool.kprint import KPrint | ||
| from .reachability import APRProof | ||
|
|
||
|
|
||
| class APRProofBehaviorView(Widget): | ||
| _proof: APRProof | ||
| _kprint: KPrint | ||
| _minimize: bool | ||
| _node_printer: NodePrinter | None | ||
| _proof_nodes: Iterable[GraphChunk] | ||
|
|
||
| def __init__( | ||
| self, | ||
| proof: APRProof, | ||
| kprint: KPrint, | ||
| minimize: bool = True, | ||
| node_printer: NodePrinter | None = None, | ||
| id: str = '', | ||
| ): | ||
| super().__init__(id=id) | ||
| self._proof = proof | ||
| self._kprint = kprint | ||
| self._minimize = minimize | ||
| self._node_printer = node_printer | ||
| self._proof_nodes = [] | ||
| proof_show = APRProofShow(kprint, node_printer=node_printer) | ||
| for lseg_id, node_lines in proof_show.pretty_segments(self._proof, minimize=self._minimize): | ||
| self._proof_nodes.append(GraphChunk(lseg_id, node_lines)) | ||
|
|
||
| def compose(self) -> ComposeResult: | ||
| return self._proof_nodes | ||
|
|
||
|
|
||
| class APRProofViewer(KCFGViewer): | ||
| CSS_PATH = 'style.css' | ||
|
|
||
| _proof: APRProof | ||
|
|
||
| def __init__( | ||
| self, | ||
| proof: APRProof, | ||
| kprint: KPrint, | ||
| node_printer: NodePrinter | None = None, | ||
| custom_view: Callable[[KCFGElem], Iterable[str]] | None = None, | ||
| minimize: bool = True, | ||
| ) -> None: | ||
| super().__init__(proof.kcfg, kprint, node_printer=node_printer, custom_view=custom_view, minimize=minimize) | ||
| self._proof = proof | ||
|
|
||
| def compose(self) -> ComposeResult: | ||
| yield Horizontal( | ||
| Vertical( | ||
| APRProofBehaviorView(self._proof, self._kprint, node_printer=self._node_printer, id='behavior'), | ||
| id='navigation', | ||
| ), | ||
| Vertical(NodeView(self._kprint, custom_view=self._custom_view, id='node-view'), id='display'), | ||
| ) | ||
| yield Footer() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just a clone of
src/pyk/kcfg/style.css? I wonder if it would be better to haveAPRProofViewerinherit the styling from its superclass.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmmm, that would be a good idea, sorry I didn't see this before it was merged.