Added some icons to the "Languages" and "End-of-Line Type" context menus of the editor and changed the status labels for programming language and end-of-line type of the main window to show an icon.

Sun, 11 Nov 2012 18:57:09 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 11 Nov 2012 18:57:09 +0100
changeset 2217
e80c74f2a25a
parent 2216
3372cf8877c0
child 2218
1940b0e0a992

Added some icons to the "Languages" and "End-of-Line Type" context menus of the editor and changed the status labels for programming language and end-of-line type of the main window to show an icon.

APIs/Python3/eric5.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric5.QScintilla.Lexers.__init__.html file | annotate | diff | comparison | revisions
Documentation/Source/eric5.ViewManager.ViewManager.html file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
QScintilla/Lexers/__init__.py file | annotate | diff | comparison | revisions
QScintilla/MiniEditor.py file | annotate | diff | comparison | revisions
Toolbox/Startup.py file | annotate | diff | comparison | revisions
ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
icons/default/eolLinux.png file | annotate | diff | comparison | revisions
icons/default/eolMac.png file | annotate | diff | comparison | revisions
icons/default/eolWindows.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerBash.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerBatch.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerCMake.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerCPP.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerCSS.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerCsharp.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerD.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerDiff.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerFortran.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerHTML.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerIDL.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerJava.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerJavaScript.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerLua.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerMakefile.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerMatlab.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerOctave.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerPHP.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerPOV.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerPascal.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerPerl.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerPostscript.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerProperties.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerPython.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerRuby.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerSQL.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerTCL.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerTeX.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerVHDL.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerXML.png file | annotate | diff | comparison | revisions
icons/default/languages/lexerYAML.png file | annotate | diff | comparison | revisions
icons/default/languages/readme.txt file | annotate | diff | comparison | revisions
install.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric5.api	Sat Nov 10 19:36:48 2012 +0100
+++ b/APIs/Python3/eric5.api	Sun Nov 11 18:57:09 2012 +0100
@@ -6653,11 +6653,12 @@
 eric5.QScintilla.Lexers.LexerYAML.LexerYAML.isStringStyle?4(style)
 eric5.QScintilla.Lexers.LexerYAML.LexerYAML?1(parent=None)
 eric5.QScintilla.Lexers.getDefaultLexerAssociations?4()
+eric5.QScintilla.Lexers.getLanguageIcon?4(language, pixmap)
 eric5.QScintilla.Lexers.getLexer?4(language, parent=None, pyname="")
 eric5.QScintilla.Lexers.getOpenFileFiltersList?4(includeAll=False, asString=False, withAdditional=True)
 eric5.QScintilla.Lexers.getSaveFileFiltersList?4(includeAll=False, asString=False, withAdditional=True)
 eric5.QScintilla.Lexers.getSupportedLanguages?4()
-eric5.QScintilla.Lexers.registerLexer?4(name, displayString, filenameSample, getLexerFunc, openFilters=[], saveFilters=[], defaultAssocs=[])
+eric5.QScintilla.Lexers.registerLexer?4(name, displayString, filenameSample, getLexerFunc, openFilters=[], saveFilters=[], defaultAssocs=[], iconFileName="")
 eric5.QScintilla.Lexers.unregisterLexer?4(name)
 eric5.QScintilla.MiniEditor.MiniEditor.activeWindow?4()
 eric5.QScintilla.MiniEditor.MiniEditor.clearSearchIndicators?4()
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sat Nov 10 19:36:48 2012 +0100
+++ b/Documentation/Help/source.qhp	Sun Nov 11 18:57:09 2012 +0100
@@ -11462,6 +11462,7 @@
       <keyword name="ViewManager.__editorOpened" id="ViewManager.__editorOpened" ref="eric5.ViewManager.ViewManager.html#ViewManager.__editorOpened" />
       <keyword name="ViewManager.__editorSaved" id="ViewManager.__editorSaved" ref="eric5.ViewManager.ViewManager.html#ViewManager.__editorSaved" />
       <keyword name="ViewManager.__enableSpellingActions" id="ViewManager.__enableSpellingActions" ref="eric5.ViewManager.ViewManager.html#ViewManager.__enableSpellingActions" />
