Example #1
0
 def get_char_info(self, char_code):
     ipos = bisect(self.starts, char_code) - 1
     try:
         category, subcategory = self.category_map[self.starts[ipos]]
     except IndexError:
         category = subcategory = _('Unknown')
     return category, subcategory, character_name_from_code(char_code)
Example #2
0
 def get_char_info(self, char_code):
     ipos = bisect(self.starts, char_code) - 1
     try:
         category, subcategory = self.category_map[self.starts[ipos]]
     except IndexError:
         category = subcategory = _('Unknown')
     return category, subcategory, character_name_from_code(char_code)
Example #3
0
 def test_character_name(self):
     ' Test character naming '
     from calibre.utils.unicode_names import character_name_from_code
     for q, e in {
             '\U0001f431': 'CAT FACE'
             }.items():
         self.ae(icu.character_name(q), e)
         self.ae(character_name_from_code(icu.ord_string(q)[0]), e)
Example #4
0
 def test_character_name(self):
     ' Test character naming '
     from calibre.utils.unicode_names import character_name_from_code
     for q, e in {
             '\U0001f431': 'CAT FACE'
             }.items():
         self.ae(icu.character_name(q), e)
         self.ae(character_name_from_code(icu.ord_string(q)[0]), e)
Example #5
0
 def update_position(self, line=None, col=None, character=None):
     if line is None:
         self.la.setText('')
     else:
         try:
             name = character_name_from_code(ord_string(character)[0]) if character and tprefs['editor_show_char_under_cursor'] else None
         except Exception:
             name = None
         text = _('Line: {0} : {1}').format(line, col)
         if not name:
             name = {'\t':'TAB'}.get(character, None)
         if name and tprefs['editor_show_char_under_cursor']:
             text = name + ' : ' + text
         self.la.setText(text)
Example #6
0
 def update_position(self, line=None, col=None, character=None):
     if line is None:
         self.la.setText('')
     else:
         try:
             name = character_name_from_code(ord_string(character)[0]) if character and tprefs['editor_show_char_under_cursor'] else None
         except Exception:
             name = None
         text = _('Line: {0} : {1}').format(line, col)
         if not name:
             name = {'\t':'TAB'}.get(character, None)
         if name and tprefs['editor_show_char_under_cursor']:
             text = name + ' : ' + text
         self.la.setText(text)