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