4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a minimalistic editor for simple editing tasks. |
7 Module implementing a minimalistic editor for simple editing tasks. |
8 """ |
8 """ |
|
9 |
|
10 from __future__ import unicode_literals # __IGNORE_WARNING__ |
9 |
11 |
10 import os |
12 import os |
11 import re |
13 import re |
12 |
14 |
13 from PyQt4.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, pyqtSignal, QSize, \ |
15 from PyQt4.QtCore import QSignalMapper, QPoint, QTimer, QFileInfo, pyqtSignal, QSize, \ |
42 |
44 |
43 @param parent parent widget (QWidget) |
45 @param parent parent widget (QWidget) |
44 @param name name of this instance (string) |
46 @param name name of this instance (string) |
45 @param flags window flags |
47 @param flags window flags |
46 """ |
48 """ |
47 super().__init__(parent) |
49 super(MiniScintilla, self).__init__(parent) |
48 |
50 |
49 self.mw = parent |
51 self.mw = parent |
50 |
52 |
51 def getFileName(self): |
53 def getFileName(self): |
52 """ |
54 """ |
72 except AttributeError: |
74 except AttributeError: |
73 pass |
75 pass |
74 |
76 |
75 self.setCursorFlashTime(QApplication.cursorFlashTime()) |
77 self.setCursorFlashTime(QApplication.cursorFlashTime()) |
76 |
78 |
77 super().focusInEvent(event) |
79 super(MiniScintilla, self).focusInEvent(event) |
78 |
80 |
79 def focusOutEvent(self, event): |
81 def focusOutEvent(self, event): |
80 """ |
82 """ |
81 Public method called when the editor loses focus. |
83 Public method called when the editor loses focus. |
82 |
84 |
83 @param event the event object (QFocusEvent) |
85 @param event the event object (QFocusEvent) |
84 """ |
86 """ |
85 self.mw.editorActGrp.setEnabled(False) |
87 self.mw.editorActGrp.setEnabled(False) |
86 self.setCaretWidth(0) |
88 self.setCaretWidth(0) |
87 |
89 |
88 super().focusOutEvent(event) |
90 super(MiniScintilla, self).focusOutEvent(event) |
89 |
91 |
90 |
92 |
91 class MiniEditor(E5MainWindow): |
93 class MiniEditor(E5MainWindow): |
92 """ |
94 """ |
93 Class implementing a minimalistic editor for simple editing tasks. |
95 Class implementing a minimalistic editor for simple editing tasks. |
103 @param filename name of the file to open (string) |
105 @param filename name of the file to open (string) |
104 @param filetype type of the source file (string) |
106 @param filetype type of the source file (string) |
105 @param parent reference to the parent widget (QWidget) |
107 @param parent reference to the parent widget (QWidget) |
106 @param name object name of the window (string) |
108 @param name object name of the window (string) |
107 """ |
109 """ |
108 super().__init__(parent) |
110 super(MiniEditor, self).__init__(parent) |
109 if name is not None: |
111 if name is not None: |
110 self.setObjectName(name) |
112 self.setObjectName(name) |
111 self.setAttribute(Qt.WA_DeleteOnClose) |
113 self.setAttribute(Qt.WA_DeleteOnClose) |
112 self.setWindowIcon(UI.PixmapCache.getIcon("editor.png")) |
114 self.setWindowIcon(UI.PixmapCache.getIcon("editor.png")) |
113 |
115 |