174 Public slot to toggle the display of the preview. |
174 Public slot to toggle the display of the preview. |
175 |
175 |
176 @param on flag indicating to show a preview (boolean) |
176 @param on flag indicating to show a preview (boolean) |
177 """ |
177 """ |
178 editor = self.__vm.activeWindow() |
178 editor = self.__vm.activeWindow() |
179 if on and self.__isPreviewable(editor): |
179 if on and editor and self.__isPreviewable(editor): |
180 self.show() |
180 self.show() |
181 else: |
181 else: |
182 self.hide() |
182 self.hide() |
183 |
183 |
184 def __isPreviewable(self, editor): |
184 def __isPreviewable(self, editor): |
186 Private method to check, if a preview can be shown for the given editor. |
186 Private method to check, if a preview can be shown for the given editor. |
187 |
187 |
188 @param editor reference to an editor (Editor) |
188 @param editor reference to an editor (Editor) |
189 @return flag indicating if a preview can be shown (boolean) |
189 @return flag indicating if a preview can be shown (boolean) |
190 """ |
190 """ |
191 if editor.getFileName() is not None: |
191 if editor: |
192 extension = os.path.normcase(os.path.splitext(editor.getFileName())[1][1:]) |
192 if editor.getFileName() is not None: |
193 return extension in \ |
193 extension = os.path.normcase( |
194 Preferences.getEditor("PreviewHtmlFileNameExtensions") + \ |
194 os.path.splitext(editor.getFileName())[1][1:]) |
195 Preferences.getEditor("PreviewMarkdownFileNameExtensions") + \ |
195 return extension in \ |
196 Preferences.getEditor("PreviewRestFileNameExtensions") |
196 Preferences.getEditor("PreviewHtmlFileNameExtensions") + \ |
197 elif editor.getLanguage() == "HTML": |
197 Preferences.getEditor("PreviewMarkdownFileNameExtensions") + \ |
198 return True |
198 Preferences.getEditor("PreviewRestFileNameExtensions") |
199 else: |
199 elif editor.getLanguage() == "HTML": |
200 return False |
200 return True |
|
201 |
|
202 return False |
201 |
203 |
202 def __runProcessingThread(self): |
204 def __runProcessingThread(self): |
203 """ |
205 """ |
204 Private slot to schedule the processing of the current editor's text. |
206 Private slot to schedule the processing of the current editor's text. |
205 """ |
207 """ |