57 lines
1.4 KiB
Python
57 lines
1.4 KiB
Python
|
# handles GUI
|
||
|
from langsys import langhandler
|
||
|
import mtTkinter as tk
|
||
|
from tkinter import ttk as tkk
|
||
|
import multiprocessing
|
||
|
import os
|
||
|
|
||
|
global LH
|
||
|
LH = langhandler()
|
||
|
LH.setlang("en_EN")
|
||
|
|
||
|
# define functions
|
||
|
def do_popup(event):
|
||
|
try:
|
||
|
rm.tk_popup(event.x_root, event.y_root)
|
||
|
finally:
|
||
|
rm.grab_release()
|
||
|
|
||
|
def delobj():
|
||
|
raise NotImplementedError()
|
||
|
|
||
|
container = tk.Tk()
|
||
|
|
||
|
# init icons
|
||
|
global icons
|
||
|
icons = {}
|
||
|
|
||
|
for i in os.listdir("icons"):
|
||
|
icons[i.split(".")[0]] = tk.PhotoImage(file=f"icons/{i}")
|
||
|
|
||
|
global canvas
|
||
|
canvas = tk.Canvas(container)
|
||
|
canvas.grid(row=0, column=0)
|
||
|
|
||
|
global objtree
|
||
|
objtree = tkk.Treeview(container, columns=("-"))
|
||
|
objtree.heading("#0", text=LH.string("game"))
|
||
|
objtree.grid(row=1, column=0)
|
||
|
objectsid = objtree.insert("", "end", text=LH.string("objs"), image=icons["game"])
|
||
|
scriptssid = objtree.insert("", "end", text=LH.string("scriptserv"), image=icons["scriptserv"])
|
||
|
soundssid = objtree.insert("", "end", text=LH.string("soundserv"), image=icons["soundserv"])
|
||
|
|
||
|
global rm
|
||
|
rm = tk.Menu(container, tearoff=0)
|
||
|
rm.add_command(label=LH.string("del"), command=delobj)
|
||
|
container.bind("<Button-3>", do_popup)
|
||
|
|
||
|
global menu
|
||
|
menu = tk.Menu(container)
|
||
|
container.config(menu=menu)
|
||
|
|
||
|
global filemenu
|
||
|
filemenu = tk.Menu(container)
|
||
|
filemenu.add_command(label=LH.string("exit"), command=container.quit)
|
||
|
menu.add_cascade(menu=filemenu, label=LH.string("file"))
|
||
|
|
||
|
container.mainloop()
|