+      <keyword name="ViewManager.__eolPixmap" id="ViewManager.__eolPixmap" ref="eric5.ViewManager.ViewManager.html#ViewManager.__eolPixmap" />
       <keyword name="ViewManager.__exportMenuTriggered" id="ViewManager.__exportMenuTriggered" ref="eric5.ViewManager.ViewManager.html#ViewManager.__exportMenuTriggered" />
       <keyword name="ViewManager.__findFileName" id="ViewManager.__findFileName" ref="eric5.ViewManager.ViewManager.html#ViewManager.__findFileName" />
       <keyword name="ViewManager.__findNextWord" id="ViewManager.__findNextWord" ref="eric5.ViewManager.ViewManager.html#ViewManager.__findNextWord" />
@@ -12150,6 +12151,7 @@
       <keyword name="getImporterInfo" id="getImporterInfo" ref="eric5.Helpviewer.Bookmarks.BookmarksImporters.XbelImporter.html#getImporterInfo" />
       <keyword name="getImporterInfo" id="getImporterInfo" ref="eric5.Helpviewer.Bookmarks.BookmarksImporters.__init__.html#getImporterInfo" />
       <keyword name="getImporters" id="getImporters" ref="eric5.Helpviewer.Bookmarks.BookmarksImporters.__init__.html#getImporters" />
+      <keyword name="getLanguageIcon" id="getLanguageIcon" ref="eric5.QScintilla.Lexers.__init__.html#getLanguageIcon" />
       <keyword name="getLexer" id="getLexer" ref="eric5.QScintilla.Lexers.__init__.html#getLexer" />
       <keyword name="getMessage" id="getMessage" ref="eric5.Plugins.CheckerPlugins.Pep8.pep8.html#getMessage" />
       <keyword name="getMultiProject" id="getMultiProject" ref="eric5.Preferences.__init__.html#getMultiProject" />
--- a/Documentation/Source/eric5.QScintilla.Lexers.__init__.html	Sat Nov 10 19:36:48 2012 +0100
+++ b/Documentation/Source/eric5.QScintilla.Lexers.__init__.html	Sun Nov 11 18:57:09 2012 +0100
@@ -41,6 +41,9 @@
 <td><a href="#getDefaultLexerAssociations">getDefaultLexerAssociations</a></td>
 <td>Module function to get a dictionary with the default associations.</td>
 </tr><tr>
+<td><a href="#getLanguageIcon">getLanguageIcon</a></td>
+<td>Module function to get an icon for a language.</td>
+</tr><tr>
 <td><a href="#getLexer">getLexer</a></td>
 <td>Module function to instantiate a lexer object for a given language.</td>
 </tr><tr>
@@ -95,6 +98,27 @@
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
+<a NAME="getLanguageIcon" ID="getLanguageIcon"></a>
+<h2>getLanguageIcon</h2>
+<b>getLanguageIcon</b>(<i>language, pixmap</i>)
+<p>
+    Module function to get an icon for a language.
+</p><dl>
+<dt><i>language</i></dt>
+<dd>
+language of the lexer (string)
+</dd><dt><i>pixmap</i></dt>
+<dd>
+flag indicating to return a pixmap (boolean)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+icon for the language (QPixmap or QIcon)
+</dd>
+</dl>
+<div align="right"><a href="#top">Up</a></div>
+<hr /><hr />
 <a NAME="getLexer" ID="getLexer"></a>
 <h2>getLexer</h2>
 <b>getLexer</b>(<i>language, parent=None, pyname=""</i>)
@@ -184,15 +208,16 @@
 dictionary of supported lexer languages. The keys are the
         internal language names. The items are lists of two entries.
         The first is the display string for the language, the second
