modified: clang
new file: icons/obj.png deleted: icons/object.png modified: langsys/lang/de_DE.LAN modified: langsys/lang/en_EN.LAN modified: main.pymain
parent
4bb3864d20
commit
2d17887635
Binary file not shown.
After Width: | Height: | Size: 216 B |
BIN
icons/object.png
BIN
icons/object.png
Binary file not shown.
Before Width: | Height: | Size: 192 B |
|
@ -7,4 +7,7 @@
|
||||||
"add": "Erstellen",
|
"add": "Erstellen",
|
||||||
"obj": "Objekt",
|
"obj": "Objekt",
|
||||||
"script": "Skript",
|
"script": "Skript",
|
||||||
|
"rename": "Umbenennen",
|
||||||
|
"delete": "Loeschen",
|
||||||
|
"NN": "Neuer Name:",
|
||||||
}
|
}
|
|
@ -7,4 +7,7 @@
|
||||||
"add": "Create",
|
"add": "Create",
|
||||||
"obj": "Object",
|
"obj": "Object",
|
||||||
"script": "Script",
|
"script": "Script",
|
||||||
|
"rename": "Rename",
|
||||||
|
"delete": "Delete",
|
||||||
|
"NN": "New name:",
|
||||||
}
|
}
|
57
main.py
57
main.py
|
@ -9,10 +9,14 @@ import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import hashengine
|
import hashengine
|
||||||
|
import os
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
import easygui
|
||||||
|
|
||||||
global LH
|
global LH
|
||||||
global gamedata
|
global gamedata
|
||||||
gamedata = []
|
gamedata = {}
|
||||||
LH = langsys.langhandler()
|
LH = langsys.langhandler()
|
||||||
lang = open("clang", 'r')
|
lang = open("clang", 'r')
|
||||||
lang = lang.read()
|
lang = lang.read()
|
||||||
|
@ -65,18 +69,59 @@ def selectlang(new):
|
||||||
subprocess.Popen([sys.executable, __file__])
|
subprocess.Popen([sys.executable, __file__])
|
||||||
|
|
||||||
def add(objtype):
|
def add(objtype):
|
||||||
obj = dir(types)[objtype]()
|
global objtree
|
||||||
temp = {"id": objtype, "args": dir(obj)}
|
obj = getattr(types, objtype)()
|
||||||
gamedata.append(temp())
|
temp = {"id": objtype, "args": dir(obj), "name": LH.string(objtype)}
|
||||||
|
id = ""
|
||||||
|
chars = list(string.ascii_letters)
|
||||||
|
for i in range(255):
|
||||||
|
id = id + random.choice(chars)
|
||||||
|
objtree.insert("", tk.END, text=LH.string(objtype), image=icons[objtype], iid=id)
|
||||||
|
gamedata[id] = temp
|
||||||
|
|
||||||
|
def renameobj():
|
||||||
|
target = objtree.focus()
|
||||||
|
if target == "": return
|
||||||
|
new = easygui.enterbox(LH.string("NN"), LH.string("rename"))
|
||||||
|
if new:
|
||||||
|
objtree.item(target, text=new)
|
||||||
|
gamedata[target]["name"] = new
|
||||||
|
|
||||||
|
def delobj():
|
||||||
|
target = objtree.focus()
|
||||||
|
if target == "": return
|
||||||
|
objtree.delete(target)
|
||||||
|
gamedata.pop(target)
|
||||||
|
|
||||||
|
def rpopup(event):
|
||||||
|
try:
|
||||||
|
rmenu.tk_popup(event.x_root, event.y_root)
|
||||||
|
finally:
|
||||||
|
rmenu.grab_release()
|
||||||
|
|
||||||
def GUIinit():
|
def GUIinit():
|
||||||
global container
|
global container
|
||||||
|
global objtree
|
||||||
|
global rmenu
|
||||||
container = tk.Tk()
|
container = tk.Tk()
|
||||||
|
|
||||||
|
global icons
|
||||||
|
icons = {}
|
||||||
|
|
||||||
|
for i in os.listdir("icons"):
|
||||||
|
icons[i.split(".")[0]] = tk.PhotoImage(file=f"icons/{i}")
|
||||||
|
|
||||||
#tree init
|
#tree init
|
||||||
objtree = tkk.Treeview(container)
|
objtree = tkk.Treeview(container)
|
||||||
objtree.grid()
|
objtree.grid()
|
||||||
|
|
||||||
|
#right click menu
|
||||||
|
rmenu = tk.Menu(container, tearoff=0)
|
||||||
|
rmenu.add_command(label=LH.string("rename"), command=renameobj)
|
||||||
|
rmenu.add_command(label=LH.string("delete"), command=delobj)
|
||||||
|
|
||||||
|
objtree.bind("<Button-3>", rpopup)
|
||||||
|
|
||||||
#menu init
|
#menu init
|
||||||
menu = tk.Menu(container)
|
menu = tk.Menu(container)
|
||||||
container.config(menu=menu)
|
container.config(menu=menu)
|
||||||
|
@ -89,7 +134,8 @@ def GUIinit():
|
||||||
|
|
||||||
addmenu = tk.Menu(menu)
|
addmenu = tk.Menu(menu)
|
||||||
menu.add_cascade(label=LH.string("add"), menu=addmenu)
|
menu.add_cascade(label=LH.string("add"), menu=addmenu)
|
||||||
filemenu.add_command(label=LH.string("obj"), command=lambda: add("obj"))
|
addmenu.add_command(label=LH.string("obj"), command=lambda: add("obj"))
|
||||||
|
addmenu.add_command(label=LH.string("script"), command=lambda: add("script"))
|
||||||
|
|
||||||
langmenu = tk.Menu(menu)
|
langmenu = tk.Menu(menu)
|
||||||
menu.add_cascade(label=LH.string("langs"), menu=langmenu)
|
menu.add_cascade(label=LH.string("langs"), menu=langmenu)
|
||||||
|
@ -100,5 +146,6 @@ def GUIinit():
|
||||||
|
|
||||||
global types
|
global types
|
||||||
types = hashengine.enum({"obj": hashengine.obj, "script": script})
|
types = hashengine.enum({"obj": hashengine.obj, "script": script})
|
||||||
|
icon = hashengine.enum({"obj": "icons/object.png", "script": "icons/script.pngg"})
|
||||||
|
|
||||||
GUIinit()
|
GUIinit()
|
Loading…
Reference in New Issue