Esempio n. 1
0
 def keyPressEvent(self, event):
     """Catch keywoard events. Process Enter, Up, Down
     """
     if event.matches(QKeySequence.InsertParagraphSeparator):
         text = self.toPlainText()
         if self._termWidget.isCommandComplete(text):
             self._termWidget.execCurrentCommand()
             return
     elif event.matches(QKeySequence.MoveToNextLine):
         text = self.toPlainText()
         cursorPos = self.textCursor().position()
         textBeforeEnd = text[cursorPos:]
         if len(textBeforeEnd.splitlines()) <= 1:
             self.historyNext.emit()
             return
     elif event.matches(QKeySequence.MoveToPreviousLine):
         text = self.toPlainText()
         cursorPos = self.textCursor().position()
         textBeforeStart = text[:cursorPos]
         lineCount = len(textBeforeStart.splitlines())
         if textBeforeStart.endswith('\n') or textBeforeStart.endswith('\r'):
             lineCount += 1
         if lineCount <= 1:
             self.historyPrev.emit()
             return
     elif event.matches(QKeySequence.MoveToNextPage) or \
          event.matches(QKeySequence.MoveToPreviousPage):
         return self._termWidget.browser().keyPressEvent(event)
     
     QTextEdit.keyPressEvent(self, event)
Esempio n. 2
0
class ReportWindow(myDialog):
    def __init__(self, text, parent = None):
        super(ReportWindow, self).__init__(parent, layoutCls = QGridLayout)
        self.setWindowTitle("Fehler!")
        
        self.infoLabel = QLabel(self)
        self.infoLabel.setText("Ein Fehler ist aufegtretten. Bitte senden Sie den unteren Text an <a  href=\"mailto:[email protected]\">[email protected]</a>!")
        self.infoLabel.setTextFormat(Qt.RichText)
        self.infoLabel.setTextInteractionFlags(Qt.TextBrowserInteraction)
        self.infoLabel.setOpenExternalLinks(True)

        self.text = text
        
        self.textArea = QTextEdit(self)
        self.textArea.setPlainText(text)
        self.textArea.setReadOnly(True)

        self.okBtn = QPushButton(QString.fromUtf8("Meldung schließen"), self)
        self.okBtn.clicked.connect(self.close)
        
        self.copyBtn = QPushButton(QString.fromUtf8("Text kopieren"), self)
        self.copyBtn.clicked.connect(self.copy)
        
        self.myLayout.addWidget(self.infoLabel,     0,0,1,2)
        self.myLayout.addWidget(self.textArea,      1,0,1,2)
        self.myLayout.addWidget(self.copyBtn,       2,0,1,1)
        self.myLayout.addWidget(self.okBtn,         2,1,1,1)
        
    def copy(self):
        clip = QApplication.clipboard()
        clip.setText(self.text)
Esempio n. 3
0
 def __init__(self, parent=None, accept_empty=False):
     QTextEdit.__init__(self, parent)
     Validable.__init__(self, accept_empty=accept_empty)
     self.setTabChangesFocus(True)
     self.setAcceptRichText(True)
     self.setWhatsThis(tr('<h3><font color="blue">IP List</font></h3>'
         'Enter a list of IP addresses separated by spaces or carriage returns.<br/>'))
Esempio n. 4
0
class ProprietesAvance(QWidget):
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self.parent = parent
        self.objets = parent.objets
        self.panel = self.parent.parent.panel
        self.canvas = self.parent.parent.canvas
        self.islabel = self.parent.parent.islabel

        self.sizer = QVBoxLayout()
        if len(self.objets) is 1:
            self.objet = self.objets[0]

            style = QVBoxLayout()
            style_box = QGroupBox(u"Style de l'objet")
            style_box.setLayout(style)
            style.addWidget(QLabel(u"Attention, ne modifiez ce contenu que si vous savez ce que vous faites."))
            self.avance = QTextEdit()
            self.avance.setMinimumSize(350, 200)
            self.actualiser()
            style.addWidget(self.avance)
            self.sizer.addWidget(style_box)

            ok = QPushButton('OK')
            appliquer = QPushButton(u"Appliquer")
            actualiser = QPushButton(u"Actualiser")
            ok.clicked.connect(self.EvtOk)
            appliquer.clicked.connect(self.EvtAppliquer)
            actualiser.clicked.connect(self.actualiser)
            boutons = QHBoxLayout()
            boutons.addWidget(ok)
            boutons.addWidget(appliquer)
            boutons.addWidget(actualiser)
            self.sizer.addLayout(boutons)

        self.setLayout(self.sizer)
        ##self.parent.parent.dim3 = self.sizer.CalcMin().Get()

    def EvtOk(self):
        self.EvtAppliquer()
        self.parent.parent.fenetre_principale.raise_()
        self.parent.parent.close() # fermeture de la frame


    def EvtAppliquer(self):
        txt = self.avance.toPlainText().split('\n')
        dico = "{"
        for ligne in txt:
            key, value = ligne.split(":", 1)
            key = "'" + key.strip() + "':"
            dico += key + value + ","
        dico += "}"
        if self.islabel:
            self.canvas.executer(u"%s.etiquette.style(**%s)" %(self.objet.parent.nom, dico))
        else:
            self.canvas.executer(u"%s.style(**%s)" %(self.objet.nom, dico))

    def actualiser(self, event = None):
        items = (txt.split(':', 1) for txt in advanced_split(str(self.objet.style())[1:-1], ","))
        self.avance.setPlainText('\n'.join(sorted(key.strip()[1:-1] + ':' + value for key, value in items)))
Esempio n. 5
0
class Form(QDialog):
    def __init__(self, parent=None):
        super(Form, self).__init__(parent)

        self.title1 = QLabel('Items')

        self.foundLabel = QLabel('If found, will appear here')

        self.textBox1 = QTextEdit()
        self.textBox1.setObjectName("Item to Search For")
        self.textBox1.setText("Please enter a list of items to search for, separated by commas.")

        self.btn1 = QPushButton()
        self.btn1.setObjectName("Search")
        self.btn1.setText("Search")

        # layout = QFormLayout()
        layout = QGridLayout()
        layout.setSpacing(10)

        layout.addWidget(self.title1, 1, 0)
        layout.addWidget(self.textBox1, 1, 1)
        layout.addWidget(self.btn1, 2, 1)
        layout.addWidget(self.foundLabel, 3, 1)

        self.setLayout(layout)
        self.connect(self.btn1, SIGNAL("clicked()"), self.button_click)
        self.setWindowTitle("Warframe Alert Tool")
        self.setGeometry(300, 300, 600, 200)

    def button_click(self):
        # shost is a QString object
        alertItems = str(self.textBox1.toPlainText())
        alertList = alertItems.split(',')