-        is a dummy file name, which can be used to derive the lexer.
-        (string, string)
+        is a dummy file name, which can be used to derive the lexer, and
+        the third is the name of an icon file.
+        (string, string, string)
 </dd>
 </dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr /><hr />
 <a NAME="registerLexer" ID="registerLexer"></a>
 <h2>registerLexer</h2>
-<b>registerLexer</b>(<i>name, displayString, filenameSample, getLexerFunc, openFilters=[], saveFilters=[], defaultAssocs=[]</i>)
+<b>registerLexer</b>(<i>name, displayString, filenameSample, getLexerFunc, openFilters=[], saveFilters=[], defaultAssocs=[], iconFileName=""</i>)
 <p>
     Module function to register a custom QScintilla lexer.
 </p><dl>
@@ -219,6 +244,9 @@
 <dd>
 default lexer associations (list of strings of filename
         wildcard patterns to be associated with the lexer)
+</dd><dt><i>iconFileName=</i></dt>
+<dd>
+name of an icon file (string)
 </dd>
 </dl><dl>
 <dt>Raises <b>KeyError</b>:</dt>
--- a/Documentation/Source/eric5.ViewManager.ViewManager.html	Sat Nov 10 19:36:48 2012 +0100
+++ b/Documentation/Source/eric5.ViewManager.ViewManager.html	Sun Nov 11 18:57:09 2012 +0100
@@ -332,6 +332,9 @@
 <td><a href="#ViewManager.__enableSpellingActions">__enableSpellingActions</a></td>
 <td>Private method to set the enabled state of the spelling actions.</td>
 </tr><tr>
+<td><a href="#ViewManager.__eolPixmap">__eolPixmap</a></td>
+<td>Private method to get an EOL pixmap for an EOL string.</td>
+</tr><tr>
 <td><a href="#ViewManager.__exportMenuTriggered">__exportMenuTriggered</a></td>
 <td>Private method to handle the selection of an export format.</td>
 </tr><tr>
@@ -1192,7 +1195,22 @@
 <b>__enableSpellingActions</b>(<i></i>)
 <p>
         Private method to set the enabled state of the spelling actions.
-</p><a NAME="ViewManager.__exportMenuTriggered" ID="ViewManager.__exportMenuTriggered"></a>
+</p><a NAME="ViewManager.__eolPixmap" ID="ViewManager.__eolPixmap"></a>
+<h4>ViewManager.__eolPixmap</h4>
+<b>__eolPixmap</b>(<i>eolIndicator</i>)
+<p>
+        Private method to get an EOL pixmap for an EOL string.
+</p><dl>
+<dt><i>eolIndicator</i></dt>
+<dd>
+eol indicator string (string)
+</dd>
+</dl><dl>
+<dt>Returns:</dt>
+<dd>
+pixmap for the eol indicator (QPixmap)
+</dd>
+</dl><a NAME="ViewManager.__exportMenuTriggered" ID="ViewManager.__exportMenuTriggered"></a>
 <h4>ViewManager.__exportMenuTriggered</h4>
 <b>__exportMenuTriggered</b>(<i>act</i>)
 <p>
--- a/QScintilla/Editor.py	Sat Nov 10 19:36:48 2012 +0100
+++ b/QScintilla/Editor.py	Sun Nov 11 18:57:09 2012 +0100
@@ -828,8 +828,10 @@
         languages = sorted(list(supportedLanguages.keys()))
         for language in languages:
             if language != "Guessed":
-                self.supportedLanguages[language] = supportedLanguages[language][:]
-                act = menu.addAction(self.supportedLanguages[language][0])
+                self.supportedLanguages[language] = supportedLanguages[language][:2]
+                act = menu.addAction(
+                    UI.PixmapCache.getIcon(supportedLanguages[language][2]),
+                    self.supportedLanguages[language][0])
                 act.setCheckable(True)
                 act.setData(language)
                 self.supportedLanguages[language].append(act)
@@ -880,19 +882,22 @@
         
         self.eolActGrp = QActionGroup(self)
         
