Skip to content

Commit 434217e

Browse files
authored
Merge pull request #13 from bourdaisj/add-tooltip-and-snackbar-to-save-button
feat(file_editor): more user feedback when saving file editor
2 parents 7290869 + eff8b5b commit 434217e

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

‎peacock_trame/app/fileEditor.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def write_file(self):
177177
print(f"Writing to {path}...")
178178
with open(path, "w") as f:
179179
f.write(self.tree.getInputFileString())
180+
self._server.state.info_snackbar = True
180181

181182
def add_to_simput_model(self, type_info):
182183
simput_type = type_info.path

‎peacock_trame/app/main.py‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ def on_tab_change(tab_idx):
7070
if tab_idx == 2:
7171
self.exodus_viewer.check_file()
7272

73+
vuetify.VSnackbar(
74+
"Configuration successfully saved to {{ input_file }}",
75+
v_model=(
76+
"info_snackbar",
77+
False,
78+
),
79+
color="success",
80+
left=True,
81+
)
82+
7383
with html.Div(
7484
style="position: relative; display: flex; border-bottom: 1px solid gray",
7585
):
@@ -95,12 +105,17 @@ def on_tab_change(tab_idx):
95105
v_if=("tab_idx == 0",),
96106
style="height: 100%; width: 100%; display: flex; align-items: center; justify-content: flex-end;",
97107
):
98-
with vuetify.VBtn(
99-
click=self.file_editor.write_file,
100-
icon=True,
101-
style="z-index: 1;",
102-
):
103-
vuetify.VIcon("mdi-content-save-outline")
108+
with vuetify.VTooltip(
109+
"Saved current configuration to file", position="left"
110+
), vuetify.Template(v_slot_activator=("{ on, attrs }",)):
111+
with vuetify.VBtn(
112+
click=self.file_editor.write_file,
113+
icon=True,
114+
style="z-index: 1;",
115+
v_on="on",
116+
v_bind="attrs",
117+
):
118+
vuetify.VIcon("mdi-content-save-outline")
104119

105120
with html.Div(
106121
style="height: 100%; width: 300px; display: flex; align-items: center; justify-content: space-between;",

0 commit comments

Comments
 (0)