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

interactive: added label to display selected queries to user (5/7) #1773

Merged
merged 41 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
752ba75
Add button + tests
dshaaban01 Nov 9, 2023
d9d328a
Copy output button added (and pyclip)
dshaaban01 Nov 9, 2023
0147487
textual update.
dshaaban01 Nov 9, 2023
40e167e
Adresssing Sasha's comments
dshaaban01 Nov 9, 2023
f1361bf
FiXeD sAsHa'S cOmMeNt
dshaaban01 Nov 9, 2023
6ff25f5
fix smth
dshaaban01 Nov 9, 2023
34e1fb4
fix pyclip.
dshaaban01 Nov 9, 2023
375bb8d
pyclip sasfadsf
dshaaban01 Nov 9, 2023
e7d309a
add selection list (i.e the ability to apply passes on the input, dis…
dshaaban01 Nov 9, 2023
75b812c
Update xdsl/interactive/app.py
dshaaban01 Nov 9, 2023
7f2e83c
tests for selection list (i.e. pass application) working and added. o…
dshaaban01 Nov 10, 2023
92ca18d
Change name of clear_input function for clarity, fixing clear_input f…
dshaaban01 Nov 10, 2023
5305773
Update app.py
dshaaban01 Nov 10, 2023
b0ba433
changed name of test
dshaaban01 Nov 10, 2023
b57f5f3
Add label displaying the passes that have been selected
dshaaban01 Nov 10, 2023
bcd6aac
visualization edits
dshaaban01 Nov 10, 2023
2bce16a
when input area is cleared, clear label
dshaaban01 Nov 10, 2023
03200b9
when input clears, deselect all the passes from the selection list (i…
dshaaban01 Nov 10, 2023
db09d87
visual change
dshaaban01 Nov 10, 2023
41af4e0
sashaaaaas commments
dshaaban01 Nov 10, 2023
ae13d14
shitty tests
dshaaban01 Nov 10, 2023
ed7626f
Combined test after addressing sasha's comment
dshaaban01 Nov 10, 2023
e186341
fixed tests.
dshaaban01 Nov 10, 2023
8faac9e
Merge branch 'dalia/mvp2.2' into dalia/mvp2.3
dshaaban01 Nov 10, 2023
375f288
Merge branch 'dalia/mvp2.0' into dalia/mvp2.1
dshaaban01 Nov 10, 2023
ecb4014
Merge branch 'dalia/mvp2.1' into dalia/mvp2.2
dshaaban01 Nov 10, 2023
1a03b91
Merge branch 'dalia/mvp2.2' into dalia/mvp2.3
dshaaban01 Nov 10, 2023
d169e46
sasha
dshaaban01 Nov 10, 2023
12ae70c
sashaaaa
dshaaban01 Nov 10, 2023
9f38005
Merge branch 'dalia/mvp2.2' into dalia/mvp2.3
dshaaban01 Nov 10, 2023
bfdcc3e
change name
dshaaban01 Nov 11, 2023
9fb1ba6
Merge branch 'dalia/mvp2.1' into dalia/mvp2.2
dshaaban01 Nov 11, 2023
08e350a
Merge branch 'dalia/mvp2.2' into dalia/mvp2.3
dshaaban01 Nov 11, 2023
14f4d11
sasha's comments
dshaaban01 Nov 12, 2023
f2e99ea
sashas comments
dshaaban01 Nov 12, 2023
6caf2e0
sasha
dshaaban01 Nov 13, 2023
95fd6aa
Merge branch 'dalia/mvp2.2' into dalia/mvp2.3
dshaaban01 Nov 13, 2023
5c1e3ff
Merge branch 'main' into dalia/mvp2.3
dshaaban01 Nov 13, 2023
fa5126a
precommit
dshaaban01 Nov 13, 2023
85eb94d
sashas comments
dshaaban01 Nov 13, 2023
062aaeb
done
dshaaban01 Nov 13, 2023
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
2 changes: 2 additions & 0 deletions tests/interactive/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async def test_passes():
"""Test pass application has the desired result."""
async with InputApp().run_test() as pilot:
app = cast(InputApp, pilot.app)

# Testing a pass
app.input_text_area.insert(
"""
Expand Down Expand Up @@ -139,6 +140,7 @@ async def test_passes():

# assert that the Output Text Area has changed accordingly
await pilot.pause()

assert (
app.output_text_area.text
== """builtin.module {
Expand Down
20 changes: 14 additions & 6 deletions xdsl/interactive/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Execute `xdsl-gui` in your terminal to run it.

Run `terminal -m xdsl.interactive.app:InputApp --dev` to run in development mode. Please

be sure to install `textual-dev` to run this command.
"""

Expand All @@ -12,9 +13,9 @@
from rich.style import Style
from textual import events, on
from textual.app import App, ComposeResult
from textual.containers import Horizontal, Vertical
from textual.containers import Horizontal, ScrollableContainer, Vertical
from textual.reactive import reactive
from textual.widgets import Button, Footer, SelectionList, TextArea
from textual.widgets import Button, Footer, Label, SelectionList, TextArea
from textual.widgets.text_area import TextAreaTheme

from xdsl.dialects.builtin import ModuleOp
Expand Down Expand Up @@ -67,13 +68,18 @@ class InputApp(App[None]):

input_text_area: TextArea
output_text_area: OutputTextArea

passes_selection_list: SelectionList[type[ModulePass]]

selected_query_label = Label("", id="selected_passes_label")
superlopuh marked this conversation as resolved.
Show resolved Hide resolved
"""Display selected passes"""

def __init__(self):
self.input_text_area = TextArea(id="input")
self.output_text_area = OutputTextArea(id="output")
self.passes_selection_list = SelectionList(id="passes_selection_list")
self.passes_selection_list: SelectionList[type[ModulePass]] = SelectionList(
superlopuh marked this conversation as resolved.
Show resolved Hide resolved
id="passes_selection_list"
)
super().__init__()

def compose(self) -> ComposeResult:
Expand All @@ -84,8 +90,10 @@ def compose(self) -> ComposeResult:
and sort the list in alphabetical order.
"""

yield self.passes_selection_list

with Horizontal(id="selected_passes_and_list_horizontal"):
yield self.passes_selection_list
with ScrollableContainer(id="selected_passes"):
yield self.selected_query_label
with Horizontal(id="input_output"):
with Vertical(id="input_container"):
yield self.input_text_area
Expand Down Expand Up @@ -153,7 +161,7 @@ def on_mount(self) -> None:
self.query_one(
"#passes_selection_list"
).border_title = "Choose a pass or multiple passes to be applied."

self.query_one("#selected_passes").border_title = "Selected passes/query"
# aids in the construction of the seleciton list containing all the passes
selections = sorted((value.name, value) for value in ALL_PASSES)

Expand Down
21 changes: 21 additions & 0 deletions xdsl/interactive/app.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,34 @@
align: center middle;
}


# ScrollableContainer(Label)
#selected_passes {
margin: 1 1 1 1;
border: heavy $warning-lighten-1;
border-title-color: $primary;
border-title-align: center;
width: 100%;
height: 100%;
}


# Horizontal( SelectionList, ScrollableContainer(Label) )
#selected_passes_and_list_horizontal{
height: 100%;
layout: grid;
grid-size: 2 1;
grid-columns: 50% 50%;
}

# Horizontal(Button)
#clear_input{
height: 3;
overflow: hidden;
text-opacity: 60%;
}


# Vertical(TextArea, Horizontal(Button))
#input_container {
margin: 1;
Expand Down