コード例 #1
0
ファイル: preview.py プロジェクト: gpa14/enki
    def terminate(self):
        """Uninstall themselves
        """
        self._typingTimer.stop()
        self._typingTimer.timeout.disconnect(self._scheduleDocumentProcessing)
        try:
            self._widget.webView.page().mainFrame().loadFinished.disconnect(
                self._restoreScrollPos)
        except TypeError:  # already has been disconnected
            pass
        self.previewSync.terminate()
        core.workspace().modificationChanged.disconnect(
            self._onDocumentModificationChanged)

        self._widget.cbTemplate.currentIndexChanged.disconnect(
            self._onCurrentTemplateChanged)
        core.aboutToTerminate.disconnect(self._quitingApplication)
        core.workspace().currentDocumentChanged.disconnect(
            self._onDocumentChanged)
        core.workspace().textChanged.disconnect(self._onTextChanged)
        core.uiSettingsManager().dialogAccepted.disconnect(
            self._scheduleDocumentProcessing)
        self._widget.webView.page().linkClicked.disconnect(self._onLinkClicked)
        self._widget.webView.page().mainFrame().titleChanged.disconnect(
            self._updateTitle)
        self._widget.cbEnableJavascript.clicked.disconnect(
            self._onJavaScriptEnabledCheckbox)
        self._widget.tbSave.clicked.disconnect(self.onPreviewSave)
        self._widget.splitter.splitterMoved.disconnect(self.on_splitterMoved)
        self._thread.logWindowClear.disconnect(self._clear_log)
        self._thread.logWindowText.disconnect()

        self._thread.htmlReady.disconnect(self._setHtml)
        self._thread.stop_async()
        self._thread.wait()
コード例 #2
0
ファイル: __init__.py プロジェクト: hlamer/enki
 def terminate(self):
     self.uninstall()
     core.workspace().currentDocumentChanged.disconnect(self._installOrUninstallIfNecessary)
     core.workspace().currentDocumentChanged.disconnect(self._updateEvalActionEnabledState)
     core.workspace().languageChanged.disconnect(self._installOrUninstallIfNecessary)
     core.workspace().languageChanged.disconnect(self._updateEvalActionEnabledState)
     core.uiSettingsManager().dialogAccepted.disconnect(self._applySettings)
     core.uiSettingsManager().aboutToExecute.disconnect(self._onSettingsDialogAboutToExecute)
コード例 #3
0
ファイル: helloworld.py プロジェクト: daffodil/enki
    def __init__(self):
        QMessageBox.information(core.mainWindow(), "Hello, world", "Plugin loaded")
        self._addAction()
        self._createDock()
        self._readSettings()
        
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)

        core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
コード例 #4
0
ファイル: __init__.py プロジェクト: bjones1/enki
 def terminate(self):
     self.uninstall()
     core.workspace().currentDocumentChanged.disconnect(self._installOrUninstallIfNecessary)
     core.workspace().currentDocumentChanged.disconnect(self._updateEvalActionEnabledState)
     core.workspace().languageChanged.disconnect(self._installOrUninstallIfNecessary)
     core.workspace().languageChanged.disconnect(self._updateEvalActionEnabledState)
     core.uiSettingsManager().aboutToExecute.disconnect(self._onSettingsDialogAboutToExecute)
     if self._dock:
         # See https://jupyter-client.readthedocs.io/en/stable/api/manager.html#jupyter_client.KernelManager.shutdown_kernel.
         self._dock.ipython_widget.kernel_manager.shutdown_kernel()
コード例 #5
0
ファイル: test_preview_sync.py プロジェクト: adjustive/enki
 def test_uiCheck8(self):
     """Start with a short code file, make sure the preview window isn't
        opened, then enable the CodeChat module and refresh Enki.
        The preview winndow should be be opened."""
     self.testText = u'test'
     with self.assertRaises(AssertionError):
         self._doBasicTest('py')
     core.config()['CodeChat']['Enabled'] = True
     core.uiSettingsManager().dialogAccepted.emit();
     self._doBasicTest('py')
コード例 #6
0
ファイル: __init__.py プロジェクト: adjustive/enki
    def __init__(self):
        QObject.__init__(self)

        self._installed = False
        self._myMessageIsShown = False
        self._thread = None

        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
        core.uiSettingsManager().dialogAccepted.connect(self._applySettings)

        self._applySettings()
