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