Skip to content

Commit 5391b78

Browse files
authored
Merge pull request #334 from pcoldico/main
Sept 1, 2026 my profile app
2 parents 21f61db + d525c1f commit 5391b78

39 files changed

Lines changed: 7820 additions & 1368 deletions
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
""""
2+
PDX-License-Identifier: Apache-2.0
3+
Copyright Contributors to the ODPi Egeria project.
4+
5+
This file provides a screen for a user to add a comment to a community for my_egeria.
6+
7+
"""
8+
9+
from textual.app import ComposeResult
10+
from textual.containers import ScrollableContainer
11+
from textual.screen import ModalScreen
12+
from textual.widgets import Header, Static, TextArea, Footer
13+
from pyegeria import Egeria
14+
15+
class AddCommentScreen(ModalScreen):
16+
""" Add a comment to a community the user belongs to """
17+
18+
BINDINGS = [
19+
("s", "save_comment", "Save Comment"),
20+
("c", "cancel", "Cancel")
21+
]
22+
23+
CSS_PATH = "my_profile.tcss"
24+
25+
def __init__(self, community_GUID):
26+
super().__init__()
27+
self.community_GUID = community_GUID
28+
29+
def on_mount(self):
30+
self.title = "Egeria - My Profile"
31+
self.subtitle = "Add Comment to a Community"
32+
33+
34+
def compose(self) -> ComposeResult:
35+
"""This method composes the UI for the AddCommentScreen."""
36+
yield Header(show_clock=True)
37+
yield ScrollableContainer(
38+
Static("Enter your comment in the text area."),
39+
Static("When complete use Save Comment to save current commment and add another"),
40+
Static("Use Cancel to return to the previous screen"),
41+
TextArea(id="community_comment-textarea"),
42+
id="comment_textarea_container"
43+
)
44+
yield Footer()
45+
46+
def action_save_comment(self):
47+
comment = self.query_one("#community_comment-textarea", TextArea)
48+
if comment:
49+
user_comment = comment.text
50+
self.log(f"User comment: {user_comment}")
51+
self.dismiss([self.community_GUID, user_comment])
52+
else:
53+
container =self.query_one("#comment_textarea_container", ScrollableContainer)
54+
container.mount(Static(f"[@b aquamarine]Please enter a comment prior to selecting Save Comment[/]"))
55+
container.refresh()
56+
57+
def action_cancel(self):
58+
self.dismiss(200)

‎my_egeria/my_egeria/DemoCode/Deprecated/EditProfileScreen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class EditProfileScreen(ModalScreen[Any]):
3333
("ctrl+t", "Edit_teams", "Edit teams"),
3434
]
3535

36-
CSS_PATH = "my_profile.tcss"
36+
CSS_PATH = "../My_Profile/my_profile.tcss"
3737

