Compare commits

..

3 Commits

Author SHA1 Message Date
Marc Brooks 1959952ef3
Merge d6ee845cc4 into b1c788cc5e 2025-10-27 16:34:43 +01:00
Marc Brooks d6ee845cc4
Merge branch 'dev' into feat/hostname 2025-10-23 17:15:10 -05:00
Marc Brooks ffca856522
feat/Add active hostname to device display
Also regularized up the layouts
2025-10-21 17:27:20 -05:00
5 changed files with 32 additions and 43 deletions

35
.gitignore vendored
View File

@ -1,18 +1,19 @@
bin/*
static/*
.idea
.DS_Store
.cache
.vite
.pnpm-store
device-tests.tar.gz
node_modules
# generated during the build process
#internal/native/include
#internal/native/lib
ui/reports
bin/*
static/*
.idea
.DS_Store
.cache
.vite
.pnpm-store
device-tests.tar.gz
node_modules
# generated during the build process
#internal/native/include
#internal/native/lib
*.eez-project-ui-state
ui/reports

View File

@ -41,15 +41,10 @@ func switchToMainScreen() {
func updateDisplay() {
if networkManager != nil {
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv4_addr", networkManager.IPv4String())
nativeInstance.UpdateLabelIfChanged("home_info_ipv4_addr", networkManager.IPv4String())
nativeInstance.UpdateLabelAndChangeVisibility("home_info_ipv6_addr", networkManager.IPv6String())
nativeInstance.UpdateLabelIfChanged("home_info_mac_addr", networkManager.MACString())
nativeInstance.UpdateLabelIfChanged("home_info_hostname", networkManager.Hostname())
// we either show the MAC address (if no IP yet) or the hostname (if either IPv4 or IPv6 are available)
hasIP := networkManager.IPv4Ready() || networkManager.IPv6Ready()
nativeInstance.ChangeVisibility("home_info_mac_addr", !hasIP)
nativeInstance.ChangeVisibility("home_info_hostname", hasIP)
}
_, _ = nativeInstance.UIObjHide("menu_btn_network")
@ -76,7 +71,6 @@ func updateDisplay() {
nativeInstance.UpdateLabelIfChanged("hdmi_status_label", "Disconnected")
_, _ = nativeInstance.UIObjClearState("hdmi_status_label", "LV_STATE_CHECKED")
}
nativeInstance.UpdateLabelIfChanged("cloud_status_label", fmt.Sprintf("%d active", actionSessions))
if networkManager != nil && networkManager.IsUp() {

View File

@ -117,18 +117,14 @@ func (n *Native) UpdateLabelIfChanged(objName string, newText string) {
// UpdateLabelAndChangeVisibility updates the label and changes the visibility of the object
func (n *Native) UpdateLabelAndChangeVisibility(objName string, newText string) {
n.UpdateLabelIfChanged(objName, newText)
n.ChangeVisibility(objName, newText != "")
}
// ChangeVisibility shows or hides an object AND the container it is in
func (n *Native) ChangeVisibility(objName string, show bool) {
containerName := objName + "_container"
if show {
_, _ = n.UIObjShow(objName)
_, _ = n.UIObjShow(containerName)
} else {
if newText == "" {
_, _ = n.UIObjHide(objName)
_, _ = n.UIObjHide(containerName)
} else {
_, _ = n.UIObjShow(objName)
_, _ = n.UIObjShow(containerName)
}
}

View File

@ -1227,8 +1227,8 @@
"type": "LVGLLabelWidget",
"left": 0,
"top": 0,
"width": 217,
"height": 31,
"width": 174,
"height": 25,
"customInputs": [],
"customOutputs": [],
"style": {
@ -1251,7 +1251,7 @@
"checkedStateType": "literal",
"disabledStateType": "literal",
"states": "",
"useStyle": "LabelFontBold30",
"useStyle": "LabelFontBold24",
"localStyles": {
"objID": "e584be1c-d434-4f13-fb87-00665e4a53a9"
},
@ -1287,7 +1287,7 @@
"heightUnit": "content",
"children": [],
"widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK|SCROLLABLE|SCROLL_CHAIN_HOR|SCROLL_CHAIN_VER|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_WITH_ARROW|SNAPPABLE",
"hiddenFlag": false,
"hiddenFlag": true,
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"checkedStateType": "literal",
@ -1335,7 +1335,6 @@
"heightUnit": "content",
"children": [],
"widgetFlags": "CLICK_FOCUSABLE|GESTURE_BUBBLE|PRESS_LOCK|SCROLLABLE|SCROLL_CHAIN_HOR|SCROLL_CHAIN_VER|SCROLL_ELASTIC|SCROLL_MOMENTUM|SCROLL_WITH_ARROW|SNAPPABLE",
"hiddenFlag": false,
"hiddenFlagType": "literal",
"clickableFlagType": "literal",
"checkedStateType": "literal",
@ -1363,8 +1362,8 @@
"type": "LVGLLabelWidget",
"left": 0,
"top": 0,
"width": 74,
"height": 21,
"width": 60,
"height": 18,
"customInputs": [],
"customOutputs": [],
"style": {
@ -1394,8 +1393,7 @@
"MAIN": {
"DEFAULT": {
"pad_bottom": 2,
"pad_top": -1,
"text_font": "FontBook20"
"pad_top": -1
}
}
}

View File

@ -318,7 +318,7 @@ void create_screen_home_screen() {
objects.home_info_ipv4_addr = obj;
lv_obj_set_pos(obj, LV_PCT(0), LV_PCT(0));
lv_obj_set_size(obj, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
add_style_label_font_bold30(obj);
add_style_label_font_bold24(obj);
lv_label_set_text(obj, "169.254.169.254");
}
{
@ -328,6 +328,7 @@ void create_screen_home_screen() {
lv_obj_set_pos(obj, LV_PCT(0), LV_PCT(0));
lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT);
lv_label_set_long_mode(obj, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN);
add_style_label_font16(obj);
lv_obj_set_style_text_font(obj, &ui_font_font_book16, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(obj, -1, LV_PART_MAIN | LV_STATE_DEFAULT);
@ -353,7 +354,6 @@ void create_screen_home_screen() {
add_style_label_font16(obj);
lv_obj_set_style_pad_bottom(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(obj, -1, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &ui_font_font_book20, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_label_set_text(obj, "JetKVM");
}
}