-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcallTest.py
100 lines (80 loc) · 3.29 KB
/
callTest.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from PyQt5.QtWidgets import QDialog, QApplication
from Test import *
import sys
list_time = ['Canh', 'Tân', 'Nhâm', 'Quý', 'Giáp', 'Ất', 'Bính', 'Đinh', 'Mậu', 'Kỷ']
list_animal = ['Thân', 'Dậu', 'Tuất', 'Hợi', 'Tí', 'Sửu', 'Dần', 'Mão', 'Thìn', 'Tỵ', 'Ngọ', 'Mùi']
class MyUI(QDialog):
def __init__(self):
super().__init__()
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.ui.pushButton.clicked.connect(self.count_year)
self.ui.pushButton.clicked.connect(self.show_name)
self.ui.pushButton.clicked.connect(self.Sex_type)
self.ui.MaleButton.toggled.connect(self.Sex_type)
self.ui.FemaleButton.toggled.connect(self.Sex_type)
self.ui.cap1.toggled.connect(self.Education_level)
self.ui.cap2.toggled.connect(self.Education_level)
self.ui.cap3.toggled.connect(self.Education_level)
self.ui.groupBox_pizza.clicked.connect(self.food_chek)
self.ui.groupBox_bread.clicked.connect(self.food_chek)
self.ui.pepperoni_check.stateChanged.connect(self.food_chek)
self.ui.cheese_check.stateChanged.connect(self.food_chek)
self.ui.fish_check.stateChanged.connect(self.food_chek)
self.ui.hot_check.stateChanged.connect(self.food_chek)
self.ui.long_check.stateChanged.connect(self.food_chek)
self.ui.big_check.stateChanged.connect(self.food_chek)
self.show()
@staticmethod
def age_cal(list_time, year1):
time = year1 % 10
return list_time[time]
@staticmethod
def animal_cal(list_animal, year1):
animal = year1 % 12
return list_animal[animal]
def count_year(self):
a = self.ui.InputYear.text()
self.ui.result_year.setText(self.age_cal(list_time, int(a)) + " " + self.animal_cal(list_animal, int(a)))
def show_name(self):
self.ui.result_name.setText(str(self.ui.InputName.text()))
def Sex_type(self):
sex_type = ""
if self.ui.MaleButton.isChecked():
sex_type = "Male"
if self.ui.FemaleButton.isChecked():
sex_type = "Female"
self.ui.result_sex.setText(sex_type)
def Education_level(self):
education_level = ""
if self.ui.cap1.isChecked():
education_level = "Primary"
if self.ui.cap2.isChecked():
education_level = "Secondary"
if self.ui.cap3.isChecked():
education_level = "Highschool"
self.ui.result_education.setText(education_level)
def food_chek(self):
amount = 0
if self.ui.groupBox_pizza.isChecked():
amount += 10
if self.ui.pepperoni_check.isChecked():
amount += 4
if self.ui.cheese_check.isChecked():
amount += 5
if self.ui.fish_check.isChecked():
amount += 10
if self.ui.groupBox_bread.isChecked():
amount += 5
if self.ui.hot_check.isChecked():
amount += 4
if self.ui.long_check.isChecked():
amount += 5
if self.ui.big_check.isChecked():
amount += 10
self.ui.result_food.setText(f"Total is {amount}")
if __name__ == "__main__":
app = QApplication(sys.argv)
ui = MyUI()
ui.show()
sys.exit(app.exec_())