19 |
19 |
20 from E5Gui.E5Action import E5Action, createActionGroup |
20 from E5Gui.E5Action import E5Action, createActionGroup |
21 from E5Gui import E5MessageBox, E5FileDialog |
21 from E5Gui import E5MessageBox, E5FileDialog |
22 from E5Gui.E5MainWindow import E5MainWindow |
22 from E5Gui.E5MainWindow import E5MainWindow |
23 |
23 |
24 from . import Lexers |
|
25 from .QsciScintillaCompat import QsciScintillaCompat |
24 from .QsciScintillaCompat import QsciScintillaCompat |
26 from .SearchReplaceWidget import SearchReplaceWidget |
|
27 |
25 |
28 import UI.PixmapCache |
26 import UI.PixmapCache |
29 import UI.Config |
27 import UI.Config |
30 |
|
31 from .Printer import Printer |
|
32 |
28 |
33 from Globals import isMacPlatform |
29 from Globals import isMacPlatform |
34 |
30 |
35 import Utilities |
31 import Utilities |
36 import Preferences |
32 import Preferences |
125 |
121 |
126 self.srHistory = { |
122 self.srHistory = { |
127 "search": [], |
123 "search": [], |
128 "replace": [] |
124 "replace": [] |
129 } |
125 } |
|
126 from .SearchReplaceWidget import SearchReplaceWidget |
130 self.searchDlg = SearchReplaceWidget(False, self, self) |
127 self.searchDlg = SearchReplaceWidget(False, self, self) |
131 self.replaceDlg = SearchReplaceWidget(True, self, self) |
128 self.replaceDlg = SearchReplaceWidget(True, self, self) |
132 |
129 |
133 centralWidget = QWidget() |
130 centralWidget = QWidget() |
134 layout = QVBoxLayout() |
131 layout = QVBoxLayout() |
2235 |
2232 |
2236 def __printFile(self): |
2233 def __printFile(self): |
2237 """ |
2234 """ |
2238 Private slot to print the text. |
2235 Private slot to print the text. |
2239 """ |
2236 """ |
|
2237 from .Printer import Printer |
2240 printer = Printer(mode=QPrinter.HighResolution) |
2238 printer = Printer(mode=QPrinter.HighResolution) |
2241 sb = self.statusBar() |
2239 sb = self.statusBar() |
2242 printDialog = QPrintDialog(printer, self) |
2240 printDialog = QPrintDialog(printer, self) |
2243 if self.__textEdit.hasSelectedText(): |
2241 if self.__textEdit.hasSelectedText(): |
2244 printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection) |
2242 printDialog.addEnabledOption(QAbstractPrintDialog.PrintSelection) |
2270 def __printPreviewFile(self): |
2268 def __printPreviewFile(self): |
2271 """ |
2269 """ |
2272 Private slot to show a print preview of the text. |
2270 Private slot to show a print preview of the text. |
2273 """ |
2271 """ |
2274 from PyQt4.QtGui import QPrintPreviewDialog |
2272 from PyQt4.QtGui import QPrintPreviewDialog |
|
2273 from .Printer import Printer |
2275 |
2274 |
2276 printer = Printer(mode=QPrinter.HighResolution) |
2275 printer = Printer(mode=QPrinter.HighResolution) |
2277 if self.__curFile: |
2276 if self.__curFile: |
2278 printer.setDocName(QFileInfo(self.__curFile).fileName()) |
2277 printer.setDocName(QFileInfo(self.__curFile).fileName()) |
2279 else: |
2278 else: |
2336 self.noLanguageAct.setCheckable(True) |
2335 self.noLanguageAct.setCheckable(True) |
2337 self.noLanguageAct.setData("None") |
2336 self.noLanguageAct.setData("None") |
2338 self.languagesActGrp.addAction(self.noLanguageAct) |
2337 self.languagesActGrp.addAction(self.noLanguageAct) |
2339 menu.addSeparator() |
2338 menu.addSeparator() |
2340 |
2339 |
|
2340 from . import Lexers |
2341 self.supportedLanguages = {} |
2341 self.supportedLanguages = {} |
2342 supportedLanguages = Lexers.getSupportedLanguages() |
2342 supportedLanguages = Lexers.getSupportedLanguages() |
2343 languages = sorted(list(supportedLanguages.keys())) |
2343 languages = sorted(list(supportedLanguages.keys())) |
2344 for language in languages: |
2344 for language in languages: |
2345 if language != "Guessed": |
2345 if language != "Guessed": |
2499 language = "Python3" |
2499 language = "Python3" |
2500 if language.startswith("Pygments|"): |
2500 if language.startswith("Pygments|"): |
2501 pyname = language.split("|", 1)[1] |
2501 pyname = language.split("|", 1)[1] |
2502 language = "" |
2502 language = "" |
2503 |
2503 |
|
2504 from . import Lexers |
2504 self.lexer_ = Lexers.getLexer(language, self.__textEdit, pyname=pyname) |
2505 self.lexer_ = Lexers.getLexer(language, self.__textEdit, pyname=pyname) |
2505 if self.lexer_ is None: |
2506 if self.lexer_ is None: |
2506 self.__textEdit.setLexer() |
2507 self.__textEdit.setLexer() |
2507 self.apiLanguage = "" |
2508 self.apiLanguage = "" |
2508 return |
2509 return |