QScintilla/Lexers/__init__.py

changeset 3656
441956d8fce5
parent 3647
fef91a1eb27b
child 3990
5dd6edf8540a
child 4022
f5f42921717e
equal deleted inserted replaced
3654:ffeb85cdc72d 3656:441956d8fce5
7 Package implementing lexers for the various supported programming languages. 7 Package implementing lexers for the various supported programming languages.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt4.QtGui import QApplication 12 from PyQt5.QtCore import QCoreApplication
13 13
14 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION 14 from QScintilla.QsciScintillaCompat import QSCINTILLA_VERSION
15 15
16 import Preferences 16 import Preferences
17 import UI.PixmapCache 17 import UI.PixmapCache
78 is a dummy file name, which can be used to derive the lexer, and 78 is a dummy file name, which can be used to derive the lexer, and
79 the third is the name of an icon file. 79 the third is the name of an icon file.
80 (string, string, string) 80 (string, string, string)
81 """ 81 """
82 supportedLanguages = { 82 supportedLanguages = {
83 "Bash": [QApplication.translate('Lexers', "Bash"), 'dummy.sh', 83 "Bash": [QCoreApplication.translate('Lexers', "Bash"), 'dummy.sh',
84 "lexerBash.png"], 84 "lexerBash.png"],
85 "Batch": [QApplication.translate('Lexers', "Batch"), 'dummy.bat', 85 "Batch": [QCoreApplication.translate('Lexers', "Batch"), 'dummy.bat',
86 "lexerBatch.png"], 86 "lexerBatch.png"],
87 "C++": [QApplication.translate('Lexers', "C/C++"), 'dummy.cpp', 87 "C++": [QCoreApplication.translate('Lexers', "C/C++"), 'dummy.cpp',
88 "lexerCPP.png"], 88 "lexerCPP.png"],
89 "C#": [QApplication.translate('Lexers', "C#"), 'dummy.cs', 89 "C#": [QCoreApplication.translate('Lexers', "C#"), 'dummy.cs',
90 "lexerCsharp.png"], 90 "lexerCsharp.png"],
91 "CMake": [QApplication.translate('Lexers', "CMake"), 'dummy.cmake', 91 "CMake": [QCoreApplication.translate('Lexers', "CMake"), 'dummy.cmake',
92 "lexerCMake.png"], 92 "lexerCMake.png"],
93 "CSS": [QApplication.translate('Lexers', "CSS"), 'dummy.css', 93 "CSS": [QCoreApplication.translate('Lexers', "CSS"), 'dummy.css',
94 "lexerCSS.png"], 94 "lexerCSS.png"],
95 "D": [QApplication.translate('Lexers', "D"), 'dummy.d', 95 "D": [QCoreApplication.translate('Lexers', "D"), 'dummy.d',
96 "lexerD.png"], 96 "lexerD.png"],
97 "Diff": [QApplication.translate('Lexers', "Diff"), 'dummy.diff', 97 "Diff": [QCoreApplication.translate('Lexers', "Diff"), 'dummy.diff',
98 "lexerDiff.png"], 98 "lexerDiff.png"],
99 "Fortran": [QApplication.translate('Lexers', "Fortran"), 'dummy.f95', 99 "Fortran": [QCoreApplication.translate('Lexers', "Fortran"),
100 "lexerFortran.png"], 100 'dummy.f95', "lexerFortran.png"],
101 "Fortran77": [QApplication.translate('Lexers', "Fortran77"), 'dummy.f', 101 "Fortran77": [QCoreApplication.translate('Lexers', "Fortran77"),
102 "lexerFortran.png"], 102 'dummy.f', "lexerFortran.png"],
103 "HTML": [QApplication.translate('Lexers', "HTML/PHP/XML"), 103 "HTML": [QCoreApplication.translate('Lexers', "HTML/PHP/XML"),
104 'dummy.html', "lexerHTML.png"], 104 'dummy.html', "lexerHTML.png"],
105 "IDL": [QApplication.translate('Lexers', "IDL"), 'dummy.idl', 105 "IDL": [QCoreApplication.translate('Lexers', "IDL"), 'dummy.idl',
106 "lexerIDL.png"], 106 "lexerIDL.png"],
107 "Java": [QApplication.translate('Lexers', "Java"), 'dummy.java', 107 "Java": [QCoreApplication.translate('Lexers', "Java"), 'dummy.java',
108 "lexerJava.png"], 108 "lexerJava.png"],
109 "JavaScript": [QApplication.translate('Lexers', "JavaScript"), 109 "JavaScript": [QCoreApplication.translate('Lexers', "JavaScript"),
110 'dummy.js', "lexerJavaScript.png"], 110 'dummy.js', "lexerJavaScript.png"],
111 "Lua": [QApplication.translate('Lexers', "Lua"), 'dummy.lua', 111 "Lua": [QCoreApplication.translate('Lexers', "Lua"), 'dummy.lua',
112 "lexerLua.png"], 112 "lexerLua.png"],
113 "Makefile": [QApplication.translate('Lexers', "Makefile"), 'dummy.mak', 113 "Makefile": [QCoreApplication.translate('Lexers', "Makefile"),
114 "lexerMakefile.png"], 114 'dummy.mak', "lexerMakefile.png"],
115 "Pascal": [QApplication.translate('Lexers', "Pascal"), 'dummy.pas', 115 "Pascal": [QCoreApplication.translate('Lexers', "Pascal"), 'dummy.pas',
116 "lexerPascal.png"], 116 "lexerPascal.png"],
117 "Perl": [QApplication.translate('Lexers', "Perl"), 'dummy.pl', 117 "Perl": [QCoreApplication.translate('Lexers', "Perl"), 'dummy.pl',
118 "lexerPerl.png"], 118 "lexerPerl.png"],
119 "PostScript": [QApplication.translate('Lexers', "PostScript"), 119 "PostScript": [QCoreApplication.translate('Lexers', "PostScript"),
120 'dummy.ps', "lexerPostscript.png"], 120 'dummy.ps', "lexerPostscript.png"],
121 "Povray": [QApplication.translate('Lexers', "Povray"), 'dummy.pov', 121 "Povray": [QCoreApplication.translate('Lexers', "Povray"), 'dummy.pov',
122 "lexerPOV.png"], 122 "lexerPOV.png"],
123 "Properties": [QApplication.translate('Lexers', "Properties"), 123 "Properties": [QCoreApplication.translate('Lexers', "Properties"),
124 'dummy.ini', "lexerProperties.png"], 124 'dummy.ini', "lexerProperties.png"],
125 "Python2": [QApplication.translate('Lexers', "Python2"), 'dummy.py', 125 "Python2": [QCoreApplication.translate('Lexers', "Python2"),
126 "lexerPython.png"], 126 'dummy.py', "lexerPython.png"],
127 "Python3": [QApplication.translate('Lexers', "Python3"), 'dummy.py', 127 "Python3": [QCoreApplication.translate('Lexers', "Python3"),
128 "lexerPython3.png"], 128 'dummy.py', "lexerPython3.png"],
129 "QSS": [QApplication.translate('Lexers', "QSS"), 'dummy.qss', 129 "QSS": [QCoreApplication.translate('Lexers', "QSS"), 'dummy.qss',
130 "lexerCSS.png"], 130 "lexerCSS.png"],
131 "Ruby": [QApplication.translate('Lexers', "Ruby"), 'dummy.rb', 131 "Ruby": [QCoreApplication.translate('Lexers', "Ruby"), 'dummy.rb',
132 "lexerRuby.png"], 132 "lexerRuby.png"],
133 "SQL": [QApplication.translate('Lexers', "SQL"), 'dummy.sql', 133 "SQL": [QCoreApplication.translate('Lexers', "SQL"), 'dummy.sql',
134 "lexerSQL.png"], 134 "lexerSQL.png"],
135 "TCL": [QApplication.translate('Lexers', "TCL"), 'dummy.tcl', 135 "TCL": [QCoreApplication.translate('Lexers', "TCL"), 'dummy.tcl',
136 "lexerTCL.png"], 136 "lexerTCL.png"],
137 "TeX": [QApplication.translate('Lexers', "TeX"), 'dummy.tex', 137 "TeX": [QCoreApplication.translate('Lexers', "TeX"), 'dummy.tex',
138 "lexerTeX.png"], 138 "lexerTeX.png"],
139 "VHDL": [QApplication.translate('Lexers', "VHDL"), 'dummy.vhd', 139 "VHDL": [QCoreApplication.translate('Lexers', "VHDL"), 'dummy.vhd',
140 "lexerVHDL.png"], 140 "lexerVHDL.png"],
141 "XML": [QApplication.translate('Lexers', "XML"), 'dummy.xml', 141 "XML": [QCoreApplication.translate('Lexers', "XML"), 'dummy.xml',
142 "lexerXML.png"], 142 "lexerXML.png"],
143 "YAML": [QApplication.translate('Lexers', "YAML"), 'dummy.yml', 143 "YAML": [QCoreApplication.translate('Lexers', "YAML"), 'dummy.yml',
144 "lexerYAML.png"], 144 "lexerYAML.png"],
145 } 145 }
146 146
147 if QSCINTILLA_VERSION() >= 0x020501: 147 if QSCINTILLA_VERSION() >= 0x020501:
148 supportedLanguages.update({ 148 supportedLanguages.update({
149 "Matlab": [QApplication.translate('Lexers', "Matlab"), 149 "Matlab": [QCoreApplication.translate('Lexers', "Matlab"),
150 'dummy.m.matlab', "lexerMatlab.png"], 150 'dummy.m.matlab', "lexerMatlab.png"],
151 "Octave": [QApplication.translate('Lexers', "Octave"), 151 "Octave": [QCoreApplication.translate('Lexers', "Octave"),
152 'dummy.m.octave', "lexerOctave.png"], 152 'dummy.m.octave', "lexerOctave.png"],
153 }) 153 })
154 154
155 if QSCINTILLA_VERSION() >= 0x020802: 155 if QSCINTILLA_VERSION() >= 0x020802:
156 supportedLanguages["Gettext"] = \ 156 supportedLanguages["Gettext"] = \
157 [QApplication.translate('Lexers', "Gettext"), 'dummy.po', 157 [QCoreApplication.translate('Lexers', "Gettext"), 'dummy.po',
158 "lexerGettext.png"] 158 "lexerGettext.png"]
159 159
160 if QSCINTILLA_VERSION() >= 0x020803: 160 if QSCINTILLA_VERSION() >= 0x020803:
161 supportedLanguages["CoffeeScript"] = \ 161 supportedLanguages["CoffeeScript"] = \
162 [QApplication.translate('Lexers', "CoffeeScript"), 'dummy.coffee', 162 [QCoreApplication.translate('Lexers', "CoffeeScript"),
163 "lexerCoffeeScript.png"] 163 'dummy.coffee', "lexerCoffeeScript.png"]
164 164
165 for name in LexerRegistry: 165 for name in LexerRegistry:
166 if not name.startswith("Pygments|"): 166 if not name.startswith("Pygments|"):
167 supportedLanguages[name] = \ 167 supportedLanguages[name] = \
168 LexerRegistry[name][:2] + [LexerRegistry[name][6]] 168 LexerRegistry[name][:2] + [LexerRegistry[name][6]]
169 169
170 supportedLanguages["Guessed"] = \ 170 supportedLanguages["Guessed"] = \
171 [QApplication.translate('Lexers', "Pygments"), 'dummy.pygments', ""] 171 [QCoreApplication.translate('Lexers', "Pygments"), 'dummy.pygments',
172 ""]
172 173
173 return supportedLanguages 174 return supportedLanguages
174 175
175 176
176 def getLanguageIcon(language, pixmap): 177 def getLanguageIcon(language, pixmap):
347 @keyparam withAdditional flag indicating to include additional filters 348 @keyparam withAdditional flag indicating to include additional filters
348 defined by the user (boolean) 349 defined by the user (boolean)
349 @return file filter list (list of strings or string) 350 @return file filter list (list of strings or string)
350 """ 351 """
351 openFileFiltersList = [ 352 openFileFiltersList = [
352 QApplication.translate( 353 QCoreApplication.translate(
353 'Lexers', 354 'Lexers',
354 'Python Files (*.py *.py2 *.py3)'), 355 'Python Files (*.py *.py2 *.py3)'),
355 QApplication.translate( 356 QCoreApplication.translate(
356 'Lexers', 357 'Lexers',
357 'Python GUI Files (*.pyw *.pyw2 *.pyw3)'), 358 'Python GUI Files (*.pyw *.pyw2 *.pyw3)'),
358 QApplication.translate( 359 QCoreApplication.translate(
359 'Lexers', 360 'Lexers',
360 'Pyrex Files (*.pyx)'), 361 'Pyrex Files (*.pyx)'),
361 QApplication.translate( 362 QCoreApplication.translate(
362 'Lexers', 363 'Lexers',
363 'Quixote Template Files (*.ptl)'), 364 'Quixote Template Files (*.ptl)'),
364 QApplication.translate( 365 QCoreApplication.translate(
365 'Lexers', 366 'Lexers',
366 'Ruby Files (*.rb)'), 367 'Ruby Files (*.rb)'),
367 QApplication.translate( 368 QCoreApplication.translate(
368 'Lexers', 369 'Lexers',
369 'IDL Files (*.idl)'), 370 'IDL Files (*.idl)'),
370 QApplication.translate( 371 QCoreApplication.translate(
371 'Lexers', 372 'Lexers',
372 'C Files (*.h *.c)'), 373 'C Files (*.h *.c)'),
373 QApplication.translate( 374 QCoreApplication.translate(
374 'Lexers', 375 'Lexers',
375 'C++ Files (*.h *.hpp *.hh *.cxx *.cpp *.cc)'), 376 'C++ Files (*.h *.hpp *.hh *.cxx *.cpp *.cc)'),
376 QApplication.translate( 377 QCoreApplication.translate(
377 'Lexers', 378 'Lexers',
378 'C# Files (*.cs)'), 379 'C# Files (*.cs)'),
379 QApplication.translate( 380 QCoreApplication.translate(
380 'Lexers', 381 'Lexers',
381 'HTML Files (*.html *.htm *.asp *.shtml)'), 382 'HTML Files (*.html *.htm *.asp *.shtml)'),
382 QApplication.translate( 383 QCoreApplication.translate(
383 'Lexers', 384 'Lexers',
384 'CSS Files (*.css)'), 385 'CSS Files (*.css)'),
385 QApplication.translate( 386 QCoreApplication.translate(
386 'Lexers', 387 'Lexers',
387 'QSS Files (*.qss)'), 388 'QSS Files (*.qss)'),
388 QApplication.translate( 389 QCoreApplication.translate(
389 'Lexers', 390 'Lexers',
390 'PHP Files (*.php *.php3 *.php4 *.php5 *.phtml)'), 391 'PHP Files (*.php *.php3 *.php4 *.php5 *.phtml)'),
391 QApplication.translate( 392 QCoreApplication.translate(
392 'Lexers', 393 'Lexers',
393 'XML Files (*.xml *.xsl *.xslt *.dtd *.svg *.xul *.xsd)'), 394 'XML Files (*.xml *.xsl *.xslt *.dtd *.svg *.xul *.xsd)'),
394 QApplication.translate( 395 QCoreApplication.translate(
395 'Lexers', 396 'Lexers',
396 'Qt Resource Files (*.qrc)'), 397 'Qt Resource Files (*.qrc)'),
397 QApplication.translate( 398 QCoreApplication.translate(
398 'Lexers', 399 'Lexers',
399 'D Files (*.d *.di)'), 400 'D Files (*.d *.di)'),
400 QApplication.translate( 401 QCoreApplication.translate(
401 'Lexers', 402 'Lexers',
402 'Java Files (*.java)'), 403 'Java Files (*.java)'),
403 QApplication.translate( 404 QCoreApplication.translate(
404 'Lexers', 405 'Lexers',
405 'JavaScript Files (*.js)'), 406 'JavaScript Files (*.js)'),
406 QApplication.translate( 407 QCoreApplication.translate(
407 'Lexers', 408 'Lexers',
408 'SQL Files (*.sql)'), 409 'SQL Files (*.sql)'),
409 QApplication.translate( 410 QCoreApplication.translate(
410 'Lexers', 411 'Lexers',
411 'Docbook Files (*.docbook)'), 412 'Docbook Files (*.docbook)'),
412 QApplication.translate( 413 QCoreApplication.translate(
413 'Lexers', 414 'Lexers',
414 'Perl Files (*.pl *.pm *.ph)'), 415 'Perl Files (*.pl *.pm *.ph)'),
415 QApplication.translate( 416 QCoreApplication.translate(
416 'Lexers', 417 'Lexers',
417 'Lua Files (*.lua)'), 418 'Lua Files (*.lua)'),
418 QApplication.translate( 419 QCoreApplication.translate(
419 'Lexers', 420 'Lexers',
420 'Tex Files (*.tex *.sty *.aux *.toc *.idx)'), 421 'Tex Files (*.tex *.sty *.aux *.toc *.idx)'),
421 QApplication.translate( 422 QCoreApplication.translate(
422 'Lexers', 423 'Lexers',
423 'Shell Files (*.sh)'), 424 'Shell Files (*.sh)'),
424 QApplication.translate( 425 QCoreApplication.translate(
425 'Lexers', 426 'Lexers',
426 'Batch Files (*.bat *.cmd)'), 427 'Batch Files (*.bat *.cmd)'),
427 QApplication.translate( 428 QCoreApplication.translate(
428 'Lexers', 429 'Lexers',
429 'Diff Files (*.diff *.patch)'), 430 'Diff Files (*.diff *.patch)'),
430 QApplication.translate( 431 QCoreApplication.translate(
431 'Lexers', 432 'Lexers',
432 'Makefiles (*.mak)'), 433 'Makefiles (*.mak)'),
433 QApplication.translate( 434 QCoreApplication.translate(
434 'Lexers', 435 'Lexers',
435 'Properties Files (*.properties *.ini *.inf *.reg *.cfg' 436 'Properties Files (*.properties *.ini *.inf *.reg *.cfg'
436 ' *.cnf *.rc)'), 437 ' *.cnf *.rc)'),
437 QApplication.translate( 438 QCoreApplication.translate(
438 'Lexers', 439 'Lexers',
439 'Povray Files (*.pov)'), 440 'Povray Files (*.pov)'),
440 QApplication.translate( 441 QCoreApplication.translate(
441 'Lexers', 442 'Lexers',
442 'CMake Files (CMakeLists.txt *.cmake *.ctest)'), 443 'CMake Files (CMakeLists.txt *.cmake *.ctest)'),
443 QApplication.translate( 444 QCoreApplication.translate(
444 'Lexers', 445 'Lexers',
445 'VHDL Files (*.vhd *.vhdl)'), 446 'VHDL Files (*.vhd *.vhdl)'),
446 QApplication.translate( 447 QCoreApplication.translate(
447 'Lexers', 448 'Lexers',
448 'TCL/Tk Files (*.tcl *.tk)'), 449 'TCL/Tk Files (*.tcl *.tk)'),
449 QApplication.translate( 450 QCoreApplication.translate(
450 'Lexers', 451 'Lexers',
451 'Fortran Files (*.f90 *.f95 *.f2k)'), 452 'Fortran Files (*.f90 *.f95 *.f2k)'),
452 QApplication.translate( 453 QCoreApplication.translate(
453 'Lexers', 454 'Lexers',
454 'Fortran77 Files (*.f *.for)'), 455 'Fortran77 Files (*.f *.for)'),
455 QApplication.translate( 456 QCoreApplication.translate(
456 'Lexers', 457 'Lexers',
457 'Pascal Files (*.dpr *.dpk *.pas *.dfm *.inc *.pp)'), 458 'Pascal Files (*.dpr *.dpk *.pas *.dfm *.inc *.pp)'),
458 QApplication.translate( 459 QCoreApplication.translate(
459 'Lexers', 460 'Lexers',
460 'PostScript Files (*.ps)'), 461 'PostScript Files (*.ps)'),
461 QApplication.translate( 462 QCoreApplication.translate(
462 'Lexers', 463 'Lexers',
463 'YAML Files (*.yaml *.yml)'), 464 'YAML Files (*.yaml *.yml)'),
464 ] 465 ]
465 466
466 if QSCINTILLA_VERSION() >= 0x020501: 467 if QSCINTILLA_VERSION() >= 0x020501:
467 openFileFiltersList.extend([ 468 openFileFiltersList.extend([
468 QApplication.translate( 469 QCoreApplication.translate(
469 'Lexers', 470 'Lexers',
470 'Matlab Files (*.m *.m.matlab)'), 471 'Matlab Files (*.m *.m.matlab)'),
471 QApplication.translate( 472 QCoreApplication.translate(
472 'Lexers', 473 'Lexers',
473 'Octave Files (*.m *.m.octave)'), 474 'Octave Files (*.m *.m.octave)'),
474 ]) 475 ])
475 476
476 if QSCINTILLA_VERSION() >= 0x020802: 477 if QSCINTILLA_VERSION() >= 0x020802:
477 openFileFiltersList.append( 478 openFileFiltersList.append(
478 QApplication.translate( 479 QCoreApplication.translate(
479 'Lexers', 480 'Lexers',
480 'Gettext Files (*.po)'), 481 'Gettext Files (*.po)'),
481 ) 482 )
482 483
483 if QSCINTILLA_VERSION() >= 0x020803: 484 if QSCINTILLA_VERSION() >= 0x020803:
484 openFileFiltersList.append( 485 openFileFiltersList.append(
485 QApplication.translate( 486 QCoreApplication.translate(
486 'Lexers', 487 'Lexers',
487 'CoffeeScript Files (*.coffee)'), 488 'CoffeeScript Files (*.coffee)'),
488 ) 489 )
489 490
490 for name in LexerRegistry: 491 for name in LexerRegistry:
495 Preferences.getEditor("AdditionalOpenFilters")) 496 Preferences.getEditor("AdditionalOpenFilters"))
496 497
497 openFileFiltersList.sort() 498 openFileFiltersList.sort()
498 if includeAll: 499 if includeAll:
499 openFileFiltersList.append( 500 openFileFiltersList.append(
500 QApplication.translate('Lexers', 'All Files (*)')) 501 QCoreApplication.translate('Lexers', 'All Files (*)'))
501 502
502 if asString: 503 if asString:
503 return ';;'.join(openFileFiltersList) 504 return ';;'.join(openFileFiltersList)
504 else: 505 else:
505 return openFileFiltersList 506 return openFileFiltersList
517 @keyparam withAdditional flag indicating to include additional filters 518 @keyparam withAdditional flag indicating to include additional filters
518 defined by the user (boolean) 519 defined by the user (boolean)
519 @return file filter list (list of strings or string) 520 @return file filter list (list of strings or string)
520 """ 521 """
521 saveFileFiltersList = [ 522 saveFileFiltersList = [
522 QApplication.translate( 523 QCoreApplication.translate(
523 'Lexers', 524 'Lexers',
524 "Python2 Files (*.py2)"), 525 "Python2 Files (*.py2)"),
525 QApplication.translate( 526 QCoreApplication.translate(
526 'Lexers', 527 'Lexers',
527 "Python3 Files (*.py)"), 528 "Python3 Files (*.py)"),
528 QApplication.translate( 529 QCoreApplication.translate(
529 'Lexers', 530 'Lexers',
530 "Python2 GUI Files (*.pyw2)"), 531 "Python2 GUI Files (*.pyw2)"),
531 QApplication.translate( 532 QCoreApplication.translate(
532 'Lexers', 533 'Lexers',
533 "Python3 GUI Files (*.pyw)"), 534 "Python3 GUI Files (*.pyw)"),
534 QApplication.translate( 535 QCoreApplication.translate(
535 'Lexers', 536 'Lexers',
536 "Pyrex Files (*.pyx)"), 537 "Pyrex Files (*.pyx)"),
537 QApplication.translate( 538 QCoreApplication.translate(
538 'Lexers', 539 'Lexers',
539 "Quixote Template Files (*.ptl)"), 540 "Quixote Template Files (*.ptl)"),
540 QApplication.translate( 541 QCoreApplication.translate(
541 'Lexers', 542 'Lexers',
542 "Ruby Files (*.rb)"), 543 "Ruby Files (*.rb)"),
543 QApplication.translate( 544 QCoreApplication.translate(
544 'Lexers', 545 'Lexers',
545 "IDL Files (*.idl)"), 546 "IDL Files (*.idl)"),
546 QApplication.translate( 547 QCoreApplication.translate(
547 'Lexers', 548 'Lexers',
548 "C Files (*.c)"), 549 "C Files (*.c)"),
549 QApplication.translate( 550 QCoreApplication.translate(
550 'Lexers', 551 'Lexers',
551 "C++ Files (*.cpp)"), 552 "C++ Files (*.cpp)"),
552 QApplication.translate( 553 QCoreApplication.translate(
553 'Lexers', 554 'Lexers',
554 "C++/C Header Files (*.h)"), 555 "C++/C Header Files (*.h)"),
555 QApplication.translate( 556 QCoreApplication.translate(
556 'Lexers', 557 'Lexers',
557 "C# Files (*.cs)"), 558 "C# Files (*.cs)"),
558 QApplication.translate( 559 QCoreApplication.translate(
559 'Lexers', 560 'Lexers',
560 "HTML Files (*.html)"), 561 "HTML Files (*.html)"),
561 QApplication.translate( 562 QCoreApplication.translate(
562 'Lexers', 563 'Lexers',
563 "PHP Files (*.php)"), 564 "PHP Files (*.php)"),
564 QApplication.translate( 565 QCoreApplication.translate(
565 'Lexers', 566 'Lexers',
566 "ASP Files (*.asp)"), 567 "ASP Files (*.asp)"),
567 QApplication.translate( 568 QCoreApplication.translate(
568 'Lexers', 569 'Lexers',
569 "CSS Files (*.css)"), 570 "CSS Files (*.css)"),
570 QApplication.translate( 571 QCoreApplication.translate(
571 'Lexers', 572 'Lexers',
572 "QSS Files (*.qss)"), 573 "QSS Files (*.qss)"),
573 QApplication.translate( 574 QCoreApplication.translate(
574 'Lexers', 575 'Lexers',
575 "XML Files (*.xml)"), 576 "XML Files (*.xml)"),
576 QApplication.translate( 577 QCoreApplication.translate(
577 'Lexers', 578 'Lexers',
578 "XSL Files (*.xsl)"), 579 "XSL Files (*.xsl)"),
579 QApplication.translate( 580 QCoreApplication.translate(
580 'Lexers', 581 'Lexers',
581 "DTD Files (*.dtd)"), 582 "DTD Files (*.dtd)"),
582 QApplication.translate( 583 QCoreApplication.translate(
583 'Lexers', 584 'Lexers',
584 "Qt Resource Files (*.qrc)"), 585 "Qt Resource Files (*.qrc)"),
585 QApplication.translate( 586 QCoreApplication.translate(
586 'Lexers', 587 'Lexers',
587 "D Files (*.d)"), 588 "D Files (*.d)"),
588 QApplication.translate( 589 QCoreApplication.translate(
589 'Lexers', 590 'Lexers',
590 "D Interface Files (*.di)"), 591 "D Interface Files (*.di)"),
591 QApplication.translate( 592 QCoreApplication.translate(
592 'Lexers', 593 'Lexers',
593 "Java Files (*.java)"), 594 "Java Files (*.java)"),
594 QApplication.translate( 595 QCoreApplication.translate(
595 'Lexers', 596 'Lexers',
596 "JavaScript Files (*.js)"), 597 "JavaScript Files (*.js)"),
597 QApplication.translate( 598 QCoreApplication.translate(
598 'Lexers', 599 'Lexers',
599 "SQL Files (*.sql)"), 600 "SQL Files (*.sql)"),
600 QApplication.translate( 601 QCoreApplication.translate(
601 'Lexers', 602 'Lexers',
602 "Docbook Files (*.docbook)"), 603 "Docbook Files (*.docbook)"),
603 QApplication.translate( 604 QCoreApplication.translate(
604 'Lexers', 605 'Lexers',
605 "Perl Files (*.pl)"), 606 "Perl Files (*.pl)"),
606 QApplication.translate( 607 QCoreApplication.translate(
607 'Lexers', 608 'Lexers',
608 "Perl Module Files (*.pm)"), 609 "Perl Module Files (*.pm)"),
609 QApplication.translate( 610 QCoreApplication.translate(
610 'Lexers', 611 'Lexers',
611 "Lua Files (*.lua)"), 612 "Lua Files (*.lua)"),
612 QApplication.translate( 613 QCoreApplication.translate(
613 'Lexers', 614 'Lexers',
614 "Shell Files (*.sh)"), 615 "Shell Files (*.sh)"),
615 QApplication.translate( 616 QCoreApplication.translate(
616 'Lexers', 617 'Lexers',
617 "Batch Files (*.bat)"), 618 "Batch Files (*.bat)"),
618 QApplication.translate( 619 QCoreApplication.translate(
619 'Lexers', 620 'Lexers',
620 "TeX Files (*.tex)"), 621 "TeX Files (*.tex)"),
621 QApplication.translate( 622 QCoreApplication.translate(
622 'Lexers', 623 'Lexers',
623 "TeX Template Files (*.sty)"), 624 "TeX Template Files (*.sty)"),
624 QApplication.translate( 625 QCoreApplication.translate(
625 'Lexers', 626 'Lexers',
626 "Diff Files (*.diff)"), 627 "Diff Files (*.diff)"),
627 QApplication.translate( 628 QCoreApplication.translate(
628 'Lexers', 629 'Lexers',
629 "Make Files (*.mak)"), 630 "Make Files (*.mak)"),
630 QApplication.translate( 631 QCoreApplication.translate(
631 'Lexers', 632 'Lexers',
632 "Properties Files (*.ini)"), 633 "Properties Files (*.ini)"),
633 QApplication.translate( 634 QCoreApplication.translate(
634 'Lexers', 635 'Lexers',
635 "Configuration Files (*.cfg)"), 636 "Configuration Files (*.cfg)"),
636 QApplication.translate( 637 QCoreApplication.translate(
637 'Lexers', 638 'Lexers',
638 'Povray Files (*.pov)'), 639 'Povray Files (*.pov)'),
639 QApplication.translate( 640 QCoreApplication.translate(
640 'Lexers', 641 'Lexers',
641 'CMake Files (CMakeLists.txt)'), 642 'CMake Files (CMakeLists.txt)'),
642 QApplication.translate( 643 QCoreApplication.translate(
643 'Lexers', 644 'Lexers',
644 'CMake Macro Files (*.cmake)'), 645 'CMake Macro Files (*.cmake)'),
645 QApplication.translate( 646 QCoreApplication.translate(
646 'Lexers', 647 'Lexers',
647 'VHDL Files (*.vhd)'), 648 'VHDL Files (*.vhd)'),
648 QApplication.translate( 649 QCoreApplication.translate(
649 'Lexers', 650 'Lexers',
650 'TCL Files (*.tcl)'), 651 'TCL Files (*.tcl)'),
651 QApplication.translate( 652 QCoreApplication.translate(
652 'Lexers', 653 'Lexers',
653 'Tk Files (*.tk)'), 654 'Tk Files (*.tk)'),
654 QApplication.translate( 655 QCoreApplication.translate(
655 'Lexers', 656 'Lexers',
656 'Fortran Files (*.f95)'), 657 'Fortran Files (*.f95)'),
657 QApplication.translate( 658 QCoreApplication.translate(
658 'Lexers', 659 'Lexers',
659 'Fortran77 Files (*.f)'), 660 'Fortran77 Files (*.f)'),
660 QApplication.translate( 661 QCoreApplication.translate(
661 'Lexers', 662 'Lexers',
662 'Pascal Files (*.pas)'), 663 'Pascal Files (*.pas)'),
663 QApplication.translate( 664 QCoreApplication.translate(
664 'Lexers', 665 'Lexers',
665 'PostScript Files (*.ps)'), 666 'PostScript Files (*.ps)'),
666 QApplication.translate( 667 QCoreApplication.translate(
667 'Lexers', 668 'Lexers',
668 'YAML Files (*.yml)'), 669 'YAML Files (*.yml)'),
669 ] 670 ]
670 671
671 if QSCINTILLA_VERSION() >= 0x020501: 672 if QSCINTILLA_VERSION() >= 0x020501:
672 saveFileFiltersList.extend([ 673 saveFileFiltersList.extend([
673 QApplication.translate( 674 QCoreApplication.translate(
674 'Lexers', 675 'Lexers',
675 'Matlab Files (*.m)'), 676 'Matlab Files (*.m)'),
676 QApplication.translate( 677 QCoreApplication.translate(
677 'Lexers', 678 'Lexers',
678 'Octave Files (*.m.octave)'), 679 'Octave Files (*.m.octave)'),
679 ]) 680 ])
680 681
681 if QSCINTILLA_VERSION() >= 0x020802: 682 if QSCINTILLA_VERSION() >= 0x020802:
682 saveFileFiltersList.append( 683 saveFileFiltersList.append(
683 QApplication.translate( 684 QCoreApplication.translate(
684 'Lexers', 685 'Lexers',
685 'Gettext Files (*.po)'), 686 'Gettext Files (*.po)'),
686 ) 687 )
687 688
688 if QSCINTILLA_VERSION() >= 0x020803: 689 if QSCINTILLA_VERSION() >= 0x020803:
689 saveFileFiltersList.append( 690 saveFileFiltersList.append(
690 QApplication.translate( 691 QCoreApplication.translate(
691 'Lexers', 692 'Lexers',
692 'CoffeeScript Files (*.coffee)'), 693 'CoffeeScript Files (*.coffee)'),
693 ) 694 )
694 695
695 for name in LexerRegistry: 696 for name in LexerRegistry:
701 702
702 saveFileFiltersList.sort() 703 saveFileFiltersList.sort()
703 704
704 if includeAll: 705 if includeAll:
705 saveFileFiltersList.append( 706 saveFileFiltersList.append(
706 QApplication.translate('Lexers', 'All Files (*)')) 707 QCoreApplication.translate('Lexers', 'All Files (*)'))
707 708
708 if asString: 709 if asString:
709 return ';;'.join(saveFileFiltersList) 710 return ';;'.join(saveFileFiltersList)
710 else: 711 else:
711 return saveFileFiltersList 712 return saveFileFiltersList

eric ide

mercurial