Esempio n. 1
0
 def __init__(self, termwidget, *args):
     QTextEdit.__init__(self, *args)
     self.setStyleSheet("font: 9pt \"Courier\";")
     self._fittedHeight = 1
     self.textChanged.connect(self._fit_to_document)
     self._fit_to_document()
     self._termWidget = termwidget
Esempio n. 2
0
    def __init__(self, mainwin, dark_theme, *args):
        QTextEdit.__init__(self, *args)

        self.main_window = mainwin
        self.config = mainwin.config
        self.setStyleSheet('font-family: "Monospace";')
        self.highlighter = Highlighter(dark_theme, self.document())
        self.setWordWrapMode(QTextOption.NoWrap)
        self.setTabStopWidth(int(self.tabStopWidth() / 2))

        self.current_file = None
        self.current_file_name = ''
        self.saveable = False

        # cursor position handling
        self.cursor_position_label = QLabel()
        self.cursor_position_label.setSizePolicy(
            QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))
        self.cursorPositionChanged.connect(self.cursor_position_changed)
        self.cursor_position_changed()

        # content modified handling
        self.editor_init = True
        self.editor_modified = False
        self.editor_modified_label = QLabel()
        self.editor_modified_label.setSizePolicy(
            QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum))
        self.textChanged.connect(self.text_changed)

        self.update_state()
Esempio n. 3
0
 def __init__(self):
     QTextEdit.__init__()
     self.setReadOnly(True)
     self.setAlignment(Qt.AlignLeft)
     font = self.font()
     font.setFamily('Courier New')
     self.setFont(font)
     self.setText("hangmanView")
Esempio n. 4
0
    def __init__(self, *args, **kwargs):
        QTextEdit.__init__(self, *args)
        if 'tamanio' in kwargs:
            self.tamanio = kwargs['tamanio']

        font = QFont()
        font.setPointSizeF(self.tamanio)
        self.setFont(font)
Esempio n. 5
0
        def __init__(self, control_window: Union[ControlWindow, None] = None):
            """Constructor."""
            QTextEdit.__init__(self, parent=control_window)
            self.control_window = control_window

            metrics = QFontMetrics(self.font())
            line_height = metrics.lineSpacing() + 1
            self.setFixedHeight(line_height)
Esempio n. 6
0
    def __init__(self, parent=None, server=None):
        QTextEdit.__init__(self, parent)

        self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

        flash_action = QAction("Flash", self)
        flash_action.triggered.connect(self.flash)
        self.addAction(flash_action)
 def __init__(self, row, col, text, table):
     QTextEdit.__init__(self)
     self.row = row
     self.col = col
     self.init = text
     self.setText(text)
     self.table = table
     self.__setting__()
Esempio n. 8
0
 def __init__(self, parent):
     self.parent = parent
     QTextEdit.__init__(self)
     font = QFont("courier new", 8)
     font.setStyleHint(QFont.TypeWriter)
     self.document().setDefaultFont(font)
     self.displayPrompt()
     self.initStyle()
     self.addhistory()
Esempio n. 9
0
    def __init__(self, *args, **kwargs):
        QTextEdit.__init__(self, *args)
        if 'tamanio' in kwargs:
            self.tamanio = kwargs['tamanio']

        if 'placeholdertext' in kwargs:
            self.setPlaceholderText(kwargs['placeholdertext'])

        font = QFont()
        font.setPointSizeF(self.tamanio)
        self.setFont(font)
Esempio n. 10
0
 def __init__(self, installProgress, parent_frame):
     " really dumb terminal with simple editing support "
     QTextEdit.__init__(self, "", parent_frame)
     self.installProgress = installProgress
     self.setFontFamily("Monospace")
     # FIXME: fixed font size set!!!
     self.setFontPointSize(8)
     self.setWordWrapMode(QTextOption.NoWrap)
     self.setUndoRedoEnabled(False)
     self.setOverwriteMode(True)
     self._block = False
Esempio n. 11
0
 def __init__(self, installProgress, parent_frame):
     " really dumb terminal with simple editing support "
     QTextEdit.__init__(self, "", parent_frame)
     self.installProgress = installProgress
     self.setFontFamily("Monospace")
     # FIXME: fixed font size set!!!
     self.setFontPointSize(8)
     self.setWordWrapMode(QTextOption.NoWrap)
     self.setUndoRedoEnabled(False)
     self.setOverwriteMode(True)
     self._block = False