-        act = menu.addAction(self.trUtf8("Unix"))
+        act = menu.addAction(UI.PixmapCache.getIcon("eolLinux.png"),
+                             self.trUtf8("Unix"))
         act.setCheckable(True)
         act.setData('\n')
         self.supportedEols['\n'] = act
         self.eolActGrp.addAction(act)
         
-        act = menu.addAction(self.trUtf8("Windows"))
+        act = menu.addAction(UI.PixmapCache.getIcon("eolWindows.png"),
+                             self.trUtf8("Windows"))
         act.setCheckable(True)
         act.setData('\r\n')
         self.supportedEols['\r\n'] = act
         self.eolActGrp.addAction(act)
         
-        act = menu.addAction(self.trUtf8("Macintosh"))
+        act = menu.addAction(UI.PixmapCache.getIcon("eolMac.png"),
+                             self.trUtf8("Macintosh"))
         act.setCheckable(True)
         act.setData('\r')
         self.supportedEols['\r'] = act
--- a/QScintilla/Lexers/__init__.py	Sat Nov 10 19:36:48 2012 +0100
+++ b/QScintilla/Lexers/__init__.py	Sun Nov 11 18:57:09 2012 +0100
@@ -12,6 +12,7 @@
 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
 
 import Preferences
+import UI.PixmapCache
 
 # The lexer registry
 # Dictionary with the language name as key. Each entry is a list with
@@ -23,12 +24,13 @@
 #       4. list of save file filters (list of strings)
 #       5. default lexer associations (list of strings of filename wildcard patterns
 #          to be associated with the lexer)
+#       6. name of an icon file (string)
 LexerRegistry = {}
 
 
 def registerLexer(name, displayString, filenameSample, getLexerFunc,
                   openFilters=[], saveFilters=[],
-                  defaultAssocs=[]):
+                  defaultAssocs=[], iconFileName=""):
     """
     Module function to register a custom QScintilla lexer.
     
@@ -41,6 +43,7 @@
     @keyparam saveFilters list of save file filters (list of strings)
     @keyparam defaultAssocs default lexer associations (list of strings of filename
         wildcard patterns to be associated with the lexer)
+    @keyparam iconFileName name of an icon file (string)
     @exception KeyError raised when the given name is already in use
     """
     global LexerRegistry
@@ -48,7 +51,8 @@
         raise KeyError('Lexer "{0}" already registered.'.format(name))
     else:
         LexerRegistry[name] = [displayString, filenameSample, getLexerFunc,
-                               openFilters, saveFilters, defaultAssocs[:]]
+                               openFilters, saveFilters, defaultAssocs[:],
+                               iconFileName]
 
 
 def unregisterLexer(name):
@@ -68,57 +72,109 @@
     @return dictionary of supported lexer languages. The keys are the
         internal language names. The items are lists of two entries.
         The first is the display string for the language, the second
