AutoComp.py: remove redundant list-building and use inplace addition where applicable
svn: r13152
This commit is contained in:
parent
3564b04584
commit
b0a00a39c0
@ -45,8 +45,9 @@ def fill_combo(combo, data_list):
|
|||||||
"""
|
"""
|
||||||
store = gtk.ListStore(gobject.TYPE_STRING)
|
store = gtk.ListStore(gobject.TYPE_STRING)
|
||||||
|
|
||||||
for data in [ item for item in data_list if item ]:
|
for data in data_list:
|
||||||
store.append(row=[data])
|
if data:
|
||||||
|
store.append(row=[data])
|
||||||
|
|
||||||
combo.set_model(store)
|
combo.set_model(store)
|
||||||
combo.set_text_column(0)
|
combo.set_text_column(0)
|
||||||
@ -60,11 +61,13 @@ def fill_entry(entry, data_list):
|
|||||||
"""
|
"""
|
||||||
Fill a entry with completion data
|
Fill a entry with completion data
|
||||||
"""
|
"""
|
||||||
|
|
||||||
store = gtk.ListStore(gobject.TYPE_STRING)
|
store = gtk.ListStore(gobject.TYPE_STRING)
|
||||||
|
|
||||||
for data in [ item for item in data_list if item ]:
|
for data in data_list:
|
||||||
store.append(row=[data])
|
if data:
|
||||||
|
store.append(row=[data])
|
||||||
|
|
||||||
completion = gtk.EntryCompletion()
|
completion = gtk.EntryCompletion()
|
||||||
completion.set_model(store)
|
completion.set_model(store)
|
||||||
completion.set_minimum_key_length(1)
|
completion.set_minimum_key_length(1)
|
||||||
@ -162,7 +165,7 @@ class StandardCustomSelector(object):
|
|||||||
self.store.append(row=[key, self.mapping[key]])
|
self.store.append(row=[key, self.mapping[key]])
|
||||||
if key == self.active_key:
|
if key == self.active_key:
|
||||||
self.active_index = index
|
self.active_index = index
|
||||||
index = index + 1
|
index += 1
|
||||||
|
|
||||||
if self.additional:
|
if self.additional:
|
||||||
for event_type in self.additional:
|
for event_type in self.additional:
|
||||||
@ -176,7 +179,7 @@ class StandardCustomSelector(object):
|
|||||||
self.store.append(row=[int(event_type), str(event_type)])
|
self.store.append(row=[int(event_type), str(event_type)])
|
||||||
if key == self.active_key:
|
if key == self.active_key:
|
||||||
self.active_index = index
|
self.active_index = index
|
||||||
index = index + 1
|
index += 1
|
||||||
|
|
||||||
def by_value(self, first, second):
|
def by_value(self, first, second):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user