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

# Form implementation generated from reading ui file 'untitled.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


class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(496, 396)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(140, 150, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(80, 90, 61, 16))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(80, 120, 71, 16))
        self.label_2.setObjectName("label_2")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(160, 90, 141, 20))
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit_2 = QtWidgets.QLineEdit(Dialog)
        self.lineEdit_2.setGeometry(QtCore.QRect(160, 120, 141, 20))
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        self.textBrowser.setGeometry(QtCore.QRect(45, 190, 411, 171))
        self.textBrowser.setObjectName("textBrowser")
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setSource(QtCore.QUrl.fromLocalFile("exampletext.html"))
        def enter_clicked():
            self.textBrowser.setSource(QtCore.QUrl.fromLocalFile("enter_success.html"))
        def enter_clicked2():
            self.textBrowser.setText("This is another message!")
            #first_word = self.lineEdit.text()
            #print(first_word)

        def createHTMLlinkEN(lemma):
            link_url = "<a href='https://www.lexico.com/definition/" + lemma + "'>" + lemma + "</a>"
            return link_url

        def createHTMLlinkDE(lemma):
            link_url = "<a href='https://www.duden.de/rechtschreibung/" + lemma + "'>" + lemma + "</a>"
            return link_url

        def combine_strings():
            #print("'Combine Strings' was pressed!")
            first_word = self.lineEdit.text()
            second_word = self.lineEdit_2.text()
            self.textBrowser.setText("Erstes Wort: " + createHTMLlinkEN(first_word) + "\tZweites Wort: "+ createHTMLlinkDE(second_word))


        self.pushButtonEnter = QtWidgets.QPushButton(Dialog)
        self.pushButtonEnter.setGeometry(QtCore.QRect(50, 150, 75, 23))
        self.pushButtonEnter.setObjectName("pushButtonEnter")
        self.pushButtonEnter.setToolTip("This should display the Tooltip for this 'Enter' button!")
        self.pushButtonEnter.clicked.connect(enter_clicked)
       # self.pushButtonEnter.clicked.connect(self.textBrowser.setSource(QtCore.QUrl.fromLocalFile("exampletext.html")))

        self.pushButtonEnter2 = QtWidgets.QPushButton(Dialog)
        self.pushButtonEnter2.setGeometry(QtCore.QRect(140, 150, 75, 23))
        self.pushButtonEnter2.setObjectName("pushButtonEnter2")
        self.pushButtonEnter2.clicked.connect(enter_clicked2)

        self.pushButtonCombine = QtWidgets.QPushButton(Dialog)
        self.pushButtonCombine.setGeometry(QtCore.QRect(230, 150, 75, 23))
        self.pushButtonCombine.setObjectName("pushButtonCombine")
        self.pushButtonCombine.clicked.connect(combine_strings)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label.setText(_translate("Dialog", "First Word:"))
        self.label_2.setText(_translate("Dialog", "Second Word:"))
        self.pushButtonEnter.setText(_translate("Dialog", "Enter"))
        self.pushButtonEnter2.setText(_translate("Dialog", "Enter 2"))
        self.pushButtonCombine.setText(_translate("Dialog", "Combine"))

