-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.py
156 lines (145 loc) · 5.81 KB
/
info.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Damian Subzda
# WCY19IJ3S1
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Info(QtWidgets.QMainWindow):
def __init__(self, row, parent=None):
super(Ui_Info, self).__init__(parent)
self.setupUi(self)
self.setLabels(row)
self.currencyComboBox = "$"
self.priceComboBox = row[2]
def setupUi(self, Info):
Info.setObjectName("Info")
Info.resize(550, 285)
self.label_title = QtWidgets.QLabel(Info)
self.label_title.setGeometry(QtCore.QRect(10, 10, 1501, 31))
font = QtGui.QFont()
font.setPointSize(15)
self.label_title.setFont(font)
self.label_title.setObjectName("label_title")
self.label_original_price = QtWidgets.QLabel(Info)
self.label_original_price.setGeometry(QtCore.QRect(10, 50, 421, 31))
font = QtGui.QFont()
font.setPointSize(15)
self.label_original_price.setFont(font)
self.label_original_price.setObjectName("label_original_price")
self.label_rating = QtWidgets.QLabel(Info)
self.label_rating.setGeometry(QtCore.QRect(10, 90, 421, 31))
font = QtGui.QFont()
font.setPointSize(15)
self.label_rating.setFont(font)
self.label_rating.setObjectName("label_rating")
self.label_have = QtWidgets.QLabel(Info)
self.label_have.setGeometry(QtCore.QRect(10, 130, 421, 31))
font = QtGui.QFont()
font.setPointSize(15)
self.label_have.setFont(font)
self.label_have.setObjectName("label_have")
self.label_want = QtWidgets.QLabel(Info)
self.label_want.setGeometry(QtCore.QRect(10, 170, 421, 31))
font = QtGui.QFont()
font.setPointSize(15)
self.label_want.setFont(font)
self.label_want.setObjectName("label_want")
self.label_price = QtWidgets.QLabel(Info)
self.label_price.setGeometry(QtCore.QRect(150, 220, 350, 31))
font = QtGui.QFont()
font.setPointSize(15)
self.label_price.setFont(font)
self.label_price.setObjectName("label_price")
self.comboBox = QtWidgets.QComboBox(Info)
self.comboBox.setGeometry(QtCore.QRect(10, 220, 111, 31))
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("$")
self.comboBox.addItem("¥")
self.comboBox.addItem("CHF")
self.comboBox.addItem("SEK")
self.comboBox.addItem("CA$")
self.comboBox.addItem("ZAR")
self.comboBox.addItem("MX$")
self.comboBox.addItem("NZ$")
self.comboBox.addItem("R$")
self.comboBox.addItem("A$")
self.comboBox.addItem("€")
self.comboBox.addItem("£")
font = self.comboBox.font()
font.setPointSize(15)
self.comboBox.setFont(font)
self.comboBox.currentTextChanged.connect(self.setCurrency)
self.retranslateUi(Info)
QtCore.QMetaObject.connectSlotsByName(Info)
def setCurrency(self):
currency = self.currencyComboBox
price = self.priceComboBox
if currency == '$':
price = price
elif currency == '¥':
price = float(price * 0.0087)
elif currency == "CHF":
price = float(price * 1.07)
elif currency == "SEK":
price = float(price * 0.11)
elif currency == "CA$":
price = float(price * 0.78)
elif currency == "ZAR":
price = float(price * 0.064)
elif currency == "MX$":
price = float(price * 0.048)
elif currency == "NZ$":
price = float(price * 0.653971)
elif currency == "R$":
price = float(price * 0.186)
elif currency == "A$":
price = float(price * 0.699)
elif currency == "€":
price = float(price * 1.11)
elif currency == "£":
price = float(price * 1.34)
else:
print("Nowa waluta:" + price)
price = 0
currency = self.comboBox.currentText()
if currency == '$':
price = price
elif currency == '¥':
price = float(price * 115.22)
elif currency == "CHF":
price = float(price * 0.93)
elif currency == "SEK":
price = float(price * 9.41)
elif currency == "CA$":
price = float(price * 1.27)
elif currency == "ZAR":
price = float(price * 15.59)
elif currency == "MX$":
price = float(price * 20.79)
elif currency == "NZ$":
price = float(price * 1.52)
elif currency == "R$":
price = float(price * 5.36)
elif currency == "A$":
price = float(price * 1.43)
elif currency == "€":
price = float(price * 0.90)
elif currency == "£":
price = float(price * 0.75)
else:
print("Nowa waluta:" + price)
price = 0
self.label_price.setText(f"Price in {currency}: {round(price, 2)}")
def setLabels(self, row):
self.label_title.setText(f"Title: {row[1]}")
self.label_original_price.setText(f"Original price: {row[2]}{row[3]}")
self.label_rating.setText(f"Rating: {row[5]}")
self.label_have.setText(f"Have: {row[6]}")
self.label_want.setText(f"Want: {row[7]}")
self.label_price.setText("<- Select currency")
def retranslateUi(self, Info):
_translate = QtCore.QCoreApplication.translate
Info.setWindowTitle(_translate("Info", "Info"))
self.label_title.setText(_translate("Info", "Title:"))
self.label_original_price.setText(_translate("Info", "Original price:"))
self.label_rating.setText(_translate("Info", "Rating:"))
self.label_have.setText(_translate("Info", "Have:"))
self.label_want.setText(_translate("Info", "Want:"))
self.label_price.setText(_translate("Info", "Price in $ :"))