Esempio n. 6
0
class SnippetEditor(QWidget):
	def __init__(self):
		QWidget.__init__(self)

		self.editor = QTextEdit()
		self.editor.setTabStopWidth(20)
		self.highlighter = PythonSyntaxHighlighter( self.editor )

		lay = QHBoxLayout()
		lay.setContentsMargins(0, 0, 0, 0)
		lay.addWidget(self.editor)
		self.setLayout(lay)

	def runCode(self, context):
		name = threading.current_thread().name
		sys.stdout.flush(name)
		try:
			scode = str(self.editor.toPlainText()).strip()
			code = compile(scode, '', 'exec')
			exec code in context
		except:
			traceback.print_exc()
		finally:
			data = sys.stdout.getOutput(name)
			self.emit(SIGNAL('codeOutput'), data)
Esempio n. 7
0
 def keyPressEvent(self, event):
     if event.modifiers() & Qt.ControlModifier:
         handled = False
         if event.key() == Qt.Key_B:
             self.toggleBold()
             handled = True
         elif event.key() == Qt.Key_I:
             self.toggleItalic()
             handled = True
         elif event.key() == Qt.Key_K:
             self.colorMenu()
             handled = True
         elif event.key() == Qt.Key_M:
             self.textEffectMenu()
             handled = True
         elif event.key() == Qt.Key_U:
             self.toggleUnderline()
             handled = True
         if handled:
             event.accept()
             return
     if event.key() in (Qt.Key_Enter, Qt.Key_Return):
         self.emit(SIGNAL("returnPressed()"))
         event.accept()
     else:
         QTextEdit.keyPressEvent(self, event)
    def __init__(self, layer, geometry, parent=None):
        GeomEditor.__init__(self, layer, geometry)
        QTextEdit.__init__(self, parent)

        self.setGeom(geometry)
        self.textChanged.connect(self.geomChanged)
        self.layerEditable()
	def loadSentences(self):
		self.contentList = data.Data().getSentencesFromDatabase()
		if len(self.contentList) > 1:
			self.sentenceList = self.contentList[0]
			self.sentenceTableWidget.setRowCount(len(self.sentenceList))
			cellList = []
			for sentence in self.sentenceList:
				##item = QTableWidgetItem(QString(sentence))
				item = QTextEdit()
				item.setText(QString(sentence))
				#item.setFlags(Qt.ItemFlags(Qt.ItemIsSelectable |
				#						Qt.ItemIsUserCheckable | 
				#						Qt.ItemIsEnabled))
				#item.setCheckState(Qt.Unchecked)
				cellList.append(item)
			cellList.reverse()
			
			# insert the sentences in the table
			for i in range(0, len(self.sentenceList)):
				self.sentenceTableWidget.setCellWidget(i, self.col, cellList.pop())
			
			for i in range(0, len(self.sentenceList)):
				self.sentenceTableWidget.setRowHeight(i, 42)
				
		else:
			QMessageBox.information(self, "Remove Sentence",
			"Data Load Error")
Esempio n. 10
0
    def __init__(self, fetcher, parent):

        QTextEdit.__init__(self, parent)
        BaseFragmentView.__init__(self, fetcher)

        self.setReadOnly(True)
        self.document().setDefaultStyleSheet("""
                    table {
                        border-color: #BCBCBC;
                        border-style: solid;
                        border-collapse: collapse;
                    }
                    table td {
                        padding-top: 2px;
                        padding-bottom: 2px;
                        padding-left: 2px;
                        padding-right: 10px;
                    }

                    table th {
                        text-align: center;
                        padding-top: 5px;
                        padding-bottom: 5px;
                    }
                    """)
Esempio n. 11
0
    def create_widget(self):
        """ Create the underlying html widget.

        """
        widget = QTextEdit(self.parent_widget())
        widget.setReadOnly(True)
        self.widget = widget
Esempio n. 12
0
 def _input_mouseDoubleClickEvent(self, event):
     cursor = self.widgets.input.textCursor()
     if cursor.position() == 0:
         log_debug("doing nothing")
         event.ignore()
     else:
         QTextEdit.mouseDoubleClickEvent(self.widgets.input, event)
Esempio n. 13
0
 def _inputKeyPressEvent(self, event):
     w = self.widgets
     key = event.key()
     modifiers = event.modifiers()
     if key == Qt.Key_Return and not modifiers:
         self.sendMsg()
         return
     if key == Qt.Key_Backspace:
         cursor = w.input.textCursor()
         if cursor.selectionStart() <=1:
             #Don't erase formatting.. normally erasing the last character
             #will also reset the format. This stores the current formatting,
             #so that we can reset it after the character has been removed
             #according to Qt documentation, selectionStart "Returns the end of
             #the selection or position() if the cursor doesn't have a selection."
             font = w.input.currentFont()
             color = w.input.textColor()
             cursor.deletePreviousChar()
             w.input.setCurrentFont(font)
             w.input.setTextColor(color)
             return
         cursor.deletePreviousChar()            
         return
     if modifiers & Qt.CTRL:
         #MS-Word style size increase/decrease
         if key == Qt.Key_BracketLeft:
             w.fontsize.stepBy(-1)
             return
         elif key == Qt.Key_BracketRight:
             w.fontsize.stepBy(1)
             return
     
     QTextEdit.keyPressEvent(w.input,event)    
Esempio n. 14
0
 def __init__(self, disassembly):
   QTextEdit.__init__(self)
   self.disassembly = disassembly
   self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
   self.setReadOnly(1)
   self.setWordWrapMode(QTextOption.NoWrap)
   self.setFont(QFont("Courier New"))
 def add_item(self, title_text):
     
     # add item to dock                
     new_widget = QTextEdit()
     new_widget.setText("")
     new_widget.setReadOnly(True)
     
     new_dock = dockarea.Dock(title_text, size=(1000, 20))
     new_dock.setOrientation('horizontal')
     new_dock.addWidget(new_widget)
     
     self.addDock(new_dock, 'right')
     
     # add item to combobox
     self.viewer_cbox.addItem(title_text)        
     new_row = self.viewer_cbox.count() - 1
     item = self.viewer_cbox.model().item(new_row, 0)
     item.setCheckState(QtCore.Qt.Checked)
     
     
     # link items
     self.widget_index[new_row] = new_widget
     self.widget_text[title_text] = new_widget
     self.dock_index[new_row] = new_dock
     
     return item
