eric6/QScintilla/Editor.py

branch
maintenance
changeset 7560
343db73c4842
parent 7507
a4eb1787ea41
parent 7546
bf5f777260a6
child 7607
dd1054be15aa
--- a/eric6/QScintilla/Editor.py	Sun Apr 05 18:17:08 2020 +0200
+++ b/eric6/QScintilla/Editor.py	Sat May 02 13:51:07 2020 +0200
@@ -288,25 +288,25 @@
             self.__createChangeMarkerPixmap(
                 "OnlineChangeTraceMarkerUnsaved"))
         self.breakpoint = self.markerDefine(
-            UI.PixmapCache.getPixmap("break.png"))
+            UI.PixmapCache.getPixmap("break"))
         self.cbreakpoint = self.markerDefine(
-            UI.PixmapCache.getPixmap("cBreak.png"))
+            UI.PixmapCache.getPixmap("cBreak"))
         self.tbreakpoint = self.markerDefine(
-            UI.PixmapCache.getPixmap("tBreak.png"))
+            UI.PixmapCache.getPixmap("tBreak"))
         self.tcbreakpoint = self.markerDefine(
-            UI.PixmapCache.getPixmap("tCBreak.png"))
+            UI.PixmapCache.getPixmap("tCBreak"))
         self.dbreakpoint = self.markerDefine(
-            UI.PixmapCache.getPixmap("breakDisabled.png"))
+            UI.PixmapCache.getPixmap("breakDisabled"))
         self.bookmark = self.markerDefine(
-            UI.PixmapCache.getPixmap("bookmark16.png"))
+            UI.PixmapCache.getPixmap("bookmark16"))
         self.syntaxerror = self.markerDefine(
-            UI.PixmapCache.getPixmap("syntaxError.png"))
+            UI.PixmapCache.getPixmap("syntaxError"))
         self.notcovered = self.markerDefine(
-            UI.PixmapCache.getPixmap("notcovered.png"))
+            UI.PixmapCache.getPixmap("notcovered"))
         self.taskmarker = self.markerDefine(
-            UI.PixmapCache.getPixmap("task.png"))
+            UI.PixmapCache.getPixmap("task"))
         self.warning = self.markerDefine(
-            UI.PixmapCache.getPixmap("warning.png"))
+            UI.PixmapCache.getPixmap("warning"))
         
         # define the line markers
         if Preferences.getEditor("LineMarkersBackground"):
