Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaosSokos committed Feb 22, 2025
1 parent 4d22b3a commit a6a9bf0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/a10y/a10y.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Screen {
Requests {
layout: grid;
grid-size: 6 5;
grid-columns: 0.7fr 0.5fr 0.1fr 1fr 1fr 1fr;
grid-columns: 0.7fr 0.5fr 0.5fr 1fr 1fr 1fr;
grid-rows: 1 3 3 3 3;
max-height: 20;
grid-gutter: 1;
Expand All @@ -29,26 +29,26 @@ Requests {
}

#nodes-container {
row-span: 4;
row-span: 3;
max-width: 24;
}
#reload-nodes{
row-span:2;
height:100%;
align: center middle;
text-align: center;
margin: 1 0;
text-align: center;

}
#nodes {
height: 100%;
}

#timeframe,#nslc{
column-span: 4;
#send-request{
column-span:4;
width:100%;
}
#options, #send-request {
#options,#nslc,#timeframe{
column-span: 5;
width:100%
width:100%;
}

.request-label {
Expand Down
15 changes: 15 additions & 0 deletions src/a10y/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ def save_nodes_to_cache(self, nodes):
with open(CACHE_FILE, "w", encoding="utf-8") as f:
json.dump({"nodes": nodes}, f)

def on_checkbox_changed(self, event: Checkbox.Changed) -> None:
"""Toggle between 'Select all' and 'Deselect all' when the checkbox is clicked."""
all_nodes_checkbox = self.query_one("#all-nodes") # Get the checkbox widget
nodes_list = self.query_one("#nodes") # Get the nodes list

if all_nodes_checkbox.value:
nodes_list.deselect_all()
all_nodes_checkbox.label = "Select all" # ✅ Change to "Select all"
else:
nodes_list.select_all()
all_nodes_checkbox.label = "Deselect all" # ✅ Change to "Deselect all"

all_nodes_checkbox.refresh() # ✅ Force UI update




Expand Down Expand Up @@ -268,6 +282,7 @@ def change_button_disabled(self, disabled: bool) -> None:

@work(exclusive=True, thread=True)
async def on_button_pressed(self, event: Button.Pressed) -> None:
self.call_from_thread(lambda: self.change_button_disabled(True))
# Disable the button to prevent multiple clicks
if event.button.id == "reload-nodes":
button = self.query_one("#reload-nodes")
Expand Down
7 changes: 5 additions & 2 deletions src/a10y/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, nodes_urls, config, *args, **kwargs):
def compose(self) -> ComposeResult:
yield Static("[b]Requests Control[/b]", id="request-title")
yield Container(
Checkbox("Select all Nodes", True, id="all-nodes"),
Checkbox("Deselect all ", False, id="all-nodes"),
SelectionList(*self.nodes_urls, id="nodes"),
id="nodes-container"

Expand Down Expand Up @@ -58,7 +58,8 @@ def compose(self) -> ComposeResult:

id="nslc"
)
yield Button("Reload Nodes\n(Restart the app)", variant="primary", id="reload-nodes", disabled=False)


yield Horizontal(
Label("Start Time:", classes="request-label"),
Input(classes="date-input", id="start", value=self.config["default_starttime"]),
Expand Down Expand Up @@ -89,13 +90,15 @@ def compose(self) -> ComposeResult:
Checkbox("M", self.config["default_quality_M"], id="qm"),
id="options"
)
yield Button("Reload Nodes\n(Restart the app)", variant="primary", id="reload-nodes", disabled=False)
yield Horizontal(
Checkbox("Include Restricted", self.config["default_includerestricted"], id="restricted"),
Button("Send", variant="primary", id="request-button",disabled=False),
Input(placeholder="Enter POST file path", value=self.config["default_file"], suggester=FileSuggester(), id="post-file"),
Button("File", variant="primary", id="file-button"),
id="send-request"
)



class Status(Static):
Expand Down

0 comments on commit a6a9bf0

Please sign in to comment.