Esempio n. 12
0
    def __init__(self):
        QTextEdit.__init__(self)
        Publisher.__init__(self)

        self.role = 'view'

        self.cue_text = ''
        self.default_bg = QColor('white')
        self.edited_bg = QColor(255, 200, 200)
        self.edited = False
        self.initUI()
Esempio n. 13
0
    def __init__(self):
        # Parent constructor(s)
        View.__init__(self)
        QTextEdit.__init__(self)

        self.acceptUpdate = True
        self.nodes = {}
        self.edges = {}
        self.graphName = "my_graph"

        self.textCursor().insertText("graph " + self.graphName + " {\n}")
        self.checker = DotAttrsUtils()
Esempio n. 14
0
    def __init__(self):
        # Parent constructor(s)
        View.__init__(self)
        QTextEdit.__init__(self)

        self.acceptUpdate = True
        self.nodes = {}
        self.edges = {}
        self.graphName = "my_graph"

        self.textCursor().insertText("graph " + self.graphName + " {\n}")
        self.checker = DotAttrsUtils()
Esempio n. 15
0
	def __init__(self, parent):
		QTextEdit.__init__(self)
		self.parent = parent.p
		self.undoRedoActive = False
		self.tableModeEnabled = False
		self.setAcceptRichText(False)
		self.lineNumberArea = LineNumberArea(self)
		self.infoArea = InfoArea(self)
		self.updateFont()
		self.document().blockCountChanged.connect(self.updateLineNumberAreaWidth)
		self.cursorPositionChanged.connect(self.highlightCurrentLine)
		self.document().contentsChange.connect(self.contentsChange)
Esempio n. 16
0
    def __init__(self, parentWidget, formatManager):
        QTextEdit.__init__(self, parentWidget)
        self.formatManager = formatManager

        self.tracking = False
        self.selectedObject = None
        self.orgCursorWidth = self.cursorWidth()

        self.l = UrlEditor(self)
        self.l.applyUrl.connect(self.setCurrentUrl)
        self.l.resize(QSize(500, self.l.size().height()))
        self.cursorPositionChanged.connect(self.handleCursorPositionChanged)
        self.currentCharFormatChanged.connect(self.handleCharFormatChanged)
Esempio n. 17
0
    def __init__(self, parentWidget, formatManager):
        QTextEdit.__init__(self, parentWidget)
        self.formatManager = formatManager

        self.tracking = False
        self.selectedObject = None
        self.orgCursorWidth = self.cursorWidth()

        self.l = UrlEditor(self)
        self.l.applyUrl.connect(self.setCurrentUrl)
        self.l.resize(QSize(500, self.l.size().height()))
        self.cursorPositionChanged.connect(self.handleCursorPositionChanged)
        self.currentCharFormatChanged.connect(self.handleCharFormatChanged)
Esempio n. 18
0
 def __init__(self, parent):
     QTextEdit.__init__(self)
     self.parent = parent.p
     self.undoRedoActive = False
     self.tableModeEnabled = False
     self.setAcceptRichText(False)
     self.lineNumberArea = LineNumberArea(self)
     self.infoArea = InfoArea(self)
     self.updateFont()
     self.document().blockCountChanged.connect(
         self.updateLineNumberAreaWidth)
     self.cursorPositionChanged.connect(self.highlightCurrentLine)
     self.document().contentsChange.connect(self.contentsChange)
Esempio n. 19
0
    def __init__(self, *args, **kwargs):
        QTextEdit.__init__(self, *args)
        if 'tamanio' in kwargs:
            self.tamanio = kwargs['tamanio']
        if 'placeholderText' in kwargs:
            self.setPlaceholderText(kwargs['placeholderText'])
        if 'alto' in kwargs:
            self.setMaximumHeight(kwargs['alto'])
        if 'enabled' in kwargs:
            self.setEnabled(kwargs['enabled'])

        font = QFont()
        font.setPointSizeF(self.tamanio)
        self.setFont(font)
