6 """ |
6 """ |
7 Module implementing the Editor Highlighting Styles configuration page. |
7 Module implementing the Editor Highlighting Styles configuration page. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSlot, QFileInfo, QFile, QIODevice |
10 from PyQt4.QtCore import pyqtSlot, QFileInfo, QFile, QIODevice |
11 from PyQt4.QtGui import QPalette, QFileDialog, QColorDialog, QFontDialog, \ |
11 from PyQt4.QtGui import QPalette, QColorDialog, QFontDialog, \ |
12 QInputDialog, QFont, QMenu |
12 QInputDialog, QFont, QMenu |
13 |
13 |
14 from .ConfigurationPageBase import ConfigurationPageBase |
14 from .ConfigurationPageBase import ConfigurationPageBase |
15 from .Ui_EditorHighlightingStylesPage import Ui_EditorHighlightingStylesPage |
15 from .Ui_EditorHighlightingStylesPage import Ui_EditorHighlightingStylesPage |
16 |
16 |
17 from E5Gui import E5MessageBox |
17 from E5Gui import E5MessageBox, E5FileDialog |
18 |
18 |
19 from E5XML.HighlightingStylesWriter import HighlightingStylesWriter |
19 from E5XML.HighlightingStylesWriter import HighlightingStylesWriter |
20 from E5XML.HighlightingStylesReader import HighlightingStylesReader |
20 from E5XML.HighlightingStylesReader import HighlightingStylesReader |
21 |
21 |
22 import Preferences |
22 import Preferences |
361 """ |
361 """ |
362 Private method to export the styles of the given lexers. |
362 Private method to export the styles of the given lexers. |
363 |
363 |
364 @param lexers list of lexer objects for which to export the styles |
364 @param lexers list of lexer objects for which to export the styles |
365 """ |
365 """ |
366 fn, selectedFilter = QFileDialog.getSaveFileNameAndFilter( |
366 fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
367 self, |
367 self, |
368 self.trUtf8("Export Highlighting Styles"), |
368 self.trUtf8("Export Highlighting Styles"), |
369 "", |
369 "", |
370 self.trUtf8("Highlighting styles file (*.e4h)"), |
370 self.trUtf8("Highlighting styles file (*.e4h)"), |
371 "", |
371 "", |
372 QFileDialog.Options(QFileDialog.DontConfirmOverwrite | |
372 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
373 QFileDialog.DontUseNativeDialog)) |
|
374 |
373 |
375 if not fn: |
374 if not fn: |
376 return |
375 return |
377 |
376 |
378 ext = QFileInfo(fn).suffix() |
377 ext = QFileInfo(fn).suffix() |
397 """ |
396 """ |
398 Private method to import the styles of the given lexers. |
397 Private method to import the styles of the given lexers. |
399 |
398 |
400 @param lexers dictionary of lexer objects for which to import the styles |
399 @param lexers dictionary of lexer objects for which to import the styles |
401 """ |
400 """ |
402 fn = QFileDialog.getOpenFileName( |
401 fn = E5FileDialog.getOpenFileName( |
403 self, |
402 self, |
404 self.trUtf8("Import Highlighting Styles"), |
403 self.trUtf8("Import Highlighting Styles"), |
405 "", |
404 "", |
406 self.trUtf8("Highlighting styles file (*.e4h)"), |
405 self.trUtf8("Highlighting styles file (*.e4h)")) |
407 QFileDialog.DontUseNativeDialog) |
|
408 |
406 |
409 if not fn: |
407 if not fn: |
410 return |
408 return |
411 |
409 |
412 f = QFile(fn) |
410 f = QFile(fn) |