예제 #1
0
class HelpForm(QDialog):

    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)
        self.create_widgets()
        self.layout_widgets()
        self.create_connections()
        self.textBrowser.setSearchPaths([":/"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle(self.tr("%1 Help").arg(
                QApplication.applicationName()))


    def create_widgets(self):
        self.backAction = QAction(QIcon(":/back.png"), self.tr("&Back"),
                self)
        self.backAction.setShortcut(QKeySequence.Back)
        self.homeAction = QAction(QIcon(":/home.png"), self.tr("&Home"),
                self)
        self.homeAction.setShortcut(self.tr("Home"))
        self.pageLabel = QLabel()

        self.toolBar = QToolBar()
        self.toolBar.addAction(self.backAction)
        self.toolBar.addAction(self.homeAction)
        self.toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()


    def layout_widgets(self):
        layout = QVBoxLayout()
        layout.addWidget(self.toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)


    def create_connections(self):
        self.backAction.triggered.connect(self.textBrowser.backward)
        self.homeAction.triggered.connect(self.textBrowser.home)
        self.textBrowser.sourceChanged.connect(self.updatePageTitle)


    def updatePageTitle(self):
        self.pageLabel.setText(self.textBrowser.documentTitle())
예제 #2
0
파일: helpform.py 프로젝트: bindx/EE-Book
class HelpForm(QDialog):

    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        QTextCodec.setCodecForTr(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForCStrings(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForLocale(QTextCodec.codecForName("system"))
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()
        # self.textBrowser.

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        self.connect(backAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("backward()"))
        self.connect(homeAction, SIGNAL("triggered()"),
                     self.textBrowser, SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("%s Help" % QApplication.applicationName())


    def updatePageTitle(self):
        self.pageLabel.setText(self.textBrowser.documentTitle())
예제 #3
0
class HelpForm(QDialog):
    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        QTextCodec.setCodecForTr(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForCStrings(QTextCodec.codecForName("system"))
        QTextCodec.setCodecForLocale(QTextCodec.codecForName("system"))
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()
        # self.textBrowser.

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        self.connect(backAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("backward()"))
        self.connect(homeAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("%s Help" % QApplication.applicationName())

    def updatePageTitle(self):
        self.pageLabel.setText(self.textBrowser.documentTitle())
예제 #4
0
class HelpForm(QDialog):

    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)
        self.create_widgets()
        self.layout_widgets()
        self.create_connections()
        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(450, 400)
        self.setWindowTitle("{0} Help".format(
            QApplication.applicationName()))

    def create_widgets(self):
        self.backAction = QAction(QIcon(":/back.png"), "&Atras", self)
        self.backAction.setShortcut(QKeySequence.Back)
        self.homeAction = QAction(QIcon(":/home.png"), "&Inicio", self)
        self.homeAction.setShortcut("Inicio")
        self.pageLabel = QLabel()

        self.toolBar = QToolBar()
        self.toolBar.addAction(self.backAction)
        self.toolBar.addAction(self.homeAction)
        self.toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()

    def layout_widgets(self):
        layout = QVBoxLayout()
        layout.addWidget(self.toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

    def create_connections(self):
        self.backAction.triggered.connect(self.textBrowser.backward)
        self.homeAction.triggered.connect(self.textBrowser.home)
        self.textBrowser.sourceChanged.connect(self.updatePageTitle)

    def updatePageTitle(self):
        self.pageLabel.setText(self.textBrowser.documentTitle())
예제 #5
0
class HelpWidget(QDialog):

    def __init__(self, page, parent=None):
        super(HelpWidget, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)
        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")
        self.pageLabel = QLabel()

        toolBar = QToolBar()
        toolBar.addAction(backAction)
        toolBar.addAction(homeAction)
        toolBar.addWidget(self.pageLabel)
        self.textBrowser = QTextBrowser()

        layout = QVBoxLayout()
        layout.addWidget(toolBar)
        layout.addWidget(self.textBrowser, 1)
        self.setLayout(layout)

        backAction.triggered.connect(self.textBrowser.backward)
        homeAction.triggered.connect(self.textBrowser.home)
        self.textBrowser.sourceChanged.connect(self.updatePageTitle)

        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(page))
        self.resize(400, 600)
        self.setWindowTitle("{0} Help".format(
                QApplication.applicationName()))


    def updatePageTitle(self):
        self.pageLabel.setText(self.textBrowser.documentTitle())
예제 #6
0
class HelpForm(QDialog):

    ## constructor
    # \param page the starting html page
    # \param parent parent widget
    def __init__(self, page, parent=None):
        super(HelpForm, self).__init__(parent)

        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setAttribute(Qt.WA_GroupLeader)

        ## help tool bar
        self.toolBar = None
        ## help text Browser
        self.textBrowser = None
        ## main label of the help
        self.pageLabel = None

        self._page = page
        self.createGUI()
        self.createActions()

    ##  creates GUI
    # \brief It create dialogs for help dialog
    def createGUI(self):
        ## help tool bar
        self.toolBar = QToolBar(self)
        ## help text Browser
        self.textBrowser = QTextBrowser(self)

        layout = QVBoxLayout(self)
        layout.addWidget(self.toolBar)
        layout.addWidget(self.textBrowser, 1)

        self.setLayout(layout)
        self.textBrowser.setSearchPaths([":/help"])
        self.textBrowser.setSource(QUrl(self._page))
        self.resize(660, 700)
        self.setWindowTitle("%s Help" % (QApplication.applicationName()))

    ## creates actions
    # \brief It creates actions and sets the command pool and stack
    def createActions(self):

        backAction = QAction(QIcon(":/back.png"), "&Back", self)
        backAction.setShortcut(QKeySequence.Back)

        forwardAction = QAction(QIcon(":/forward.png"), "&Forward", self)
        forwardAction.setShortcut("Forward")

        homeAction = QAction(QIcon(":/home.png"), "&Home", self)
        homeAction.setShortcut("Home")

        ## main label of the help
        self.pageLabel = QLabel(self)

        self.toolBar.addAction(backAction)
        self.toolBar.addAction(forwardAction)
        self.toolBar.addAction(homeAction)
        self.toolBar.addSeparator()
        self.toolBar.addWidget(self.pageLabel)

        self.disconnect(backAction, SIGNAL("triggered()"), self.textBrowser,
                        SLOT("backward()"))
        self.disconnect(forwardAction, SIGNAL("triggered()"), self.textBrowser,
                        SLOT("forward()"))
        self.disconnect(homeAction, SIGNAL("triggered()"), self.textBrowser,
                        SLOT("home()"))
        self.disconnect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                        self.updatePageTitle)

        self.connect(backAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("backward()"))
        self.connect(forwardAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("forward()"))
        self.connect(homeAction, SIGNAL("triggered()"), self.textBrowser,
                     SLOT("home()"))
        self.connect(self.textBrowser, SIGNAL("sourceChanged(QUrl)"),
                     self.updatePageTitle)

        self.updatePageTitle()

    ## updates the title page
    # \brief It resets the pageLabel withg the document title
    def updatePageTitle(self):
        self.pageLabel.setText(
            "<p><b><i><font color='#0066ee' font size = 4>" + "&nbsp;&nbsp;" +
            self.textBrowser.documentTitle() + "</i></b></p></br>")