예제 #1
0
 def wheelEvent(self, event):
     """Reimplemented to emit zoom in/out signals when Ctrl is pressed"""
     # This feature is disabled on MacOS, see Issue 1510:
     # http://code.google.com/p/spyderlib/issues/detail?id=1510
     if sys.platform != 'darwin':
         if event.modifiers() & Qt.ControlModifier:
             if event.delta() < 0:
                 self.emit(SIGNAL("zoom_out()"))
             elif event.delta() > 0:
                 self.emit(SIGNAL("zoom_in()"))
             return
     QPlainTextEdit.wheelEvent(self, event)
예제 #2
0
 def wheelEvent(self, event):
     """Reimplemented to emit zoom in/out signals when Ctrl is pressed"""
     # This feature is disabled on MacOS, see Issue 1510
     if sys.platform != 'darwin':
         if event.modifiers() & Qt.ControlModifier:
             if event.delta() < 0:
                 self.emit(SIGNAL("zoom_out()"))
             elif event.delta() > 0:
                 self.emit(SIGNAL("zoom_in()"))
             return
     QPlainTextEdit.wheelEvent(self, event)
     self.highlight_current_cell()
예제 #3
0
 def wheelEvent(self, event):
     """Reimplemented to emit zoom in/out signals when Ctrl is pressed"""
     # This feature is disabled on MacOS, see Issue 1510
     if sys.platform != 'darwin':
         if event.modifiers() & Qt.ControlModifier:
             if event.delta() < 0:
                 self.emit(SIGNAL("zoom_out()"))
             elif event.delta() > 0:
                 self.emit(SIGNAL("zoom_in()"))
             return
     QPlainTextEdit.wheelEvent(self, event)
     self.highlight_current_cell()
예제 #4
0
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)
        BaseEditMixin.__init__(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        
        self.extra_selections_dict = {}
        
        self.connect(self, SIGNAL('textChanged()'), self.changed)
        self.connect(self, SIGNAL('cursorPositionChanged()'),
                     self.cursor_position_changed)
        
        self.indent_chars = " "*4
        
        # Code completion / calltips
        if parent is not None:
            mainwin = parent
            while not isinstance(mainwin, QMainWindow):
                mainwin = mainwin.parent()
                if mainwin is None:
                    break
            if mainwin is not None:
                parent = mainwin

        self.completion_widget = CompletionWidget(self, parent)
        self.codecompletion_auto = False
        self.codecompletion_case = True
        self.codecompletion_enter = False
        self.completion_text = ""

        self.calltip_widget = CallTipWidget(self, hide_timer_on=True)
        self.calltips = True
        self.calltip_position = None

        self.has_cell_separators = False
        self.highlight_current_cell_enabled = False
        
        # The color values may be overridden by the syntax highlighter
        # Highlight current line color
        self.currentline_color = QColor(Qt.red).lighter(190)
        self.currentcell_color = QColor(Qt.red).lighter(194)

        # Brace matching
        self.bracepos = None
        self.matched_p_color = QColor(Qt.green)
        self.unmatched_p_color = QColor(Qt.red)
예제 #5
0
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)
        BaseEditMixin.__init__(self)
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.extra_selections_dict = {}

        self.connect(self, SIGNAL('textChanged()'), self.changed)
        self.connect(self, SIGNAL('cursorPositionChanged()'),
                     self.cursor_position_changed)

        self.indent_chars = " " * 4

        # Code completion / calltips
        if parent is not None:
            mainwin = parent
            while not isinstance(mainwin, QMainWindow):
                mainwin = mainwin.parent()
                if mainwin is None:
                    break
            if mainwin is not None:
                parent = mainwin

        self.completion_widget = CompletionWidget(self, parent)
        self.codecompletion_auto = False
        self.codecompletion_case = True
        self.codecompletion_enter = False
        self.completion_text = ""

        self.calltip_widget = CallTipWidget(self, hide_timer_on=True)
        self.calltips = True
        self.calltip_position = None

        self.has_cell_separators = False
        self.highlight_current_cell_enabled = False

        # The color values may be overridden by the syntax highlighter
        # Highlight current line color
        self.currentline_color = QColor(Qt.red).lighter(190)
        self.currentcell_color = QColor(Qt.red).lighter(194)

        # Brace matching
        self.bracepos = None
        self.matched_p_color = QColor(Qt.green)
        self.unmatched_p_color = QColor(Qt.red)
