class geopunt4QgisAboutdialog(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self, None) self.setWindowFlags( self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint ) self.setWindowFlags( self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) # initialize locale locale = QtCore.QSettings().value("locale/userLocale")[0:2] localePath = os.path.join(os.path.dirname(__file__), 'i18n', 'geopunt4qgis_{}.qm'.format(locale)) if os.path.exists(localePath): self.translator = QtCore.QTranslator() self.translator.load(localePath) if QtCore.qVersion() > '4.3.3': QtCore.QCoreApplication.installTranslator(self.translator) if 'en' in locale: self.htmlFile = os.path.join(os.path.dirname(__file__), 'i18n', 'about-en.html') else: #dutch is default self.htmlFile = os.path.join(os.path.dirname(__file__), 'i18n', 'about-nl.html') self._initGui() def _initGui(self): # Set up the user interface from Designer. self.ui = Ui_aboutDlg() self.ui.setupUi(self) self.ui.buttonBox.addButton( QtGui.QPushButton("Sluiten"), QtGui.QDialogButtonBox.RejectRole ) with open(self.htmlFile, 'r') as html: self.ui.aboutText.setHtml( html.read() )
class geopunt4QgisAboutdialog(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self, None) self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) # initialize locale locale = QtCore.QSettings().value("locale/userLocale")[0:2] localePath = os.path.join(os.path.dirname(__file__), 'i18n', 'geopunt4qgis_{}.qm'.format(locale)) if os.path.exists(localePath): self.translator = QtCore.QTranslator() self.translator.load(localePath) if QtCore.qVersion() > '4.3.3': QtCore.QCoreApplication.installTranslator(self.translator) if 'en' in locale: self.htmlFile = os.path.join(os.path.dirname(__file__), 'i18n', 'about-en.html') else: #dutch is default self.htmlFile = os.path.join(os.path.dirname(__file__), 'i18n', 'about-nl.html') self._initGui() def _initGui(self): # Set up the user interface from Designer. self.ui = Ui_aboutDlg() self.ui.setupUi(self) self.ui.buttonBox.addButton(QtGui.QPushButton("Sluiten"), QtGui.QDialogButtonBox.RejectRole) with open(self.htmlFile, 'r') as html: self.ui.aboutText.setHtml(html.read())
def _initGui(self): # Set up the user interface from Designer. self.ui = Ui_aboutDlg() self.ui.setupUi(self) self.ui.buttonBox.addButton(QtGui.QPushButton("Sluiten"), QtGui.QDialogButtonBox.RejectRole) with codecs.open(self.htmlFile, 'r', encoding="utf-8") as html: self.ui.aboutText.setHtml(html.read())
def _initGui(self): # Set up the user interface from Designer. self.ui = Ui_aboutDlg() self.ui.setupUi(self) self.ui.buttonBox.addButton( QtGui.QPushButton("Sluiten"), QtGui.QDialogButtonBox.RejectRole ) with open(self.htmlFile, 'r') as html: self.ui.aboutText.setHtml( html.read() )