Esempio n. 16
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. 17
0
 def  __init__(self):
     QTextEdit.__init__(self)
     self.setFocus()
     self.lastSaved = None
     self.fileName = None
     self.ensureCursorVisible()
     self.defaultWeight = self.fontWeight()
Esempio n. 18
0
class ItemDescriptionWidget(QWidget):
    """
    Widget to show item description

    .. versionadded:: 0.6
    """
    def __init__(self, parent):
        """
        Default constructor
        """
        super(ItemDescriptionWidget, self).__init__(parent)
        self.setFocusPolicy(Qt.NoFocus)

        self.text_edit = None

        self.__set_layout()

    def __set_layout(self):
        """
        Sets layout of this widget
        """
        layout = QHBoxLayout()
        self.text_edit = QTextEdit()
        self.text_edit.setReadOnly(True)

        layout.addWidget(self.text_edit)
        self.setLayout(layout)

    def set_text(self, text):
        """
        Set text being displayed on this widget
        """
        self.text_edit.setText(text)
Esempio n. 19
0
 def __init__(self, parent=None):
     QTextEdit.__init__(self, parent)
     BaseEditMixin.__init__(self)
     TracebackLinksMixin.__init__(self)
     InspectObjectMixin.__init__(self)
     self.calltips = False        # To not use Spyder calltips
     self.found_results = []
Esempio n. 20
0
    def createArgument(self, arg):
        warg = QWidget()
        vlayout = QVBoxLayout()
        vlayout.setSpacing(5)
        vlayout.setMargin(0)
        winfo = QWidget()
        infolayout = QFormLayout()
        infolayout.setMargin(0)
        requirement = arg.requirementType()
        # Generate argument's widget
        warguments = self.getWidgetFromType(arg)

        if arg.requirementType() in (Argument.Optional, Argument.Empty):
            checkBox =  checkBoxWidget(self, winfo, warguments, self.labActivate.text())
            vlayout.addWidget(checkBox, 0)

        infolayout.addRow(self.labType.text(), QLabel(str(typeId.Get().typeToName(arg.type()))))
        tedit = QTextEdit(str(arg.description()))
        tedit.setReadOnly(True)
        infolayout.addRow(tedit)
        winfo.setLayout(infolayout)
        vlayout.addWidget(winfo, 1)
        if warguments:
            vlayout.addWidget(warguments, 2)        
            self.valueArgs[arg.name()] = warguments
        else:
            self.valueArgs[arg.name()] = winfo
        warg.setLayout(vlayout)
        self.stackedargs.addWidget(warg)
        argitem = QListWidgetItem(str(arg.name()), self.listargs)
Esempio n. 21
0
class FSNTextEdit(QWidget):
    def __init__(self, *args, **kwargs):
        super(FSNTextEdit, self).__init__(*args, **kwargs)
        self.fsn_label = QLabel("FSN(s):")
        self.text_edit = QTextEdit()
        layout = QVBoxLayout()
        layout.addWidget(self.fsn_label,0)
        layout.addWidget(self.text_edit,2)
        self.text_edit.setToolTip("Paste a list of FSNs here. Preferably from Excel or Google Spreadsheets.\nIf you're entering more than 1 FSN yourself, then please separate them either by a comma or a new line.")
        self.setLayout(layout)

    def getFSNs(self):
        text_edit_contents = str(self.text_edit.toPlainText()).strip()
        #print "Got text!"
        fsns_string = []
        possible_separators = [" ","'",'"', ","]
        for separator in possible_separators:
            if separator in text_edit_contents:
                text_edit_contents = text_edit_contents.replace(separator,"\n")
        if "\n" in text_edit_contents:
            fsns_string = list(set(text_edit_contents.split("\n")))
        if len(text_edit_contents) in [13, 16]:
            fsns_string = [text_edit_contents]
        #print fsns_string
        if len(fsns_string)>0:
            fsn_list = [fsn for fsn in fsns_string if ((len(fsn) == 16) or (len(fsn) == 13))]
        else:
            fsn_list = fsns_string

        validated_list = filter(OINKM.checkIfFSN, list(set(fsn_list)))
        return validated_list
Esempio n. 22
0
File: shell.py Progetto: halbbob/dff
    def __init__(self, parent=None, log=''):
        QTextEdit.__init__(self, parent)
        console.__init__(self, sigstp=False)
        self.setupUi(self)
        self.name = self.windowTitle()
	self.completion = completion.Completion(self)
        self.hookTermSize()
	taskmanager = TaskManager()
        self.vfs = vfs.vfs()
        self.log = log or ''
        if parent is None:
            self.eofKey = Qt.Key_D
        else:
            self.eofKey = None
        self.line    = QString()
        self.lines   = []
        self.point   = 0
        self.more    = 0
        self.reading = 0
        self.pointer = 0
        self.cursor_pos   = 0

        self.fgcolor = QColor("white")
        self.selcolor = QColor("green")

        self.preloop()
	self.redirect = RedirectIO()
	self.sig = "Sputtext"
	self.connect(self, SIGNAL(self.sig), self.puttext)
	self.redirect.addparent(self, ["ui.gui.widget.shell", "ui.console.console", "ui.console.completion", "ui.console.line_to_arguments", "api.taskmanager.taskmanager", "api.taskmanager.scheduler", "api.taskmanager.processus"], True)
        self.writePrompt()
Esempio n. 23
0
 def __init__(self, parent):
     RWidget.__init__(self, parent)
     textEdit = QTextEdit(self)
     textEdit.setToolTip("Random text goes here")
     hbox = QHBoxLayout(self)
     hbox.addWidget(textEdit)
     self.setFocusProxy(textEdit)
Esempio n. 24
0
    def _clicked(self, point, button):
        if self.iface.activeLayer() is None:
            self.raise_message("no_active_layer")
            return
        # Prüfe, ob Punkt innerhalb des Features
        for feature in self.iface.activeLayer().getFeatures():
            #Falls Punkt in Features
            if feature.geometry().contains(point):
                #hole gml_id
                try:
                    gml_id = feature.attribute('gml_id')
                except KeyError:
                    self.raise_message("no_gml_id_found")
                    return
                break

        # ids = tuple(str(feature.attribute('gml_id')) for feature in selected_features)
        result = self._get_fsn_from_gml_id(gml_id)
        html = self._build_html(result[0]['flsnr'])
        parent = QDialog()
        parent.setWindowTitle(u"Eigentümerinformationen")
        parent.setParent(self.iface.mainWindow())
        parent.setWindowFlags(QtCore.Qt.Window)

        textview = QTextEdit()
        textview.setReadOnly(True)
        textview.setText(html)
        layout = QGridLayout(parent)
        layout.addWidget(textview)
        parent.resize(500, 600)
        parent.show()
