-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathShowTreeController.py
53 lines (44 loc) · 1.54 KB
/
ShowTreeController.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from core.Core import Core
from models.Customers import Customers
from core.Controller import Controller
from tkinter import messagebox
"""
Responsible for ShowTreeView behavior.
"""
class ShowTreeController(Controller):
#-----------------------------------------------------------------------
# Constructor
#-----------------------------------------------------------------------
def __init__(self):
self.customers = Customers()
self.showView = self.loadView("showTree")
#-----------------------------------------------------------------------
# Methods
#-----------------------------------------------------------------------
"""
@return All customers in database
"""
def getCustomers(self):
data = self.customers.getAll()
return data
"""
Opens EditController
@param id_customer Customer id that will be edited
"""
def btnEdit(self, id_customer):
customer = self.customers.get(id_customer)
c = Core.openController("edit")
c.main(customer, self.showView)
"""
Deletes the chosen customer and updates the ShowView
@param id_customer Customer id that will be edited
"""
def btnDel(self, id_customer):
self.customers.delete(id_customer)
self.showView.update()
messagebox.showinfo("Delete customer", "Customer deleted with success!")
"""
@Override
"""
def main(self):
self.showView.main()