This commit is contained in:
2026-06-09 14:01:51 +08:00
parent 3acb26d9e2
commit 448f2f18cc
16 changed files with 699 additions and 289 deletions
+16 -16
View File
@@ -13,39 +13,39 @@ class NetworkTab(Page):
self.adapters = []
self.profiles = {}
selector = self.section("网卡选择", 0, columns=4)
self.iface = combo(selector, "选择网卡", 1, 0, [], "", 44, colspan=2)
selector = self.section("网卡选择", 0, columns=6)
self.iface = combo(selector, "选择网卡", 1, 0, [], "", 56, colspan=3)
self.iface["combobox"].bind("<<ComboboxSelected>>", lambda _event: self.load_selected_adapter())
self.status = field(selector, "连接状态", 1, 2, "", 14)
self.status = field(selector, "连接状态", 1, 3, "", 18)
self.status["entry"].configure(state="disabled")
actions = action_bar(selector, 2, 4)
actions = action_bar(selector, 2, 6)
self.refresh_btn = button(actions, "刷新网卡", self.refresh_adapters, "Primary.TButton")
identity = self.section("网卡信息", 1, columns=4)
self.description = field(identity, "设备描述", 1, 0, "", 46, colspan=2)
self.mac = field(identity, "MAC 地址", 1, 2, "", 24)
adapter_actions = action_bar(identity, 2, 4)
identity = self.section("网卡信息", 1, columns=6)
self.description = field(identity, "设备描述", 1, 0, "", 62, colspan=3)
self.mac = field(identity, "MAC 地址", 1, 3, "", 26)
adapter_actions = action_bar(identity, 2, 6)
self.enable_adapter_btn = button(adapter_actions, "启用网卡", self.enable_adapter, "Primary.TButton")
self.disable_adapter_btn = button(adapter_actions, "禁用网卡", self.disable_adapter, "Danger.TButton")
for item in (self.description, self.mac):
item["entry"].configure(state="disabled")
config = self.section("IPv4 配置", 2, columns=4)
config = self.section("IPv4 配置", 2, columns=6)
self.dhcp = combo(config, "地址模式", 1, 0, ["DHCP 自动获取", "静态手动配置"], "DHCP 自动获取", 18)
self.dhcp["combobox"].bind("<<ComboboxSelected>>", lambda _event: self.update_entry_state())
self.ipv4 = field(config, "IPv4 地址", 1, 1, "", 18)
self.netmask = field(config, "子网掩码", 1, 2, "", 18)
self.gateway = field(config, "默认网关", 1, 3, "", 18)
self.dns1 = field(config, "首选 DNS", 2, 1, "", 18)
self.dns2 = field(config, "备用 DNS", 2, 2, "", 18)
config_actions = action_bar(config, 3, 4)
self.dns1 = field(config, "首选 DNS", 1, 4, "", 18)
self.dns2 = field(config, "备用 DNS", 1, 5, "", 18)
config_actions = action_bar(config, 2, 6)
self.apply_btn = button(config_actions, "应用配置", self.apply_settings, "Primary.TButton")
self.reload_btn = button(config_actions, "重新读取", self.refresh_adapters, "Secondary.TButton")
profiles = self.section("配置模板", 3, columns=4)
self.profile_name = field(profiles, "模板名称", 1, 0, "", 20)
self.profile_select = combo(profiles, "选择模板", 1, 1, [], "", 24)
profile_actions = action_bar(profiles, 2, 4)
profiles = self.section("配置模板", 3, columns=6)
self.profile_name = field(profiles, "模板名称", 1, 0, "", 28, colspan=2)
self.profile_select = combo(profiles, "选择模板", 1, 2, [], "", 34, colspan=2)
profile_actions = action_bar(profiles, 2, 6)
self.save_profile_btn = button(profile_actions, "保存当前为模板", self.save_profile, "Primary.TButton")
self.apply_profile_btn = button(profile_actions, "套用模板到表单", self.apply_profile_to_form, "Secondary.TButton")
self.delete_profile_btn = button(profile_actions, "删除模板", self.delete_profile, "Danger.TButton")