コード例 #7
0
ファイル: __init__.py プロジェクト: hlamer/enki
    def terminate(self):
        """Uninstall the plugin
        """
        if self._thread is not None:
            self._thread.stopAsync()
            self._thread.wait()

        self._uninstall()

        core.uiSettingsManager().aboutToExecute.disconnect(self._onSettingsDialogAboutToExecute)
        core.uiSettingsManager().dialogAccepted.disconnect(self._applySettings)
コード例 #8
0
ファイル: test_preview.py プロジェクト: freason/enki
 def test_previewCheck8(self):
     """Start with a short code file, make sure the preview window isn't
        opened, then enable the CodeChat module and refresh Enki.
        The preview window should now be opened."""
     self.testText = 'test'
     self.createFile('file.py', self.testText)
     with self.assertRaisesRegex(AssertionError, 'Dock Previe&w not found'):
         self._dock()
     core.config()['CodeChat']['Enabled'] = True
     core.uiSettingsManager().dialogAccepted.emit()
     self._doBasicTest('py', numEmittedExpected=1)
     assert 'test' in self._html()
コード例 #9
0
ファイル: __init__.py プロジェクト: bjones1/enki
    def __init__(self):
        """Setup settings and activate plugin, if feasable."""
        self._checkPaths()
        self._checkSettings()
        self._repo = constants.EMPTY_REPO
        helper.initPlugins()

        core.uiSettingsManager().aboutToExecute.connect(
            self._onSettingsDialogAboutToExecute)

        getRepoThread = GetRepoThread()
        getRepoThread.success.connect(self._onSuccessGetRepo)
        getRepoThread.start()
コード例 #10
0
ファイル: __init__.py プロジェクト: daffodil/enki
 def __init__(self):
     core.workspace().documentOpened.connect(self._applyLanguageToDocument)
     
     self._menu = core.actionManager().action("mView/mHighlighting").menu()
     
     self._menu.aboutToShow.connect(self._onMenuAboutToShow)
     core.workspace().currentDocumentChanged.connect(self._onCurrentDocumentChanged)
     core.workspace().modifiedChanged.connect(self._onDocumentModifiedChanged)
     
     core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
     core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
     
     self._menu.setEnabled(False)
     
     Plugin.instance = self
コード例 #11
0
ファイル: __init__.py プロジェクト: bjones1/enki
    def __init__(self):
        QObject.__init__(self)

        self._installed = False
        self._evalAction = None
        self._activeInterpreterPath = None
        self._dock = None

        # TODO handle situation, when lexer changed for current document
        core.workspace().currentDocumentChanged.connect(self._installOrUninstallIfNecessary)
        core.workspace().currentDocumentChanged.connect(self._updateEvalActionEnabledState)
        core.workspace().languageChanged.connect(self._installOrUninstallIfNecessary)
        core.workspace().languageChanged.connect(self._updateEvalActionEnabledState)
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)

        self._installOrUninstallIfNecessary()
コード例 #12
0
ファイル: test_preview.py プロジェクト: freason/enki
    def test_previewCheck22(self):
        """ Assume codechat is not installed, render a .rst file using
        restructuredText and then render using sphinx.
        """
        with ImportFail(['CodeChat']):
            self.testText = 'Underlying :download:`source code <file.rst>`.'
            self._doBasicTest('rst')
            self.assertTrue('Unknown interpreted text role "download".' in self._logText())
            self.assertTrue('red' in self._widget().prgStatus.styleSheet())

            self._doBasicSphinxConfig()
            core.uiSettingsManager().dialogAccepted.emit()
            self._assertHtmlReady(lambda: None, timeout=10000,
                                  numEmittedExpected=1)
            self.assertTrue("document isn't included in any toctree" in self._logText())
            self.assertTrue('#FF9955' in self._widget().prgStatus.styleSheet())
コード例 #13
0
ファイル: __init__.py プロジェクト: bjones1/enki
    def terminate(self):
        """Uninstall the plugin
        """
        if self._dock is not None:
            self._thread.tagsReady.disconnect(self._dock.setTags)
            self._thread.error.disconnect(self._dock.onError)
            self._dock.remove()
            self._dock.term()
        self._typingTimer.stop()
        self._thread.stopAsync()
        self._thread.wait()

        core.workspace().currentDocumentChanged.disconnect(self._onDocumentChanged)
        core.workspace().textChanged.disconnect(self._onTextChanged)
        core.uiSettingsManager().aboutToExecute.disconnect(self._onSettingsDialogAboutToExecute)
        core.uiSettingsManager().dialogAccepted.disconnect(self._scheduleDocumentProcessing)
