RefactoringRope/CodeAssistServer.py

branch
server_client_variant
changeset 223
d30d3b0d1df5
parent 221
b3592afc8718
child 232
65d7d745543d
equal deleted inserted replaced
222:5771e459f94c 223:d30d3b0d1df5
343 for 343 for
344 @type QScintilla.Editor.Editor 344 @type QScintilla.Editor.Editor
345 """ 345 """
346 language = editor.getLanguage() 346 language = editor.getLanguage()
347 if language not in self.__editorLanguageMapping: 347 if language not in self.__editorLanguageMapping:
348 if Preferences.getDocuViewer("ShowInfoAsRichText"):
349 warning = self.tr("Language <b>{0}</b> is not supported.")\
350 .format(language)
351 else:
352 warning = self.tr("Language '{0}' is not supported.")\
353 .format(language)
348 self.__documentationViewer.documentationReady( 354 self.__documentationViewer.documentationReady(
349 self.tr("Language '{0}' is not supported.").format(language)) 355 warning, isWarning=True)
350 return 356 return
357
351 idString = self.__editorLanguageMapping[language] 358 idString = self.__editorLanguageMapping[language]
352 359
353 filename = editor.getFileName() 360 filename = editor.getFileName()
354 source = editor.text() 361 source = editor.text()
355 line, index = editor.getCursorPosition() 362 line, index = editor.getCursorPosition()
380 387
381 if "Error" not in result: 388 if "Error" not in result:
382 documentationDict = result["DocumentationDict"] 389 documentationDict = result["DocumentationDict"]
383 if documentationDict: 390 if documentationDict:
384 if "module" in documentationDict: 391 if "module" in documentationDict:
385 if Preferences.getDocuViewer("ShowInfoAsMarkdown"): 392 if Preferences.getDocuViewer("ShowInfoAsRichText"):
386 documentationDict["note"] = \ 393 documentationDict["note"] = \
387 self.tr("Present in _{0}_ module", 394 self.tr("Present in <i>{0}</i> module",
388 "Note with markdown syntax")\ 395 "Note with markdown syntax")\
389 .format(documentationDict["module"]) 396 .format(documentationDict["module"])
390 else: 397 else:
391 documentationDict["note"] = \ 398 documentationDict["note"] = \
392 self.tr("Present in '{0}' module", 399 self.tr("Present in '{0}' module",
393 "Note as plain text")\ 400 "Note as plain text")\
394 .format(documentationDict["module"]) 401 .format(documentationDict["module"])
395 del documentationDict["module"] 402 del documentationDict["module"]
396 docu = documentationDict 403 docu = documentationDict
397 404
398 self.__documentationViewer.documentationReady(docu) 405 if docu is None:
406 msg = self.tr("No documentation available.")
407 self.__documentationViewer.documentationReady(
408 msg, isDocWarning=True)
409 else:
410 self.__documentationViewer.documentationReady(docu)
399 411
400 ####################################################################### 412 #######################################################################
401 ## Methods below handle the network connection 413 ## Methods below handle the network connection
402 ####################################################################### 414 #######################################################################
403 415

eric ide

mercurial