-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathShowController.py
54 lines (45 loc) · 1.55 KB
/
ShowController.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
54
from core.Core import Core
from models.Customers import Customers
from core.Controller import Controller
from tkinter import messagebox
"""
Responsible for ShowView behavior.
"""
class ShowController(Controller):
#-----------------------------------------------------------------------
# Constructor
#-----------------------------------------------------------------------
def __init__(self):
self.customers = Customers()
self.showView = self.loadView("show")
self.core = Core()
#-----------------------------------------------------------------------
# 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 = self.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()