当前位置: 首页>>代码示例>>Python>>正文


Python DockWidget.__init__方法代码示例

本文整理汇总了Python中enki.widgets.dockwidget.DockWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DockWidget.__init__方法的具体用法?Python DockWidget.__init__怎么用?Python DockWidget.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在enki.widgets.dockwidget.DockWidget的用法示例。


在下文中一共展示了DockWidget.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, *args):
        DockWidget.__init__(self, *args)

        self.setObjectName("PreviewDock")
        self.setWindowTitle(self.tr( "&Preview" ))
        self.setWindowIcon(QIcon(':/enkiicons/internet.png'))
        self.showAction().setShortcut("Alt+P")

        from PyQt4.QtWebKit import QWebView  # delayed import, startup performance optimization
        self._view = QWebView(self)
        self._view.page().mainFrame().titleChanged.connect(self._updateTitle)
        self.setWidget(self._view)
        self.setFocusProxy(self._view)
        
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)
        core.workspace().textChanged.connect(self._onTextChanged)
        
        self._scrollPos = {}
        self._vAtEnd = {}
        self._hAtEnd = {}
        
        self._thread = ConverterThread()
        self._thread.htmlReady.connect(self._setHtml)

        self._visiblePath = None
        self._onDocumentChanged(None, core.workspace().currentDocument())
开发者ID:daffodil,项目名称:enki,代码行数:28,代码来源:preview.py

示例2: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    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())
开发者ID:rapgro,项目名称:enki,代码行数:37,代码来源:openedfilemodel.py

示例3: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, parent):
        DockWidget.__init__( self, parent, "&Search Results", QIcon(":/enkiicons/search.png"), "Alt+S")

        # actions
        widget = QWidget( self )

        self._model = searchresultsmodel.SearchResultsModel(self)
        self.onResultsHandledByReplaceThread.connect(self._model.onResultsHandledByReplaceThread)

        self._view = QTreeView( self )
        self._view.setHeaderHidden( True )
        self._view.setUniformRowHeights( True )
        self._view.setModel( self._model )
        self._delegate = HTMLDelegate()
        self._view.setItemDelegate(self._delegate)

        self._layout = QHBoxLayout( widget )
        self._layout.setMargin( 5 )
        self._layout.setSpacing( 5 )
        self._layout.addWidget( self._view )

        self.setWidget( widget )
        self.setFocusProxy(self._view)

        # connections
        self._model.firstResultsAvailable.connect(self.show)
        self._view.activated.connect(self._onResultActivated)

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

        self._expandCollapseAll = ExpandCollapseAllButton(self.titleBarWidget(), self._view, self._model)
        self._checkUncheckAll = None
开发者ID:adjustive,项目名称:enki,代码行数:34,代码来源:searchresultsdock.py

示例4: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
 def __init__(self):
     DockWidget.__init__(self, core.mainWindow(), "Previe&w", QIcon(':/enkiicons/internet.png'), "Alt+W")
     self._widget = QLabel("Qt5 Webkit not found. Preview is not available.<br/>"
                           "Install <i>python3-pyqt5.qtwebkit</i> package on Debian based distributions,"
                           "<i>python3-qt5-webkit</i> on Fedora")
     self.setFocusProxy(self._widget)
     self.setWidget(self._widget)
开发者ID:rapgro,项目名称:enki,代码行数:9,代码来源:__init__.py

示例5: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self):
        DockWidget.__init__(self, core.mainWindow(), "&Preview", QIcon(':/enkiicons/internet.png'), "Alt+P")

        from PyQt4.QtWebKit import QWebView  # delayed import, startup performance optimization
        self._view = QWebView(self)
        self._view.page().mainFrame().titleChanged.connect(self._updateTitle)
        self.setWidget(self._view)
        self.setFocusProxy(self._view)
        
        core.workspace().currentDocumentChanged.connect(self._onDocumentChanged)
        core.workspace().textChanged.connect(self._onTextChanged)
        
        self._scrollPos = {}
        self._vAtEnd = {}
        self._hAtEnd = {}
        
        self._thread = ConverterThread()
        self._thread.htmlReady.connect(self._setHtml)

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

        self._scheduleDocumentProcessing()
