Now displays which mod can be run server side only.

This commit is contained in:
Patrick Marsee 2024-07-20 12:59:13 -04:00
parent 33d1502a1b
commit ebda851611
3 changed files with 59 additions and 17 deletions

View file

@ -82,13 +82,17 @@ class AppFrame(ttk.Frame):
# Mod list
self.mod_list = ttk.Treeview(self,
columns = ("name", "version", "author", "enabled"),
columns = ("name", "version", "author", "serverside", "enabled"),
height = 20,
selectmode = "browse")
self.mod_list.heading("name", text = "Name")
self.mod_list.heading("version", text = "Version")
self.mod_list.column("version", width = 100)
self.mod_list.heading("author", text = "Author")
self.mod_list.heading("serverside", text = "Serverside")
self.mod_list.column("serverside", width = 100)
self.mod_list.heading("enabled", text = "Enabled")
self.mod_list.column("enabled", width = 100)
self.mod_list.tag_configure("DISABLED", foreground = "red")
self.mod_list.tag_configure("ENABLED", foreground = "green")
self.mod_list.tag_bind("DISABLED", '<Double-1>', lambda e: self.command_enable(self.mod_list.selection()[0]))
@ -177,7 +181,8 @@ class AppFrame(ttk.Frame):
self.refresh_mod_list()
def get_mod_data(self, mod: str) -> tuple:
mod_info_path = os.path.join(self.cfg.mods_dir, mod, "ModInfo.xml")
mod_path = os.path.join(self.cfg.mods_dir, mod)
mod_info_path = os.path.join(mod_path, "ModInfo.xml")
try:
tree = et.parse(mod_info_path)
except:
@ -186,6 +191,7 @@ class AppFrame(ttk.Frame):
name = ""
author = ""
version = ""
serverside = str(seven_mods.mod_is_server_only(mod_path))
for node in root[0]:
if node.tag == "Name":
name = node.attrib["value"]
@ -193,7 +199,7 @@ class AppFrame(ttk.Frame):
author = node.attrib["value"]
elif node.tag == "Version":
version = node.attrib["value"]
return name, version, author
return name, version, author, serverside
def refresh_mod_list(self):
if self.cfg == None: