fix a bug when selected a filter which slowed ui

This commit is contained in:
guinux 2013-04-29 15:26:09 +02:00
parent 0e8d52c1bb
commit aea3a13b35
2 changed files with 38 additions and 41 deletions

View File

@ -461,7 +461,6 @@
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="search_treeview_selection"> <object class="GtkTreeSelection" id="search_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_search_treeview_selection_changed" swapped="no"/> <signal name="changed" handler="on_search_treeview_selection_changed" swapped="no"/>
</object> </object>
</child> </child>
@ -512,7 +511,6 @@
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="groups_treeview_selection"> <object class="GtkTreeSelection" id="groups_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_groups_treeview_selection_changed" swapped="no"/> <signal name="changed" handler="on_groups_treeview_selection_changed" swapped="no"/>
</object> </object>
</child> </child>
@ -560,7 +558,6 @@
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="state_treeview_selection"> <object class="GtkTreeSelection" id="state_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_state_treeview_selection_changed" swapped="no"/> <signal name="changed" handler="on_state_treeview_selection_changed" swapped="no"/>
</object> </object>
</child> </child>
@ -608,7 +605,6 @@
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="repos_treeview_selection"> <object class="GtkTreeSelection" id="repos_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_repos_treeview_selection_changed" swapped="no"/> <signal name="changed" handler="on_repos_treeview_selection_changed" swapped="no"/>
</object> </object>
</child> </child>
@ -670,10 +666,9 @@
<property name="search_column">0</property> <property name="search_column">0</property>
<property name="fixed_height_mode">True</property> <property name="fixed_height_mode">True</property>
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<signal name="button-press-event" handler="on_list_treeview_button_press_event" swapped="no"/>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="list_treeview_selection"> <object class="GtkTreeSelection" id="list_treeview_selection"/>
<signal name="changed" handler="on_list_treeview_selection_changed" swapped="no"/>
</object>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="installed_column"> <object class="GtkTreeViewColumn" id="installed_column">
@ -1141,24 +1136,6 @@
</object> </object>
</child> </child>
</object> </object>
<object class="GtkListStore" id="repos_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="search_list">
<columns>
<!-- column-name terms -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="state_list">
<columns>
<!-- column-name state -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="packages_list"> <object class="GtkListStore" id="packages_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name name -->
@ -1179,6 +1156,24 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="repos_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="search_list">
<columns>
<!-- column-name terms -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="state_list">
<columns>
<!-- column-name state -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="transaction_sum"> <object class="GtkListStore" id="transaction_sum">
<columns> <columns>
<!-- column-name action --> <!-- column-name action -->

View File

@ -959,21 +959,23 @@ class Handler:
current_filter = ('search', search_entry.get_text().split()) current_filter = ('search', search_entry.get_text().split())
set_packages_list() set_packages_list()
def on_list_treeview_selection_changed(self, widget): def on_list_treeview_button_press_event(self, treeview, event):
liste, line = list_selection.get_selected() if event.button == 1: # left click
if line: treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y))
if packages_list[line][0] != _('No package found'): treeiter = packages_list.get_iter(treepath)
if packages_list[line][0] in transaction.localpkgs.keys(): if treeiter:
set_infos_list(transaction.localpkgs[packages_list[line][0]]) if packages_list[treeiter][0] != _('No package found'):
set_deps_list(transaction.localpkgs[packages_list[line][0]], "local") if packages_list[treeiter][0] in transaction.localpkgs.keys():
set_details_list(transaction.localpkgs[packages_list[line][0]], "local") set_infos_list(transaction.localpkgs[packages_list[treeiter][0]])
set_files_list(transaction.localpkgs[packages_list[line][0]]) set_deps_list(transaction.localpkgs[packages_list[treeiter][0]], "local")
files_scrolledwindow.set_visible(True) set_details_list(transaction.localpkgs[packages_list[treeiter][0]], "local")
elif packages_list[line][0] in transaction.syncpkgs.keys(): set_files_list(transaction.localpkgs[packages_list[treeiter][0]])
set_infos_list(transaction.syncpkgs[packages_list[line][0]]) files_scrolledwindow.set_visible(True)
set_deps_list(transaction.syncpkgs[packages_list[line][0]], "sync") elif packages_list[treeiter][0] in transaction.syncpkgs.keys():
set_details_list(transaction.syncpkgs[packages_list[line][0]], "sync") set_infos_list(transaction.syncpkgs[packages_list[treeiter][0]])
files_scrolledwindow.set_visible(False) set_deps_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync")
set_details_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync")
files_scrolledwindow.set_visible(False)
def on_search_treeview_selection_changed(self, widget): def on_search_treeview_selection_changed(self, widget):
global current_filter global current_filter
@ -1018,7 +1020,7 @@ class Handler:
def on_cellrenderertoggle1_toggled(self, widget, line): def on_cellrenderertoggle1_toggled(self, widget, line):
if packages_list[line][1] is True: if packages_list[line][1] is True:
if packages_list[line][0] in transaction.to_remove: if packages_list[line][0] in transaction.to_remove:
packages_list[line][3] =True packages_list[line][3] = True
packages_list[line][4] = installed_icon packages_list[line][4] = installed_icon
transaction.to_remove.discard(packages_list[line][0]) transaction.to_remove.discard(packages_list[line][0])
else: else: