inject connector instead of coupling
This commit is contained in:
@@ -8,6 +8,7 @@ from tkinter import ttk
|
|||||||
|
|
||||||
from config import Config
|
from config import Config
|
||||||
from model import Model
|
from model import Model
|
||||||
|
from src.connector import JSONConnector
|
||||||
from windows import SettingsWindow, EditRecord, show_error
|
from windows import SettingsWindow, EditRecord, show_error
|
||||||
|
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ class Application:
|
|||||||
self.filter_active = tk.BooleanVar(value=False)
|
self.filter_active = tk.BooleanVar(value=False)
|
||||||
|
|
||||||
# model connector
|
# model connector
|
||||||
self.model = Model(self.config)
|
self.model = Model(JSONConnector(self.config))
|
||||||
|
|
||||||
# init paths to json and csv file
|
# init paths to json and csv file
|
||||||
self.json_file_name = "brovski-adress-etiketten-verwaltung.json"
|
self.json_file_name = "brovski-adress-etiketten-verwaltung.json"
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
from config import Config
|
from src.connector import Connector
|
||||||
from connector import JSONConnector
|
|
||||||
|
|
||||||
|
|
||||||
class Model:
|
class Model:
|
||||||
def __init__(self, config: Config):
|
def __init__(self, connector: Connector):
|
||||||
self.connector = JSONConnector(config)
|
self.connector = connector
|
||||||
self.config = config
|
|
||||||
|
|
||||||
def get_all(self):
|
def get_all(self):
|
||||||
return self.connector.get_all()
|
return self.connector.get_all()
|
||||||
|
|||||||
Reference in New Issue
Block a user