Esempio n. 20
0
	def __init__(self, parent):
		QTextEdit.__init__(self)
		self.tab = weakref.proxy(parent)
		self.parent = parent.p
		self.undoRedoActive = False
		self.tableModeEnabled = False
		self.setAcceptRichText(False)
		self.lineNumberArea = LineNumberArea(self)
		self.infoArea = InfoArea(self)
		self.updateFont()
		self.document().blockCountChanged.connect(self.updateLineNumberAreaWidth)
		self.cursorPositionChanged.connect(self.highlightCurrentLine)
		self.document().contentsChange.connect(self.contentsChange)
		if globalSettings.useFakeVim:
			self.installFakeVimHandler()
Esempio n. 21
0
 def __init__(self, parent=None):
     """
     Initialize the STDOutText object.
     :param parent: the parent widget
     """
     QTextEdit.__init__(self, parent)
     self.setReadOnly(True)
     self.setStyleSheet("""
     QTextEdit {
         background: #000000;
         border: 0;
         color: #F2F2F2;
         font-family: Courier, sans-serif;
     }
     """)
Esempio n. 22
0
	def __init__(self, parent):
		QTextEdit.__init__(self)
		self.parent = parent
		self.undoRedoActive = False
		self.tableModeEnabled = False
		self.setFont(monofont)
		self.setAcceptRichText(False)
		self.marginx = (self.cursorRect(self.cursorForPosition(QPoint())).topLeft().x()
			+ self.fontMetrics().width(" "*globalSettings.rightMargin))
		self.lineNumberArea = LineNumberArea(self)
		self.infoArea = InfoArea(self)
		self.document().blockCountChanged.connect(self.updateLineNumberAreaWidth)
		self.updateLineNumberAreaWidth()
		self.cursorPositionChanged.connect(self.highlightCurrentLine)
		self.document().contentsChange.connect(self.contentsChange)
Esempio n. 23
0
 def __init__(self, parent):
     QTextEdit.__init__(self)
     self.tab = weakref.proxy(parent)
     self.parent = parent.p
     self.undoRedoActive = False
     self.tableModeEnabled = False
     self.setAcceptRichText(False)
     self.lineNumberArea = LineNumberArea(self)
     self.infoArea = InfoArea(self)
     self.updateFont()
     self.document().blockCountChanged.connect(
         self.updateLineNumberAreaWidth)
     self.cursorPositionChanged.connect(self.highlightCurrentLine)
     self.document().contentsChange.connect(self.contentsChange)
     if globalSettings.useFakeVim:
         self.installFakeVimHandler()
Esempio n. 24
0
    def __init__(self, parent = None):
        QTextEdit.__init__(self)

        self.setupEditor()
        state = settings.get('editor:spell')
        if state == "":  # no settings
            state = True
        self.toggleSpell(state)

        onOff = settings.get('editor:whiteSpace')
        if onOff == "":  # no settings
            onOff = True
        self.togglewhiteSpace(onOff)

        self.currentCharFormatChanged.connect(
                self.CharFormatChanged)
Esempio n. 25
0
 def __init__(self, parent):
     Screen.__init__(self, 80, 24)
     QTextEdit.__init__(self, parent=None)
     QApplication.instance().setCursorFlashTime(0)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
     self.setFontPointSize(12)
     self._text_width = self.fontMetrics().maxWidth() + 1.5  # This could be cleaner
     self._text_height = self.fontMetrics().lineSpacing() + 2.3  # This could be cleaner too
     # self.setStyleSheet('background-color: black; color: white')
     self._parent = parent
     self._conn = None
     self._term_em = None
     self._timer = QTimer(self)
     self._angle_delta = 0
Esempio n. 26
0
 def __init__(self, parent):
     QTextEdit.__init__(self)
     self.parent = parent
     self.undoRedoActive = False
     self.tableModeEnabled = False
     self.setFont(monofont)
     self.setAcceptRichText(False)
     self.marginx = (
         self.cursorRect(self.cursorForPosition(QPoint())).topLeft().x() +
         self.fontMetrics().width(" " * globalSettings.rightMargin))
     self.lineNumberArea = LineNumberArea(self)
     self.infoArea = InfoArea(self)
     self.document().blockCountChanged.connect(
         self.updateLineNumberAreaWidth)
     self.updateLineNumberAreaWidth()
     self.cursorPositionChanged.connect(self.highlightCurrentLine)
     self.document().contentsChange.connect(self.contentsChange)
