# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'CurrencyExchange.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!

import currency_exchange
from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(640, 360)
        MainWindow.setMinimumSize(QtCore.QSize(640, 360))
        MainWindow.setMaximumSize(QtCore.QSize(640, 360))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 53, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 53, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Light, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 53, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 53, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        MainWindow.setPalette(palette)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("moneybags.jpg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.convert = QtWidgets.QPushButton(self.centralwidget)
        self.convert.setGeometry(QtCore.QRect(270, 210, 101, 41))
        font = QtGui.QFont()
        font.setPointSize(16)
        self.convert.setFont(font)
        self.convert.setObjectName("convert")
        self.inputcur = QtWidgets.QComboBox(self.centralwidget)
        self.inputcur.setGeometry(QtCore.QRect(200, 130, 69, 51))
        self.inputcur.setObjectName("inputcur")
        self.inputcur.addItem("")
        self.inputcur.setItemText(0, "")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.inputcur.addItem("")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(20, 20, 591, 71))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        self.label.setPalette(palette)
        font = QtGui.QFont()
        font.setPointSize(24)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.outputcur = QtWidgets.QComboBox(self.centralwidget)
        self.outputcur.setGeometry(QtCore.QRect(550, 130, 69, 51))
        self.outputcur.setObjectName("outputcur")
        self.outputcur.addItem("")
        self.outputcur.setItemText(0, "")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.outputcur.addItem("")
        self.inputnum = QtWidgets.QPlainTextEdit(self.centralwidget)
        self.inputnum.setGeometry(QtCore.QRect(20, 130, 171, 51))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.inputnum.setFont(font)
        self.inputnum.setObjectName("inputnum")
        self.outputnum = QtWidgets.QPlainTextEdit(self.centralwidget)
        self.outputnum.setGeometry(QtCore.QRect(370, 130, 171, 51))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.outputnum.setFont(font)
        self.outputnum.setObjectName("outputnum")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(170, 270, 301, 31))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        self.label_2.setPalette(palette)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label_2.setFont(font)
        self.label_2.setText("")
        self.label_2.setAlignment(QtCore.Qt.AlignCenter)
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(self.centralwidget)
        self.label_3.setGeometry(QtCore.QRect(276, 132, 91, 51))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        self.label_3.setPalette(palette)
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label_3.setFont(font)
        self.label_3.setAlignment(QtCore.Qt.AlignCenter)
        self.label_3.setObjectName("label_3")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 640, 21))
        self.menubar.setObjectName("menubar")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.convert.clicked.connect(self.converter)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Currency Exchange"))
        self.convert.setText(_translate("MainWindow", "Convert"))
        self.inputcur.setItemText(1, _translate("MainWindow", "AED"))
        self.inputcur.setItemText(2, _translate("MainWindow", "AUD"))
        self.inputcur.setItemText(3, _translate("MainWindow", "BHD"))
        self.inputcur.setItemText(4, _translate("MainWindow", "CAD"))
        self.inputcur.setItemText(5, _translate("MainWindow", "CNY"))
        self.inputcur.setItemText(6, _translate("MainWindow", "EUR"))
        self.inputcur.setItemText(7, _translate("MainWindow", "GBP"))
        self.inputcur.setItemText(8, _translate("MainWindow", "INR"))
        self.inputcur.setItemText(9, _translate("MainWindow", "JPY"))
        self.inputcur.setItemText(10, _translate("MainWindow", "KWD"))
        self.inputcur.setItemText(11, _translate("MainWindow", "LKR"))
        self.inputcur.setItemText(12, _translate("MainWindow", "PKR"))
        self.inputcur.setItemText(13, _translate("MainWindow", "RUB"))
        self.inputcur.setItemText(14, _translate("MainWindow", "SAR"))
        self.inputcur.setItemText(15, _translate("MainWindow", "SGD"))
        self.inputcur.setItemText(16, _translate("MainWindow", "USD"))
        self.label.setText(_translate("MainWindow", "Currency Exchange"))
        self.outputcur.setItemText(1, _translate("MainWindow", "AED"))
        self.outputcur.setItemText(2, _translate("MainWindow", "AUD"))
        self.outputcur.setItemText(3, _translate("MainWindow", "BHD"))
        self.outputcur.setItemText(4, _translate("MainWindow", "CAD"))
        self.outputcur.setItemText(5, _translate("MainWindow", "CNY"))
        self.outputcur.setItemText(6, _translate("MainWindow", "EUR"))
        self.outputcur.setItemText(7, _translate("MainWindow", "GBP"))
        self.outputcur.setItemText(8, _translate("MainWindow", "INR"))
        self.outputcur.setItemText(9, _translate("MainWindow", "JPY"))
        self.outputcur.setItemText(10, _translate("MainWindow", "KWD"))
        self.outputcur.setItemText(11, _translate("MainWindow", "LKR"))
        self.outputcur.setItemText(12, _translate("MainWindow", "PKR"))
        self.outputcur.setItemText(13, _translate("MainWindow", "RUB"))
        self.outputcur.setItemText(14, _translate("MainWindow", "SAR"))
        self.outputcur.setItemText(15, _translate("MainWindow", "SGD"))
        self.outputcur.setItemText(16, _translate("MainWindow", "USD"))
        self.label_3.setText(_translate("MainWindow", "------>"))

    def converter(self):
        inputcur = self.inputcur.currentText()
        outputcur = self.outputcur.currentText()
        try:
            inputnum = int(self.inputnum.toPlainText())
            out = str(currency_exchange.exchange(inputcur, outputcur, inputnum))
            upperlimit = len(out) - 6
            self.outputnum.setPlainText(out[2:upperlimit])
            self.label_2.setText("")
        except:
            self.label_2.setText("Incorrect Input!")

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
