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

# Form implementation generated from reading ui file 'hesapla.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.girdi = QtWidgets.QLineEdit(self.centralwidget)
        self.girdi.setObjectName("girdi")
        self.gridLayout.addWidget(self.girdi, 1, 0, 1, 1)
        self.dugme = QtWidgets.QPushButton(self.centralwidget)
        self.dugme.setObjectName("dugme")
        self.gridLayout.addWidget(self.dugme, 2, 0, 1, 1)
        self.liste = QtWidgets.QListWidget(self.centralwidget)
        self.liste.setObjectName("liste")
        self.gridLayout.addWidget(self.liste, 0, 0, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
        self.menubar.setObjectName("menubar")
        self.menuDosya = QtWidgets.QMenu(self.menubar)
        self.menuDosya.setObjectName("menuDosya")
        self.menuYard_m = QtWidgets.QMenu(self.menubar)
        self.menuYard_m.setObjectName("menuYard_m")
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)
        self.actionA = QtWidgets.QAction(MainWindow)
        self.actionA.setObjectName("actionA")
        self.action_k = QtWidgets.QAction(MainWindow)
        self.action_k.setObjectName("action_k")
        self.actionKaydet = QtWidgets.QAction(MainWindow)
        self.actionKaydet.setObjectName("actionKaydet")
        self.actionFarkl_Kaydet = QtWidgets.QAction(MainWindow)
        self.actionFarkl_Kaydet.setObjectName("actionFarkl_Kaydet")
        self.actionHakk_nda = QtWidgets.QAction(MainWindow)
        self.actionHakk_nda.setObjectName("actionHakk_nda")
        self.menuDosya.addAction(self.actionA)
        self.menuDosya.addAction(self.actionKaydet)
        self.menuDosya.addAction(self.actionFarkl_Kaydet)
        self.menuDosya.addSeparator()
        self.menuDosya.addAction(self.action_k)
        self.menuYard_m.addAction(self.actionHakk_nda)
        self.menubar.addAction(self.menuDosya.menuAction())
        self.menubar.addAction(self.menuYard_m.menuAction())

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

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.dugme.setText(_translate("MainWindow", "Hesapla"))
        self.menuDosya.setTitle(_translate("MainWindow", "Dosya"))
        self.menuYard_m.setTitle(_translate("MainWindow", "Yardım"))
        self.actionA.setText(_translate("MainWindow", "Aç"))
        self.action_k.setText(_translate("MainWindow", "Çıkış"))
        self.actionKaydet.setText(_translate("MainWindow", "Kaydet"))
        self.actionFarkl_Kaydet.setText(_translate("MainWindow", "Farklı Kaydet"))
        self.actionHakk_nda.setText(_translate("MainWindow", "Hakkında"))
        self.dugme.clicked.connect(self.updateUI)
        self.girdi.returnPressed.connect(self.updateUI)

    def updateUI(self):
        try:
            text = self.girdi.text()
            self.liste.addItem(f"{text} = <b>{eval(text)}</b>")
        except :
            self.liste.addItem(f"<font color=red>{text} geçersiz</font>")


if __name__ == '__main__':
    app = QApplication([])
    form = QMainWindow()
    pencere = Ui_MainWindow()
    pencere.setupUi(form)
    form.show()
    app.exec_()