QScintilla/Lexers/SubstyledLexer.py

branch
sub_styles
changeset 6864
7837ab17f079
parent 6861
20899dc18e59
child 6878
79008f970902
equal deleted inserted replaced
6863:e900929889dd 6864:7837ab17f079
355 @type int 355 @type int
356 @param substyle sub-style number 356 @param substyle sub-style number
357 @type int 357 @type int
358 """ 358 """
359 if style in self.__subStyles and substyle in self.__subStyles[style]: 359 if style in self.__subStyles and substyle in self.__subStyles[style]:
360 self.__subStyles[style][substyle]["Description"] = description 360 self.__subStyles[style][substyle]["Description"] = \
361 description.strip()
361 362
362 def substyleDescription(self, style, substyle): 363 def substyleDescription(self, style, substyle):
363 """ 364 """
364 Public method to get the description of a sub-style. 365 Public method to get the description of a sub-style.
365 366
369 @type int 370 @type int
370 @return sub-style description 371 @return sub-style description
371 @rtype str 372 @rtype str
372 """ 373 """
373 if style in self.__subStyles and substyle in self.__subStyles[style]: 374 if style in self.__subStyles and substyle in self.__subStyles[style]:
374 desc = self.__subStyles[style][substyle]["Description"] 375 desc = self.__subStyles[style][substyle]["Description"].strip()
375 else: 376 else:
376 desc = "" 377 desc = ""
377 378
378 return desc 379 return desc
379 380
387 @type int 388 @type int
388 @param substyle sub-style number 389 @param substyle sub-style number
389 @type int 390 @type int
390 """ 391 """
391 if style in self.__subStyles and substyle in self.__subStyles[style]: 392 if style in self.__subStyles and substyle in self.__subStyles[style]:
392 self.__subStyles[style][substyle]["Words"] = words 393 self.__subStyles[style][substyle]["Words"] = words.strip()
393 394
394 def substyleWords(self, style, substyle): 395 def substyleWords(self, style, substyle):
395 """ 396 """
396 Public method to get the words of a sub-style. 397 Public method to get the words of a sub-style.
397 398
401 @type int 402 @type int
402 @return white-space separated word list 403 @return white-space separated word list
403 @rtype str 404 @rtype str
404 """ 405 """
405 if style in self.__subStyles and substyle in self.__subStyles[style]: 406 if style in self.__subStyles and substyle in self.__subStyles[style]:
406 words = self.__subStyles[style][substyle]["Words"] 407 words = self.__subStyles[style][substyle]["Words"].strip()
407 else: 408 else:
408 words = "" 409 words = ""
409 410
410 return words 411 return words
411 412
586 """ 587 """
587 description = "" 588 description = ""
588 589
589 if style in self.defaultSubStyles and \ 590 if style in self.defaultSubStyles and \
590 substyle in self.defaultSubStyles[style]: 591 substyle in self.defaultSubStyles[style]:
591 styleData = self.defaultSubStyles[style][substyle]["Style"] 592 substyleData = self.defaultSubStyles[style][substyle]
592 description = styleData["Description"] 593 description = substyleData["Description"].strip()
593 594
594 return description 595 return description
595 596
596 def substyleDefaultWords(self, style, substyle): 597 def substyleDefaultWords(self, style, substyle):
597 """ 598 """
606 """ 607 """
607 words = "" 608 words = ""
608 609
609 if style in self.defaultSubStyles and \ 610 if style in self.defaultSubStyles and \
610 substyle in self.defaultSubStyles[style]: 611 substyle in self.defaultSubStyles[style]:
611 styleData = self.defaultSubStyles[style][substyle]["Style"] 612 substyleData = self.defaultSubStyles[style][substyle]
612 words = styleData["Words"] 613 words = substyleData["Words"].strip()
613 614
614 return words 615 return words
615 616
616 def substyleDefaultColor(self, style, substyle): 617 def substyleDefaultColor(self, style, substyle):
617 """ 618 """
765 @return flag indicating the existence of a sub-style definition 766 @return flag indicating the existence of a sub-style definition
766 @rtype bool 767 @rtype bool
767 """ 768 """
768 return (style in self.__subStyles and 769 return (style in self.__subStyles and
769 substyle in self.__subStyles[style]) 770 substyle in self.__subStyles[style])
771
772 def isBaseStyle(self, style):
773 """
774 Public method to test, if a given style may have sub-styles.
775
776 @param style base style number
777 @type int
778 @return flag indicating that the style may have sub-styles
779 @rtype bool
780 """
781 return style in self.baseStyles

eric ide

mercurial