From bb61bc8c890901691bd125d969ec734698b9fe2a Mon Sep 17 00:00:00 2001 From: mistangl Date: Tue, 16 Jan 2024 10:29:38 +0100 Subject: [PATCH] =?UTF-8?q?Observer=20pattern=20raus=20geschmissen.=20Nich?= =?UTF-8?q?t=20ben=C3=B6tigt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/CreoMigrateGui.py | 8 ++++++++ lib/caditem.py | 2 +- lib/controller.py | 25 +------------------------ 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/lib/CreoMigrateGui.py b/lib/CreoMigrateGui.py index 274dcd7..1b874a9 100644 --- a/lib/CreoMigrateGui.py +++ b/lib/CreoMigrateGui.py @@ -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 diff --git a/lib/caditem.py b/lib/caditem.py index 3e517e2..7fba644 100644 --- a/lib/caditem.py +++ b/lib/caditem.py @@ -1,5 +1,5 @@ import json -from controller import Controller, Event +from controller import Controller diff --git a/lib/controller.py b/lib/controller.py index 82d61fb..9e052e7 100644 --- a/lib/controller.py +++ b/lib/controller.py @@ -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 """