def createHelpWindow(self): # http://www.walletfox.com/course/qhelpengineexample.php help_path = (Path(__file__).parent / 'TimeView.qhc').resolve() assert help_path.exists() help_engine = QtHelp.QHelpEngine(str(help_path)) help_engine.setupData() tab_widget = QtWidgets.QTabWidget() tab_widget.setMaximumWidth(400) tab_widget.addTab(help_engine.contentWidget(), "Contents") tab_widget.addTab(help_engine.indexWidget(), "Index") text_viewer = HelpBrowser(help_engine) url = "qthelp://org.sphinx.timeview.1.0/doc/index.html" text_viewer.setSource(QtCore.QUrl(url)) help_engine.contentWidget()\ .linkActivated['QUrl'].connect(text_viewer.setSource) help_engine.indexWidget()\ .linkActivated['QUrl', str].connect(text_viewer.setSource) horiz_splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) horiz_splitter.insertWidget(0, tab_widget) horiz_splitter.insertWidget(1, text_viewer) help_window = QtWidgets.QDockWidget('Help', self) help_window.setWidget(horiz_splitter) help_window.hide() self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, help_window) return help_window
def createHelpWindow(self): self.helpEngine = QtHelp.QHelpEngine( os.path.join(CURRENT_DIR, "documentation", "qgraphicshelpexample.qhc") ) self.helpEngine.setupData() tWidget = QtWidgets.QTabWidget() tWidget.setMaximumWidth(200) tWidget.addTab(self.helpEngine.contentWidget(), "Contents") tWidget.addTab(self.helpEngine.indexWidget(), "Index") textViewer = HelpBrowser(self.helpEngine) textViewer.setSource( QtCore.QUrl("qthelp://walletfox.qt.helpexample/doc/index.html") ) self.helpEngine.setUsesFilterEngine(True) self.helpEngine.contentWidget().linkActivated.connect(textViewer.setSource) self.helpEngine.indexWidget().linkActivated.connect(textViewer.setSource) horizSplitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) horizSplitter.insertWidget(0, tWidget) horizSplitter.insertWidget(1, textViewer) horizSplitter.hide() self.helpWindow = QtWidgets.QDockWidget(self.tr("Help"), self) self.helpWindow.setWidget(horizSplitter) self.helpWindow.hide() self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.helpWindow)
def __init__(self): # Super call super(ShovelBot, self).__init__() # "Public" declarations self.ui = ClientUi() self.help_dialog: typing.Optional[Help] = None self.request_factory: typing.Optional[requests.Factory] = None self.extensions: Dict[str, Union[dataclasses.ExtensionStub, dataclasses.Extension]] = {} self.settings: settings.Display = settings.Display() self.themes: List = [themes.dark, themes.high_contrast] self.display_timer: QtCore.QTimer = QtCore.QTimer(parent=self) self.base_theme: QtGui.QPalette = QtGui.QPalette(self.palette()) self.help_engine: QtHelp.QHelpEngine = QtHelp.QHelpEngineCore( 'resources/docs/shovelbot.qhc') self.command_manager: commands.Manager = commands.Manager() self.database: QtSql.QSqlDatabase = QtSql.QSqlDatabase.addDatabase( 'QSQLITE') # "Private" attributes self._settings_file: typing.Optional[QtCore.QFile] = None # Internal calls self.help_engine.warning.connect(self.LOGGER.warning) self.database.setDatabaseName('data/shovelbot.db')
def __init__(self, qhcfile, *args, **kw): self._kwmap = dict() if not isfile(qhcfile): raise IOError("%s file not found" % (qhcfile)) super(AtAssistant, self).__init__(*args, **kw) loadUI(join(dirname(__file__), "assistant.ui"), self) self.toolBar.setObjectName('Navigation Toolbar') self.hengine = QtHelp.QHelpEngine(qhcfile) self.hengine.setupData() self.hengine.registerDocumentation(qhcfile.replace('.qhc', '.qch')) self.hengine.searchEngine().reindexDocumentation() self.hbrowser = AtHelpBrowser() self.hbrowser.setHelpEngine(self.hengine) self.setupToolBar() self.setCentralWidget(self.hbrowser) self.hengine.contentWidget().linkActivated.connect( self.hbrowser.setSource) self.queries = self.hengine.searchEngine().queryWidget() self.results = self.hengine.searchEngine().resultWidget() self.index = self.hengine.indexWidget() self.contents = self.hengine.contentWidget() self.tabifyDockWidget(self.contentDock, self.indexDock) self.tabifyDockWidget(self.contentDock, self.searchDock) self.searchDock.hide() # search dock (hidden) search = QtWidgets.QFrame(self) vbox = QtWidgets.QVBoxLayout(search) vbox.setContentsMargins(3, 3, 3, 3) vbox.addWidget(self.queries) vbox.addWidget(self.results) self.results.requestShowLink.connect(self.hbrowser.setSource) self.index.linkActivated.connect(self.hbrowser.setSource) self.queries.search.connect(self.search) # index dock index = QtWidgets.QFrame(self) filterEdit = AtLineEdit(self) vbox = QtWidgets.QVBoxLayout(index) vbox.setContentsMargins(3, 3, 3, 3) vbox.addWidget(QtWidgets.QLabel("Look for:")) vbox.addWidget(filterEdit) vbox.addWidget(self.index) filterEdit.textChanged.connect(self.filter) self.searchDock.setWidget(search) self.contentDock.setWidget(self.contents) self.indexDock.setWidget(index) self._restoreSettings() self.indexDock.show() self.contentDock.show() self._genKeywordMap()
def __init__ (self, parent=None): QtWidgets.QDialog.__init__(self, parent) self.engine = QtHelp.QHelpEngine(getdata.path('fgmk.qhc'), self) self.engine.setupData() self.engine.registerDocumentation(getdata.path('fgmk.qch')) self.engine.searchEngine().reindexDocumentation() self.querySearch = self.engine.searchEngine().queryWidget() self.resultSearch = self.engine.searchEngine().resultWidget() splitter = QtWidgets.QSplitter(orientation=QtCore.Qt.Horizontal) self.browser = HelpBrowser(self.engine, self) tWidget = QtWidgets.QTabWidget(self); searcWidget = QtWidgets.QWidget(self) VBox = QtWidgets.QVBoxLayout(searcWidget) VBox.addWidget(self.querySearch) VBox.addWidget(self.resultSearch) tWidget.setMaximumWidth(200); self.hcontent = self.engine.contentWidget() self.hindex = self.engine.indexWidget() tWidget.addTab(self.hcontent, "Contents") #tWidget.addTab(self.hindex, "Index"); tWidget.addTab(searcWidget, "Search") self.hcontent.expandToDepth(2) self.hcontent.setExpandsOnDoubleClick(False) self.hcontent.linkActivated.connect(self.browser.setSource) self.hindex.linkActivated.connect(self.browser.setSource) self.resultSearch.requestShowLink.connect(self.browser.setSource) self.querySearch.search.connect(self.search) splitter.addWidget(tWidget) splitter.addWidget(self.browser) splitter.setSizes((160,440)) hlayout = QtWidgets.QHBoxLayout(self) hlayout.addWidget(splitter) self.browser.setSource(QtCore.QUrl('qthelp://org.sphinx.fgmk.'+ __version__ +'/doc/index.html')) #self.setLayout(hlayout) self.resize(800, 600) self.setWindowTitle(u'%s help' % __title__)
def __init__(self, collection_file: str, parent: QtWidgets.QWidget = None): # Super call super(Help, self).__init__(parent=parent) # Ui attributes self.tabs: typing.Optional[QtWidgets.QTabBar] = None self.new_tab: typing.Optional[QtWidgets.QToolButton] = None self.url_box: typing.Optional[QtWidgets.QLineEdit] = None self.back_button: typing.Optional[QtWidgets.QToolButton] = None self.forward_button: typing.Optional[QtWidgets.QToolButton] = None self.home_button: typing.Optional[QtWidgets.QToolButton] = None self.page_container: typing.Optional[QtWidgets.QStackedWidget] = None # Url attributes self.url_completer: typing.Optional[QtWidgets.QCompleter] = None self.url_validator: typing.Optional[ QtGui.QRegularExpressionValidator] = None # Internal attributes self._engine: QtHelp.QHelpEngineCore = QtHelp.QHelpEngineCore( collection_file) self._pages: typing.Dict[str, HelpPage] = {}