3838
def __init__(self, user,
3939
password,

‎my_egeria/my_egeria/DemoCode/Deprecated/EditRolesScreen.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class EditRolesScreen(ModalScreen):
1818

1919
BINDINGS = [
2020
("escape", "exit_screen", "Exit"),
21-
("d", "delete_row", "Delete Row")
21+
("ctrl+a", "add_role", "Add Role"),
22+
("ctrl+d", "delete_role", "Delete Role"),
2223
]
2324

2425
def __init__(self, columns, rows_with_keys, *args, **kwargs):
@@ -75,7 +76,7 @@ def action_exit_screen(self):
7576
rows_with_keys.append((row_key.value, self.my_roles_table.get_row(row_key)))
7677
self.dismiss(rows_with_keys)
7778

78-
def action_delete_row(self):
79+
def action_delete_role(self):
7980
""" The user has selected the delete row option """
8081
self.log(f"Delete row selected, row key: {self.row_key}")
8182
# If there is a row selected, delete it and clear the row key variable
@@ -89,3 +90,9 @@ def action_delete_row(self):
8990
else:
9091
self.roles_container.mount(Static("Please select a row to delete prior to using the hot key!"))
9192
self.roles_container.refresh(layout=True)
93+
94+
def action_add_role(self):
95+
""" The user has selected the add role option """
96+
self.log("Add role selected")
97+
self.roles_container.mount(Static("Add role functionality not yet implemented!"))
98+
self.roles_container.refresh(layout=True)

‎my_egeria/my_egeria/DemoCode/Deprecated/EditTeamsScreen.py‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class EditTeamsScreen(ModalScreen):
1919

2020
BINDINGS = [
2121
("escape", "exit_screen", "Exit"),
22-
("d", "delete_row", "Delete Row")
22+
("ctrl+t", "add_team", "Add Team"),
23+
("ctrl+r", "delete_team", "Delete Team")
2324
]
2425

2526
def __init__(self, columns, rows_with_keys, *args, **kwargs):
@@ -44,6 +45,7 @@ async def on_mount(self):
4445
# Polulate DataTable
4546
self.my_teams_table.clear(columns=True)
4647
self.my_teams_table.add_columns(*self.columns)
48+
self.my_teams_table.cursor_type="row"
4749
for key_str, cell_values in self.rows_with_keys:
4850
self.my_teams_table.add_row(*cell_values, key=key_str)
4951
try:
@@ -67,6 +69,7 @@ async def on_mount(self):
6769
def row_selected(self, event: DataTable.RowSelected):
6870
""" When the user selects a row in the data table store the row key"""
6971
self.row_key = event.row_key
72+
self.table = event.data_table
7073

7174
def action_exit_screen(self):
7275
""" The user has requested to exit the screen, return the current table data """
@@ -75,7 +78,7 @@ def action_exit_screen(self):
7578
rows_with_keys.append((row_key.value, self.my_teams_table.get_row(row_key)))
7679
self.dismiss(rows_with_keys)
7780

78-
def action_delete_row(self):
81+
def action_delete_team(self):
7982
""" The user has selected the delete row option """
8083
self.log(f"Delete row selected, row key: {self.row_key}")
8184
# If there is a row selected, delete it and clear the row key variable
@@ -89,3 +92,9 @@ def action_delete_row(self):
8992
else:
9093
self.teams_container.mount(Static("Please select a row to delete prior to using the hot key!"))
9194
self.teams_container.refresh(layout=True)
95+
96+
def action_add_team(self):
97+
""" The user has selected the add team option """
98+
self.log("Add team selected")
99+
self.teams_container.mount(Static("Add team functionality not yet implemented!"))
100+
self.teams_container.refresh(layout=True)

‎my_egeria/my_egeria/DemoCode/Deprecated/TechnologyTypeOptionsScreen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TechnologyTypeOptionsScreen(ModalScreen):
2323
# ("ctl+s", "Select", "tech_type_option_select")
2424
]
2525

26-
CSS_PATH = "my_profile.tcss"
26+
CSS_PATH = "../My_Profile/my_profile.tcss"
2727

2828
def __init__(self, tech_type_guid: str,
2929
tech_type_name: str,

‎my_egeria/my_egeria/DemoCode/Deprecated/TechnologyTypeProcessesScreen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TechnologyTypeProcessesScreen(ModalScreen[Any]):
2222
("b", "back", "Go back"),
2323
("ctl+e", "expand", "Toggle Twisties")]
2424

25-
CSS_PATH = "my_profile.tcss"
25+
CSS_PATH = "../My_Profile/my_profile.tcss"
2626

2727
def __init__ (self,
2828
user_name: str,

‎my_egeria/my_egeria/DemoCode/Deprecated/TechnologyTypeTemplatesScreen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TechnologyTypeTemplatesScreen(ModalScreen[Any]):
2222
("b", "back", "Go back"),
2323
("ctl+e", "expand", "Toggle Twisties")]
2424

25-
CSS_PATH = "my_profile.tcss"
25+
CSS_PATH = "../My_Profile/my_profile.tcss"
2626

2727
def __init__ (self,
2828
user_name: str,

‎my_egeria/my_egeria/DemoCode/Deprecated/TechnologyTypesScreen.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TechnologyTypesScreen(ModalScreen):
2121
("g", "go_back", "Back"),
2222
("ctl+e", "expand", "Toggle Twisties")]
2323

24-
CSS_PATH = "my_profile.tcss"
24+
CSS_PATH = "../My_Profile/my_profile.tcss"
2525

2626
def __init__(self, ttlist, user_name, user_pwd, user_kpts):
2727
"""Initialize the TechnologyTypes screen with a list of technology types."""

0 commit comments

Comments
 (0)