-        is a dummy file name, which can be used to derive the lexer.
-        (string, string)
+        is a dummy file name, which can be used to derive the lexer, and
+        the third is the name of an icon file.
+        (string, string, string)
     """
     supportedLanguages = {
-        "Bash": [QApplication.translate('Lexers', "Bash"), 'dummy.sh'],
-        "Batch": [QApplication.translate('Lexers', "Batch"), 'dummy.bat'],
-        "C++": [QApplication.translate('Lexers', "C/C++"), 'dummy.cpp'],
-        "C#": [QApplication.translate('Lexers', "C#"), 'dummy.cs'],
-        "CMake": [QApplication.translate('Lexers', "CMake"), 'dummy.cmake'],
-        "CSS": [QApplication.translate('Lexers', "CSS"), 'dummy.css'],
-        "D": [QApplication.translate('Lexers', "D"), 'dummy.d'],
-        "Diff": [QApplication.translate('Lexers', "Diff"), 'dummy.diff'],
-        "Fortran": [QApplication.translate('Lexers', "Fortran"), 'dummy.f95'],
-        "Fortran77": [QApplication.translate('Lexers', "Fortran77"), 'dummy.f'],
-        "HTML": [QApplication.translate('Lexers', "HTML/PHP/XML"), 'dummy.html'],
-        "IDL": [QApplication.translate('Lexers', "IDL"), 'dummy.idl'],
-        "Java": [QApplication.translate('Lexers', "Java"), 'dummy.java'],
-        "JavaScript": [QApplication.translate('Lexers', "JavaScript"), 'dummy.js'],
-        "Lua": [QApplication.translate('Lexers', "Lua"), 'dummy.lua'],
-        "Makefile": [QApplication.translate('Lexers', "Makefile"), 'dummy.mak'],
-        "Pascal": [QApplication.translate('Lexers', "Pascal"), 'dummy.pas'],
-        "Perl": [QApplication.translate('Lexers', "Perl"), 'dummy.pl'],
-        "PostScript": [QApplication.translate('Lexers', "PostScript"), 'dummy.ps'],
-        "Povray": [QApplication.translate('Lexers', "Povray"), 'dummy.pov'],
-        "Properties": [QApplication.translate('Lexers', "Properties"), 'dummy.ini'],
-        "Python2": [QApplication.translate('Lexers', "Python2"), 'dummy.py'],
-        "Python3": [QApplication.translate('Lexers', "Python3"), 'dummy.py'],
-        "Ruby": [QApplication.translate('Lexers', "Ruby"), 'dummy.rb'],
-        "SQL": [QApplication.translate('Lexers', "SQL"), 'dummy.sql'],
-        "TCL": [QApplication.translate('Lexers', "TCL"), 'dummy.tcl'],
-        "TeX": [QApplication.translate('Lexers', "TeX"), 'dummy.tex'],
-        "VHDL": [QApplication.translate('Lexers', "VHDL"), 'dummy.vhd'],
-        "XML": [QApplication.translate('Lexers', "XML"), 'dummy.xml'],
-        "YAML": [QApplication.translate('Lexers', "YAML"), 'dummy.yml'],
+        "Bash": [QApplication.translate('Lexers', "Bash"), 'dummy.sh',
+            "lexerBash.png"],
+        "Batch": [QApplication.translate('Lexers', "Batch"), 'dummy.bat',
+                "lexerBatch.png"],
+        "C++": [QApplication.translate('Lexers', "C/C++"), 'dummy.cpp',
+            "lexerCPP.png"],
+        "C#": [QApplication.translate('Lexers', "C#"), 'dummy.cs',
+            "lexerCsharp.png"],
+        "CMake": [QApplication.translate('Lexers', "CMake"), 'dummy.cmake',
+            "lexerCMake.png"],
+        "CSS": [QApplication.translate('Lexers', "CSS"), 'dummy.css',
+            "lexerCSS.png"],
+        "D": [QApplication.translate('Lexers', "D"), 'dummy.d',
+            "lexerD.png"],
+        "Diff": [QApplication.translate('Lexers', "Diff"), 'dummy.diff',
+            "lexerDiff.png"],
+        "Fortran": [QApplication.translate('Lexers', "Fortran"), 'dummy.f95',
+            "lexerFortran.png"],
+        "Fortran77": [QApplication.translate('Lexers', "Fortran77"), 'dummy.f',
+            "lexerFortran.png"],
+        "HTML": [QApplication.translate('Lexers', "HTML/PHP/XML"), 'dummy.html',
+            "lexerHTML.png"],
+        "IDL": [QApplication.translate('Lexers', "IDL"), 'dummy.idl',
+            "lexerIDL.png"],
+        "Java": [QApplication.translate('Lexers', "Java"), 'dummy.java',
+            "lexerJava.png"],
+        "JavaScript": [QApplication.translate('Lexers', "JavaScript"), 'dummy.js',
+            "lexerJavaScript.png"],
+        "Lua": [QApplication.translate('Lexers', "Lua"), 'dummy.lua',
+            "lexerLua.png"],
+        "Makefile": [QApplication.translate('Lexers', "Makefile"), 'dummy.mak',
+            "lexerMakefile.png"],
+        "Pascal": [QApplication.translate('Lexers', "Pascal"), 'dummy.pas',
+            "lexerPascal.png"],
+        "Perl": [QApplication.translate('Lexers', "Perl"), 'dummy.pl',
+            "lexerPerl.png"],
+        "PostScript": [QApplication.translate('Lexers', "PostScript"), 'dummy.ps',
+            "lexerPostscript.png"],
+        "Povray": [QApplication.translate('Lexers', "Povray"), 'dummy.pov',
+            "lexerPOV.png"],
+        "Properties": [QApplication.translate('Lexers', "Properties"), 'dummy.ini',
+            "lexerProperties.png"],
+        "Python2": [QApplication.translate('Lexers', "Python2"), 'dummy.py',
+            "lexerPython.png"],
+        "Python3": [QApplication.translate('Lexers', "Python3"), 'dummy.py',
+            "lexerPython.png"],
+        "Ruby": [QApplication.translate('Lexers', "Ruby"), 'dummy.rb',
+            "lexerRuby.png"],
+        "SQL": [QApplication.translate('Lexers', "SQL"), 'dummy.sql',
+            "lexerSQL.png"],
+        "TCL": [QApplication.translate('Lexers', "TCL"), 'dummy.tcl',
+            "lexerTCL.png"],
+        "TeX": [QApplication.translate('Lexers', "TeX"), 'dummy.tex',
+            "lexerTeX.png"],
+        "VHDL": [QApplication.translate('Lexers', "VHDL"), 'dummy.vhd',
+            "lexerVHDL.png"],
+        "XML": [QApplication.translate('Lexers', "XML"), 'dummy.xml',
+            "lexerXML.png"],
+        "YAML": [QApplication.translate('Lexers', "YAML"), 'dummy.yml',
+            "lexerYAML.png"],
     }
     
     if QSCINTILLA_VERSION() >= 0x020501:
         supportedLanguages.update({
-            "Matlab": [QApplication.translate('Lexers', "Matlab"), 'dummy.m.matlab'],
-            "Octave": [QApplication.translate('Lexers', "Octave"), 'dummy.m.octave'],
+            "Matlab": [QApplication.translate('Lexers', "Matlab"), 'dummy.m.matlab',
+                "lexerMatlab.png"],
+            "Octave": [QApplication.translate('Lexers', "Octave"), 'dummy.m.octave',
+                "lexerOctave.png"],
         })
     
     for name in LexerRegistry:
-        supportedLanguages[name] = LexerRegistry[name][:2]
+        supportedLanguages[name] = LexerRegistry[name][:2] + [LexerRegistry[name][6]]
     
     supportedLanguages["Guessed"] = \
-        [QApplication.translate('Lexers', "Pygments"), 'dummy.pygments']
+        [QApplication.translate('Lexers', "Pygments"), 'dummy.pygments', ""]
     
     return supportedLanguages
 
 
+def getLanguageIcon(language, pixmap):
+    """
+    Module function to get an icon for a language.
+    
+    @param language language of the lexer (string)
+    @param pixmap flag indicating to return a pixmap (boolean)
+    @return icon for the language (QPixmap or QIcon)
+    """
+    supportedLanguages = getSupportedLanguages()
+    if language in supportedLanguages:
+        iconFileName = supportedLanguages[language][2]
+    else:
+        iconFileName = ""
+    if pixmap:
+        return UI.PixmapCache.getPixmap(iconFileName)
+    else:
+        return UI.PixmapCache.getIcon(iconFileName)
+
+
 def getLexer(language, parent=None, pyname=""):
     """
     Module function to instantiate a lexer object for a given language.