Esempio n. 27
0
 def __init__(self, parent, data_name, mapping_name=None, attach=None):
     QTextEdit.__init__(self, parent)
     self.data_name = data_name
     self.mapping_name = mapping_name
     self.attach = attach
     self.data_type: Character = self.parser(self.parser_type, data_name)
     char_file = open(CHARACTER_PATH, 'r', encoding='UTF-8')
     regex_char = char_file.read() + EXPAND_CHARACTER
     char_file.close()
     self.reg_exp = QRegExp(f'[{regex_char}\\n\\r]+')
     self.textChanged.connect(self.check_reg_exp)
     self.verticalScrollBar().setStyleSheet('''
         QScrollBar:vertical {
             background: #E7E7E7;
             width: 15px;
             margin-left: 0;
             margin-right: 0;
         }
         QScrollBar::handle:vertical {
             border: 1px solid transparent;
             background: #B1B1B1;
         }
         QScrollBar::sub-line:vertical {
             border: 1px solid transparent;
             background: #B1B1B1;
         }
         QScrollBar::add-line:vertical {
             border: 1px solid transparent;
             background: #B1B1B1;
         }
         QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
             background: none;
         }
         QScrollBar::handle:vertical:hover {
             background: #D4D4D4;
         }
         QScrollBar::sub-line:vertical:hover {
             background: #D4D4D4;
         }
         QScrollBar::add-line:vertical:hover {
             background: #D4D4D4;
         }
         ''')
 def __init__(self, calUpdateSecs, calServerUrl, parent=None):
     QTextEdit.__init__(self, parent)
     self.calendarUpdateSecs = calUpdateSecs
     self.calServerUrl = calServerUrl
     # Class vars
     self.updatesRunning = False
     self.updateTimer = None
     self.listUpdateThread = None
     self.calDataLock = threading.Lock()
     self.calDataUpdated = False
     self.curCalendarInfo = None
     # Appearance
     self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     # Text
     self.setReadOnly(True)
     self.setLineWidth(0)
     self.setFrameShape(QtWidgets.QFrame.NoFrame)
     self.setStyleSheet('font: 25pt "Segoe UI"; color:"white"; background-color:"black"')
     self.setHtml("<B...</B>")
     self.start()
Esempio n. 29
0
    def __init__(self, device_type):
        QTextEdit.__init__(self)
        self.font = QFont()
        self.font.setFamily('Monospace')
        self.font.setStyleHint(QFont.Monospace)
        self.font.setFixedPitch(True)
        self.font.setPointSize(int(12))

        self.setFont(self.font)
        pal = QPalette()
        bgc = QColor(0, 0, 0)
        pal.setColor(QPalette.Base, bgc)
        textc = QColor(230, 230, 230)
        pal.setColor(QPalette.Text, textc)
        self.setPalette(pal)
        self.device_type = device_type
        self.setAcceptRichText(False)
        self.setContextMenuPolicy(Qt.NoContextMenu)
        #self.setOpenLinks(False)
        self.setReadOnly(True)
        self.setUndoRedoEnabled(False)
Esempio n. 30
0
    def __init__(self, parent):
        QTextEdit.__init__(self, parent)

        self.setCursorWidth(8)
        self.setLineWrapMode(QTextEdit.NoWrap);

        # set the font
        font = self.font()
        font.setFamily("Courier")
        font.setPointSize(10)
        self.setFont(font)

        self.bytesPerLine = 16
        self.addressWidth = 10

        self.addrColor = Qt.red
        self.addrBackground = Qt.white
        self.dataColor = Qt.black
        self.dataBackground = Qt.white
        self.asciiColor = Qt.black
        self.asciiBackground = Qt.lightGray

        self.cursorPositionChanged.connect(self.showPosition)
Esempio n. 31
0
    def __init__(self, parent):
        QTextEdit.__init__(self, parent)

        self.setCursorWidth(8)
        self.setLineWrapMode(QTextEdit.NoWrap)

        # set the font
        font = self.font()
        font.setFamily("Courier")
        font.setPointSize(10)
        self.setFont(font)

        self.bytesPerLine = 16
        self.addressWidth = 10

        self.addrColor = Qt.red
        self.addrBackground = Qt.white
        self.dataColor = Qt.black
        self.dataBackground = Qt.white
        self.asciiColor = Qt.black
        self.asciiBackground = Qt.lightGray

        self.cursorPositionChanged.connect(self.showPosition)
