|
|
@@ -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.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.container.pack() |
|
|
|
self.btnFrame.grid() |
|
|
|
#self.rightFrame.grid(column=1, row=0) |
|
|
|
|
|
|
|
testBtn = Button(self.leftFrame, text="test", command=lambda: self.controller.actionPerformed("test"), height=6, width = 10) |
|
|
|
testBtn.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.rightFrame, text="freeSpelling", command=lambda: self.controller.actionPerformed("freeSpelling"), height=6, width = 10) |
|
|
|
freeSpellingBtn.grid() |
|
|
|
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 WorkingPageTaktil(Frame): |
|
|
|
def __init__(self, parent, controller, layout): |
|
|
|
self.layout = layout |
|
|
|
|
|
|
|
class WorkingPage(Frame): |
|
|
|
def __init__(self, parent, controller): |
|
|
|
Frame.__init__(self, parent) |
|
|
|
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 |