コード例 #14
0
ファイル: __init__.py プロジェクト: bjones1/enki
    def __init__(self):
        QObject.__init__(self)
        self._dock = None
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)
        core.workspace().textChanged.connect(self._onTextChanged)

        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
        core.uiSettingsManager().dialogAccepted.connect(self._scheduleDocumentProcessing)

        # If we update Tree on every key pressing, freezes are sensible (GUI thread draws tree too slowly
        # This timer is used for drawing Preview 1000 ms After user has stopped typing text
        self._typingTimer = QTimer()
        self._typingTimer.setInterval(1000)
        self._typingTimer.setSingleShot(True)
        self._typingTimer.timeout.connect(self._scheduleDocumentProcessing)

        self._thread = ProcessorThread()
コード例 #15
0
    def __init__(self):
        QObject.__init__(self)
        
        self._installed = False
        self._evalAction = None
        self._activeInterpreterPath = None

        # TODO handle situation, when lexer changed for current document
        core.workspace().documentOpened.connect(self._installOrUninstallIfNecessary)
        core.workspace().documentClosed.connect(self._installOrUninstallIfNecessary)
        core.workspace().currentDocumentChanged.connect(self._installOrUninstallIfNecessary)
        core.workspace().currentDocumentChanged.connect(self._updateEvalActionEnabledState)
        core.workspace().languageChanged.connect(self._installOrUninstallIfNecessary)
        core.workspace().languageChanged.connect(self._updateEvalActionEnabledState)
        core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
        
        self._installOrUninstallIfNecessary()
コード例 #16
0
ファイル: document.py プロジェクト: vi/enki
    def __init__( self, parentObject, filePath, createNew=False):
        """Create editor and open file.
        If file is None or createNew is True, empty not saved file is created
        IO Exceptions are not catched, therefore, must be catched on upper level
        """
        QWidget.__init__( self, parentObject)
        self._neverSaved = filePath is None or createNew
        self._filePath = filePath
        self._externallyRemoved = False
        self._externallyModified = False
        # File opening should be implemented in the document classes

        self._fileWatcher = _FileWatcher(filePath)
        self._fileWatcher.modified.connect(self._onWatcherFileModified)
        self._fileWatcher.removed.connect(self._onWatcherFileRemoved)

        if filePath and self._neverSaved:
            core.mainWindow().appendMessage('New file "%s" is going to be created' % filePath, 5000)

        self.qutepart = Qutepart(self)

        self.qutepart.setStyleSheet('QPlainTextEdit {border: 0}')

        self.qutepart.userWarning.connect(lambda text: core.mainWindow().statusBar().showMessage(text, 5000))

        self._applyQpartSettings()
        core.uiSettingsManager().dialogAccepted.connect(self._applyQpartSettings)

        layout = QVBoxLayout(self)
        layout.setMargin(0)
        layout.addWidget(self.qutepart)
        self.setFocusProxy(self.qutepart)

        if not self._neverSaved:
            originalText = self._readFile(filePath)
            self.qutepart.text = originalText
        else:
            originalText = ''

        #autodetect eol, if need
        self._configureEolMode(originalText)

        self._tryDetectSyntax()
コード例 #17
0
    def terminate(self):
        """Uninstall the plugin
        """
        if self._dock is not None:
            self._thread.tagsReady.disconnect(self._dock.setTags)
            self._thread.error.disconnect(self._dock.onError)
            self._dock.remove()
            self._dock.term()
        self._typingTimer.stop()
        self._thread.stopAsync()
        self._thread.wait()

        core.workspace().currentDocumentChanged.disconnect(
            self._onDocumentChanged)
        core.workspace().textChanged.disconnect(self._onTextChanged)
        core.uiSettingsManager().aboutToExecute.disconnect(
            self._onSettingsDialogAboutToExecute)
        core.uiSettingsManager().dialogAccepted.disconnect(
            self._scheduleDocumentProcessing)
