check updates and progress display fixes

This commit is contained in:
guinux 2014-01-29 18:52:32 +01:00
parent 5152f01be8
commit dcea80e88f
4 changed files with 32 additions and 46 deletions

View File

@ -135,10 +135,6 @@ class PamacDBusService(dbus.service.Object):
def EmitAvailableUpdates(self, updates):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitDownloadStart(self, message):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitTransactionStart(self, message):
pass
@ -153,7 +149,10 @@ class PamacDBusService(dbus.service.Object):
@dbus.service.signal('org.manjaro.pamac')
def EmitReloadConfig(self, message):
pass
# recheck aur updates next time
self.aur_updates_checked = False
# reload config
config.pamac_conf.reload()
def cb_event(self, event, tupel):
action = self.previous_action
@ -273,7 +272,6 @@ class PamacDBusService(dbus.service.Object):
action = _('Downloading')+'...'
action_long = action+'\n'
icon = '/usr/share/pamac/icons/24x24/status/package-download.png'
self.EmitDownloadStart('')
elif event == 'ALPM_EVENT_DISKSPACE_START':
action = _('Checking available disk space')+'...'
action_long = action+'\n'
@ -463,12 +461,13 @@ class PamacDBusService(dbus.service.Object):
if not self.aur_updates_checked:
self.get_local_packages()
self.local_packages -= _ignorepkgs
for pkg in self.localdb.pkgcache:
if not pkg.name in _ignorepkgs:
candidate = pyalpm.sync_newversion(pkg, self.syncdbs)
if candidate:
updates.append((candidate.name, candidate.version, candidate.db.name, '', candidate.download_size))
self.local_packages.discard(pkg.name)
for pkg in self.localdb.pkgcache:
if not pkg.name in _ignorepkgs:
candidate = pyalpm.sync_newversion(pkg, self.syncdbs)
if candidate:
updates.append((candidate.name, candidate.version, candidate.db.name, '', candidate.download_size))
self.local_packages.discard(pkg.name)
if config.enable_aur:
if not self.aur_updates_checked:
if self.local_packages:
self.aur_updates_pkgs = aur.multiinfo(self.local_packages)

View File

@ -490,6 +490,7 @@ def on_TransValidButton_clicked(*args):
transaction.finalize()
def on_TransCancelButton_clicked(*args):
transaction.ProgressWindow.hide()
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.ConfDialog.hide()
while Gtk.events_pending():
@ -504,9 +505,6 @@ def on_TransCancelButton_clicked(*args):
refresh_packages_list(current_filter[0](current_filter[1]))
def on_ProgressCloseButton_clicked(*args):
#~ transaction.ProgressWindow.hide()
#~ while Gtk.events_pending():
#~ Gtk.main_iteration()
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))

View File

@ -107,9 +107,6 @@ def handle_reply(reply):
transaction.progress_buffer.insert(end_iter, str(reply))
transaction.get_handle()
else:
#~ transaction.ProgressWindow.hide()
#~ while Gtk.events_pending():
#~ Gtk.main_iteration()
UpdaterWindow.get_window().set_cursor(None)
transaction.get_handle()
transaction.get_updates()
@ -137,6 +134,7 @@ def on_TransValidButton_clicked(*args):
def on_TransCancelButton_clicked(*args):
UpdaterWindow.get_window().set_cursor(None)
transaction.ProgressWindow.hide()
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.ConfDialog.hide()
while Gtk.events_pending():
@ -149,9 +147,6 @@ def on_TransCancelButton_clicked(*args):
def on_ProgressCloseButton_clicked(*args):
UpdaterWindow.get_window().set_cursor(None)
#~ transaction.ProgressWindow.hide()
#~ while Gtk.events_pending():
#~ Gtk.main_iteration()
transaction.progress_buffer.delete(transaction.progress_buffer.get_start_iter(),transaction.progress_buffer.get_end_iter())
transaction.need_details_handler(False)
transaction.get_updates()

View File

