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>
<child internal-child="selection">
<object class="GtkTreeSelection" id="search_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_search_treeview_selection_changed" swapped="no"/>
</object>
</child>
@ -512,7 +511,6 @@
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="groups_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_groups_treeview_selection_changed" swapped="no"/>
</object>
</child>
@ -560,7 +558,6 @@
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="state_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_state_treeview_selection_changed" swapped="no"/>
</object>
</child>
@ -608,7 +605,6 @@
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="repos_treeview_selection">
<property name="mode">browse</property>
<signal name="changed" handler="on_repos_treeview_selection_changed" swapped="no"/>
</object>
</child>
@ -670,10 +666,9 @@
<property name="search_column">0</property>
<property name="fixed_height_mode">True</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">
<object class="GtkTreeSelection" id="list_treeview_selection">
<signal name="changed" handler="on_list_treeview_selection_changed" swapped="no"/>
</object>
<object class="GtkTreeSelection" id="list_treeview_selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="installed_column">
@ -1141,24 +1136,6 @@
</object>
</child>
</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">
<columns>
<!-- column-name name -->
@ -1179,6 +1156,24 @@
<column type="gchararray"/>
</columns>
</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">
<columns>
<!-- column-name action -->

View File

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