Esempio n. 25
0
 def __init__(self, mime, parent=None):
     QTextEdit.__init__(self, parent)
     self.setAcceptRichText(False)
     font = QFont()
     font.setFamily('Terminal [DEC]')
     self.setFont(font)
     ts = QFontMetrics(font).maxWidth()
Esempio n. 26
0
 def setPlainText(self, text):
     """QTextEdit.setPlainText implementation.
     Clears inline completion before setting new text
     """
     self.setInlineCompletion('')
     QTextEdit.setPlainText(self, text)
     self.moveCursor(QTextCursor.End)
Esempio n. 27
0
    def keyPressEvent__(self, event):
        # needed because text edit is not going to recognize short cuts because will do something with control key
        # not needed if have global shortcuts
        if event.modifiers() & Qt.ControlModifier:
            handled = False
            if event.key() == Qt.Key_A:
                self.create_anchor()
                handled = True
            elif event.key() == Qt.Key_B:
                self.toggleBold()
                handled = True
            elif event.key() == Qt.Key_I:
                self.toggleItalic()
                handled = True
            #elif event.key() == Qt.Key_K:
                #self.colorMenu()
                #handled = True
            elif event.key() == Qt.Key_M:
                self.textEffectMenu()
                handled = True
            elif event.key() == Qt.Key_P:
                self.make_plain_text()
                handled = True
            elif event.key() == Qt.Key_Z:
                self.make_pre_block()
                handled = True
            elif event.key() == Qt.Key_U:
                self.toggleUnderline()
                handled = True
            if handled:
                event.accept()
                return

        QTextEdit.keyPressEvent(self, event)
Esempio n. 28
0
 def keyPressEvent(self, event):
     """ for Qt.Key_Tab, expand as 4 spaces
         for other keys, use default implementation
     """
     if event.key() == Qt.Key_Tab:
         self.insertPlainText('    ')
     else:
         QTextEdit.keyPressEvent(self, event)
Esempio n. 29
0
    def __init__(self, layer, geometry, parent=None):
        GeomEditor.__init__(self, layer, geometry)
        QTextEdit.__init__(self, parent)

        self.setGeom(geometry)
        self.cursorPositionChanged.connect(self.emitCurrentPoint)
        self.textChanged.connect(self.geomChanged)
        self.layerEditable()
Esempio n. 30
0
 def mousePressEvent(self, event):
     """Mouse event handler.
     Removed inline completion before processing event
     """
     self._clearInlineCompletion()
     QTextEdit.mousePressEvent(self, event)
     if self.textCursor().atEnd():
         self.updateCompletion.emit()
Esempio n. 31
0
 def __init__(self, s):
     QDialog.__init__(self)
     self.setModal(True)
     self.resize(600, 400)
     self.setWindowTitle(self.tr('Unit test'))
     layout = QVBoxLayout()
     self.text = QTextEdit()
     self.text.setEnabled(True)
     self.text.setText(s)
     layout.addWidget(self.text)
     self.setLayout(layout)
     QMetaObject.connectSlotsByName(self)
Esempio n. 32
0
    def __set_layout(self):
        """
        Set layout of this component
        """
        self.horizontal_layout = QHBoxLayout()

        self.text_edit = QTextEdit()
        self.text_edit.setReadOnly(True)

        self.horizontal_layout.addWidget(self.text_edit)

        self.setLayout(self.horizontal_layout)
Esempio n. 33
0
    def createWidget(self):
        """
        Create all widgets
        """
        self.logsEdit = QTextEdit()
        self.logsEdit.setReadOnly(True)
        self.logsEdit.setOverwriteMode(True)
        self.logsEdit.setMinimumWidth(450)

        mainLayout = QVBoxLayout()
        mainLayout.addWidget(self.logsEdit)
        self.setLayout(mainLayout)
Esempio n. 34
0
    def changeEvent(self, event):
        """ Search for a language change event

        This event have to call retranslateUi to change interface language on
        the fly.
        """
        if event.type() == QEvent.LanguageChange:
            self.retranslateUi(self)
            self.writePrompt()

        else:
            QTextEdit.changeEvent(self, event)
Esempio n. 35
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Custom Menu")

        self.text_edit = QTextEdit()
        self.text_edit.setContextMenuPolicy(Qt.CustomContextMenu)

        self.setCentralWidget(self.text_edit)

        self.connect(self.text_edit,
                     SIGNAL('customContextMenuRequested(const QPoint &)'),
                     self.context_menu)
Esempio n. 36
0
class LayoutInformations(QHBoxLayout):
    def __init__(self, parent):
        super(LayoutInformations, self).__init__()
        self.settings(parent)

    def settings(self, parent):
        # CRIANDO O GRUPOBOXINFOS PARA POR OS WIDGETS
        self.groupBoxInfos = QGroupBox(parent)
        self.groupBoxInfos.setMaximumSize(QSize(16777215, 16777215))

        # CRIANDO OS LAYOUT'S
        self.LayoutTimeSampling = LayoutTimeSampling(parent)
        self.LayoutFile = LayoutFile(parent)
        self.LayoutSelectCOM = LayoutSelectCOM(parent)
        self.LayoutButtons = LayoutButtons(parent)

        self.creatTextBrowser()
        self.label()

        self.verticalLayoutInformations = QVBoxLayout(self.groupBoxInfos)
        self.verticalLayoutInformations.setMargin(11)
        self.verticalLayoutInformations.setSpacing(6)

        # ADICOINANDO O LAYOUT TIME AMOSTRAGEM, LABEL, LAYOUT ARQUIVO,
        # TEXTO LOG E GRID NO LAYOUT VERTICAL
        self.verticalLayoutInformations.addLayout(self.LayoutTimeSampling)
        self.verticalLayoutInformations.addWidget(self.lbArquivo)
        self.verticalLayoutInformations.addLayout(self.LayoutFile)
        self.verticalLayoutInformations.addLayout(self.LayoutSelectCOM)
        self.verticalLayoutInformations.addWidget(self.TextLog)
        self.verticalLayoutInformations.addLayout(self.LayoutButtons)

        # ADICIONANDO O GRUPOBOX NO LAYOUT INFOS
        self.addWidget(self.groupBoxInfos)

    def creatTextBrowser(self):
        # DEFININDO O TAMANHO DA FONTE
        font = QFont()
        font.setPointSize(11)

        # CRIANDO O TEXTO DE LOG
        self.TextLog = QTextEdit(self.groupBoxInfos)
        sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.TextLog.sizePolicy().hasHeightForWidth())
        self.TextLog.setReadOnly(True)
        # self.TextLog.setEnabled(False)
        self.TextLog.setFont(font)
        self.TextLog.setSizePolicy(sizePolicy)
        self.TextLog.setMaximumSize(QSize(600, 100))

    def label(self):
        # CRIANDO O LABEL PARA SELECIONAR O LOCAL DO ARQUIVO
        self.lbArquivo = QLabel(self.groupBoxInfos)
        self.lbArquivo.setText("Selecione onde quer salvar o novo arquivo: ")