Esempio n. 32
0
    def __init__(self, *args):
        QTextEdit.__init__(self)

        # Set text to be monospace
        doc = self.document()
        font = doc.defaultFont()
        font.setFamily("Courier New")
        doc.setDefaultFont(font)

        # Set the background color to green
        palette = self.palette()
        palette.setColor(self.backgroundRole(), QColor(200, 255, 200))
        self.setPalette(palette)
        self.setAutoFillBackground(True)

        # Set the height of the box
        # 10 Lines tall
        nRows = 10
        doc = self.document()
        fm = QFontMetrics(doc.defaultFont())
        margins = self.contentsMargins()
        height = fm.lineSpacing() * nRows + 2 * (doc.documentMargin(
        ) + self.frameWidth()) + margins.top() + margins.bottom()
        self.setFixedHeight(height)
Esempio n. 33
0
 def __init__(self, *args):
     QTextEdit.__init__(self, *args)
Esempio n. 34
0
 def __init__(self, focusin, focusout):
     QTextEdit.__init__(self)
     self.focusin = focusin
     self.focusout = focusout
     self.createActions()
Esempio n. 35
0
	def __init__(self):
		QTextEdit.__init__(self)
		self.append("Murmeli")
Esempio n. 36
0
    def __init__(self, parent=None, index=None, html=None, spellcheck=None,
                 highlighting=False, dict="", autoResize=False):
        QTextEdit.__init__(self, parent)
        self._column = Outline.text
        self._index = None
        self._indexes = None
        self._model = None
        self._placeholderText = self.placeholderText()
        self._updating = False
        self._item = None
        self._highlighting = highlighting
        self._textFormat = "text"
        self.setAcceptRichText(False)
        # When setting up a theme, this becomes true.
        self._fromTheme = False
        self._themeData = None
        self._highlighterClass = BasicHighlighter

        if spellcheck is None:
            spellcheck = settings.spellcheck

        self.spellcheck = spellcheck
        self.currentDict = dict if dict else settings.dict
        self._defaultFontSize = qApp.font().pointSize()
        self.highlighter = None
        self.setAutoResize(autoResize)
        self._defaultBlockFormat = QTextBlockFormat()
        self._defaultCharFormat = QTextCharFormat()
        self.highlightWord = ""
        self.highligtCS = False
        self._dict = None
        # self.document().contentsChanged.connect(self.submit, F.AUC)

        # Submit text changed only after 500ms without modifications
        self.updateTimer = QTimer()
        self.updateTimer.setInterval(500)
        self.updateTimer.setSingleShot(True)
        self.updateTimer.timeout.connect(self.submit)
        # self.updateTimer.timeout.connect(lambda: print("Timeout"))

        self.updateTimer.stop()
        self.document().contentsChanged.connect(self.updateTimer.start, F.AUC)
        # self.document().contentsChanged.connect(lambda: print("Document changed"))

        # self.document().contentsChanged.connect(lambda: print(self.objectName(), "Contents changed"))

        self.setEnabled(False)

        if index:
            self.setCurrentModelIndex(index)

        elif html:
            self.document().setHtml(html)
            self.setReadOnly(True)

        # Spellchecking
        if enchant and self.spellcheck:
            try:
                self._dict = enchant.Dict(self.currentDict if self.currentDict
                                          else self.getDefaultLocale())
            except enchant.errors.DictNotFoundError:
                self.spellcheck = False

        else:
            self.spellcheck = False

        if self._highlighting and not self.highlighter:
            self.highlighter = self._highlighterClass(self)
            self.highlighter.setDefaultBlockFormat(self._defaultBlockFormat)
Esempio n. 37
0
 def __init__(self, text=''):
     QTextEdit.__init__(self)
     self.setStyleSheet(styleInfo)
     self.setText(text)
Esempio n. 38
0
 def __init__(self, parent):
     QTextEdit.__init__(self)
     self.parent = parent
Esempio n. 39
0
 def __init__(self):
     QTextEdit.__init__(self)
Esempio n. 40
0
 def __init__(self, parent=None):
     QTextEdit.__init__(self, parent)
Esempio n. 41
0
 def __init__(self, focusin, focusout):
     QTextEdit.__init__(self)
     self.focusin = focusin
     self.focusout = focusout
     self.createActions()