コード例 #18
0
    def test_previewCheck21(self):
        """When user hit ok button in setting window, the project will get
        rebuild.
        """
        core.config()['CodeChat']['Enabled'] = True
        self._doBasicSphinxConfig()

        self.testText = """# ****
# head
# ****
#
# :doc:`missing.file`"""
        webEngineViewContent, logContent = self._doBasicSphinxTest('py')
        self.assertTrue('<span class="xref doc">missing.file</span>' in webEngineViewContent)
        self.assertTrue('unknown document: missing.file' in logContent)
        core.config()['Sphinx']['Enabled'] = False
        core.uiSettingsManager().dialogAccepted.emit()
        self._assertHtmlReady(lambda: None, timeout=10000,
                              numEmittedExpected=1)
        self.assertTrue('Unknown interpreted text role "doc"' in self._logText())
コード例 #19
0
ファイル: __init__.py プロジェクト: daffodil/enki
    def __init__(self):
        QObject.__init__(self)
        self._installed = False
        self._evalAction = None
        self._activeInterpreterPath = None

        allDocs = core.workspace().documents()
        self._schemeDocumentsCount = len(filter(self._isSchemeFile, allDocs))
        
        # TODO handle situation, when lexer changed for current document
        core.workspace().documentOpened.connect(self._installOrUninstallIfNecessary)
        core.workspace().documentClosed.connect(self._installOrUninstallIfNecessary)
        core.workspace().currentDocumentChanged.connect(self._installOrUninstallIfNecessary)
        core.workspace().currentDocumentChanged.connect(self._updateEvalActionEnabledState)
        core.workspace().languageChanged.connect(self._installOrUninstallIfNecessary)
        core.workspace().languageChanged.connect(self._updateEvalActionEnabledState)
        core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
        
        self._installOrUninstallIfNecessary()
コード例 #20
0
ファイル: test_preview.py プロジェクト: freason/enki
    def test_previewCheck21(self):
        """When user hit ok button in setting window, the project will get
        rebuild.
        """
        core.config()['CodeChat']['Enabled'] = True
        self._doBasicSphinxConfig()

        self.testText = """# ****
# head
# ****
#
# :doc:`missing.file`"""
        webViewContent, logContent = self._doBasicSphinxTest('py')
        self.assertTrue('<span class="pre">missing.file</span>' in webViewContent)
        self.assertTrue('unknown document: missing.file' in logContent)
        core.config()['Sphinx']['Enabled'] = False
        core.uiSettingsManager().dialogAccepted.emit()
        self._assertHtmlReady(lambda: None, timeout=10000,
                              numEmittedExpected=1)
        self.assertTrue('Unknown interpreted text role "doc"' in self._logText())
コード例 #21
0
ファイル: __init__.py プロジェクト: adjustive/enki
    def __init__(self):
        Plugin.instance = self
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)

        showTrailingAction = core.actionManager().action('mView/aShowIncorrectIndentation')
        showTrailingAction.triggered.connect(self._onShowIncorrectTriggered)
        showTrailingAction.setChecked(self._confShowIncorrect())
        showTrailingAction.setEnabled(not self._confShowAnyWhitespace())

        showAnyIndentAction = core.actionManager().action('mView/aShowAnyWhitespaces')
        showAnyIndentAction.triggered.connect(self._onShowAnyWhitespaceTriggered)
        showAnyIndentAction.setChecked(self._confShowAnyWhitespace())
        showAnyIndentAction.setEnabled(True)

        stripTrailingWhitespaceAction = core.actionManager().action('mEdit/aStripTrailingWhitespace')
        stripTrailingWhitespaceAction.triggered.connect(self._onStripTrailingTriggered)
        stripTrailingWhitespaceAction.setChecked(self._confStripTrailing())
        stripTrailingWhitespaceAction.setEnabled(True)

        core.workspace().documentOpened.connect(self._onDocumentOpened)
コード例 #22
0
ファイル: __init__.py プロジェクト: gpa14/enki
    def terminate(self):
        """Uninstall the plugin
        """
        core.actionManager().removeAction("mTools/aSetSphinxPath")
        core.project().changed.disconnect(self.onFileBrowserPathChanged)

        if self._dockInstalled:
            self._removeDock()

        if self._dock is not None:
            self._dock.terminate()

        core.workspace().currentDocumentChanged.disconnect(self._onDocumentChanged)
        core.workspace().languageChanged.disconnect(self._onDocumentChanged)
        core.uiSettingsManager().aboutToExecute.disconnect(self._onSettingsDialogAboutToExecute)
        core.uiSettingsManager().dialogAccepted.disconnect(self._onDocumentChanged)
        if self._dock:
            self._dock.closed.disconnect(self._onDockClosed)
            self._dock.shown.disconnect(self._onDockShown)
            self._saveAction.triggered.disconnect(self._dock.onPreviewSave)
