# Path: source/gui/panconvert_diag_openuri.py
# class Ui_DialogOpenURI(object):
#     def setupUi(self, DialogOpenURI):
#         DialogOpenURI.setObjectName("DialogOpenURI")
#         DialogOpenURI.resize(386, 90)
#         sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(DialogOpenURI.sizePolicy().hasHeightForWidth())
#         DialogOpenURI.setSizePolicy(sizePolicy)
#         DialogOpenURI.setMinimumSize(QtCore.QSize(386, 90))
#         DialogOpenURI.setMaximumSize(QtCore.QSize(386, 90))
#         self.URI = QtWidgets.QPlainTextEdit(DialogOpenURI)
#         self.URI.setGeometry(QtCore.QRect(10, 10, 371, 41))
#         self.URI.setObjectName("URI")
#         self.layoutWidget = QtWidgets.QWidget(DialogOpenURI)
#         self.layoutWidget.setGeometry(QtCore.QRect(7, 60, 371, 32))
#         self.layoutWidget.setObjectName("layoutWidget")
#         self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
#         self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
#         self.horizontalLayout.setObjectName("horizontalLayout")
#         self.CheckBoxStayOnTop = QtWidgets.QCheckBox(self.layoutWidget)
#         self.CheckBoxStayOnTop.setEnabled(False)
#         self.CheckBoxStayOnTop.setObjectName("CheckBoxStayOnTop")
#         self.horizontalLayout.addWidget(self.CheckBoxStayOnTop)
#         self.ButtonCancel = QtWidgets.QPushButton(self.layoutWidget)
#         sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(self.ButtonCancel.sizePolicy().hasHeightForWidth())
#         self.ButtonCancel.setSizePolicy(sizePolicy)
#         self.ButtonCancel.setMinimumSize(QtCore.QSize(114, 32))
#         self.ButtonCancel.setMaximumSize(QtCore.QSize(114, 32))
#         self.ButtonCancel.setBaseSize(QtCore.QSize(114, 32))
#         self.ButtonCancel.setObjectName("ButtonCancel")
#         self.horizontalLayout.addWidget(self.ButtonCancel)
#         self.ButtonOpenURI = QtWidgets.QPushButton(self.layoutWidget)
#         self.ButtonOpenURI.setObjectName("ButtonOpenURI")
#         self.horizontalLayout.addWidget(self.ButtonOpenURI)
# 
#         self.retranslateUi(DialogOpenURI)
#         QtCore.QMetaObject.connectSlotsByName(DialogOpenURI)
# 
#     def retranslateUi(self, DialogOpenURI):
#         _translate = QtCore.QCoreApplication.translate
#         DialogOpenURI.setWindowTitle(_translate("DialogOpenURI", "Open URI"))
#         self.CheckBoxStayOnTop.setText(_translate("DialogOpenURI", "Stay on Top"))
#         self.ButtonCancel.setText(_translate("DialogOpenURI", "Cancel"))
#         self.ButtonOpenURI.setText(_translate("DialogOpenURI", "Open URI"))


