Skip to content

Commit 3d4881a

Browse files
committed
Add theme management and configuration options to Groot2
1 parent 18ccd41 commit 3d4881a

File tree

7 files changed

+173
-9
lines changed

7 files changed

+173
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
# Other pecific files or directories
1313
*.AppImage
1414
*.btproj
15-
**/Backups/
15+
**/Backups/
16+
**/Themes/Groot2.ini
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[General]
2+
Editor.recentlyLoadedDatafile=@Invalid()
3+
Groot2%3A%3APortLayout=0
4+
Replay.recentlyLoadedDatafile=@Invalid()
5+
Settings%3A%3Amonitor_current_logger=FileLogger2
6+
Telemetry%3A%3Acountry=
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[General]
2+
APP%3A%3AMode=Editor
3+
Editor.recentlyLoadedDatafile=@Invalid()
4+
Groot2%3A%3APortLayout=0
5+
Groot%3A%3Aformat=4
6+
LicenseWidget%3A%3Aradio_online=true
7+
Replay.recentlyLoadedDatafile=@Invalid()
8+
Settings%3A%3ATheme=/home/ros/app/groot2/Themes
9+
Settings%3A%3Aallow_telemetry=false
10+
Settings%3A%3Aautoload_includes=ask
11+
Settings%3A%3Aindent_XML=true
12+
Settings%3A%3Amonitor_current_logger=FileLogger2
13+
Settings%3A%3Amonitor_timeout=500
14+
Settings%3A%3Amultirow_adaptive=false
15+
Settings%3A%3Amultirow_ports=false
16+
Settings%3A%3Anode_editor_theme=custom
17+
Settings%3A%3Aold_XML=false
18+
Settings%3A%3Aports_show=true
19+
Settings%3A%3Aprepost_show=true
20+
Settings%3A%3Auser_custom_style="{\n \"BehaviorTreeNodeStyle\": {\n \"CommentColor\": \"#ff808080\",\n \"FailureColor\": \"#ffff003c\",\n \"LockedBackground\": \"#ff2e2e2e\",\n \"RunningColor\": \"#ffffa500\",\n \"SuccessColor\": \"#ff00ff00\"\n },\n \"ConnectionStyle\": {\n \"ConstructionColor\": \"gray\",\n \"ConstructionLineWidth\": 2,\n \"HoveredColor\": \"#ffff4d6d\",\n \"LineWidth\": 3,\n \"NormalColor\": \"#ff8b0000\",\n \"PointDiameter\": 10,\n \"SelectedColor\": \"#ffff003c\",\n \"SelectedHaloColor\": \"transparent\",\n \"UseDataDefinedColors\": false\n },\n \"EmbeddedWidgetStyle\": {\n \"conditions_background\": \"#ff1a1a1a\",\n \"conditions_text\": \"#ffff003c\",\n \"control_type\": \"#ffff005f\",\n \"decorator_type\": \"#ffff003c\",\n \"expand_background\": \"#dddddd\",\n \"expand_text\": \"black\",\n \"general_type\": \"#ffffffff\",\n \"port_line_background\": \"#dddddd\",\n \"port_line_blackboard_text\": \"#000077\",\n \"port_line_border\": \"#dddddd\",\n \"port_line_highlight\": \"#ffff003c\",\n \"port_line_invalid_text\": \"#bb2222\",\n \"port_line_text\": \"black\",\n \"text_bg_color\": \"transparent\",\n \"text_color\": \"#ffffffff\",\n \"text_faded\": \"#ffe8e8e8\"\n },\n \"GraphicsViewStyle\": {\n \"BackgroundColor\": \"#ff0d0d0d\",\n \"CoarseGridColor\": \"#ff0d0d0d\",\n \"FineGridColor\": \"#ff0d0d0d\"\n },\n \"NodeStyle\": {\n \"ConnectionPointColor\": \"#ff8b0000\",\n \"ConnectionPointDiameter\": 8,\n \"DashedBoundaryColor\": \"transparent\",\n \"ErrorColor\": \"red\",\n \"FilledConnectionPointColor\": \"#ff8b0000\",\n \"FontColor\": \"white\",\n \"FontColorFaded\": \"#dddddd\",\n \"GradientColor0\": \"#ff1a1a1a\",\n \"GradientColor1\": \"#ff1a1a1a\",\n \"GradientColor2\": \"#ff111117\",\n \"GradientColor3\": \"#ff111117\",\n \"HoveredPenWidth\": 1.5,\n \"NormalBoundaryColor\": \"#ffcccccc\",\n \"Opacity\": 1,\n \"PenWidth\": 1,\n \"SelectedBoundaryColor\": \"#ffff003c\",\n \"ShadowColor\": \"transparent\",\n \"WarningColor\": \"#ffff003c\"\n },\n \"theme\": \"dark\"\n}\n"
21+
Telemetry%3A%3Acountry=
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"BehaviorTreeNodeStyle": {
3+
"CommentColor": "#ff808080",
4+
"FailureColor": "#ffff003c",
5+
"LockedBackground": "#ff2e2e2e",
6+
"RunningColor": "#ffffa500",
7+
"SuccessColor": "#ff00ff00"
8+
},
9+
"ConnectionStyle": {
10+
"ConstructionColor": "gray",
11+
"ConstructionLineWidth": 2,
12+
"HoveredColor": "#ffff4d6d",
13+
"LineWidth": 3,
14+
"NormalColor": "#ff8b0000",
15+
"PointDiameter": 10,
16+
"SelectedColor": "#ffff003c",
17+
"SelectedHaloColor": "transparent",
18+
"UseDataDefinedColors": false
19+
},
20+
"EmbeddedWidgetStyle": {
21+
"conditions_background": "#ff1a1a1a",
22+
"conditions_text": "#ffff003c",
23+
"control_type": "#ffff005f",
24+
"decorator_type": "#ffff003c",
25+
"expand_background": "#dddddd",
26+
"expand_text": "black",
27+
"general_type": "#ffffffff",
28+
"port_line_background": "#dddddd",
29+
"port_line_blackboard_text": "#000077",
30+
"port_line_border": "#dddddd",
31+
"port_line_highlight": "#ffff003c",
32+
"port_line_invalid_text": "#bb2222",
33+
"port_line_text": "black",
34+
"text_bg_color": "transparent",
35+
"text_color": "#ffffffff",
36+
"text_faded": "#ffe8e8e8"
37+
},
38+
"GraphicsViewStyle": {
39+
"BackgroundColor": "#ff0d0d0d",
40+
"CoarseGridColor": "#ff0d0d0d",
41+
"FineGridColor": "#ff0d0d0d"
42+
},
43+
"NodeStyle": {
44+
"ConnectionPointColor": "#ff8b0000",
45+
"ConnectionPointDiameter": 8,
46+
"DashedBoundaryColor": "transparent",
47+
"ErrorColor": "red",
48+
"FilledConnectionPointColor": "#ff8b0000",
49+
"FontColor": "white",
50+
"FontColorFaded": "#dddddd",
51+
"GradientColor0": "#ff1a1a1a",
52+
"GradientColor1": "#ff1a1a1a",
53+
"GradientColor2": "#ff111117",
54+
"GradientColor3": "#ff111117",
55+
"HoveredPenWidth": 1.5,
56+
"NormalBoundaryColor": "#ffcccccc",
57+
"Opacity": 1,
58+
"PenWidth": 1,
59+
"SelectedBoundaryColor": "#ffff003c",
60+
"ShadowColor": "transparent",
61+
"WarningColor": "#ffff003c"
62+
},
63+
"theme": "dark"
64+
}