コード例 #23
0
ファイル: openedfilemodel.py プロジェクト: adjustive/enki
    def __init__(self, workspace):
        DockWidget.__init__(self, workspace, "&Opened Files", QIcon(":/enkiicons/filtered.png"), "Alt+O")

        self._workspace = workspace

        self.setAllowedAreas( Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea )

        self.tvFiles = QTreeView(self)
        self.tvFiles.setHeaderHidden(True)
        self.tvFiles.setEditTriggers(QAbstractItemView.SelectedClicked)
        self.tvFiles.setContextMenuPolicy(Qt.CustomContextMenu)
        self.tvFiles.setDragEnabled(True)
        self.tvFiles.setDragDropMode(QAbstractItemView.InternalMove)
        self.tvFiles.setRootIsDecorated(False)
        self.tvFiles.setTextElideMode(Qt.ElideMiddle)
        self.tvFiles.setUniformRowHeights( True )

        self.tvFiles.customContextMenuRequested.connect(self._onTvFilesCustomContextMenuRequested)

        self.setWidget(self.tvFiles)
        self.setFocusProxy(self.tvFiles)

        self.model = _OpenedFileModel(self)  # Not protected, because used by Configurator
        self.tvFiles.setModel( self.model )
        self.tvFiles.setAttribute( Qt.WA_MacShowFocusRect, False )
        self.tvFiles.setAttribute( Qt.WA_MacSmallSize )

        self._workspace.currentDocumentChanged.connect(self._onCurrentDocumentChanged)

        # disconnected by startModifyModel()
        self.tvFiles.selectionModel().selectionChanged.connect(self._onSelectionModelSelectionChanged)

        self.tvFiles.activated.connect(self._workspace.focusCurrentDocument)

        core.actionManager().addAction("mView/aOpenedFiles", self.showAction())

        core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
コード例 #24
0
ファイル: __init__.py プロジェクト: adjustive/enki
    def __init__(self):
        """Create and install the plugin
        """
        QObject.__init__(self)

        self._dock = None
        self._saveAction = None
        self._dockInstalled = False
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)
        core.workspace().languageChanged.connect(self._onDocumentChanged)

        # Install our CodeChat page into the settings dialog.
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
        # Update preview dock when the settings dialog (which contains the CodeChat
        # enable checkbox) is changed.
        core.uiSettingsManager().dialogAccepted.connect(self._onDocumentChanged)

        # If user's config .json file lacks it, populate CodeChat's default
        # config key.
        if not 'CodeChat' in core.config():
            core.config()['CodeChat'] = {}
            core.config()['CodeChat']['Enabled'] = False
            core.config().flush()
コード例 #25
0
ファイル: __init__.py プロジェクト: rapgro/enki
    def __init__(self):
        """Create and install the plugin
        """
        QObject.__init__(self)

        self._dock = None
        self._saveAction = None
        self._dockInstalled = False
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)
        core.workspace().languageChanged.connect(self._onDocumentChanged)

        # Install our CodeChat page into the settings dialog.
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
        # Update preview dock when the settings dialog (which contains the
        # CodeChat enable checkbox) is changed.
        core.uiSettingsManager().dialogAccepted.connect(self._onDocumentChanged)

        # Provide a "Set Sphinx Path" menu item.
        core.uiSettingsManager().dialogAccepted.connect(self._setSphinxActionVisibility)
        self._sphinxAction = QAction('Set Sphinx path', self._dock)
        self._sphinxAction.setShortcut(QKeySequence('Alt+Shift+S'))
        core.actionManager().addAction('mTools/aSetSphinxPath',
                                       self._sphinxAction)
        self._sphinxAction.triggered.connect(self.onSphinxPath)
        # Only enable this command if the File browser has a valid path.
        self.onFileBrowserPathChanged()
        core.project().changed.connect(self.onFileBrowserPathChanged)

        # If user's config .json file lacks it, populate CodeChat's default
        # config key and Sphinx's default config key.
        if not 'CodeChat' in core.config():
            core.config()['CodeChat'] = {}
            core.config()['CodeChat']['Enabled'] = False
            core.config().flush()
        if not 'Sphinx' in core.config():
            core.config()['Sphinx'] = {}
            core.config()['Sphinx']['Enabled'] = False
            core.config()['Sphinx']['Executable'] = 'sphinx-build'
            core.config()['Sphinx']['ProjectPath'] = ''
            core.config()['Sphinx']['BuildOnSave'] = False
            core.config()['Sphinx']['OutputPath'] = os.path.join('_build',
                                                                 'html')
            core.config()['Sphinx']['AdvancedMode'] = False
            core.config()['Sphinx']['Cmdline'] = ('sphinx-build -d ' +
                                                  os.path.join('_build', 'doctrees') + ' . ' +
                                                  os.path.join('_build', 'html'))
            core.config().flush()

        self._setSphinxActionVisibility()