--- a/QScintilla/MiniEditor.py	Sat Nov 10 19:36:48 2012 +0100
+++ b/QScintilla/MiniEditor.py	Sun Nov 11 18:57:09 2012 +0100
@@ -2348,8 +2348,10 @@
         languages = sorted(list(supportedLanguages.keys()))
         for language in languages:
             if language != "Guessed":
-                self.supportedLanguages[language] = supportedLanguages[language][:]
-                act = menu.addAction(self.supportedLanguages[language][0])
+                self.supportedLanguages[language] = supportedLanguages[language][:2]
+                act = menu.addAction(
+                    UI.PixmapCache.getIcon(supportedLanguages[language][2]),
+                    self.supportedLanguages[language][0])
                 act.setCheckable(True)
                 act.setData(language)
                 self.supportedLanguages[language].append(act)
--- a/Toolbox/Startup.py	Sat Nov 10 19:36:48 2012 +0100
+++ b/Toolbox/Startup.py	Sun Nov 11 18:57:09 2012 +0100
@@ -113,13 +113,17 @@
     """
     import Preferences
     
-    defaultIconPath = os.path.join(getConfig('ericIconDir'), "default")
+    defaultIconPaths = [
+        os.path.join(getConfig('ericIconDir'), "default"),
+        os.path.join(getConfig('ericIconDir'), "default", "languages"),
+    ]
     iconPaths = Preferences.getIcons("Path")
     for iconPath in iconPaths:
         if iconPath:
             UI.PixmapCache.addSearchPath(iconPath)
-    if not defaultIconPath in iconPaths:
-        UI.PixmapCache.addSearchPath(defaultIconPath)
+    for defaultIconPath in defaultIconPaths:
+        if not defaultIconPath in iconPaths:
+            UI.PixmapCache.addSearchPath(defaultIconPath)
 
 
 def setLibraryPaths():
--- a/ViewManager/ViewManager.py	Sat Nov 10 19:36:48 2012 +0100
+++ b/ViewManager/ViewManager.py	Sun Nov 11 18:57:09 2012 +0100
@@ -12,7 +12,7 @@
 from PyQt4.QtCore import QSignalMapper, QTimer, QFileInfo, pyqtSignal, QRegExp, \
     QObject, Qt, QUrl
 from PyQt4.QtGui import QColor, QKeySequence, QLineEdit, QToolBar, QWidgetAction, \
-    QDialog, QApplication, QMenu, QPalette, QComboBox
+    QDialog, QApplication, QMenu, QPalette, QComboBox, QPixmap
 from PyQt4.Qsci import QsciScintilla
 
 from E5Gui.E5Application import e5App
@@ -3980,11 +3980,38 @@
         
         if language is None:
             language = ''
-        self.sbLang.setText(language)
+        pixmap = QScintilla.Lexers.getLanguageIcon(language, True)
+        self.sbLang.setPixmap(pixmap)
+        if pixmap.isNull():
+            self.sbLang.setText(language)
+            self.sbLang.setToolTip("")
+        else:
+            self.sbLang.setText("")
+            self.sbLang.setToolTip(QApplication.translate('ViewManager',
+                'Language: {0}'.format(language)))
         
         if eol is None:
             eol = ''
-        self.sbEol.setText(eol)
+        self.sbEol.setPixmap(self.__eolPixmap(eol))
+        self.sbEol.setToolTip(QApplication.translate('ViewManager',
+            'EOL Mode: {0}'.format(eol)))
+        
+    def __eolPixmap(self, eolIndicator):
+        """
+        Private method to get an EOL pixmap for an EOL string.
+        
+        @param eolIndicator eol indicator string (string)
+        @return pixmap for the eol indicator (QPixmap)
+        """
+        if eolIndicator == "LF":
+            pixmap = UI.PixmapCache.getPixmap("eolLinux.png")
+        elif eolIndicator == "CR":
+            pixmap = UI.PixmapCache.getPixmap("eolMac.png")
+        elif eolIndicator == "CRLF":
+            pixmap = UI.PixmapCache.getPixmap("eolWindows.png")
+        else:
+            pixmap = QPixmap()
+        return pixmap
         
     def unhighlight(self, current=False):
         """
