From 2fe767445240c56bb0bedf96badc67e0853b8442 Mon Sep 17 00:00:00 2001 From: bettleChen <2207153529@qq.com> Date: Mon, 17 Jul 2023 14:04:30 +0800 Subject: [PATCH] update code and reset code --- NetworkAnalog/SimObjs.py | 49 ++++++------------ .../__pycache__/SimObjs.cpython-37.pyc | Bin 24496 -> 24530 bytes NetworkAnalog/network.db | Bin 40960 -> 40960 bytes 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/NetworkAnalog/SimObjs.py b/NetworkAnalog/SimObjs.py index 24904bb..07c77b1 100644 --- a/NetworkAnalog/SimObjs.py +++ b/NetworkAnalog/SimObjs.py @@ -13,27 +13,6 @@ from PIL import ImageTk, Image from dbUtil import search, execute_sql -host_img = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/主机.png").resize((60, 60))) -host_img_tm = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/主机_tm.png").resize((60, 60))) - -router_img = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/路由器.png").resize((60, 60))) -router_img_tm = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/路由器_tm.png").resize((60, 60))) - -switch_img = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/交换机.png").resize((60, 60))) -switch_img_tm = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/交换机_tm.png").resize((60, 60))) - -hub_img = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/集线器.png").resize((60, 60))) -hub_img_tm = ImageTk.PhotoImage( - Image.open(sys.path[0] + "/../datas/images/集线器_tm.png").resize((60, 60))) - - class SimBase(): # todo: 组件父类 """ @@ -115,18 +94,6 @@ class SimBase(): 创建图片 :return: """ - if self.ObjType == 1: - self.img = host_img - self.img_tm = host_img_tm - elif self.ObjType == 2: - self.img = router_img - self.img_tm = router_img_tm - elif self.ObjType == 3: - self.img = switch_img - self.img_tm = switch_img_tm - else: - self.img = hub_img - self.img_tm = hub_img_tm self.canvas.delete("L") id = self.canvas.create_image(self.ObjX - 30, self.ObjY - 30, image=self.img if self.ConfigCorrect == 1 else self.img_tm, anchor="nw", @@ -488,6 +455,10 @@ class SimHost(SimBase): self.interface = [{}] self.connections = [None] self.set_default_config() + self.img = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/主机.png").resize((60, 60))) + self.img_tm = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/主机_tm.png").resize((60, 60))) def create_packet(self, ip, mac, message): """ @@ -548,6 +519,10 @@ class SimRouter(SimBase): self.ObjLabel = label if label is not None else self.set_default_name() self.router_table = {} self.set_default_router_table() + self.img = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/路由器.png").resize((60, 60))) + self.img_tm = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/路由器_tm.png").resize((60, 60))) def set_default_router_table(self): """ @@ -653,6 +628,10 @@ class SimSwitch(SimBase): self.ObjLabel = label if label is not None else self.set_default_name() self.mac_table = {} self.set_default_mac_table() + self.img = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/交换机.png").resize((60, 60))) + self.img_tm = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/交换机_tm.png").resize((60, 60))) def set_default_mac_table(self): """ @@ -742,6 +721,10 @@ class SimHub(SimBase): super().__init__(canvas, x, y, self.ObjID, config, label) self.ObjType = 4 self.ObjLabel = label if label is not None else self.set_default_name() + self.img = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/集线器.png").resize((60, 60))) + self.img_tm = ImageTk.PhotoImage( + Image.open(sys.path[0] + "/../datas/images/集线器_tm.png").resize((60, 60))) def transmit(self, packet: SimPacket): """ diff --git a/NetworkAnalog/__pycache__/SimObjs.cpython-37.pyc b/NetworkAnalog/__pycache__/SimObjs.cpython-37.pyc index 772375f13d0a416036444d9a5ca70aa262bf1086..451b022e904b6e3bee3486127dfef7a10a1dfb9a 100644 GIT binary patch delta 7327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