コード例 #26
0
ファイル: __init__.py プロジェクト: gpa14/enki
    def __init__(self):
        """Create and install the plugin
        """
        QObject.__init__(self)

        self._dock = None
        self._saveAction = None
        self._dockInstalled = False
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)  # Disconnected.
        core.workspace().languageChanged.connect(self._onDocumentChanged)  # Disconnected.

        # Install our CodeChat page into the settings dialog.
        core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)  # Disconnected.
        # Update preview dock when the settings dialog (which contains the
        # CodeChat enable checkbox) is changed.
        core.uiSettingsManager().dialogAccepted.connect(self._onDocumentChanged)  # Disconnected.

        # Provide a "Set Sphinx Path" menu item.
        core.uiSettingsManager().dialogAccepted.connect(self._setSphinxActionVisibility)
        self._sphinxAction = QAction("Set Sphinx path", self._dock)
        self._sphinxAction.setShortcut(QKeySequence("Alt+Shift+S"))
        core.actionManager().addAction("mTools/aSetSphinxPath", self._sphinxAction)
        self._sphinxAction.triggered.connect(self.onSphinxPath)
        # Only enable this command if the File browser has a valid path.
        self.onFileBrowserPathChanged()
        core.project().changed.connect(self.onFileBrowserPathChanged)

        # If user's config .json file lacks it, populate CodeChat's default
        # config key and Sphinx's default config key.
        if not "CodeChat" in core.config():
            core.config()["CodeChat"] = {}
            core.config()["CodeChat"]["Enabled"] = False
            core.config().flush()
        if not "Sphinx" in core.config():
            core.config()["Sphinx"] = {}
            core.config()["Sphinx"]["Enabled"] = False
            core.config()["Sphinx"]["Executable"] = "sphinx-build"
            core.config()["Sphinx"]["ProjectPath"] = ""
            core.config()["Sphinx"]["BuildOnSave"] = False
            core.config()["Sphinx"]["OutputPath"] = os.path.join("_build", "html")
            core.config()["Sphinx"]["AdvancedMode"] = False
            core.config()["Sphinx"]["Cmdline"] = (
                "sphinx-build -d " + os.path.join("_build", "doctrees") + " . " + os.path.join("_build", "html")
            )
            core.config().flush()

        self._setSphinxActionVisibility()
コード例 #27
0
ファイル: filefilter.py プロジェクト: adjustive/enki
 def __init__(self):
     QObject.__init__(self)
     self._applySettings()
     core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
     core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
コード例 #28
0
 def terminate(self):
     """clean up"""
     core.uiSettingsManager().aboutToExecute.disconnect(
         self._onSettingsDialogAboutToExecute)
コード例 #29
0
ファイル: openterm.py プロジェクト: mrsuman2002/enki-1
 def terminate(self):
     core.actionManager().removeAction('mTools/aOpenTerm')
     core.uiSettingsManager().aboutToExecute.disconnect(
         self._onSettingsDialogAboutToExecute)
コード例 #30
0
ファイル: __init__.py プロジェクト: y0no/enki
 def __init__(self):
     Plugin.instance = self
     core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
コード例 #31
0
ファイル: openterm.py プロジェクト: gpa14/enki
 def __init__(self):
     self._addAction()
     core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)
コード例 #32
0
 def terminate(self):
     core.workspace().documentOpened.disconnect(self._onDocumentOpened)
     core.uiSettingsManager().aboutToExecute.disconnect(
         self._onSettingsDialogAboutToExecute)
