Ejemplo n.º 1
0
 def __init__(self,
              theme_config,
              local_themes,
              theme_kwargs,
              pl,
              ambiwidth=1,
              **options):
     self.__dict__.update(options)
     self.theme_config = theme_config
     theme_kwargs['pl'] = pl
     self.pl = pl
     if theme_config.get('use_non_breaking_spaces', True):
         self.character_translations = self.character_translations.copy()
         self.character_translations[ord(' ')] = NBSP
     self.theme = Theme(theme_config=theme_config, **theme_kwargs)
     self.local_themes = local_themes
     self.theme_kwargs = theme_kwargs
     self.width_data = {
         'N': 1,  # Neutral
         'Na': 1,  # Narrow
         'A': ambiwidth,  # Ambiguous
         'H': 1,  # Half-width
         'W': 2,  # Wide
         'F': 2,  # Fullwidth
     }
Ejemplo n.º 2
0
 def get_matched_theme(self, match):
     try:
         return match['theme']
     except KeyError:
         match['theme'] = Theme(theme_config=match['config'],
                                main_theme_config=self.theme_config,
                                **self.theme_kwargs)
         return match['theme']
Ejemplo n.º 3
0
	def get_theme(self, matcher_info):
		for matcher in self.local_themes.keys():
			if matcher(matcher_info):
				match = self.local_themes[matcher]
				try:
					return match['theme']
				except KeyError:
					match['theme'] = Theme(theme_config=match['config'], top_theme_config=self.theme_config, **self.theme_kwargs)
					return match['theme']
		else:
			return self.theme
Ejemplo n.º 4
0
 def get_theme(self, matcher_info):
     if not matcher_info:
         return self.theme
     match = self.local_themes[matcher_info]
     try:
         return match['theme']
     except KeyError:
         match['theme'] = Theme(theme_config=match['config'],
                                main_theme_config=self.theme_config,
                                **self.theme_kwargs)
         return match['theme']
Ejemplo n.º 5
0
 def get_theme(self, matcher_info):
     if matcher_info == 'in':
         return self.theme
     else:
         match = self.local_themes[matcher_info]
         try:
             return match['theme']
         except KeyError:
             match['theme'] = Theme(theme_config=match['config'],
                                    top_theme_config=self.theme_config,
                                    **self.theme_kwargs)
             return match['theme']
Ejemplo n.º 6
0
 def __init__(self,
              theme_config,
              local_themes,
              theme_kwargs,
              colorscheme,
              pl,
              ambiwidth=1,
              **options):
     self.__dict__.update(options)
     self.theme_config = theme_config
     theme_kwargs['pl'] = pl
     self.pl = pl
     self.theme = Theme(theme_config=theme_config, **theme_kwargs)
     self.local_themes = local_themes
     self.theme_kwargs = theme_kwargs
     self.colorscheme = colorscheme
     self.width_data = {
         'N': 1,  # Neutral
         'Na': 1,  # Narrow
         'A': ambiwidth,  # Ambigious
         'H': 1,  # Half-width
         'W': 2,  # Wide
         'F': 2,  # Fullwidth
     }