mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
Rename variable
This commit is contained in:
parent
cf5badd4f4
commit
a176ca7797
1 changed files with 19 additions and 19 deletions
|
@ -29,23 +29,23 @@ import gtk
|
||||||
|
|
||||||
class SearchOperation (object):
|
class SearchOperation (object):
|
||||||
|
|
||||||
def __init__ (self, model, search_string, search_forward = True, start_position = None):
|
def __init__ (self, model, search_text, search_forward = True, start_position = None):
|
||||||
|
|
||||||
self.model = model
|
self.model = model
|
||||||
self.search_string = search_string
|
self.search_text = search_text
|
||||||
self.search_forward = search_forward
|
self.search_forward = search_forward
|
||||||
self.start_position = start_position
|
self.start_position = start_position
|
||||||
|
|
||||||
col_id = GUI.LogModelBase.COL_MESSAGE
|
col_id = GUI.LogModelBase.COL_MESSAGE
|
||||||
len_search_string = len (search_string)
|
len_search_text = len (search_text)
|
||||||
|
|
||||||
def match_func (model_row):
|
def match_func (model_row):
|
||||||
|
|
||||||
message = model_row[col_id]
|
message = model_row[col_id]
|
||||||
if search_string in message:
|
if search_text in message:
|
||||||
# TODO: Return all match ranges here.
|
# TODO: Return all match ranges here.
|
||||||
pos = message.find (search_string)
|
pos = message.find (search_text)
|
||||||
return ((pos, pos + len_search_string,),)
|
return ((pos, pos + len_search_text,),)
|
||||||
else:
|
else:
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
@ -331,9 +331,9 @@ class FindBarFeature (FeatureBase):
|
||||||
self.clear_results ()
|
self.clear_results ()
|
||||||
|
|
||||||
model = self.log_view.props.model
|
model = self.log_view.props.model
|
||||||
search_string = entry.props.text
|
search_text = entry.props.text
|
||||||
column = self.window.column_manager.find_item (name = "message")
|
column = self.window.column_manager.find_item (name = "message")
|
||||||
if search_string == "":
|
if search_text == "":
|
||||||
self.logger.debug ("search string set to '', aborting search")
|
self.logger.debug ("search string set to '', aborting search")
|
||||||
self.search_state = None
|
self.search_state = None
|
||||||
self.next_match = None
|
self.next_match = None
|
||||||
|
@ -346,14 +346,14 @@ class FindBarFeature (FeatureBase):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.logger.debug ("starting search for %r", search_string)
|
self.logger.debug ("starting search for %r", search_text)
|
||||||
self.next_match = None
|
self.next_match = None
|
||||||
self.prev_match = None
|
self.prev_match = None
|
||||||
self.update_sensitivity ()
|
self.update_sensitivity ()
|
||||||
self.scroll_match = True
|
self.scroll_match = True
|
||||||
|
|
||||||
start_path = self.log_view.get_visible_range ()[0]
|
start_path = self.log_view.get_visible_range ()[0]
|
||||||
self.start_search_operation (search_string, start_position = start_path[0])
|
self.start_search_operation (search_text, start_position = start_path[0])
|
||||||
self.bar.status_searching ()
|
self.bar.status_searching ()
|
||||||
column.highlighters[self] = self.operation.match_func
|
column.highlighters[self] = self.operation.match_func
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ class FindBarFeature (FeatureBase):
|
||||||
action = self.action_group.get_action (name)
|
action = self.action_group.get_action (name)
|
||||||
action.props.sensitive = (value is not None)
|
action.props.sensitive = (value is not None)
|
||||||
|
|
||||||
def start_search_operation (self, search_string = None, forward = True, start_position = None):
|
def start_search_operation (self, search_text = None, forward = True, start_position = None):
|
||||||
|
|
||||||
model = self.log_view.props.model
|
model = self.log_view.props.model
|
||||||
|
|
||||||
|
@ -379,13 +379,13 @@ class FindBarFeature (FeatureBase):
|
||||||
if start_position is None:
|
if start_position is None:
|
||||||
start_position = len (model) - 1
|
start_position = len (model) - 1
|
||||||
|
|
||||||
if search_string is None:
|
if search_text is None:
|
||||||
operation = self.operation
|
operation = self.operation
|
||||||
if operation is None:
|
if operation is None:
|
||||||
raise ValueError ("search_string not given but have no previous search operation")
|
raise ValueError ("search_text not given but have no previous search operation")
|
||||||
search_string = operation.search_string
|
search_text = operation.search_text
|
||||||
|
|
||||||
self.operation = SearchOperation (model, search_string, start_position = start_position)
|
self.operation = SearchOperation (model, search_text, start_position = start_position)
|
||||||
self.sentinel.run_for (self.operation)
|
self.sentinel.run_for (self.operation)
|
||||||
|
|
||||||
def handle_match_found (self, model, tree_iter):
|
def handle_match_found (self, model, tree_iter):
|
||||||
|
@ -399,10 +399,10 @@ class FindBarFeature (FeatureBase):
|
||||||
|
|
||||||
if forward_search:
|
if forward_search:
|
||||||
self.logger.debug ("forward search for %r matches line %i",
|
self.logger.debug ("forward search for %r matches line %i",
|
||||||
self.operation.search_string, line_index)
|
self.operation.search_text, line_index)
|
||||||
else:
|
else:
|
||||||
self.logger.debug ("backward search for %r matches line %i",
|
self.logger.debug ("backward search for %r matches line %i",
|
||||||
self.operation.search_string, line_index)
|
self.operation.search_text, line_index)
|
||||||
|
|
||||||
self.sentinel.abort ()
|
self.sentinel.abort ()
|
||||||
|
|
||||||
|
@ -426,11 +426,11 @@ class FindBarFeature (FeatureBase):
|
||||||
|
|
||||||
if self.search_state == "search-forward":
|
if self.search_state == "search-forward":
|
||||||
self.logger.debug ("forward search for %r reached last line",
|
self.logger.debug ("forward search for %r reached last line",
|
||||||
self.operation.search_string)
|
self.operation.search_text)
|
||||||
self.next_match = None
|
self.next_match = None
|
||||||
elif self.search_state == "search-backward":
|
elif self.search_state == "search-backward":
|
||||||
self.logger.debug ("backward search for %r reached first line",
|
self.logger.debug ("backward search for %r reached first line",
|
||||||
self.operation.search_string)
|
self.operation.search_text)
|
||||||
self.prev_match = None
|
self.prev_match = None
|
||||||
else:
|
else:
|
||||||
self.logger.warning ("inconsistent search state %r",
|
self.logger.warning ("inconsistent search state %r",
|
||||||
|
|
Loading…
Reference in a new issue