Permalink
Browse files

Patch for regression of select_keys option on table sources. (bochecha)

  • Loading branch information...
kaio committed Nov 30, 2012
1 parent d1b8d13 commit 52ec65d94b69f8f4e06325a7cb18f0d8ed4f707a
Showing with 7 additions and 17 deletions.
  1. +6 −8 engine/table.py
  2. +1 −9 engine/tabsqlitedb.py
View
@@ -84,18 +84,13 @@ def __init__ (self, config, phrase_table_index,valid_input_chars, max_key_length
self._cursor = [0,0]
# self._candidates: hold candidates selected from database [[now],[pre]]
self._candidates = [[],[]]
# __page_size: lookup table page size
__page_size = self._config.get_value (
self._config_section,
"LookupTablePageSize",
self.db.get_page_size())
# __orientation: lookup table orientation
__orientation = self._config.get_value (
self._config_section,
"LookupTableOrientation",
self.db.get_orientation())
# self._lookup_table: lookup table
self._lookup_table = ibus.LookupTable (__page_size)
self._lookup_table = ibus.LookupTable ()
self._lookup_table.set_orientation (__orientation)
# self._py_mode: whether in pinyin mode
self._py_mode = False
@@ -120,6 +115,11 @@ def __init__ (self, config, phrase_table_index,valid_input_chars, max_key_length
# self._select_keys: a list of chars for select keys
self.init_select_keys()
# __page_size: lookup table page size
# this is computed from the select_keys, so should be done after it
__page_size = self.db.get_page_size()
self._lookup_table.set_page_size(__page_size)
def init_select_keys(self):
# __select_keys: lookup table select keys/labels
__select_keys = self._config.get_value (
@@ -1718,8 +1718,6 @@ def config_value_changed_cb (self, config, section, name, value):
self._full_width_punct[0] = value
elif name == u'LookupTableOrientation':
self._editor._lookup_table.set_orientation (value)
elif name == u'LookupTablePageSize':
self._editor._lookup_table.set_page_size (value)
elif name == u'LookupTableSelectKeys':
self._editor.set_select_keys (value)
elif name == u'OneChar':
View
@@ -90,7 +90,6 @@ def __init__(self, name = 'table.db', user_db = None, filename = None ):
# 'commit_keys':'space',
# 'forward_keys':'Return',
'select_keys':'1,2,3,4,5,6,7,8,9,0',
'page_size':'6',
'page_up_keys':'Page_Up,minus',
'page_down_keys':'Page_Down,equal',
'status_prompt':'',
@@ -272,14 +271,7 @@ def get_chinese_mode (self):
return -1
def get_page_size (self):
try:
__page_size = int( self.get_ime_property ('page_size') )
if __page_size:
return __page_size
else:
return len(__select_keys.split(','))
except:
return 6
return len(self.get_select_keys().split(','))
def get_select_keys (self):
ret = None

2 comments on commit 52ec65d

@mozbugbox

This comment has been minimized.

Show comment
Hide comment
@mozbugbox

mozbugbox May 19, 2013

Why was the "LookupTablePageSize" option removed here? I kept seeing people asking ways to set the page size because of lower screen resolution or bigger font.

For myself, the default page size of 10 for most Chinese input table is just too big.

"LookupTablePageSize" should be able to override table default page size.

mozbugbox replied May 19, 2013

Why was the "LookupTablePageSize" option removed here? I kept seeing people asking ways to set the page size because of lower screen resolution or bigger font.

For myself, the default page size of 10 for most Chinese input table is just too big.

"LookupTablePageSize" should be able to override table default page size.

@kaio

This comment has been minimized.

Show comment
Hide comment
@kaio

kaio May 19, 2013

Owner

This is not a removal of the feature, but reproduced in a different way.

The page size is not controlled by the LookupTablePageSize option, but the number of items listed in SELECT_KEYS in the table source. Because the select_keys implied the page size already, keeping 2 data will make confusion.

Owner

kaio replied May 19, 2013

This is not a removal of the feature, but reproduced in a different way.

The page size is not controlled by the LookupTablePageSize option, but the number of items listed in SELECT_KEYS in the table source. Because the select_keys implied the page size already, keeping 2 data will make confusion.

Please sign in to comment.