예제 #6
0
 def mousePressEvent(self, event):
     """Reimplement Qt method"""
     if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
         self.calltip_widget.hide()
         if self.has_selected_text():
             self.remove_selected_text()
         self.setFocus()
         event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         QPlainTextEdit.mousePressEvent(self, event)
         QPlainTextEdit.mouseReleaseEvent(self, event)
         # Send selection text to clipboard to be able to use
         # the paste method and avoid the strange Issue 1445
         #
         # Note: This issue seems a focusing problem but it
         # seems really hard to track
         mode_clip = QClipboard.Clipboard
         mode_sel = QClipboard.Selection
         text_clip = QApplication.clipboard().text(mode=mode_clip)
         text_sel = QApplication.clipboard().text(mode=mode_sel)
         QApplication.clipboard().setText(text_sel, mode=mode_clip)
         self.paste()
         QApplication.clipboard().setText(text_clip, mode=mode_clip)
     else:
         self.calltip_widget.hide()
         QPlainTextEdit.mousePressEvent(self, event)
예제 #7
0
파일: base.py 프로젝트: YP-Ye/spyderlib
 def mousePressEvent(self, event):
     """Reimplement Qt method"""
     if sys.platform.startswith('linux') and event.button() == Qt.MidButton:
         self.calltip_widget.hide()
         if self.has_selected_text():
             self.remove_selected_text()
         self.setFocus()
         event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         QPlainTextEdit.mousePressEvent(self, event)
         QPlainTextEdit.mouseReleaseEvent(self, event)
         # Send selection text to clipboard to be able to use
         # the paste method and avoid the strange Issue 1445
         #
         # Note: This issue seems a focusing problem but it
         # seems really hard to track
         mode_clip = QClipboard.Clipboard
         mode_sel = QClipboard.Selection
         text_clip = QApplication.clipboard().text(mode=mode_clip)
         text_sel = QApplication.clipboard().text(mode=mode_sel)
         QApplication.clipboard().setText(text_sel, mode=mode_clip)
         self.paste()
         QApplication.clipboard().setText(text_clip, mode=mode_clip)
     else:
         self.calltip_widget.hide()
         QPlainTextEdit.mousePressEvent(self, event)
예제 #8
0
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)
        BaseEditMixin.__init__(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        
        self.extra_selections_dict = {}
        
        self.connect(self, SIGNAL('textChanged()'), self.changed)
        self.connect(self, SIGNAL('cursorPositionChanged()'),
                     self.cursor_position_changed)
        
        self.indent_chars = " "*4
        
        # Code completion / calltips
        if parent is not None:
            mainwin = parent
            while not isinstance(mainwin, QMainWindow):
                mainwin = mainwin.parent()
                if mainwin is None:
                    break
            if mainwin is not None:
                parent = mainwin
        self.completion_widget = CompletionWidget(self, parent)
        self.codecompletion_auto = False
        self.codecompletion_case = True
        self.codecompletion_single = False
        self.codecompletion_enter = False
        self.calltips = True
        self.calltip_position = None
        self.calltip_font = QFont()
        self.completion_text = ""
        self.signature_widget = CallTipWidget(self)
        
        # Highlight current line color
        self.currentline_color = QColor(Qt.red).lighter(190)

        # Brace matching
        self.bracepos = None
        self.matched_p_color = QColor(Qt.green)
        self.unmatched_p_color = QColor(Qt.red)
예제 #9
0
 def mousePressEvent(self, event):
     """Reimplement Qt method"""
     if os.name != 'posix' and event.button() == Qt.MidButton:
         self.signature_widget.hide()
         self.setFocus()
         event = QMouseEvent(QEvent.MouseButtonPress, event.pos(),
                             Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
         QPlainTextEdit.mousePressEvent(self, event)
         QPlainTextEdit.mouseReleaseEvent(self, event)
         self.paste()
     else:
         self.signature_widget.hide()
         QPlainTextEdit.mousePressEvent(self, event)
예제 #10
0
 def focusOutEvent(self, event):
     """Reimplemented to handle focus"""
     self.emit(SIGNAL("focus_changed()"))
     QPlainTextEdit.focusOutEvent(self, event)
예제 #11
0
 def focusInEvent(self, event):
     """Reimplemented to handle focus"""
     self.emit(SIGNAL("focus_changed()"))
     self.emit(SIGNAL("focus_in()"))
     self.highlight_current_cell()
     QPlainTextEdit.focusInEvent(self, event)
예제 #12
0
파일: base.py 프로젝트: YP-Ye/spyderlib
 def focusOutEvent(self, event):
     """Reimplemented to handle focus"""
     self.emit(SIGNAL("focus_changed()"))
     QPlainTextEdit.focusOutEvent(self, event)
예제 #13
0
파일: base.py 프로젝트: YP-Ye/spyderlib
 def focusInEvent(self, event):
     """Reimplemented to handle focus"""
     self.emit(SIGNAL("focus_changed()"))
     self.emit(SIGNAL("focus_in()"))
     self.highlight_current_cell()
     QPlainTextEdit.focusInEvent(self, event)