开发者ID:polovik,项目名称:enki,代码行数:30,代码来源:preview.py

示例6: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, widget, title, icon):
        DockWidget.__init__(self, core.mainWindow(), title, icon, "Alt+I")
        self.setObjectName(title)

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

        self.setWidget(widget)
        self.setFocusProxy(widget)
开发者ID:vi,项目名称:enki,代码行数:10,代码来源:repl.py

示例7: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, widget):
        DockWidget.__init__(self, core.mainWindow(), "&MIT Scheme", QIcon(':/enkiicons/languages/scheme.png'), "Alt+M")

        self.setAllowedAreas( Qt.BottomDockWidgetArea)
        
        core.actionManager().addAction("mView/aMitScheme", self.showAction())

        self.setWidget(widget)
        self.setFocusProxy(widget)
        widget.installEventFilter(self)
开发者ID:polovik,项目名称:enki,代码行数:12,代码来源:mitscheme.py

示例8: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, widget, replName, title, icon):
        DockWidget.__init__(self, core.mainWindow(), title, icon, "Alt+M")

        self.setAllowedAreas( Qt.BottomDockWidgetArea | Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
        
        self._action = core.actionManager().addAction("mView/a%s" % replName, self.showAction())

        self.setWidget(widget)
        self.setFocusProxy(widget)
        widget.installEventFilter(self)
开发者ID:y0no,项目名称:enki,代码行数:12,代码来源:repl.py

示例9: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, parent):
        DockWidget.__init__(self, parent, "&File Browser", QIcon(':/enkiicons/open.png'), "Alt+F")

        self._comboBox = None
        self._tree = None
        self._smartRecents = None
        self._smartHistory = None

        # restrict areas
        self.setAllowedAreas( Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea )

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

        core.mainWindow().directoryDropt.connect(self._onDirectoryDropt)

        self.visibilityChanged.connect(self._onVisibilityChanged)
开发者ID:adjustive,项目名称:enki,代码行数:18,代码来源:filebrowser.py

示例10: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self):
        DockWidget.__init__(self, core.mainWindow(), "&Preview", QIcon(':/enkiicons/internet.png'), "Alt+P")
        self._widget = QWidget(self)

        uic.loadUi(os.path.join(os.path.dirname(__file__), 'Preview.ui'), self._widget)

        self._loadTemplates()

        self._widget.webView.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self._widget.webView.page().linkClicked.connect(self._onLinkClicked)

        self._widget.webView.page().mainFrame().titleChanged.connect(self._updateTitle)
        self.setWidget(self._widget)
        self.setFocusProxy(self._widget.webView )

        self._widget.cbEnableJavascript.clicked.connect(self._onJavaScriptEnabledCheckbox)

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

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

        self._thread = ConverterThread()
        self._thread.htmlReady.connect(self._setHtml)

        self._visiblePath = None

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

        self._widget.cbTemplate.currentIndexChanged.connect(self._onCurrentTemplateChanged)

        self._scheduleDocumentProcessing()
        self._applyJavaScriptEnabled(self._isJavaScriptEnabled())

        self._widget.tbSave.clicked.connect(self.onSave)

        # Only set up sync if TRE is installed.
        if findApproxTextInTarget:
            self._initPreviewToTextSync()
            self._initTextToPreviewSync()
开发者ID:vi,项目名称:enki,代码行数:48,代码来源:preview.py

