分离edit_profile,降低耦合

This commit is contained in:
冯佳
2025-07-31 10:17:36 +08:00
parent ed4f610708
commit 627aa51235
5 changed files with 217 additions and 183 deletions

187
kv/app.kv
View File

@ -591,7 +591,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
IconLeftWidget:
icon: "email-outline"
OneLineIconListItem:
id : profile_prn
id : profile_modbus_ip
text: ""
IconLeftWidget:
icon: "dialpad"
@ -760,7 +760,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
app.secure_profile()
MDLabel:
text: "Name"
text: "User"
color: rgba(0, 0, 0, 255)
font_name: "BPoppins"
font_size: '15sp'
@ -768,7 +768,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
size_hint_x: None
width: dp(335)
MDLabel:
text: "PRN"
text: "User_pass"
color: rgba(0, 0, 0, 255)
font_name: "BPoppins"
font_size: '15sp'
@ -776,7 +776,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
size_hint_x: None
width: dp(335)
MDLabel:
text: "Email"
text: "Wifi_SSID"
color: rgba(0, 0, 0, 255)
font_name: "BPoppins"
font_size: '15sp'
@ -784,7 +784,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
size_hint_x: None
width: dp(335)
MDLabel:
text: "Phone Number"
text: "Modbus_IP"
color: rgba(0, 0, 0, 255)
font_name: "BPoppins"
font_size: '15sp'
@ -792,7 +792,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
size_hint_x: None
width: dp(335)
MDLabel:
text: "Branch"
text: "Modbus_Port"
color: rgba(0, 0, 0, 255)
font_name: "BPoppins"
font_size: '15sp'
@ -800,7 +800,7 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
size_hint_x: None
width: dp(335)
MDLabel:
text: "Semester"
text: "Reserve"
color: rgba(0, 0, 0, 255)
font_name: "BPoppins"
font_size: '15sp'
@ -1043,105 +1043,194 @@ ScreenManager: # 屏幕管理器,用于管理应用中所有的屏幕及其
app.on_press_back_arrow() # 执行返回操作
ScrollView: # 可滚动区域
id: real_time_scroll_view
size_hint: 1, None
height: self.parent.height - dp(150)
pos_hint: {'top':0.895}
MDList:
# id : image_label_grid
id: real_time_md_list
padding: "20dp", "40dp", "12dp", "17dp"
spacing: "50dp"
# MDLabel:
# text: "测试"
# font_name: "BPoppins"
# font_size: "24sp"
# pos_hint: {'center_x': 0.45}
# halign: 'center'
# bold: True
# color: rgba(0, 0, 0, 255)
# MDLabel:
# text: "曲线"
# font_name: "BPoppins"
# font_size: "24sp"
# size_hint_x: None
# width: dp(400)
# padding: "12dp"
# pos_hint: {'center_x': 0.5, 'center_y': 0.9}
# color: rgba(0, 0, 59, 255)
BoxLayout:
orientation: 'horizontal'
size_hint_x: None
width: dp(400)
pos_hint: {'center_x': 0.5, 'center_y': 0.85}
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 0:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: None
width: dp(120)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_0
comm_address: 0
unit: "倍数"
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: None
width: dp(120)
halign: "right"
size_hint_x: 0.6
input_filter: "int"
on_focus:if not self.focus: app.update_register_display(0)
on_text_validate: app.modify_register(self, self.text)
MDLabel:
text: "倍数"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: 0.4
halign: "right"
BoxLayout:
orientation: 'horizontal'
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 1:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: None
width: dp(120)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_1
comm_address: 1
unit: "A"
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: None
width: dp(120)
halign: "right"
size_hint_x: 0.6
input_filter: "int"
on_focus:if not self.focus: app.update_register_display(0)
on_text_validate: app.modify_register(self, self.text)
BoxLayout:
orientation: 'horizontal'
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 2:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: None
width: dp(120)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_2
comm_address: 2
unit: "A"
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: None
width: dp(120)
halign: "right"
size_hint_x: 0.6
input_filter: "int"
on_focus:if not self.focus: app.update_register_display(0)
on_text_validate: app.modify_register(self, self.text)
BoxLayout:
orientation: 'horizontal'
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 3:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_3
comm_address: 3
unit: "A"
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: 0.6
input_filter: "int"
on_text_validate: app.modify_register(self, self.text)
BoxLayout:
orientation: 'horizontal'
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 4:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_4
comm_address: 4
unit: "A"
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: 0.6
input_filter: "int"
on_text_validate: app.modify_register(self, self.text)
BoxLayout:
orientation: 'horizontal'
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 5:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_5
comm_address: 5
unit: "A"
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: 0.6
input_filter: "int"
on_text_validate: app.modify_register(self, self.text)
BoxLayout:
orientation: 'horizontal'
spacing: dp(10)
size_hint_y: None
height: dp(60)
MDLabel:
text: "寄存器 6:"
font_name: "MPoppins"
font_size: "18sp"
color: (135/255, 133/255, 193/255, 1)
size_hint_x: 0.4
halign: "left"
MDTextField:
id: register_value_field_6
comm_address: 6
text: ""
font_name: "MPoppins"
font_size: "18sp"
size_hint_x: 0.6
input_filter: "int"
on_text_validate: app.modify_register(self, self.text)
# CurveWidget:
# size_hint_y: None
# height: dp(300)