@ -136,7 +136,6 @@ def config_dbus_signals():
bus.add_signal_receiver(target_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTarget")
bus.add_signal_receiver(percent_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitPercent")
bus.add_signal_receiver(need_details_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitNeedDetails")
bus.add_signal_receiver(download_start_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitDownloadStart")
bus.add_signal_receiver(transaction_start_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionStart")
bus.add_signal_receiver(log_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitLogError")
bus.add_signal_receiver(log_warning, dbus_interface = "org.manjaro.pamac", signal_name = "EmitLogWarning")
@ -166,14 +165,6 @@ def percent_handler(percent):
def transaction_start_handler(msg):
ProgressCancelButton.set_visible(False)
ProgressWindow.show()
while Gtk.events_pending():
Gtk.main_iteration()
def download_start_handler(msg):
ProgressWindow.show()
while Gtk.events_pending():
Gtk.main_iteration()
def log_error(msg):
ErrorDialog.format_secondary_text(msg)
@ -410,7 +401,7 @@ def run(cascade = True, recurse = False):
progress_buffer.delete(progress_buffer.get_start_iter(), progress_buffer.get_end_iter())
ProgressCancelButton.set_visible(False)
ProgressCloseButton.set_visible(False)
progress_expander.set_visible(False)
progress_expander.set_visible(True)
ProgressWindow.show()
while Gtk.events_pending():
Gtk.main_iteration()
@ -422,6 +413,7 @@ def run(cascade = True, recurse = False):
error += check_to_build()
if not error:
if to_add or to_remove or to_load:
ProgressCancelButton.set_visible(True)
while Gtk.events_pending():
Gtk.main_iteration()
trans_flags = {'cascade': cascade, 'recurse': recurse}
@ -437,7 +429,6 @@ def run(cascade = True, recurse = False):
error += prepare(**trans_flags)
if not error:
set_transaction_sum()
ProgressWindow.hide()
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
@ -659,15 +650,6 @@ def build_next():
def finalize():
if To_Add() or To_Remove():
global progress_buffer
action_handler(_('Preparing')+'...')
icon_handler('/usr/share/pamac/icons/24x24/status/package-setup.png')
target_handler('')
percent_handler(0)
progress_buffer.delete(progress_buffer.get_start_iter(), progress_buffer.get_end_iter())
ProgressCancelButton.set_visible(True)
ProgressCloseButton.set_visible(False)
progress_expander.set_visible(True)
try:
Commit()
except dbus.exceptions.DBusException as e:
@ -796,14 +778,26 @@ def set_transaction_sum(show_updates = True):
sum_bottom_label.set_markup('<b>{} {}</b>'.format(_('Total download size:'), common.format_size(dsize)))
def sysupgrade(show_updates = True):
global to_update
global to_add
global to_remove
syncfirst, updates = available_updates
if updates:
global to_update
global to_add
global to_remove
global progress_buffer
to_update.clear()
to_add.clear()
to_remove.clear()
action_handler(_('Preparing')+'...')
icon_handler('/usr/share/pamac/icons/24x24/status/package-setup.png')
target_handler('')
percent_handler(0)
progress_buffer.delete(progress_buffer.get_start_iter(), progress_buffer.get_end_iter())
ProgressCancelButton.set_visible(False)
ProgressCloseButton.set_visible(False)
progress_expander.set_visible(True)
ProgressWindow.show()
while Gtk.events_pending():
Gtk.main_iteration()
for name, version, db, tarpath, size in updates:
if db == 'AUR':
# call AURPkg constructor directly to avoid a request to AUR
@ -814,6 +808,7 @@ def sysupgrade(show_updates = True):
to_update.add(name)
error = ''
if syncfirst:
ProgressCancelButton.set_visible(True)
error += init_transaction()
if not error:
for name in to_update:
@ -826,6 +821,7 @@ def sysupgrade(show_updates = True):
# grab errors differently here to not break regular updates
_error = check_to_build()
if to_update or to_add:
ProgressCancelButton.set_visible(True)
error += init_transaction()
if not error:
if to_update:
@ -840,13 +836,11 @@ def sysupgrade(show_updates = True):
if not error:
set_transaction_sum(show_updates = show_updates)
if show_updates:
ProgressWindow.hide()
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
else:
if len(transaction_sum) != 0:
ProgressWindow.hide()
ConfDialog.show_all()
while Gtk.events_pending():
Gtk.main_iteration()