Exemple #1
0
    def __init__(self, parent):
        super(AboutDialog, self).__init__(parent)

        title = _("About {}...").format(configuration.get("Globals", "name"))
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title, self)
        top_layout.addWidget(self.title_widget)

        text = QLabel(u"{}<br/>Version : {}<br/><br/>".format(
            copyright(), str(configuration.this_version)) +
                      _("""This program is given to you with a few important
freedoms and duties as specified in the license below. <b>We believe they will help to make a better world</b>. They are
also <b>legally binding</b> (see Free Software Foundation's website), so make sure you read the license
carefully. We give you the right to
<ul>
<li>run the program,</li>
<li>inspect it to make sure it is safe to use,</li>
<li>modify it to suit your needs,</li>
<li>distribute copies of it,</li>
</ul>
as long as you give those freedoms and duties to anybody you give this program to.
"""))
        text.setTextFormat(Qt.RichText)
        text.setWordWrap(True)
        # text.setMaximumWidth(400)
        top_layout.addWidget(text)

        browser = QTextBrowser()
        browser.setLineWrapMode(QTextEdit.NoWrap)
        browser.setPlainText(license())
        browser.setMinimumWidth(browser.document().documentLayout().
                                documentSize().toSize().width())
        browser.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        top_layout.addWidget(browser)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
Exemple #2
0
    def __init__(self,parent):
        super(HelpDialog,self).__init__(parent)

        title = _("A bit of help")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        browser = QTextBrowser()

        import os.path
        from koi.Configurator import resource_dir

        with open( os.path.join(resource_dir,"manual.html"), encoding='utf-8') as input:
            html = input.read()
        browser.setHtml(html)

        # browser.setLineWrapMode(QTextEdit.NoWrap)
        #         browser.setHtml("""<h1>Tables</h1>
        #
        # In tables you can edit, don't forget these few useful shortcuts :
        # <ul>
        # <li><b>F5</b> : will insert a line under your cursor</li>
        # <li><b>Shift + F5</b> : will append a line at the end of the table</li>
        # <li><b>F8</b> : will delete the line under your cursor (if you're allowed to)</li>
        # <li><b>F1</b> and <b>Shift + F1</b> : will allow you to move up/move down a row </li>
        # </ul>
        # """)
        # browser.setMinimumWidth(browser.document().documentLayout().documentSize().toSize().width())
        browser.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        top_layout.addWidget(browser)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)