from source.gui.panconvert_diag_openuri import Ui_DialogOpenURI
from source.language.messages import *
from source.main_gui import *
from os.path import isfile
import builtins
import codecs
        self.ui = Ui_DialogOpenURI()
        self.ui.setupUi(self)
        self.ui.ButtonOpenURI.clicked.connect(self.openuri)
        self.ui.ButtonCancel.clicked.connect(self.closeEvent)
        self.ui.CheckBoxStayOnTop.stateChanged.connect(self.stayOnTop)

        #Initialize Settings
        settings = QSettings('Pandoc', 'PanConvert')

        self.resize(settings.value("OpenURI_size", QSize(270, 225)))
        self.move(settings.value("OpenURI_pos", QPoint(50, 50)))
        uri = ''


    def stayOnTop(self):
        if self.ui.CheckBoxStayOnTop.isChecked():
            self.setWindowFlags(
                self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
        else:
            self.setWindowFlags(
                self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
        self.show()

    def closeEvent(self, event):
        settings = QSettings('Pandoc', 'PanConvert')
        Dialog_Size = settings.value('Dialog_Size')
        if Dialog_Size is True or Dialog_Size == 'true':
            settings.setValue("OpenURI_size", self.size())
            settings.setValue("OpenURI_pos", self.pos())


# Path: source/gui/panconvert_diag_openuri.py
# class Ui_DialogOpenURI(object):
#     def setupUi(self, DialogOpenURI):
#         DialogOpenURI.setObjectName("DialogOpenURI")
#         DialogOpenURI.resize(386, 90)
#         sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(DialogOpenURI.sizePolicy().hasHeightForWidth())
#         DialogOpenURI.setSizePolicy(sizePolicy)
#         DialogOpenURI.setMinimumSize(QtCore.QSize(386, 90))
#         DialogOpenURI.setMaximumSize(QtCore.QSize(386, 90))
#         self.URI = QtWidgets.QPlainTextEdit(DialogOpenURI)
#         self.URI.setGeometry(QtCore.QRect(10, 10, 371, 41))
#         self.URI.setObjectName("URI")
#         self.layoutWidget = QtWidgets.QWidget(DialogOpenURI)
#         self.layoutWidget.setGeometry(QtCore.QRect(7, 60, 371, 32))
#         self.layoutWidget.setObjectName("layoutWidget")
#         self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
#         self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
#         self.horizontalLayout.setObjectName("horizontalLayout")
#         self.CheckBoxStayOnTop = QtWidgets.QCheckBox(self.layoutWidget)
#         self.CheckBoxStayOnTop.setEnabled(False)
#         self.CheckBoxStayOnTop.setObjectName("CheckBoxStayOnTop")
#         self.horizontalLayout.addWidget(self.CheckBoxStayOnTop)
#         self.ButtonCancel = QtWidgets.QPushButton(self.layoutWidget)
#         sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
#         sizePolicy.setHorizontalStretch(0)
#         sizePolicy.setVerticalStretch(0)
#         sizePolicy.setHeightForWidth(self.ButtonCancel.sizePolicy().hasHeightForWidth())
#         self.ButtonCancel.setSizePolicy(sizePolicy)
#         self.ButtonCancel.setMinimumSize(QtCore.QSize(114, 32))
#         self.ButtonCancel.setMaximumSize(QtCore.QSize(114, 32))
#         self.ButtonCancel.setBaseSize(QtCore.QSize(114, 32))
#         self.ButtonCancel.setObjectName("ButtonCancel")
#         self.horizontalLayout.addWidget(self.ButtonCancel)
#         self.ButtonOpenURI = QtWidgets.QPushButton(self.layoutWidget)
#         self.ButtonOpenURI.setObjectName("ButtonOpenURI")
#         self.horizontalLayout.addWidget(self.ButtonOpenURI)
# 
#         self.retranslateUi(DialogOpenURI)
#         QtCore.QMetaObject.connectSlotsByName(DialogOpenURI)
# 
#     def retranslateUi(self, DialogOpenURI):
#         _translate = QtCore.QCoreApplication.translate
#         DialogOpenURI.setWindowTitle(_translate("DialogOpenURI", "Open URI"))
#         self.CheckBoxStayOnTop.setText(_translate("DialogOpenURI", "Stay on Top"))
#         self.ButtonCancel.setText(_translate("DialogOpenURI", "Cancel"))
#         self.ButtonOpenURI.setText(_translate("DialogOpenURI", "Open URI"))


# Path: source/dialogs/dialog_openuri.py
from source.gui.panconvert_diag_openuri import Ui_DialogOpenURI
from source.language.messages import *
from source.main_gui import *
from os.path import isfile
import builtins
import codecs

        self.ui = Ui_DialogOpenURI()
        self.ui.setupUi(self)
        self.ui.ButtonOpenURI.clicked.connect(self.openuri)
        self.ui.ButtonCancel.clicked.connect(self.closeEvent)
        self.ui.CheckBoxStayOnTop.stateChanged.connect(self.stayOnTop)

        #Initialize Settings
        settings = QSettings('Pandoc', 'PanConvert')

        self.resize(settings.value("OpenURI_size", QSize(270, 225)))
        self.move(settings.value("OpenURI_pos", QPoint(50, 50)))
        uri = ''


    def stayOnTop(self):
        if self.ui.CheckBoxStayOnTop.isChecked():
            self.setWindowFlags(
                self.windowFlags() & ~QtCore.Qt.WindowStaysOnTopHint)
        else:
            self.setWindowFlags(
                self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
        self.show()

    def closeEvent(self, event):
        settings = QSettings('Pandoc', 'PanConvert')
        Dialog_Size = settings.value('Dialog_Size')
        if Dialog_Size is True or Dialog_Size == 'true':
            settings.setValue("OpenURI_size", self.size())
            settings.setValue("OpenURI_pos", self.pos())


        settings.sync()