Observer pattern raus geschmissen. Nicht benötigt.

This commit is contained in:
2024-01-16 10:29:38 +01:00
parent 404e241ba0
commit bb61bc8c89
3 changed files with 10 additions and 25 deletions
+8
View File
@@ -178,6 +178,7 @@ class RightFramePDM(AllRightFrames):
variable=self.neuaufbau,
onvalue="True",
offvalue="False")
#command=self.checkbox_callback,
neuaufbau_checkbutton.grid(column=col_left+2, row=self.rownum, sticky=tk.W, padx=5, pady=5)
self.rownum += 1
@@ -201,6 +202,7 @@ class RightFramePDM(AllRightFrames):
variable=self.aus_halbzeug_neu,
onvalue="True",
offvalue="False")
#command=self.checkbox_callback,
aushalbzeug_checkbuttonr.grid(column=col_left+2, row=self.rownum, sticky=tk.W, padx=5, pady=5)
self.rownum += 1
@@ -237,6 +239,12 @@ class RightFramePDM(AllRightFrames):
def combo_callbacks(self, event):
""" handle the changed event of TK"""
# TODO falls nötig
a = 6
pass
def checkbox_callback(self, event):
""" handle the changed event of TK"""
a = 6
pass
+1 -1
View File
@@ -1,5 +1,5 @@
import json
from controller import Controller, Event
from controller import Controller
+1 -24
View File
@@ -2,30 +2,7 @@
Contains the logic for the MVC of CreoMigrate Gui
"""
class Observer():
_observers = []
def __init__(self):
self._observers.append(self)
self._observables = {}
def observe(self, event_name, callback):
"""If the observer is not in the list,
append it into the list"""
if event_name not in self._observables:
self._observables[event_name] = callback
class Event():
def __init__(self, name, data, autofire = True):
self.name = name
self.data = data
if autofire:
self.fire()
def fire(self):
for observer in Observer._observers:
if self.name in observer._observables:
observer._observables[self.name](self.data)
class Controller(Observer):
class Controller():
"""
Class for manipulating the model and returning data for the view
"""