From e032dfa8f01291532d4dc095ae9fa887f748f157 Mon Sep 17 00:00:00 2001 From: guinux Date: Wed, 12 Feb 2014 16:06:15 +0100 Subject: [PATCH] move refresh button and do not auto-refresh at manager startup --- gui/dialogs.ui | 12 +++++++++++ gui/manager.ui | 53 ++++++++++++++++++++++++++++++------------------ pamac-daemon.py | 9 +++++--- pamac-manager.py | 41 ++++++++++++++++++++++++++++--------- pamac-updater.py | 2 +- 5 files changed, 83 insertions(+), 34 deletions(-) diff --git a/gui/dialogs.ui b/gui/dialogs.ui index 2907484..2608fd5 100644 --- a/gui/dialogs.ui +++ b/gui/dialogs.ui @@ -7,7 +7,9 @@ False True center-on-parent + system-software-install dialog + True False error ok @@ -38,7 +40,10 @@ False True center-on-parent + system-software-install dialog + True + False ok @@ -214,8 +219,12 @@ False False + True center-on-parent + system-software-install dialog + True + False question yes-no @@ -242,8 +251,11 @@ False False + True center-on-parent dialog + True + False warning ok diff --git a/gui/manager.ui b/gui/manager.ui index edcb836..01facf9 100644 --- a/gui/manager.ui +++ b/gui/manager.ui @@ -128,6 +128,12 @@ + + True + False + gtk-file + 1 + @@ -140,12 +146,6 @@ - - True - False - gtk-file - 1 - True False @@ -155,22 +155,12 @@ True False - - - gtk-refresh - True - False - True - True - - - View History True False - image1 + file_icon False @@ -300,6 +290,11 @@ + + True + False + gtk-refresh + @@ -341,6 +336,24 @@ True False + + + True + True + True + Refresh + refresh_icon + none + False + True + + + + False + True + 0 + + True @@ -356,7 +369,7 @@ False True - 0 + 1 @@ -374,7 +387,7 @@ False True - 1 + 2 @@ -392,7 +405,7 @@ False True - 2 + 3 diff --git a/pamac-daemon.py b/pamac-daemon.py index 673bdac..3a4fb0b 100755 --- a/pamac-daemon.py +++ b/pamac-daemon.py @@ -335,14 +335,14 @@ class PamacDBusService(dbus.service.Object): if not (level & _logmask): return if level & pyalpm.LOG_ERROR: - self.EmitLogError(line) - _error = "ERROR: "+line + #self.EmitLogError(line) + _error = _('Error: ')+line self.EmitActionLong(_error) self.EmitNeedDetails(True) print(line) elif level & pyalpm.LOG_WARNING: self.warning += line - _warning = "WARNING: "+line + _warning = _('WARNING: ')+line self.EmitActionLong(_warning) elif level & pyalpm.LOG_DEBUG: line = "DEBUG: " + line @@ -549,6 +549,9 @@ class PamacDBusService(dbus.service.Object): error = '' try: for db in self.syncdbs: + # this is a security, in case of virtual package it will + # choose the first provider, the choice should have been + # done by the client pkg = pyalpm.find_satisfier(db.pkgcache, pkgname) if pkg: self.t.add_pkg(pkg) diff --git a/pamac-manager.py b/pamac-manager.py index cee292a..d76e317 100755 --- a/pamac-manager.py +++ b/pamac-manager.py @@ -424,7 +424,6 @@ def set_files_list(pkg): def handle_error(error): ManagerWindow.get_window().set_cursor(None) - transaction.ProgressWindow.hide() while Gtk.events_pending(): Gtk.main_iteration() if error: @@ -434,6 +433,7 @@ def handle_error(error): response = transaction.ErrorDialog.run() if response: transaction.ErrorDialog.hide() + transaction.ProgressWindow.hide() transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter()) transaction.Release() transaction.get_handle() @@ -491,7 +491,7 @@ def reload_config(msg): if config.enable_aur == False: search_aur_button.set_active(False) search_aur_button.set_visible(config.enable_aur) - transaction.get_updates() + #transaction.get_updates() def on_ManagerWindow_delete_event(*args): transaction.StopDaemon() @@ -524,11 +524,13 @@ def on_TransCancelButton_clicked(*args): def on_ProgressCloseButton_clicked(*args): transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter()) transaction.need_details_handler(False) - ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) - while Gtk.events_pending(): - Gtk.main_iteration() transaction.to_build.clear() - transaction.get_updates() + #ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) + #while Gtk.events_pending(): + #Gtk.main_iteration() + #transaction.get_updates() + ManagerWindow.get_window().set_cursor(None) + transaction.ProgressWindow.hide() def on_ProgressCancelButton_clicked(*args): ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) @@ -597,6 +599,25 @@ def select_optdeps(widget, pkg, optdeps): for long_string in optdeps: transaction.choose_list.append([False, long_string]) transaction.ChooseDialog.run() + # some optdep can be virtual package so check for providers + for name in transaction.to_add: + if not transaction.get_syncpkg(name): + transaction.to_add.discard(name) + # if a provider is already installed, do nothing + if pyalpm.find_satisfier(transaction.localdb.pkgcache, name): + continue + providers = set() + for db in transaction.syncdbs: + pkgs = db.pkgcache + provider = pyalpm.find_satisfier(pkgs, name) + while provider: + providers.add(provider.name) + for pkg in pkgs: + if pkg.name == provider.name: + pkgs.remove(pkg) + break + provider = pyalpm.find_satisfier(pkgs, name) + transaction.choose_provides((providers, name)) if transaction.to_add: ManagerValidButton.set_sensitive(True) ManagerCancelButton.set_sensitive(True) @@ -823,7 +844,7 @@ def on_ManagerCancelButton_clicked(*args): if current_filter[0]: refresh_packages_list(current_filter[0](current_filter[1])) -def on_refresh_item_activate(*args): +def on_ManagerRefreshButton_clicked(*args): ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) while Gtk.events_pending(): Gtk.main_iteration() @@ -960,7 +981,7 @@ signals = {'on_ManagerWindow_delete_event' : on_ManagerWindow_delete_event, 'on_notebook1_switch_page' : on_notebook1_switch_page, 'on_ManagerCancelButton_clicked' : on_ManagerCancelButton_clicked, 'on_ManagerValidButton_clicked' : on_ManagerValidButton_clicked, - 'on_refresh_item_activate' : on_refresh_item_activate, + 'on_ManagerRefreshButton_clicked' : on_ManagerRefreshButton_clicked, 'on_history_item_activate' : on_history_item_activate, 'on_history_textview_size_allocate' : on_history_textview_size_allocate, 'on_HistoryCloseButton_clicked' : on_HistoryCloseButton_clicked, @@ -1003,8 +1024,8 @@ else: transaction.get_handle() update_lists() ManagerWindow.show() - ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) - transaction.refresh() + #ManagerWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) + #transaction.refresh() while Gtk.events_pending(): Gtk.main_iteration() Gtk.main() diff --git a/pamac-updater.py b/pamac-updater.py index 8755fd8..df5bbfa 100755 --- a/pamac-updater.py +++ b/pamac-updater.py @@ -80,7 +80,6 @@ def have_updates(): def handle_error(error): UpdaterWindow.get_window().set_cursor(None) - transaction.ProgressWindow.hide() while Gtk.events_pending(): Gtk.main_iteration() if error: @@ -90,6 +89,7 @@ def handle_error(error): response = transaction.ErrorDialog.run() if response: transaction.ErrorDialog.hide() + transaction.ProgressWindow.hide() transaction.get_handle() transaction.mark_needed_pkgs_as_dep()