Esempio n. 37
0
    def keyPressEvent(self, event):
        """Reimplement Qt Method - Basic keypress event handler"""
        event, text, key, ctrl, shift = restore_keyevent(event)

        if key == Qt.Key_Question and not self.has_selected_text() and \
          self.set_inspector_enabled:
            self._key_question(text)
        elif key == Qt.Key_ParenLeft and not self.has_selected_text() \
          and self.set_inspector_enabled:
            self._key_question(text)
        else:
            # Let the parent widget handle the key press event
            QTextEdit.keyPressEvent(self, event)
Esempio n. 38
0
    def __init__(self, spell_dict):
        QTextEdit.__init__(self)
        BaseEdit.__init__(self)
        self.spell_dict = spell_dict
        self.highlighter = Highlighter(self.document(), self.spell_dict)
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(self.customContextMenu)
        self.found = False
        self.edit_id = "spellcheck"
        self.completer = QCompleter(self.text())
        self.completer.setCompletionMode(QCompleter.PopupCompletion)

        self.setAcceptRichText(False)
Esempio n. 39
0
def test():
    a = QApplication([])
    e = QTextEdit()
    e.setCursorWidth(2)
    e.setFont(QFont("Monospace"))
    e.setPlainText("""\
some text
here another line
and here yet another
""")
    e.show()
    v = ViMode(e)
    a.exec_()
Esempio n. 40
0
    def __init__(self, *a):
        super(RichTextApp, self).__init__(*a)
        self.win = MainWindowWithPersistentDocks()
        self.win.setting_ids = ("IMDEA", "FOL.Synopsis")
        self.win.setWindowTitle("FOL Synopsis")

        self.text = QTextEdit(self.win)
        #self.put_some_text_in()

        self.win.setCentralWidget(self.text)
        #self.win.statusBar().show()
        
        self.win.load()
Esempio n. 41
0
 def __init__(self, title='', parent=None):
     super(Err, self).__init__(parent)
     self.Msg = QTextEdit(self)
     self.Msg.setGeometry(5, 25, 490, 430)
     self.setFixedSize(500, 500)
     self.index = 0
     self.message = ''
     self.okBtn = QPushButton('ok', self)
     self.okBtn.setGeometry(220, 460, 70, 30)
     self.okBtn.clicked.connect(self.hide)
     global sendErr
     sendErr = self.sendErr
     self.hide()
Esempio n. 42
0
 def insertFromMimeData(self, source):
     # not sure really necessary since it actually appears to paste URLs correctly
     # I am stripping the http
     print("Paste")
     text = g.u(source.text())
     if len(text.split())==1 and (text.startswith('http://') or 'www' in text or '.com' in text or '.html' in text):
         if text.startswith('http://'):
             text = '<a href="{0}">{1}</a> '.format(text, text[7:])
         else:
             text = '<a href="http://{0}">{0}</a> '.format(text)
         self.insertHtml(text)
     else:   
         QTextEdit.insertFromMimeData(self, source)
Esempio n. 43
0
    def __createLayout( self ):
        """ Creates the dialog layout """

        self.resize( 450, 220 )
        self.setSizeGripEnabled( True )

        self.verticalLayout = QVBoxLayout( self )

        # Info label
        self.infoLabel = FitPathLabel( self )
        #sizePolicy = QSizePolicy( QSizePolicy.Expanding,
        #                          QSizePolicy.Preferred )
        sizePolicy = QSizePolicy( QSizePolicy.Minimum,
                                  QSizePolicy.Preferred )
        sizePolicy.setHorizontalStretch( 0 )
        sizePolicy.setVerticalStretch( 0 )
        sizePolicy.setHeightForWidth(
                    self.infoLabel.sizePolicy().hasHeightForWidth() )
        self.infoLabel.setSizePolicy( sizePolicy )
        self.verticalLayout.addWidget( self.infoLabel )

        # Progress bar
        self.progressBar = QProgressBar( self )
        self.progressBar.setValue( 0 )
        self.progressBar.setOrientation( Qt.Horizontal )
        self.verticalLayout.addWidget( self.progressBar )

        # Result window
        self.resultEdit = QTextEdit( self )
        self.resultEdit.setTabChangesFocus( False )
        self.resultEdit.setAcceptRichText( False )
        self.resultEdit.setReadOnly( True )
        self.resultEdit.setFontFamily( GlobalData().skin.baseMonoFontFace )
        font = self.resultEdit.font()

        # Calculate the vertical size
        fontMetrics = QFontMetrics( font )
        rect = fontMetrics.boundingRect( "W" )
        # 6 lines, 5 line spacings, 2 frames
        self.resultEdit.setMinimumHeight( rect.height() * 7 + 4 * 5 +
                                          self.resultEdit.frameWidth() * 2 )
        self.verticalLayout.addWidget( self.resultEdit )

        # Buttons
        self.buttonBox = QDialogButtonBox( self )
        self.buttonBox.setOrientation( Qt.Horizontal )
        self.buttonBox.setStandardButtons( QDialogButtonBox.Close )
        self.verticalLayout.addWidget( self.buttonBox )

        self.buttonBox.rejected.connect( self.__onClose )
        return
