Exemplo n.º 1
0
def editor(request):
    global _app, _widget
    from pyqode.core import modes
    from pyqode.rst.widgets import RstCodeEdit
    from pyqode.qt.QtTest import QTest

    logging.info('################ setup session editor ################')

    _widget = RstCodeEdit()
    _widget.resize(800, 600)
    _app.setActiveWindow(_widget)
    while not _widget.backend.connected:
        QTest.qWait(100)

    _widget.modes.get(modes.FileWatcherMode).file_watcher_auto_reload = True
    _widget.save_on_focus_out = False

    def fin():
        global _widget
        _widget.close()
        while _widget.backend.connected:
            QTest.qWait(100)
        del _widget

    request.addfinalizer(fin)

    return _widget
Exemplo n.º 2
0
def editor(request):
    global _app, _widget
    from pyqode.core import modes
    from pyqode.rst.widgets import RstCodeEdit
    from pyqode.qt.QtTest import QTest

    logging.info('################ setup session editor ################')

    _widget = RstCodeEdit()
    _widget.resize(800, 600)
    _app.setActiveWindow(_widget)
    while not _widget.backend.connected:
        QTest.qWait(100)

    _widget.modes.get(modes.FileWatcherMode).file_watcher_auto_reload = True
    _widget.save_on_focus_out = False

    def fin():
        global _widget
        _widget.close()
        while _widget.backend.connected:
            QTest.qWait(100)
        del _widget

    request.addfinalizer(fin)

    return _widget
Exemplo n.º 3
0
def test_json_code_edit():
    editor = RstCodeEdit()
    editor.file.open('test/files/demo_ko.rst')
    QTest.qWait(1000)
    assert editor.backend.running
    editor.close()
    assert not editor.backend.running
Exemplo n.º 4
0
import logging
from pyqode.qt import QtWidgets
from pyqode.rst.widgets import RstCodeEdit
from pyqode.core.widgets import HtmlPreviewWidget

logging.basicConfig(level=logging.DEBUG)

app = QtWidgets.QApplication([])

editor = RstCodeEdit(color_scheme='qt')
editor.file.open('demo.rst')
editor.resize(800, 600)
editor.show()

preview = HtmlPreviewWidget()
preview.set_editor(editor)
preview.show()

app.exec_()