--- a/changelog	Sat Nov 10 19:36:48 2012 +0100
+++ b/changelog	Sun Nov 11 18:57:09 2012 +0100
@@ -10,6 +10,7 @@
 - Editor
   -- added actions to search for the next/previous occurence of the current word
      (default shortcuts Ctrl+. and Ctrl+,)
+  -- added some icons to the "Languages" and "End-of-Line Type" context menus
 - Spell Checker
   -- added a dialog to edit the various spell checking dictionaries
 - Syntax Checker
@@ -22,6 +23,8 @@
 - View Manager
   -- added actions to open the find in files and replace in files dialogs in a mode
      that searches open files only
+  -- change the status labels for programming language and end-of-line type to show
+     an icon
 
 Version 5.3-snapshot-20121101:
 - bug fixes
Binary file icons/default/eolLinux.png has changed
Binary file icons/default/eolMac.png has changed
Binary file icons/default/eolWindows.png has changed
Binary file icons/default/languages/lexerBash.png has changed
Binary file icons/default/languages/lexerBatch.png has changed
Binary file icons/default/languages/lexerCMake.png has changed
Binary file icons/default/languages/lexerCPP.png has changed
Binary file icons/default/languages/lexerCSS.png has changed
Binary file icons/default/languages/lexerCsharp.png has changed
Binary file icons/default/languages/lexerD.png has changed
Binary file icons/default/languages/lexerDiff.png has changed
Binary file icons/default/languages/lexerFortran.png has changed
Binary file icons/default/languages/lexerHTML.png has changed
Binary file icons/default/languages/lexerIDL.png has changed
Binary file icons/default/languages/lexerJava.png has changed
Binary file icons/default/languages/lexerJavaScript.png has changed
Binary file icons/default/languages/lexerLua.png has changed
Binary file icons/default/languages/lexerMakefile.png has changed
Binary file icons/default/languages/lexerMatlab.png has changed
Binary file icons/default/languages/lexerOctave.png has changed
Binary file icons/default/languages/lexerPHP.png has changed
Binary file icons/default/languages/lexerPOV.png has changed
Binary file icons/default/languages/lexerPascal.png has changed
Binary file icons/default/languages/lexerPerl.png has changed
Binary file icons/default/languages/lexerPostscript.png has changed
Binary file icons/default/languages/lexerProperties.png has changed
Binary file icons/default/languages/lexerPython.png has changed
Binary file icons/default/languages/lexerRuby.png has changed
Binary file icons/default/languages/lexerSQL.png has changed
Binary file icons/default/languages/lexerTCL.png has changed
Binary file icons/default/languages/lexerTeX.png has changed
Binary file icons/default/languages/lexerVHDL.png has changed
Binary file icons/default/languages/lexerXML.png has changed
Binary file icons/default/languages/lexerYAML.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/icons/default/languages/readme.txt	Sun Nov 11 18:57:09 2012 +0100
@@ -0,0 +1,1 @@
+Icons where downloaded from official sites of the languages and various other places.
--- a/install.py	Sat Nov 10 19:36:48 2012 +0100
+++ b/install.py	Sun Nov 11 18:57:09 2012 +0100
@@ -477,7 +477,7 @@
         copyTree('{1}{0}i18n'.format(os.sep, sourceDir), cfg['ericTranslationsDir'],
             ['*.qm'])
         copyTree('{1}{0}icons'.format(os.sep, sourceDir), cfg['ericIconDir'],
-            ['*.png', 'LICENSE*.*'])
+            ['*.png', 'LICENSE*.*', 'readme.txt'])
         copyTree('{1}{0}pixmaps'.format(os.sep, sourceDir), cfg['ericPixDir'],
             ['*.png', '*.xpm', '*.ico', '*.gif'])
         copyTree('{1}{0}DesignerTemplates'.format(os.sep, sourceDir),

eric ide

mercurial