Esempio n. 44
0
    def __init__(self, parent=None, log=''):
        QTextEdit.__init__(self, parent)
        InteractiveInterpreter.__init__(self, None)
        self.setupUi(self)
        self.name = self.windowTitle()
        self.log = log or ''
        self.__canwrite = True

        if parent is None:
            self.eofKey = Qt.Key_D
        else:
            self.eofKey = None

        self.line = QString()
        self.lines = []
        self.point = 0
        self.more = 0
        self.reading = 0
        self.history = []
        self.pointer = 0
        self.cursor_pos = 0
        self.fgcolor = QColor("white")
        self.selcolor = QColor("green")
        self.strcolor = QColor("red")

        self.redirect = RedirectIO()
        self.sig = "IIputtext(QString)"
        self.connect(self, SIGNAL(self.sig),
                     self.sputtext)  #, Qt.QueuedConnection)
        self.connect(self, SIGNAL("Iputtext(QString)"), self.puttext)
        self.redirect.addparent(
            self,
            ["dff.ui.gui.widget.interpreter", "code", "__console__", "pydoc"])

        self.ps1 = ">>> "
        self.ps2 = "... "
        self.writePrompt()
        api_imports = [
            "from dff.api.types.libtypes import Variant, VList, VMap, DateTime, typeId, Argument, Parameter, ConfigManager, Constant, Config, Path",
            "from dff.api.vfs.vfs import vfs",
            "from dff.api.vfs.libvfs import VFS, FileMapping, ABSOLUTE_ATTR_NAME, RELATIVE_ATTR_NAME",
            "from dff.api.filters.libfilters import Filter",
            "from dff.api.search.libsearch import Search",
            "from dff.api.events.libevents import EventHandler, event",
            "from dff.api.datatype.libdatatype import DataTypeManager, DataTypeHandler",
            "from dff.api.loader.loader import loader",
            "from dff.api.module.module import Module, Script",
            "from dff.api.taskmanager.taskmanager import TaskManager"
        ]
        for api_import in api_imports:
            self.more = self.runsource(api_import)
Esempio n. 45
0
    def keyPressEvent(self, event):
        "Atiene el evento de pulsación de tecla."
        self._cambios_sin_guardar = True

        # Permite usar tab como seleccionador de la palabra actual
        # en el popup de autocompletado.
        if event.key() in [Qt.Key_Tab]:
            if self.completer and self.completer.popup().isVisible():
                event.ignore()
                nuevo_evento = QKeyEvent(QKeyEvent.KeyPress, Qt.Key_Return, Qt.NoModifier)
                try:
                    if self.autocomplete(nuevo_evento):
                        return None
                except UnicodeEncodeError:
                    pass
                return None


        if editor_base.EditorBase.keyPressEvent(self, event):
            return None


        # Elimina los pares de caracteres especiales si los encuentra
        if event.key() == Qt.Key_Backspace:
            self._eliminar_pares_de_caracteres()
            self._borrar_un_grupo_de_espacios(event)

        if self.autocomplete(event):
            return None


        if event.key() == Qt.Key_Return:
            cursor = self.textCursor()
            block = self.document().findBlockByNumber(cursor.blockNumber())
            whitespace = re.match(r"(\s*)", unicode(block.text())).group(1)

            linea_anterior = str(block.text()[:])
            cantidad_espacios = linea_anterior.count(' ') / 4

            if linea_anterior[-1:] == ':':
                whitespace = '    ' * (cantidad_espacios + 1)
            else:
                whitespace = '    ' * (cantidad_espacios)

            QTextEdit.keyPressEvent(self, event)
            return self.insertPlainText(whitespace)



        return QTextEdit.keyPressEvent(self, event)
Esempio n. 46
0
class AddressView(QWidget):
    def __init__(self):
        super(AddressView, self).__init__()
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        layout.setMargin(0)
        # layout.insertStretch(-1, 1)
        self.addressTB = QTextEdit()
        # self.addressTB.setContentsMargins(0,0,0,0)
        self.addressTB.setMaximumHeight(40)
        self.addressTB.setMaximumWidth(160)
        self.address = '-' * 32
        self.addressTB.setText(self.address)

        layout.addWidget(self.addressTB)

        self.setLayout(layout)

        self.setMaximumHeight(60)

    def set_address(self, address):
        self.address = address
        self.addressTB.setText(self.address)
        self.update()
Esempio n. 47
0
 def testExample(self):
     logging.debug(self.__class__.__name__ +': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle("test ToolBoxContainer")
     self.app.setActiveWindow(self.window)
     self.window.show()
     container = ToolBoxContainer(self.window)
     self.window.setCentralWidget(container)
     container.addWidget(QTextEdit("ganz viel text\n mit zeilenumbruechen\n."))
     container.addWidget(QTextEdit("anderer inhalt."))
     container.show()
     if not hasattr(unittest,"NO_GUI_TEST"):
         self.app.exec_()
Esempio n. 48
0
    def setup_widgets(self):
        self.label_info = QLabel("updates from exchange folder:")
        self.info = QTextEdit(self)
        self.info.setReadOnly(1)

        self.label_updates = QLabel("updates from internet:")
        self.updates = QTableWidget(0, 3)
        self.updates.setHorizontalHeaderLabels(["updater", "info", "try updatde ?"])
        self.updates.verticalHeader().hide()
        self.updates.horizontalHeader().setResizeMode(0, QHeaderView.Stretch)
        self.updates.horizontalHeader().setResizeMode(1, QHeaderView.Stretch)

        self.ok_button = QPushButton("OK")
        self.ok_button.setEnabled(False)
Esempio n. 49
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.page_name = QLabel(self)
        self.page_name.setMaximumHeight(30)

        self.field = QTextEdit(self)
        self.field.setReadOnly(True)
        self.field.setFontPointSize(14)
        self.field.move(0, 30)

        self.runesID = {}
        self.runesDescription = {}
        self.rune_name = {}
Esempio n. 50
0
    def createDialog(self):
        """
        Create dialog
        """
        self.labelName = QLabel("Agent Name:")
        self.nameEdit = QLineEdit(self.agentName)
        nameLayout = QHBoxLayout()
        nameLayout.addWidget(self.labelName)
        nameLayout.addWidget(self.nameEdit)

        self.labelDescr = QLabel("Description:")
        self.descrEdit = QTextEdit()

        self.labelValue = QLabel("Value:")
        self.comboValue = QComboBox()

        typeLayout = QHBoxLayout()
        typeLayout.addWidget(self.labelValue)
        typeLayout.addWidget(self.comboValue)

        self.labelType = QLabel("Type:")
        self.typeEdit = QLineEdit()
        self.typeEdit.setEnabled(False)
        type2Layout = QHBoxLayout()
        type2Layout.addWidget(self.labelType)
        type2Layout.addWidget(self.typeEdit)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setStyleSheet("""QDialogButtonBox { 
            dialogbuttonbox-buttons-have-icons: 1;
            dialog-ok-icon: url(:/ok.png);
            dialog-cancel-icon: url(:/test-close-black.png);
        }""")
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel)

        mainLayout = QVBoxLayout()
        mainLayout.addLayout(nameLayout)
        if not self.datasetView__:
            mainLayout.addLayout(typeLayout)
            mainLayout.addLayout(type2Layout)
        mainLayout.addWidget(self.labelDescr)
        mainLayout.addWidget(self.descrEdit)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.setWindowTitle("Test Config > Add agent")
        self.resize(350, 250)
        self.center()
