Ejemplo n.º 1
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle('Install miniconda')
        self.setModal(True)
        self.resize(500, 500)

        text = 'This will download and install miniconda on your computer.'

        self._label = QtGui.QLabel(text, self)

        self._scipystack = QtGui.QCheckBox('Also install scientific packages',
                                           self)
        self._scipystack.setChecked(True)
        self._path = QtGui.QLineEdit(default_conda_dir, self)
        self._progress = QtGui.QProgressBar(self)
        self._outputLine = QtGui.QLabel(self)
        self._output = QtGui.QPlainTextEdit(self)
        self._output.setReadOnly(True)
        self._button = QtGui.QPushButton('Install', self)

        self._outputLine.setSizePolicy(QtGui.QSizePolicy.Ignored,
                                       QtGui.QSizePolicy.Fixed)

        vbox = QtGui.QVBoxLayout(self)
        self.setLayout(vbox)
        vbox.addWidget(self._label, 0)
        vbox.addWidget(self._path, 0)
        vbox.addWidget(self._scipystack, 0)
        vbox.addWidget(self._progress, 0)
        vbox.addWidget(self._outputLine, 0)
        vbox.addWidget(self._output, 1)
        vbox.addWidget(self._button, 0)

        self._button.clicked.connect(self.go)

        self.addOutput('Waiting to start installation.\n')
        self._progress.setVisible(False)

        self.lineFromStdOut.connect(self.setStatus)
Ejemplo n.º 2
0
    def __init__(self, parent=None, collection_filename=None):
        """
            Initializes an assistance instance.
            When collection_file is none, it is determined from the
            appDataDir.
        """
        from pyzolib.qt import QtHelp
        super().__init__(parent)
        self.setWindowTitle('Help')
        pyzoDir, appDataDir = getResourceDirs()
        if collection_filename is None:
            # Collection file is stored in pyzo data dir:
            collection_filename = os.path.join(appDataDir, 'tools', 'docs.qhc')
        self._engine = QtHelp.QHelpEngine(collection_filename)

        # Important, call setup data to load the files:
        self._engine.setupData()

        # If no files are loaded, register at least the pyzo docs:
        if len(self._engine.registeredDocumentations()) == 0:
            doc_file = os.path.join(pyzoDir, 'resources', 'pyzo.qch')
            ok = self._engine.registerDocumentation(doc_file)

        # The main players:
        self._content = self._engine.contentWidget()
        self._index = self._engine.indexWidget()
        self._indexTab = QtGui.QWidget()
        il = QtGui.QVBoxLayout(self._indexTab)
        filter_text = QtGui.QLineEdit()
        il.addWidget(filter_text)
        il.addWidget(self._index)

        self._helpBrowser = HelpBrowser(self._engine)
        self._searchEngine = self._engine.searchEngine()
        self._settings = Settings(self._engine)

        self._progress = QtGui.QWidget()
        pl = QtGui.QHBoxLayout(self._progress)
        bar = QtGui.QProgressBar()
        bar.setMaximum(0)
        pl.addWidget(QtGui.QLabel('Indexing'))
        pl.addWidget(bar)

        self._searchResultWidget = self._searchEngine.resultWidget()
        self._searchQueryWidget = self._searchEngine.queryWidget()
        self._searchTab = QtGui.QWidget()
        search_layout = QtGui.QVBoxLayout(self._searchTab)
        search_layout.addWidget(self._searchQueryWidget)
        search_layout.addWidget(self._searchResultWidget)

        tab = QtGui.QTabWidget()
        tab.addTab(self._content, "Contents")
        tab.addTab(self._indexTab, "Index")
        tab.addTab(self._searchTab, "Search")
        tab.addTab(self._settings, "Settings")

        splitter = QtGui.QSplitter(self)
        splitter.addWidget(tab)
        splitter.addWidget(self._helpBrowser)

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(splitter)
        layout.addWidget(self._progress)

        # Connect clicks:
        self._content.linkActivated.connect(self._helpBrowser.setSource)
        self._index.linkActivated.connect(self._helpBrowser.setSource)
        self._searchEngine.searchingFinished.connect(self.onSearchFinish)
        self._searchEngine.indexingStarted.connect(self.onIndexingStarted)
        self._searchEngine.indexingFinished.connect(self.onIndexingFinished)
        filter_text.textChanged.connect(self._index.filterIndices)
        self._searchResultWidget.requestShowLink.connect(
            self._helpBrowser.setSource)
        self._searchQueryWidget.search.connect(self.goSearch)

        # Always re-index on startup:
        self._searchEngine.reindexDocumentation()

        self._search_term = None

        # Show initial page:
        # self.showHelpForTerm('welcome to pyzo')
        self._helpBrowser.setHtml(help_help)