コード例 #33
0
ファイル: openterm.py プロジェクト: bjones1/enki
 def terminate(self):
     core.actionManager().removeAction('mTools/aOpenTerm')
     core.uiSettingsManager().aboutToExecute.disconnect(self._onSettingsDialogAboutToExecute)
コード例 #34
0
ファイル: preview.py プロジェクト: gpa14/enki
    def __init__(self):
        DockWidget.__init__(self, core.mainWindow(), "Previe&w", QIcon(':/enkiicons/internet.png'), "Alt+W")

        self._widget = self._createWidget()
        # Don't need to schedule document processing; a call to show() does.

        self._loadTemplates()
        self._widget.cbTemplate.currentIndexChanged.connect(
            self._onCurrentTemplateChanged)  # Disconnected.

        # When quitting this program, don't rebuild when closing all open
        # documents. This can take a long time, particularly if a some of the
        # documents are associated with a Sphinx project.
        self._programRunning = True
        core.aboutToTerminate.connect(self._quitingApplication)  # Disconnected.

        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)  # Disconnected.
        core.workspace().textChanged.connect(self._onTextChanged)  # Disconnected.

        # If the user presses the accept button in the setting dialog, Enki
        # will force a rebuild of the whole project.
        #
        # TODO: only build if preview settings have been changed.
        #
        # In order to make this happen, let ``_onSettingsDialogAboutToExecute`` emit
        # a signal indicating that the CodeChat setting dialog has been opened. Save
        # core.config()['Sphinx'] and core.config()['CodeChat']. After dialogAccepted
        # is detected, compare current settings with the old one. Build if necessary.
        core.uiSettingsManager().dialogAccepted.connect(
            self._scheduleDocumentProcessing)  # Disconnected.

        core.workspace().modificationChanged.connect(
            self._onDocumentModificationChanged)  # disconnected

        self._scrollPos = {}
        self._vAtEnd = {}
        self._hAtEnd = {}

        # Keep track of which Sphinx template copies we've already asked the user about.
        self._sphinxTemplateCheckIgnoreList = []

        self._thread = ConverterThread()  # stopped
        self._thread.htmlReady.connect(self._setHtml)  # disconnected

        self._visiblePath = None

        # If we update Preview on every key press, freezes are noticable (the
        # GUI thread draws the preview too slowly).
        # This timer is used for drawing Preview 800 ms After user has stopped typing text
        self._typingTimer = QTimer()  # stopped.
        self._typingTimer.setInterval(800)
        self._typingTimer.timeout.connect(self._scheduleDocumentProcessing)  # Disconnected.

        self.previewSync = PreviewSync(self)  # del_ called

        self._applyJavaScriptEnabled(self._isJavaScriptEnabled())

        # Clear flags used to temporarily disable signals during
        # ``_scheduleDocumentProcessing.``.
        self._ignoreDocumentChanged = False
        self._ignoreTextChanges = False

        # Provide an inital value for the rebuild needed flag.
        self._rebuildNeeded = False

        # Save the initial font, then restore it after a ``clear``. Note that
        # ``clear()`` doesn't reset the `currentCharFormat
        # <http://doc.qt.io/qt-4.8/qplaintextedit.html#currentCharFormat>`_. In
        # fact, clicking in red (error/warning) message in the log window
        # changes the current font to red! So, save it here so that it will be
        # restored correctly on a ``_clear_log``.
        self._defaultLogFont = self._widget.teLog.currentCharFormat()
        # The logWindowClear signal clears the log window.
        self._thread.logWindowClear.connect(self._clear_log)  # disconnected
        # The logWindowText signal simply appends text to the log window.
        self._thread.logWindowText.connect(lambda s:
                                           self._widget.teLog.appendPlainText(s))  # disconnected
コード例 #35
0
 def __init__(self):
     Plugin.instance = self
     core.uiSettingsManager().aboutToExecute.connect(
         self._onSettingsDialogAboutToExecute)
コード例 #36
0
ファイル: __init__.py プロジェクト: daffodil/enki
 def __init__(self):
     Plugin.instance = self
     core.workspace().setTextEditorClass(Editor)
     self._shortcuts = shortcuts.Shortcuts()
     core.uiSettingsManager().dialogAccepted.connect(self._applySettings)
     core.uiSettingsManager().aboutToExecute.connect(self._onSettingsDialogAboutToExecute)