@@ -315,9 +315,9 @@
             self.__setLineMarkerColours()
         else:
             self.currentline = self.markerDefine(
-                UI.PixmapCache.getPixmap("currentLineMarker.png"))
+                UI.PixmapCache.getPixmap("currentLineMarker"))
             self.errorline = self.markerDefine(
-                UI.PixmapCache.getPixmap("errorLineMarker.png"))
+                UI.PixmapCache.getPixmap("errorLineMarker"))
         
         self.breakpointMask = (
             (1 << self.breakpoint) |
@@ -557,35 +557,35 @@
         Private method to register images for autocompletion lists.
         """
         self.registerImage(self.ClassID,
-                           UI.PixmapCache.getPixmap("class.png"))
+                           UI.PixmapCache.getPixmap("class"))
         self.registerImage(self.ClassProtectedID,
-                           UI.PixmapCache.getPixmap("class_protected.png"))
+                           UI.PixmapCache.getPixmap("class_protected"))
         self.registerImage(self.ClassPrivateID,
-                           UI.PixmapCache.getPixmap("class_private.png"))
+                           UI.PixmapCache.getPixmap("class_private"))
         self.registerImage(self.MethodID,
-                           UI.PixmapCache.getPixmap("method.png"))
+                           UI.PixmapCache.getPixmap("method"))
         self.registerImage(self.MethodProtectedID,
-                           UI.PixmapCache.getPixmap("method_protected.png"))
+                           UI.PixmapCache.getPixmap("method_protected"))
         self.registerImage(self.MethodPrivateID,
-                           UI.PixmapCache.getPixmap("method_private.png"))
+                           UI.PixmapCache.getPixmap("method_private"))
         self.registerImage(self.AttributeID,
-                           UI.PixmapCache.getPixmap("attribute.png"))
+                           UI.PixmapCache.getPixmap("attribute"))
         self.registerImage(self.AttributeProtectedID,
-                           UI.PixmapCache.getPixmap("attribute_protected.png"))
+                           UI.PixmapCache.getPixmap("attribute_protected"))
         self.registerImage(self.AttributePrivateID,
-                           UI.PixmapCache.getPixmap("attribute_private.png"))
+                           UI.PixmapCache.getPixmap("attribute_private"))
         self.registerImage(self.EnumID,
-                           UI.PixmapCache.getPixmap("enum.png"))
+                           UI.PixmapCache.getPixmap("enum"))
         self.registerImage(self.KeywordsID,
-                           UI.PixmapCache.getPixmap("keywords.png"))
+                           UI.PixmapCache.getPixmap("keywords"))
         self.registerImage(self.ModuleID,
-                           UI.PixmapCache.getPixmap("module.png"))
+                           UI.PixmapCache.getPixmap("module"))
         
         self.registerImage(self.FromDocumentID,
-                           UI.PixmapCache.getPixmap("editor.png"))
+                           UI.PixmapCache.getPixmap("editor"))
         
         self.registerImage(self.TemplateImageID,
-                           UI.PixmapCache.getPixmap("templateViewer.png"))
+                           UI.PixmapCache.getPixmap("templateViewer"))
     
     def addClone(self, editor):
         """
@@ -777,23 +777,23 @@
         self.__menus["SpellLanguages"] = self.spellLanguagesMenu
         
         self.menuActs["Undo"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("editUndo.png"),
+            UI.PixmapCache.getIcon("editUndo"),
             self.tr('Undo'), self.undo)
         self.menuActs["Redo"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("editRedo.png"),
+            UI.PixmapCache.getIcon("editRedo"),
             self.tr('Redo'), self.redo)
         self.menuActs["Revert"] = self.menu.addAction(
             self.tr("Revert to last saved state"),
             self.revertToUnmodified)
         self.menu.addSeparator()
         self.menuActs["Cut"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("editCut.png"),
+            UI.PixmapCache.getIcon("editCut"),
             self.tr('Cut'), self.cut)
         self.menuActs["Copy"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("editCopy.png"),
+            UI.PixmapCache.getIcon("editCopy"),
             self.tr('Copy'), self.copy)
         self.menuActs["Paste"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("editPaste.png"),
+            UI.PixmapCache.getIcon("editPaste"),
             self.tr('Paste'), self.paste)
         if not self.miniMenu:
             self.menuActs["ExecuteSelection"] = self.menu.addAction(
@@ -801,16 +801,16 @@
                 self.__executeSelection)
             self.menu.addSeparator()
             self.menu.addAction(
-                UI.PixmapCache.getIcon("editIndent.png"),
+                UI.PixmapCache.getIcon("editIndent"),
                 self.tr('Indent'), self.indentLineOrSelection)
             self.menu.addAction(
-                UI.PixmapCache.getIcon("editUnindent.png"),
+                UI.PixmapCache.getIcon("editUnindent"),
                 self.tr('Unindent'), self.unindentLineOrSelection)
             self.menuActs["Comment"] = self.menu.addAction(
-                UI.PixmapCache.getIcon("editComment.png"),
+                UI.PixmapCache.getIcon("editComment"),
                 self.tr('Comment'), self.commentLineOrSelection)
             self.menuActs["Uncomment"] = self.menu.addAction(
-                UI.PixmapCache.getIcon("editUncomment.png"),
+                UI.PixmapCache.getIcon("editUncomment"),
                 self.tr('Uncomment'), self.uncommentLineOrSelection)
             self.menuActs["StreamComment"] = self.menu.addAction(
                 self.tr('Stream Comment'),
@@ -828,10 +828,10 @@
             self.menuActs["ExecuteSelection"] = None
         self.menu.addSeparator()
         self.menuActs["SpellCheck"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("spellchecking.png"),
+            UI.PixmapCache.getIcon("spellchecking"),
             self.tr('Check spelling...'), self.checkSpelling)
         self.menuActs["SpellCheckSelection"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("spellchecking.png"),
+            UI.PixmapCache.getIcon("spellchecking"),
             self.tr('Check spelling of selection...'),
             self.__checkSpellingSelection)
         self.menuActs["SpellCheckRemove"] = self.menu.addAction(
@@ -888,27 +888,27 @@
         self.menuActs["Tools"] = self.menu.addMenu(self.toolsMenu)
         self.menu.addSeparator()
         self.menu.addAction(
-            UI.PixmapCache.getIcon("documentNewView.png"),
+            UI.PixmapCache.getIcon("documentNewView"),
             self.tr('New Document View'), self.__newView)
         self.menuActs["NewSplit"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("splitVertical.png"),
+            UI.PixmapCache.getIcon("splitVertical"),
             self.tr('New Document View (with new split)'),
             self.__newViewNewSplit)
         self.menuActs["NewSplit"].setEnabled(self.vm.canSplit())
         self.menu.addAction(
-            UI.PixmapCache.getIcon("close.png"),
+            UI.PixmapCache.getIcon("close"),
             self.tr('Close'), self.__contextClose)
         self.menu.addSeparator()
         self.reopenEncodingMenu = self.__initContextMenuReopenWithEncoding()
         self.menuActs["Reopen"] = self.menu.addMenu(self.reopenEncodingMenu)
         self.menuActs["Save"] = self.menu.addAction(
-            UI.PixmapCache.getIcon("fileSave.png"),
+            UI.PixmapCache.getIcon("fileSave"),
             self.tr('Save'), self.__contextSave)
         self.menu.addAction(
-            UI.PixmapCache.getIcon("fileSaveAs.png"),
+            UI.PixmapCache.getIcon("fileSaveAs"),
             self.tr('Save As...'), self.__contextSaveAs)
         self.menu.addAction(
-            UI.PixmapCache.getIcon("fileSaveCopy.png"),
+            UI.PixmapCache.getIcon("fileSaveCopy"),
             self.tr('Save Copy...'), self.__contextSaveCopy)
         if not self.miniMenu:
             self.menu.addMenu(self.exportersMenu)
@@ -918,10 +918,10 @@
                 self.__contextOpenRejections)
             self.menu.addSeparator()
             self.menu.addAction(
-                UI.PixmapCache.getIcon("printPreview.png"),
+                UI.PixmapCache.getIcon("printPreview"),
                 self.tr("Print Preview"), self.printPreviewFile)
             self.menu.addAction(
-                UI.PixmapCache.getIcon("print.png"),
+                UI.PixmapCache.getIcon("print"),
                 self.tr('Print'), self.printFile)
         else:
             self.menuActs["OpenRejections"] = None
@@ -1024,7 +1024,7 @@
             self.__showApplicationDiagram)
         menu.addSeparator()
         menu.addAction(
-            UI.PixmapCache.getIcon("open.png"),
+            UI.PixmapCache.getIcon("open"),
             self.tr("Load Diagram..."), self.__loadDiagram)
         
         menu.aboutToShow.connect(self.__showContextMenuGraphics)
@@ -1041,7 +1041,7 @@
         
         self.languagesActGrp = QActionGroup(self)
         self.noLanguageAct = menu.addAction(
-            UI.PixmapCache.getIcon("fileText.png"),
+            UI.PixmapCache.getIcon("fileText"),
             self.tr("No Language"))
         self.noLanguageAct.setCheckable(True)
         self.noLanguageAct.setData("None")
@@ -1109,7 +1109,7 @@
         @return reference to the generated menu (QMenu)
         """
         menu = QMenu(self.tr("Re-Open With Encoding"))
-        menu.setIcon(UI.PixmapCache.getIcon("open.png"))
+        menu.setIcon(UI.PixmapCache.getIcon("open"))
         
         for encoding in sorted(Utilities.supportedCodecs):
             act = menu.addAction(encoding)
@@ -1131,21 +1131,21 @@
         
         self.eolActGrp = QActionGroup(self)
         
-        act = menu.addAction(UI.PixmapCache.getIcon("eolLinux.png"),
+        act = menu.addAction(UI.PixmapCache.getIcon("eolLinux"),
                              self.tr("Unix"))
         act.setCheckable(True)
         act.setData('\n')
         self.supportedEols['\n'] = act
         self.eolActGrp.addAction(act)
         
-        act = menu.addAction(UI.PixmapCache.getIcon("eolWindows.png"),
+        act = menu.addAction(UI.PixmapCache.getIcon("eolWindows"),
                              self.tr("Windows"))
         act.setCheckable(True)
         act.setData('\r\n')
         self.supportedEols['\r\n'] = act
         self.eolActGrp.addAction(act)
         
-        act = menu.addAction(UI.PixmapCache.getIcon("eolMac.png"),
+        act = menu.addAction(UI.PixmapCache.getIcon("eolMac"),
                              self.tr("Macintosh"))
         act.setCheckable(True)
         act.setData('\r')
@@ -1750,7 +1750,7 @@
             language = self.filetype
         
         if language.startswith("Pygments|"):
-            pyname = language.split("|", 1)[1]
+            pyname = language
             language = ""
         
         from . import Lexers
@@ -3737,7 +3737,7 @@
         self.__markerMap.update()
     
     ###########################################################################
-    ## Highlightinh marker handling methods below
+    ## Highlighting marker handling methods below
     ###########################################################################
     
     def setHighlight(self, startLine, startIndex, endLine, endIndex):
@@ -4343,10 +4343,10 @@
             self.__setLineMarkerColours()
         else:
             self.markerDefine(
-                UI.PixmapCache.getPixmap("currentLineMarker.png"),
+                UI.PixmapCache.getPixmap("currentLineMarker"),
                 self.currentline)
             self.markerDefine(
-                UI.PixmapCache.getPixmap("errorLineMarker.png"),
+                UI.PixmapCache.getPixmap("errorLineMarker"),
                 self.errorline)
         
         # set the text display
@@ -4720,6 +4720,10 @@
         """
         self.setCallTipsBackgroundColor(
             Preferences.getEditorColour("CallTipsBackground"))
+        self.setCallTipsForegroundColor(
+            Preferences.getEditorColour("CallTipsForeground"))
+        self.setCallTipsHighlightColor(
+            Preferences.getEditorColour("CallTipsHighlight"))
         self.setCallTipsVisible(Preferences.getEditor("CallTipsVisible"))
         calltipsStyle = Preferences.getEditor("CallTipsStyle")
         try:
@@ -5139,6 +5143,9 @@
                     line, col = self.getCursorPosition()
                 elif wLeft:
                     txt = txt[len(wLeft):]
+                
+                if txt[0] in "'\"":  # New in jedi 0.16: AC of dict keys
+                    txt = txt[1:]
             self.insert(txt)
             self.endUndoAction()
             self.setCursorPosition(line, col + len(txt))
@@ -5479,10 +5486,10 @@
         splitOrientation = self.vm.getSplitOrientation()
         if splitOrientation == Qt.Horizontal:
             self.menuActs["NewSplit"].setIcon(
-                UI.PixmapCache.getIcon("splitHorizontal.png"))
+                UI.PixmapCache.getIcon("splitHorizontal"))
         else:
             self.menuActs["NewSplit"].setIcon(
-                UI.PixmapCache.getIcon("splitVertical.png"))
+                UI.PixmapCache.getIcon("splitVertical"))
         
         self.menuActs["Tools"].setEnabled(not self.toolsMenu.isEmpty())
         
@@ -7137,7 +7144,12 @@
         @param evt reference to the event (QEvent)
         @return flag indiating that the event was handled (boolean)
         """
-        self.__markerMap.calculateGeometry()
+        try:
+            self.__markerMap.calculateGeometry()
+        except AttributeError:
+            # ignore this - there seems to be a runtime issue when the editor
+            # is created
+            pass
         return super(Editor, self).viewportEvent(evt)
     
     def __updateReadOnly(self, bForce=True):
@@ -7833,7 +7845,7 @@
         if suggestions:
             self.spellingMenu.addSeparator()
         self.spellingMenu.addAction(
-            UI.PixmapCache.getIcon("spellchecking.png"),
+            UI.PixmapCache.getIcon("spellchecking"),
             self.tr("Check spelling..."), self.__checkSpellingWord)
         self.spellingMenu.addAction(
             self.tr("Add to dictionary"), self.__addToSpellingDictionary)

eric ide

mercurial