better way to fix the ui freeze trouble

This commit is contained in:
guinux 2013-05-01 14:57:52 +02:00
parent f560beb1ba
commit 7ff8f5a683
3 changed files with 29 additions and 27 deletions

View File

@ -666,10 +666,10 @@
<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"/>
<signal name="move-cursor" handler="on_list_treeview_move_cursor" 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">

View File

@ -112,5 +112,4 @@ elif updates:
else: else:
common.write_pid_file() common.write_pid_file()
pkgs_to_install = argv[1:] pkgs_to_install = argv[1:]
main.mode = 'manager'
install(pkgs_to_install) install(pkgs_to_install)

View File

@ -42,8 +42,6 @@ search_list = interface.get_object('search_list')
search_selection = interface.get_object('search_treeview_selection') search_selection = interface.get_object('search_treeview_selection')
packages_list = interface.get_object('packages_list') packages_list = interface.get_object('packages_list')
list_selection = interface.get_object('list_treeview_selection') list_selection = interface.get_object('list_treeview_selection')
installed_column = interface.get_object('installed_column')
name_column = interface.get_object('name_column')
groups_list = interface.get_object('groups_list') groups_list = interface.get_object('groups_list')
groups_selection = interface.get_object('groups_treeview_selection') groups_selection = interface.get_object('groups_treeview_selection')
state_list = interface.get_object('state_list') state_list = interface.get_object('state_list')
@ -104,7 +102,8 @@ search_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/22x22/status/package-
pkg_name_list = set() pkg_name_list = set()
current_filter = (None, None) current_filter = (None, None)
mode = 'manager' mode = None
liststore_clearing = False
states = [_('Installed'), _('Uninstalled'), _('Orphans'), _('To install'), _('To remove')] states = [_('Installed'), _('Uninstalled'), _('Orphans'), _('To install'), _('To remove')]
for state in states: for state in states:
state_list.append([state]) state_list.append([state])
@ -210,7 +209,10 @@ def refresh_packages_list():
ManagerWindow.get_root_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) ManagerWindow.get_root_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH))
while Gtk.events_pending(): while Gtk.events_pending():
Gtk.main_iteration() Gtk.main_iteration()
global liststore_clearing
liststore_clearing = True
packages_list.clear() packages_list.clear()
liststore_clearing = False
if not pkg_name_list: if not pkg_name_list:
packages_list.append([_('No package found'), False, False, False, search_icon, '', 0, '']) packages_list.append([_('No package found'), False, False, False, search_icon, '', 0, ''])
else: else:
@ -376,7 +378,7 @@ def set_transaction_sum():
while i < len(transaction_dict['to_remove']): while i < len(transaction_dict['to_remove']):
transaction_sum.append([' ', transaction_dict['to_remove'][i]]) transaction_sum.append([' ', transaction_dict['to_remove'][i]])
i += 1 i += 1
if mode == 'manager': if mode != 'updater':
if transaction_dict['to_update']: if transaction_dict['to_update']:
transaction_sum.append([_('To update')+':', transaction_dict['to_update'][0][0]]) transaction_sum.append([_('To update')+':', transaction_dict['to_update'][0][0]])
i = 1 i = 1
@ -959,26 +961,27 @@ 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_move_cursor(self, treeview, step, count): #~ def on_list_treeview_button_press_event(self, treeview, event):
liststore, treeiter = treeview.get_selection().get_selected() #~ if event.button == 1: # left click
if treeiter: #~ treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y))
if packages_list[treeiter][0] != _('No package found'): #~ treeiter = packages_list.get_iter(treepath)
if packages_list[treeiter][0] in transaction.localpkgs.keys(): #~ if treeiter:
set_infos_list(transaction.localpkgs[packages_list[treeiter][0]]) #~ if packages_list[treeiter][0] != _('No package found'):
set_deps_list(transaction.localpkgs[packages_list[treeiter][0]], "local") #~ if packages_list[treeiter][0] in transaction.localpkgs.keys():
set_details_list(transaction.localpkgs[packages_list[treeiter][0]], "local") #~ set_infos_list(transaction.localpkgs[packages_list[treeiter][0]])
set_files_list(transaction.localpkgs[packages_list[treeiter][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[treeiter][0] in transaction.syncpkgs.keys(): #~ set_files_list(transaction.localpkgs[packages_list[treeiter][0]])
set_infos_list(transaction.syncpkgs[packages_list[treeiter][0]]) #~ files_scrolledwindow.set_visible(True)
set_deps_list(transaction.syncpkgs[packages_list[treeiter][0]], "sync") #~ elif packages_list[treeiter][0] in transaction.syncpkgs.keys():
set_details_list(transaction.syncpkgs[packages_list[treeiter][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_list_treeview_button_press_event(self, treeview, event): def on_list_treeview_selection_changed(self, treeview):
if event.button == 1: # left click if not liststore_clearing:
treepath, viewcolumn, x, y = treeview.get_path_at_pos(int(event.x), int(event.y)) liststore, treeiter = list_selection.get_selected()
treeiter = packages_list.get_iter(treepath)
if treeiter: if treeiter:
if packages_list[treeiter][0] != _('No package found'): if packages_list[treeiter][0] != _('No package found'):
if packages_list[treeiter][0] in transaction.localpkgs.keys(): if packages_list[treeiter][0] in transaction.localpkgs.keys():