Esempio n. 51
0
    def initShape(self):
        self.hbox = QHBoxLayout()

        self.stringedit = QTextEdit()
        self.stringedit.setReadOnly(True)
        self.stringedit.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        self.scrollbar = stringLFScrollBar(self.heditor.filesize,
                                           self.heditor.pageSize,
                                           self.heditor.bytesPerLine, self)

        self.hbox.addWidget(self.stringedit)
        self.hbox.addWidget(self.scrollbar)

        self.setLayout(self.hbox)
Esempio n. 52
0
    def __init__(self,
                 text,
                 title='',
                 font=None,
                 parent=None,
                 readonly=False,
                 size=(400, 300)):
        QDialog.__init__(self, parent)

        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.text = None

        self._conv = str if isinstance(text, str) else unicode

        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

        # Text edit
        self.edit = QTextEdit(parent)
        self.connect(self.edit, SIGNAL('textChanged()'), self.text_changed)
        self.edit.setReadOnly(readonly)
        self.edit.setPlainText(text)
        if font is None:
            font = get_font('texteditor')
        self.edit.setFont(font)
        self.layout.addWidget(self.edit)

        # Buttons configuration
        buttons = QDialogButtonBox.Ok
        if not readonly:
            buttons = buttons | QDialogButtonBox.Cancel
        bbox = QDialogButtonBox(buttons)
        self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
        self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()"))
        self.layout.addWidget(bbox)

        # Make the dialog act as a window
        self.setWindowFlags(Qt.Window)

        self.setWindowIcon(get_icon('edit.png'))
        self.setWindowTitle(_("Text editor") + \
                            "%s" % (" - "+str(title) if str(title) else ""))
        self.resize(size[0], size[1])
Esempio n. 53
0
    def createWidgetScreen(self):
        """
        Create screen widget
        """
        self.screenGroup = QGroupBox(self.tr(""))

        # text
        self.checkComboBox = QComboBox(self)
        self.checkComboBox.addItems([
            GuiSteps.OP_ANY, GuiSteps.OP_CONTAINS, GuiSteps.OP_NOTCONTAINS,
            GuiSteps.OP_REGEXP, GuiSteps.OP_NOTREGEXP, GuiSteps.OP_STARTSWITH,
            GuiSteps.OP_NOTSTARTSWITH, GuiSteps.OP_ENDSWITH,
            GuiSteps.OP_NOTENDSWITH
        ])

        self.screenLine = QLineEdit(self)
        self.screenLine.setMinimumWidth(300)
        self.screenLine.setEnabled(False)
        self.screenLine.hide()
        self.screenArea = QTextEdit(self)
        self.screenArea.setMinimumWidth(300)
        self.screenArea.setEnabled(False)

        self.screenCombo = QComboBox(self)
        self.screenCombo.addItems(LIST_TYPES)
        self.screenCombo.setEnabled(False)

        self.screenSaveCombo = QComboBox(self)
        self.screenSaveCombo.addItems(["VARIABLE", "CACHE"])
        self.screenSaveLine = QLineEdit(self)
        self.screenSaveLine.setMinimumWidth(300)
        self.screenSaveLine.setEnabled(False)

        mainTextlayout = QGridLayout()
        mainTextlayout.addWidget(QLabel(self.tr("Checking if the screen: ")),
                                 0, 0)
        mainTextlayout.addWidget(self.checkComboBox, 0, 1)
        mainTextlayout.addWidget(QLabel(self.tr("The value:")), 1, 0)
        mainTextlayout.addWidget(self.screenCombo, 1, 1)
        mainTextlayout.addWidget(self.screenLine, 2, 1)
        mainTextlayout.addWidget(self.screenArea, 2, 1)
        mainTextlayout.addWidget(QLabel(self.tr("And save the screen in:")), 0,
                                 2)
        mainTextlayout.addWidget(self.screenSaveCombo, 1, 2)
        mainTextlayout.addWidget(self.screenSaveLine, 2, 2)

        self.screenGroup.setLayout(mainTextlayout)
        self.screenGroup.hide()
Esempio n. 54
0
    def __init__(self,
                 mobject,
                 undolen=defaults.OBJECT_EDIT_UNDO_LENGTH,
                 parent=None):
        QtGui.QTableView.__init__(self, parent)
        #self.setEditTriggers(self.DoubleClicked | self.SelectedClicked | self.EditKeyPressed)
        vh = self.verticalHeader()
        vh.setVisible(False)
        hh = self.horizontalHeader()
        hh.setStretchLastSection(True)
        self.setAlternatingRowColors(True)
        self.resizeColumnsToContents()
        self.setModel(ObjectEditModel(mobject, undolen=undolen))
        self.colorButton = QtGui.QPushButton()
        self.colorDialog = QtGui.QColorDialog()
        self.textEdit = QTextEdit()
        try:
            notesIndex = self.model().fields.index("Notes")
            self.setIndexWidget(self.model().index(notesIndex, 1),
                                self.textEdit)
            info = moose.Annotator(self.model().mooseObject.path + '/info')
            self.textEdit.setText(QtCore.QString(info.getField('notes')))
            self.setRowHeight(notesIndex, self.rowHeight(notesIndex) * 3)

            # self.colorDialog.colorSelected.connect(
            #     lambda color:
            #
            # self.setColor(getColor(self.model().mooseObject.path+'/info')[1])
        except:
            pass

        try:
            colorIndex = self.model().fields.index("Color")
            self.colorButton.clicked.connect(self.colorDialog.show)
            self.colorButton.setFocusPolicy(PyQt4.QtCore.Qt.NoFocus)
            self.colorDialog.colorSelected.connect(
                lambda color: self.colorButton.setStyleSheet(
                    "QPushButton {" + "background-color: {0}; color: {0};".
                    format(color.name()) + "}"))
            self.setIndexWidget(self.model().index(colorIndex, 1),
                                self.colorButton)
            # self.colorDialog.colorSelected.connect(
            #     lambda color:
            #
            self.setColor(getColor(self.model().mooseObject.path + '/info')[1])
        except:
            pass
        print('Created view with %s' % (mobject))
