Commit 2beadd50 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[gui] Refactor and rename confusing methods

parent dbc0fea3
......@@ -138,7 +138,7 @@ class SearchManager(object):
def on_clear(self, widget):
"""Clear button callback: Reset selected nodes, and search entry field
"""
self.sn_viewer.clear(widget)
self.sn_viewer.deselect_all()
self.search_entry.set_text('')
if self.model:
self.model.search_unmark()
......@@ -280,17 +280,15 @@ class SearchManager(object):
return list(set(node_names + self.model.get_matching_node_names(regex_obj)))
def get_selected_keywords(self):
def get_selected_items(self):
"""
As it says
"""
return self.sn_viewer.get_selected_items()
def clear(self):
"""
It is clear
"""
self.sn_viewer.refresh([])
"""Remove all items"""
self.sn_viewer.clear()
class SearchFrontier(SearchManager):
"""
......@@ -332,7 +330,8 @@ class SearchFrontier(SearchManager):
return fvi.frontier
def clear(self):
self.sn_viewer.refresh([])
"""Remove all items"""
self.sn_viewer.clear()
class LegendWindow(object):
......
......@@ -491,7 +491,7 @@ class SelectPlaceWindow(object):
button = self.wtree.get_widget("select_button")
button.connect("clicked", self.on_select)
button = self.wtree.get_widget("unselect_button")
button.connect("clicked", self.on_unselect)
button.connect("clicked", self.on_deselect)
button = self.wtree.get_widget("save_button")
button.connect("clicked", self.on_save)
button = self.wtree.get_widget("load_button")
......@@ -513,13 +513,13 @@ class SelectPlaceWindow(object):
"""
???
"""
self.search_area.sn_viewer.select_all(widget)
self.search_area.sn_viewer.select_all()
def on_unselect(self, widget):
def on_deselect(self, widget):
"""
???
"""
self.search_area.sn_viewer.clear(widget)
self.search_area.sn_viewer.deselect_all()
def on_save(self, widget):
"""
......@@ -593,7 +593,7 @@ class SelectPlaceWindow(object):
make a txt file with the current selected places
"""
file = open(file_name,'w')
list_of_places = self.search_area.get_selected_keywords()
list_of_places = self.search_area.get_selected_items()
for place in list_of_places :
file.write(str(place)+'\n')
file.close()
......@@ -619,8 +619,8 @@ class SelectPlaceWindow(object):
"""
set the chosen activated places
"""
self.simulator.init_places = self.search_area.get_selected_keywords()
skw = self.search_area.get_selected_keywords()
self.simulator.init_places = self.search_area.get_selected_items()
skw = list(self.simulator.init_places)
self.simulator.sim.simul_init_places(skw)
class ToggleWholeModel(object):
......@@ -653,7 +653,7 @@ class ToggleWholeModel(object):
# display node names
self.sn_viewer.refresh(lnode)
def get_selected_keywords(self):
def get_selected_items(self):
"""
retrieve the selected items
"""
......
......@@ -129,19 +129,19 @@ class ToggleList(gtk.Frame):
"""Retrieve the cas and word associated (pairs)"""
return [(item[0], item[1]) for item in self.list_item]
def clear(self, widget):
"""Unselect all items"""
def deselect_all(self):
"""Deselect all items"""
for item in self.list_item:
item[1] = False
def select_all(self, widget):
def select_all(self):
"""Select all items"""
for item in self.list_item:
item[1] = True
def rubout(self):
def clear(self):
"""Remove all items"""
self.list_item.clear()
self.refresh([])
def refresh(self, newlist):
"""Rebuild the list"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment