UI/Previewer.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3458
64bbac483843
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
231 language = "Markdown" 231 language = "Markdown"
232 elif extension in \ 232 elif extension in \
233 Preferences.getEditor("PreviewRestFileNameExtensions"): 233 Preferences.getEditor("PreviewRestFileNameExtensions"):
234 language = "ReST" 234 language = "ReST"
235 else: 235 else:
236 self.__setHtml(fn, self.trUtf8( 236 self.__setHtml(fn, self.tr(
237 "<p>No preview available for this type of file.</p>")) 237 "<p>No preview available for this type of file.</p>"))
238 return 238 return
239 239
240 if fn: 240 if fn:
241 project = e5App().getObject("Project") 241 project = e5App().getObject("Project")
271 Private slot to handle a change of the title. 271 Private slot to handle a change of the title.
272 272
273 @param title new title (string) 273 @param title new title (string)
274 """ 274 """
275 if title: 275 if title:
276 self.titleLabel.setText(self.trUtf8("Preview - {0}").format(title)) 276 self.titleLabel.setText(self.tr("Preview - {0}").format(title))
277 else: 277 else:
278 self.titleLabel.setText(self.trUtf8("Preview")) 278 self.titleLabel.setText(self.tr("Preview"))
279 279
280 def __saveScrollBarPositions(self): 280 def __saveScrollBarPositions(self):
281 """ 281 """
282 Private method to save scroll bar positions for a previewed editor. 282 Private method to save scroll bar positions for a previewed editor.
283 """ 283 """
413 elif language == "Markdown": 413 elif language == "Markdown":
414 return self.__convertMarkdown(text) 414 return self.__convertMarkdown(text)
415 elif language == "ReST": 415 elif language == "ReST":
416 return self.__convertReST(text) 416 return self.__convertReST(text)
417 else: 417 else:
418 return self.trUtf8( 418 return self.tr(
419 "<p>No preview available for this type of file.</p>") 419 "<p>No preview available for this type of file.</p>")
420 420
421 def __processSSI(self, txt, filename, root): 421 def __processSSI(self, txt, filename, root):
422 """ 422 """
423 Private method to process the given text for SSI statements. 423 Private method to process the given text for SSI statements.
473 @return processed HTML (string) 473 @return processed HTML (string)
474 """ 474 """
475 try: 475 try:
476 import docutils.core # __IGNORE_EXCEPTION__ __IGNORE_WARNING__ 476 import docutils.core # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
477 except ImportError: 477 except ImportError:
478 return self.trUtf8( 478 return self.tr(
479 """<p>ReStructuredText preview requires the""" 479 """<p>ReStructuredText preview requires the"""
480 """ <b>python-docutils</b> package.<br/>Install it with""" 480 """ <b>python-docutils</b> package.<br/>Install it with"""
481 """ your package manager or see""" 481 """ your package manager or see"""
482 """ <a href="http://pypi.python.org/pypi/docutils">""" 482 """ <a href="http://pypi.python.org/pypi/docutils">"""
483 """this page.</a></p>""") 483 """this page.</a></p>""")
493 @return processed HTML (string) 493 @return processed HTML (string)
494 """ 494 """
495 try: 495 try:
496 import markdown # __IGNORE_EXCEPTION__ __IGNORE_WARNING__ 496 import markdown # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
497 except ImportError: 497 except ImportError:
498 return self.trUtf8( 498 return self.tr(
499 """<p>Markdown preview requires the <b>python-markdown</b> """ 499 """<p>Markdown preview requires the <b>python-markdown</b> """
500 """package.<br/>Install it with your package manager or see """ 500 """package.<br/>Install it with your package manager or see """
501 """<a href="http://pythonhosted.org/Markdown/install.html">""" 501 """<a href="http://pythonhosted.org/Markdown/install.html">"""
502 """installation instructions.</a></p>""") 502 """installation instructions.</a></p>""")
503 503

eric ide

mercurial