Esempio n. 55
0
    def __init__(self, publisher, plugin, parentWidget=None):
        DialogBase.__init__(self, parentWidget)
        self.setupUi(self)
        self.setObjectName("ProgressDialog")
        self.viewButton_.setEnabled(False)

        self._publisher = publisher
        self._plugin = plugin
        self._parent = parentWidget
        self._cancelled = False
        self._timeline = QTimeLine(1000 * 60, self)
        self._timeline.setFrameRange(0, 2 * 60)
        self._timeline.setLoopCount(0)
        self.progressBar_.setRange(0, 60)
        self.connect(self._timeline, QtCore.SIGNAL("frameChanged(int)"),
                     self.updateProgressBar)

        self.outputGroupBox_ = QGroupBox("Script output", None)

        self.outputTextEdit_ = QTextEdit()
        self.outputTextEdit_.setTextInteractionFlags(
            Qt.TextSelectableByKeyboard
            | Qt.TextSelectableByMouse)
        self.outputTextEdit_.setReadOnly(True)
        self.outputTextEdit_.setTabChangesFocus(True)
        self.outputTextEdit_.setAcceptRichText(False)

        groupBoxLayout = QVBoxLayout()
        groupBoxLayout.setObjectName("groupBoxLayout")
        groupBoxLayout.setMargin(0)
        groupBoxLayout.addWidget(self.outputTextEdit_)
        self.outputGroupBox_.setLayout(groupBoxLayout)

        gridLayout = QGridLayout()
        gridLayout.setSizeConstraint(gridLayout.SetFixedSize)
        gridLayout.addWidget(self.progressLabel_, 0, 0, 1, 4)
        gridLayout.addWidget(self.progressBar_, 1, 0, 1, 4)
        gridLayout.addWidget(self.detailsCheckBox_, 2, 0)
        hSpacer = QSpacerItem(250, 10, QSizePolicy.Expanding)
        gridLayout.addItem(hSpacer, 2, 1)

        gridLayout.addWidget(self.viewButton_, 2, 2)
        gridLayout.addWidget(self.cancelButton_, 2, 3)
        gridLayout.addWidget(self.outputGroupBox_, 3, 0, 1, 4)

        self.setLayout(gridLayout)

        self.outputGroupBox_.setVisible(False)
Esempio n. 56
0
 def mouseMoveEvent(self, event):
     position = event.pos()
     cursor = self.cursorForPosition(position)
     block = cursor.block()
     checkers = self._neditable.sorted_checkers
     for items in checkers:
         checker, color, _ = items
         if block.blockNumber() in checker.checks:
             message = checker.checks[block.blockNumber()][0]
             QToolTip.showText(self.mapToGlobal(position), message, self)
     if event.modifiers() == Qt.ControlModifier:
         cursor.select(QTextCursor.WordUnderCursor)
         selection_start = cursor.selectionStart()
         selection_end = cursor.selectionEnd()
         cursor.setPosition(selection_start - 1)
         cursor.setPosition(selection_end + 1, QTextCursor.KeepAnchor)
         if cursor.selectedText()[-1:] in ('(', '.') or \
         cursor.selectedText()[:1] in ('.', '@'):
             self.extraSelections = []
             selection = QTextEdit.ExtraSelection()
             lineColor = QColor(
                 resources.CUSTOM_SCHEME.get(
                     'linkNavigate',
                     resources.COLOR_SCHEME['linkNavigate']))
             selection.format.setForeground(lineColor)
             selection.format.setFontUnderline(True)
             selection.cursor = cursor
             self.extraSelections.append(selection)
             self.setExtraSelections(self.extraSelections)
         else:
             self.extraSelections = []
             self.setExtraSelections(self.extraSelections)
     QPlainTextEdit.mouseMoveEvent(self, event)
Esempio n. 57
0
    def highlight(self, format, cursors, priority=0, msec=0):
        """Highlights the selection of an arbitrary list of QTextCursors.
        
        format can be a name for a predefined text format or a QTextCharFormat;
        in the first case the textFormat() method should return a qtextformat to use.
        priority determines the order of drawing, highlighting with higher priority
        is drawn over highlighting with lower priority.
        msec, if > 0, removes the highlighting after that many milliseconds.
        
        """
        fmt = format if isinstance(format,
                                   QTextFormat) else self.textFormat(format)
        selections = []
        for cursor in cursors:
            es = QTextEdit.ExtraSelection()
            es.cursor = cursor
            es.format = fmt
            selections.append(es)
        if msec:

            def clear(selfref=weakref.ref(self)):
                self = selfref()
                if self:
                    self.clear(format)

            timer = QTimer(timeout=clear, singleShot=True)
            timer.start(msec)
            self._selections[format] = (priority, selections, timer)
        else:
            self._selections[format] = (priority, selections)
        self.update()
Esempio n. 58
0
    def addText(self, key,  value=""):
        if not self.overwriteKeys(key):
            if type(key).__name__=='str':
                w = QTextEdit()
		self.connect(w, SIGNAL("textChanged()"), self.argumentChanged)
                w.setPlainText(value)
                if not self.displaykey:
                    self.layout.addRow(w)
                else:
                    self.layout.addRow(key, w)
                self.widgets[key] = w
                return 1
            else:
                return -1
        else:
            return -1
Esempio n. 59
0
    def test1(self):
        class FT(QToolBar):
            def paintEvent(self, e):
                pass

        w = QMainWindow()
        ftt, ftb = FT(), FT()
        ftt.setFixedHeight(15)
        ftb.setFixedHeight(15)

        w.addToolBar(Qt.TopToolBarArea, ftt)
        w.addToolBar(Qt.BottomToolBarArea, ftb)

        f = dropshadow.DropShadowFrame()
        te = QTextEdit()
        c = QWidget()
        c.setLayout(QVBoxLayout())
        c.layout().setContentsMargins(20, 0, 20, 0)
        c.layout().addWidget(te)
        w.setCentralWidget(c)
        f.setWidget(te)
        f.radius = 15
        f.color = QColor(Qt.blue)
        w.show()

        self.singleShot(3000, lambda: f.setColor(Qt.red))
        self.singleShot(4000, lambda: f.setRadius(30))
        self.singleShot(5000, lambda: f.setRadius(40))

        self.app.exec_()
Esempio n. 60
0
    def minimumSizeHint(self):
        """Reimplemented to allow the Splitter to resize the widget
        with a continuous animation.

        """
        hint = QTextEdit.minimumSizeHint(self)
        return QSize(hint.width(), 0)