示例11: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self):
        DockWidget.__init__(self, core.mainWindow(), '&Navigator', QIcon(':/enkiicons/goto.png'), "Alt+N")

        self._tags = []

        self._tree = QTreeView(self)
        self._tree.installEventFilter(self)
        self._tree.setHeaderHidden(True)
        self.setFocusProxy(self._tree)

        self._filterEdit = LineEdit(self)
        self._filterEdit.setClearButtonVisible(True)
        self._filterEdit.textEdited.connect(self._applyFilter)
        self._filterEdit.clearButtonClicked.connect(self._applyFilter)
        self._filterEdit.clearButtonClicked.connect(self._tree.setFocus)
        self._filterEdit.clearButtonClicked.connect(self._hideFilter)
        self._filterEdit.installEventFilter(self)

        self._displayWidget = QWidget(self)
        layout = QVBoxLayout(self._displayWidget)
        layout.addWidget(self._tree)
        layout.addWidget(self._filterEdit)
        layout.setContentsMargins(0, 0, 0, 0)

        self.setWidget(self._displayWidget)

        self._tagModel = _TagModel(self._tree)
        self._tagModel.jumpToTagDone.connect(self._hideFilter)

        self._tree.setModel(self._tagModel)
        self._tree.activated.connect(self._tagModel.onActivated)
        self._tree.clicked.connect(self._tagModel.onActivated)
        self._tagModel.modelAboutToBeReset.connect(self._onModelAboutToBeReset)
        self._tagModel.modelReset.connect(self._onModelReset)

        self._showAction.triggered.connect(self._onShowTriggered)

        self._currentTagPath = None

        self._errorLabel = None

        self._installed = False
开发者ID:freason,项目名称:enki,代码行数:44,代码来源:dock.py

示例12: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    def __init__(self, title, icon):
        DockWidget.__init__(self, core.mainWindow(), title, icon, "Alt+I")
        self.setObjectName(title)

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

        # Copied from https://github.com/jupyter/qtconsole/blob/master/examples/inprocess_qtconsole.py, then modified based on https://github.com/jupyter/qtconsole/blob/master/qtconsole/qtconsoleapp.py -- the QtInProcessKernelManager is blocking, so infinite loops crash Enki!
        kernel_manager = QtKernelManager()
        kernel_manager.start_kernel()
        kernel_manager.client_factory = QtKernelClient
        kernel_manager.kernel.gui = 'qt'

        kernel_client = kernel_manager.client()
        kernel_client.start_channels()

        self.ipython_widget = RichJupyterWidget()
        self.ipython_widget.kernel_manager = kernel_manager
        self.ipython_widget.kernel_client = kernel_client
        # By default, iPython adds a blank line between inputs. Per Monika's request, this eliminates the extra line. See https://qtconsole.readthedocs.io/en/latest/config_options.html#options; this fix was based on info from https://stackoverflow.com/questions/38652671/ipython-5-0-remove-spaces-between-input-lines.
        self.ipython_widget.input_sep = ''
        self.ipython_widget.show()

        self.setWidget(self.ipython_widget)
        self.setFocusProxy(self.ipython_widget)
开发者ID:bjones1,项目名称:enki,代码行数:26,代码来源:repl.py

示例13: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
    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
开发者ID:gpa14,项目名称:enki,代码行数:79,代码来源:preview.py

示例14: __init__

# 需要导入模块: from enki.widgets.dockwidget import DockWidget [as 别名]
# 或者: from enki.widgets.dockwidget.DockWidget import __init__ [as 别名]
 def __init__(self):
     DockWidget.__init__(self, core.mainWindow(), "Previe&w", QIcon(':/enkiicons/internet.png'), "Alt+W")
     self._widget = QLabel("Qt5 WebEngine not found. Preview is not available.<br/>"
                           "Run <tt>pip install PyQt5</tt>.")
     self.setFocusProxy(self._widget)
     self.setWidget(self._widget)
开发者ID:bjones1,项目名称:enki,代码行数:8,代码来源:__init__.py


注:本文中的enki.widgets.dockwidget.DockWidget.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。