UI Verbesserung
This commit is contained in:
parent
249fa25357
commit
34d78660c3
@ -8,12 +8,15 @@ class Controller():
|
||||
|
||||
def __init__(self):
|
||||
self.view = viewTkinter.View(self)
|
||||
self.modi = "taktilesBCI"
|
||||
|
||||
self.commands = {
|
||||
"copySpelling": self.commandoCopySpelling,
|
||||
"stop": self.commandStop,
|
||||
"freeSpelling": self.commandFreeSpelling,
|
||||
"test": self.test
|
||||
"test": self.test,
|
||||
"wechsel": self.wechsel,
|
||||
"speicherort": self.speicherort
|
||||
}
|
||||
|
||||
self.nexts = {
|
||||
@ -21,22 +24,48 @@ class Controller():
|
||||
"filterClassic": self.filterClassic
|
||||
}
|
||||
|
||||
self.pages = {
|
||||
self.pagesTaktil = {
|
||||
"stop": "StartPage",
|
||||
"copySpelling": "WorkingPage",
|
||||
"freeSpelling": "WorkingPage",
|
||||
"test": "WorkingPage"
|
||||
"copySpelling": "WorkingPageTaktil",
|
||||
"freeSpelling": "WorkingPageTaktil",
|
||||
"test": "WorkingPageTaktil"
|
||||
}
|
||||
self.pagesVisuell = {
|
||||
"stop": "StartPage",
|
||||
"copySpelling": "WorkingPageVisuell",
|
||||
"freeSpelling": "WorkingPageVisuell",
|
||||
"test": "WorkingPageVisuell"
|
||||
}
|
||||
self.view.mainloop()
|
||||
|
||||
def actionPerformed(self, action):
|
||||
self.view.changeFrame(self.pages.get(action))
|
||||
self.changePage(action)
|
||||
func = self.commands.get(action)
|
||||
if(func is not None):
|
||||
func()
|
||||
else:
|
||||
print("Kommado existiert nicht")
|
||||
|
||||
def changePage(self,action):
|
||||
if(self.modi == "taktilesBCI"):
|
||||
page = self.pagesTaktil.get(action)
|
||||
elif(self.modi == "visuellesBCI"):
|
||||
page = self.pagesVisuell.get(action)
|
||||
if(page is not None):
|
||||
self.view.changeFrame(self.pages.get(action))
|
||||
|
||||
def wechsel(self):
|
||||
if(self.modi == "taktilesBCI"):
|
||||
self.view.setChangeBtnText("Wechsel zu taktilen BCI")
|
||||
self.view.setTitleText("visuelles BCI")
|
||||
self.modi = "visuellesBCI"
|
||||
elif(self.modi == "visuellesBCI"):
|
||||
self.setTitle("taktiles BCI")
|
||||
self.view.setChangeBtnText("Wechsel zu visuellen BCI")
|
||||
self.modi = "taktilesBCI"
|
||||
|
||||
def speicherort(self):
|
||||
pass
|
||||
|
||||
|
||||
def test(self):
|
||||
@ -95,5 +124,8 @@ class Controller():
|
||||
def changeScreen(self, pageName):
|
||||
self.view.changeFrame(pageName=pageName)
|
||||
|
||||
def getModi(self):
|
||||
return self.modi
|
||||
|
||||
|
||||
|
||||
|
@ -3,6 +3,7 @@ try:
|
||||
except ImportError:
|
||||
from tkinter import *
|
||||
|
||||
from tkinter import font
|
||||
from UIController import *
|
||||
|
||||
|
||||
@ -12,11 +13,19 @@ class View(Tk):
|
||||
Tk.__init__(self, *args, **kwargs)
|
||||
self.controller = c
|
||||
self.title("Taktiles Spelling")
|
||||
self.h = 400
|
||||
self.w = 500
|
||||
self.faktor = [(0.125),(0.625), (0.25)]
|
||||
#self.resizable(height=False, width= False)
|
||||
self.h = 800
|
||||
self.w = 1000
|
||||
self.geometry('{}x{}'.format(self.w,self.h))
|
||||
self.faktor = [(0.0675),(0.6825), (0.25)]
|
||||
#self.resizable(height=False, width= False)
|
||||
self.layout = {
|
||||
"background": "#00001E",
|
||||
"backgroundBtn": "#1C86EE",
|
||||
"fontColor": "#FFFFFF",
|
||||
"backgroundBar": "#00002E",
|
||||
"font": ('times', 25, 'bold'),
|
||||
"fontSmall": ('times', 10, 'bold')
|
||||
}
|
||||
|
||||
self.createTopFrame()
|
||||
self.createMainFrame()
|
||||
@ -40,7 +49,7 @@ class View(Tk):
|
||||
self.container.configure(height=(self.h*self.faktor[1]), width=self.w)
|
||||
for f in self.frames:
|
||||
self.frames[f].configure(height=(self.h*self.faktor[1]), width=self.w)
|
||||
self.frames[f].adjustSize(height=(self.h*self.faktor[1]), width=self.w/2)
|
||||
self.frames[f].adjustSize(height=(self.h*self.faktor[1]), width=self.w)
|
||||
|
||||
|
||||
def onClosing(self):
|
||||
@ -49,40 +58,44 @@ class View(Tk):
|
||||
|
||||
|
||||
def createTopFrame(self):
|
||||
self.topFrame = Frame(self, bg="blue", height=50, width=500) #, padx=460, pady=10)
|
||||
self.toplabel = Label(self.topFrame, text="taktilles Buchstabieren")
|
||||
self.topFrame = Frame(self, bg=self.layout["backgroundBar"], height=50, width=500) #, padx=460, pady=10)
|
||||
#self.toplabel = Label(self.topFrame, text="taktilles Buchstabieren")
|
||||
self.changeBtn = Button(self.topFrame, text="Wechsel zu visuellen BCI", command=lambda: self.controller.actionPerformed("wechsel"), height=3, width = 25, font=self.layout["fontSmall"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||
self.saveBtn = Button(self.topFrame, text="Änderung des Speicherorts", command=lambda: self.controller.actionPerformed("speicherort"), height=3, width = 25, font=self.layout["fontSmall"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||
|
||||
self.topFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||
self.topFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||
#self.topFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||
#self.topFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||
|
||||
self.topFrame.grid(column=0, row=0)
|
||||
self.topFrame.grid_propagate(0)
|
||||
self.topFrame.pack_propagate(0)
|
||||
self.toplabel.grid()
|
||||
#self.toplabel.grid()
|
||||
self.changeBtn.grid(column=0, row=0, padx=10,pady=5)
|
||||
self.saveBtn.grid(column=1, row=0, padx=10, pady=5)
|
||||
|
||||
def createMainFrame(self):
|
||||
|
||||
self.mainFrame = Frame(self, bg="red", height=250, width=500)
|
||||
self.mainFrame = Frame(self, bg=self.layout["background"], height=250, width=500)
|
||||
self.mainFrame.grid(column=0, row=1)
|
||||
self.mainFrame.pack_propagate(0)
|
||||
|
||||
self.container = Frame(self.mainFrame, bg="cyan", height=250, width=500)
|
||||
self.container = Frame(self.mainFrame, bg=self.layout["background"], height=250, width=500)
|
||||
self.container.pack(side="top", fill="both", expand = True)
|
||||
self.container.pack_propagate(0)
|
||||
self.container.grid_propagate(0)
|
||||
|
||||
self.frames = {}
|
||||
for F in (StartPage, WorkingPage):
|
||||
for F in (StartPage, WorkingPageTaktil, WorkingPageVisuell):
|
||||
page_name = F.__name__
|
||||
frame = F(parent=self.container, controller=self.controller)
|
||||
frame = F(parent=self.container, controller=self.controller, layout=self.layout)
|
||||
self.frames[page_name] = frame
|
||||
frame.grid(row=0, column=0, sticky="nsew")
|
||||
|
||||
self.changeFrame("StartPage")
|
||||
|
||||
def createBottomFrame(self):
|
||||
self.bottomFrame = Frame(self, bg="green", height=100, width=500)
|
||||
self.bottomlabel = Label(self.bottomFrame, text="Hier stehen Infos\nGanz viele", justify='left')
|
||||
self.bottomFrame = Frame(self, bg=self.layout["backgroundBar"], height=100, width=500)
|
||||
self.bottomlabel = Label(self.bottomFrame, text="Hier stehen Infos\nGanz viele", justify='left', font=self.layout["font"], bg=self.layout["backgroundBar"], fg=self.layout["fontColor"])
|
||||
|
||||
#self.bottomFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||
#self.bottomFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||
@ -97,50 +110,81 @@ class View(Tk):
|
||||
self.bottomlabel['text'] = text
|
||||
|
||||
def setTitleText(self,text):
|
||||
self.toplabel['text'] = text
|
||||
self.title(text)
|
||||
|
||||
def setChangeBtnText(self,text):
|
||||
self.changeBtn["text"] = text
|
||||
|
||||
|
||||
class StartPage(Frame):
|
||||
def __init__(self, parent, controller):
|
||||
Frame.__init__(self, parent, height=250, width=500, bg="red")
|
||||
def __init__(self, parent, controller, layout):
|
||||
self.layout = layout
|
||||
|
||||
Frame.__init__(self, parent, height=250, width=500, bg=self.layout["background"])
|
||||
self.grid_propagate(0)
|
||||
self.pack_propagate(0)
|
||||
self.controller = controller
|
||||
|
||||
self.leftFrame = Frame(self, bg="cyan", height=250, width=250)
|
||||
self.rightFrame = Frame(self, bg="blue", height=250, width=250)
|
||||
self.container = Frame(self, bg=self.layout["background"], height=250, width=500)
|
||||
self.btnFrame = Frame(self.container, bg=self.layout["background"], height=250, width=250)
|
||||
#self.rightFrame = Frame(self, bg=self.layout["background"], height=250, width=250)
|
||||
|
||||
self.leftFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||
self.leftFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||
self.leftFrame.grid_propagate(0)
|
||||
self.leftFrame.pack_propagate(0)
|
||||
self.container.columnconfigure(0, weight=1) # Set weight to row and
|
||||
self.container.rowconfigure(0, weight=1) # column where the widget is
|
||||
self.container.grid_propagate(0)
|
||||
self.container.pack_propagate(0)
|
||||
|
||||
self.rightFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||
self.rightFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||
self.rightFrame.grid_propagate(0)
|
||||
self.rightFrame.pack_propagate(0)
|
||||
|
||||
|
||||
self.leftFrame.grid(column=0, row=0)
|
||||
self.rightFrame.grid(column=1, row=0)
|
||||
#self.rightFrame.columnconfigure(0, weight=1) # Set weight to row and
|
||||
#self.rightFrame.rowconfigure(0, weight=1) # column where the widget is
|
||||
#self.rightFrame.grid_propagate(0)
|
||||
#self.rightFrame.pack_propagate(0)
|
||||
|
||||
testBtn = Button(self.leftFrame, text="test", command=lambda: self.controller.actionPerformed("test"), height=6, width = 10)
|
||||
testBtn.grid()
|
||||
self.container.pack()
|
||||
self.btnFrame.grid()
|
||||
#self.rightFrame.grid(column=1, row=0)
|
||||
|
||||
freeSpellingBtn = Button(self.rightFrame, text="freeSpelling", command=lambda: self.controller.actionPerformed("freeSpelling"), height=6, width = 10)
|
||||
freeSpellingBtn.grid()
|
||||
testBtn = Button(self.btnFrame, text="copySpelling", command=lambda: self.controller.actionPerformed("test"), height=6, width = 20, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||
testBtn.grid(row=0,column=0, padx=25,pady=25)
|
||||
|
||||
freeSpellingBtn = Button(self.btnFrame, text="freeSpelling", command=lambda: self.controller.actionPerformed("freeSpelling"), height=6, width = 20, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||
freeSpellingBtn.grid(row=0, column=1, padx=25,pady=25)
|
||||
|
||||
def adjustSize(self, height, width):
|
||||
self.leftFrame.configure(height=height, width= width)
|
||||
self.rightFrame.configure(height=height, width= width)
|
||||
self.container.configure(height=height, width= width)
|
||||
self.btnFrame.configure(height=(height*4)/5, width= width/2)
|
||||
|
||||
class WorkingPage(Frame):
|
||||
def __init__(self, parent, controller):
|
||||
Frame.__init__(self, parent)
|
||||
class WorkingPageTaktil(Frame):
|
||||
def __init__(self, parent, controller, layout):
|
||||
self.layout = layout
|
||||
|
||||
Frame.__init__(self, parent, height=250, width=500, bg=self.layout["background"])
|
||||
self.controller = controller
|
||||
|
||||
|
||||
self.columnconfigure(0, weight=1) # Set weight to row and
|
||||
self.rowconfigure(0, weight=1) # column where the widget is
|
||||
|
||||
stopBtn = Button(self, text="stop", command=lambda: self.controller.actionPerformed("stop"), height=6, width = 10)
|
||||
stopBtn = Button(self, text="stop", command=lambda: self.controller.actionPerformed("stop"), height=4, width = 15, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||
stopBtn.grid()
|
||||
|
||||
def adjustSize(self, height, width):
|
||||
pass
|
||||
|
||||
class WorkingPageVisuell(Frame):
|
||||
def __init__(self, parent, controller, layout):
|
||||
self.layout = layout
|
||||
|
||||
Frame.__init__(self, parent, height=250, width=500, bg=self.layout["background"])
|
||||
self.controller = controller
|
||||
|
||||
|
||||
self.columnconfigure(0, weight=1) # Set weight to row and
|
||||
self.rowconfigure(0, weight=1) # column where the widget is
|
||||
|
||||
stopBtn = Button(self, text="stop", command=lambda: self.controller.actionPerformed("stop"), height=4, width = 15, font=self.layout["font"], bg=self.layout["backgroundBtn"], fg=self.layout["fontColor"])
|
||||
stopBtn.grid()
|
||||
|
||||
def adjustSize(self, height, width):
|
||||
pass
|
BIN
Masterarbeit/__pycache__/UIController.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIController.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIModell.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIModell.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIViewPySide.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIViewPySide.cpython-39.pyc
Normal file
Binary file not shown.
BIN
Masterarbeit/__pycache__/UIViewTKinter.cpython-39.pyc
Normal file
BIN
Masterarbeit/__pycache__/UIViewTKinter.cpython-39.pyc
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user