Groot2/docker/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ services:
2929
- ./entrypoint.sh:/entrypoint.sh
3030
# Mount app resources into container.
3131
- ../app:/home/ros/app
32+
- ../app/groot2/Themes/Groot2.ini:/home/ros/.config/AurynRobotics/Groot2.ini
3233

3334
# Mount local timezone into container.
3435
- /etc/timezone:/etc/timezone:ro

Groot2/groot2

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,84 @@
44
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
55
cd $DIR
66

7-
# Open Xhost
8-
xhost +local:
7+
# Allow local connections to the X server (suppress output)
8+
xhost +local: &> /dev/null
99

10-
# Environment variables
10+
# Set default ROS domain ID if not already set
1111
export ROS_DOMAIN_ID=${ROS_DOMAIN_ID:=100}
1212

13-
# Initialize docker environment
13+
# Define theme-related paths
14+
THEME_DIR="$DIR/app/groot2/Themes"
15+
THEME_PATH="$THEME_DIR/Groot2.ini"
16+
DEFAULT_THEME="$THEME_DIR/Groot2_default.ini"
17+
18+
# Ensure Groot2.ini exists
19+
if [ ! -f "$THEME_PATH" ]; then
20+
touch "$THEME_PATH"
21+
fi
22+
23+
# Handle script arguments
24+
if [ -z "$1" ]; then
25+
# No argument provided, do nothing
26+
:
27+
elif [ "$1" == "config" ]; then
28+
# Configuration mode
29+
echo -e "\e[1;34mConfiguring Groot\e[0m"
30+
31+
# Display available themes with numbering
32+
echo -e "\n\e[1;32m───────────────────────────────────────────────\e[0m"
33+
echo -e "\e[1;32mAvailable themes\e[0m"
34+
THEMES=($(ls "$THEME_DIR" | grep -E "\.ini$" | grep -v "^Groot2\.ini$"))
35+
for ((i = 0; i < ${#THEMES[@]}; i++)); do
36+
echo -e "\e[1;32m[$((i + 1))]\e[0m ${THEMES[$i]}"
37+
done
38+
echo -e "\e[1;32m───────────────────────────────────────────────\e[0m"
39+
40+
# Prompt user to select a theme by number
41+
read -p $'\e[1;36mSelect a theme by number:\e[0m ' SELECTED_INDEX
42+
if [ -n "$SELECTED_INDEX" ] && [[ "$SELECTED_INDEX" =~ ^[0-9]+$ ]] && [ "$SELECTED_INDEX" -ge 1 ] && [ "$SELECTED_INDEX" -le "${#THEMES[@]}" ]; then
43+
SELECTED_THEME="${THEMES[$((SELECTED_INDEX - 1))]}"
44+
if [ -f "$THEME_PATH" ]; then
45+
echo -e "\e[1;33m───────────────────────────────────────────────\e[0m"
46+
echo -e "\e[1;33mApplying theme: $SELECTED_THEME\e[0m"
47+
echo -e "\e[1;33m───────────────────────────────────────────────\e[0m"
48+
cp "$THEME_DIR/$SELECTED_THEME" "$THEME_PATH"
49+
else
50+
echo -e "\e[1;31m───────────────────────────────────────────────\e[0m"
51+
echo -e "\e[1;31mTheme not found: $SELECTED_THEME. \e[0m"
52+
echo -e "\e[1;31mUsing default theme.\e[0m"
53+
echo -e "\e[1;31m───────────────────────────────────────────────\e[0m"
54+
cp "$DEFAULT_THEME" "$THEME_PATH"
55+
fi
56+
else
57+
echo -e "\e[1;33m───────────────────────────────────────────────\e[0m"
58+
echo -e "\e[1;33mNo valid selection. Using default theme.\e[0m"
59+
echo -e "\e[1;33m───────────────────────────────────────────────\e[0m"
60+
cp "$DEFAULT_THEME" "$THEME_PATH"
61+
fi
62+
elif [ "$1" == "help" ]; then
63+
# Help mode
64+
echo -e "\n\e[1;34m───────────────────────────────────────────────\e[0m"
65+
echo -e "\e[1;34mUsage: $0 [option]\e[0m"
66+
echo -e "\e[1;34m───────────────────────────────────────────────\e[0m"
67+
echo -e "\e[1;32mOptions:\e[0m"
68+
echo " config Configure Groot theme"
69+
echo " help Display this help message"
70+
exit 0
71+
else
72+
# Unrecognized argument
73+
echo -e "\e[1;31m───────────────────────────────────────────────\e[0m"
74+
echo -e "\e[1;31mUnrecognized argument: $1.\e[0m"
75+
echo -e "\e[1;31mUse 'help' for usage information.\e[0m"
76+
echo -e "\e[1;31m───────────────────────────────────────────────\e[0m"
77+
fi
78+
79+
# Initialize Docker environment
1480
cd ./docker
1581
docker compose up
1682

17-
# Clean up docker after exit
83+
# Clean up Docker environment after exit
1884
docker compose down
1985

20-
# Clean up Xhost
21-
xhost -local:
86+
# Revoke local connections to the X server (suppress output)
87+
xhost -local: &> /dev/null

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,9 @@ groot2
4141

4242
This will automatically handle the following:
4343
- Mounting all robot Groot workspaces in the current network environment using the Samba service provided by [DIT-Scripts](https://github.com/DIT-ROBOTICS/DIT-Scripts).
44-
- Backing up the latest mounted directories for future reference.
44+
- Backing up the latest mounted directories for future reference.
45+
46+
Additionally, you can use the following options with the `groot2` command:
47+
48+
- **`groot2 config`**: Opens a configuration mode where you can select and apply a theme for Groot2.
49+
- **`groot2 help`**: Displays a help message with usage information for the `groot2` script.

0 commit comments

Comments
 (0)