fix miscelleanous bugs

This commit is contained in:
guinux 2013-11-24 17:02:04 +01:00
parent 8aaed3ec9c
commit 5c143a9fb5
4 changed files with 42 additions and 22 deletions

View File

@ -365,7 +365,7 @@ class PamacDBusService(dbus.service.Object):
else: else:
percent = round(_percent/100, 2) percent = round(_percent/100, 2)
if target != self.previous_target: if target != self.previous_target:
self.previous_target = target.format() self.previous_target = target
if percent != self.previous_percent: if percent != self.previous_percent:
self.EmitTarget('{}/{}'.format(str(i), str(n))) self.EmitTarget('{}/{}'.format(str(i), str(n)))
self.previous_percent = percent self.previous_percent = percent
@ -401,6 +401,7 @@ class PamacDBusService(dbus.service.Object):
syncfirst = False syncfirst = False
updates = [] updates = []
_ignorepkgs = set() _ignorepkgs = set()
self.get_handle()
self.get_local_packages() self.get_local_packages()
for group in self.handle.ignoregrps: for group in self.handle.ignoregrps:
db = self.localdb db = self.localdb
@ -428,6 +429,7 @@ class PamacDBusService(dbus.service.Object):
if candidate: if candidate:
updates.append((candidate.name, candidate.version, candidate.db.name, '', candidate.download_size)) updates.append((candidate.name, candidate.version, candidate.db.name, '', candidate.download_size))
self.local_packages.discard(pkg.name) self.local_packages.discard(pkg.name)
if self.local_packages:
aur_pkgs = aur.multiinfo(self.local_packages) aur_pkgs = aur.multiinfo(self.local_packages)
for aur_pkg in aur_pkgs: for aur_pkg in aur_pkgs:
comp = pyalpm.vercmp(aur_pkg.version, self.localdb.get_pkg(aur_pkg.name).version) comp = pyalpm.vercmp(aur_pkg.version, self.localdb.get_pkg(aur_pkg.name).version)
@ -455,7 +457,7 @@ class PamacDBusService(dbus.service.Object):
self.EmitTransactionDone('') self.EmitTransactionDone('')
self.task = Process(target=refresh) self.task = Process(target=refresh)
self.task.start() self.task.start()
GObject.timeout_add(500, self.check_finished_commit) GObject.timeout_add(100, self.check_finished_commit)
success('') success('')
@dbus.service.method('org.manjaro.pamac', 'a{sb}', 's') @dbus.service.method('org.manjaro.pamac', 'a{sb}', 's')
@ -704,7 +706,7 @@ class PamacDBusService(dbus.service.Object):
if authorized: if authorized:
self.task = Process(target=commit) self.task = Process(target=commit)
self.task.start() self.task.start()
GObject.timeout_add(500, self.check_finished_commit) GObject.timeout_add(100, self.check_finished_commit)
else : else :
self.t.release() self.t.release()
self.EmitTransactionError(_('Authentication failed')) self.EmitTransactionError(_('Authentication failed'))

View File

@ -1,7 +1,7 @@
#! /usr/bin/python3 #! /usr/bin/python3
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
version = '0.9.2' version = '0.9.3'
from gi.repository import Gtk, Gdk from gi.repository import Gtk, Gdk
from gi.repository.GdkPixbuf import Pixbuf from gi.repository.GdkPixbuf import Pixbuf

View File

@ -133,6 +133,10 @@ def info(pkgname):
return [] return []
else: else:
results_dict = r.json() results_dict = r.json()
if results_dict['type'] == 'error':
print('failed to get infos about {} from AUR'.format(pkgname))
return None
else:
result = results_dict['results'] result = results_dict['results']
if result: if result:
pkg = AURPkg(result) pkg = AURPkg(result)
@ -151,8 +155,12 @@ def multiinfo(pkgnames):
return [] return []
else: else:
results_dict = r.json() results_dict = r.json()
results = results_dict['results'] if results_dict['type'] == 'error':
print('failed to get infos about {} from AUR'.format(pkgnames))
return []
else:
pkgs = [] pkgs = []
results = results_dict['results']
if results: if results:
for result in results: for result in results:
pkgs.append(AURPkg(result)) pkgs.append(AURPkg(result))

View File

@ -123,6 +123,8 @@ def write_to_buffer(fd, condition):
#print(line.rstrip('\n')) #print(line.rstrip('\n'))
progress_buffer.insert_at_cursor(line) progress_buffer.insert_at_cursor(line)
progress_bar.pulse() progress_bar.pulse()
while Gtk.events_pending():
Gtk.main_iteration()
return True # FUNDAMENTAL, otherwise the callback isn't recalled return True # FUNDAMENTAL, otherwise the callback isn't recalled
else: else:
return False # Raised an error: exit return False # Raised an error: exit
@ -454,6 +456,9 @@ def check_finished_build(data):
path = data[0] path = data[0]
pkg = data[1] pkg = data[1]
if build_proc.poll() is None: if build_proc.poll() is None:
progress_bar.pulse()
while Gtk.events_pending():
Gtk.main_iteration()
return True return True
elif build_proc.poll() == 0: elif build_proc.poll() == 0:
built = [] built = []
@ -464,7 +469,8 @@ def check_finished_build(data):
for new_pkg in new_pkgs: for new_pkg in new_pkgs:
for item in os.listdir(path): for item in os.listdir(path):
if os.path.isfile(os.path.join(path, item)): if os.path.isfile(os.path.join(path, item)):
if fnmatch.fnmatch(item, '{}-{}-*.pkg.tar.?z'.format(new_pkg.name, new_pkg.version)): # add a * before pkgver if there an epoch variable
if fnmatch.fnmatch(item, '{}-*{}-*.pkg.tar.?z'.format(new_pkg.name, new_pkg.version)):
built.append(os.path.join(path, item)) built.append(os.path.join(path, item))
break break
if built: if built:
@ -496,6 +502,10 @@ def check_finished_build(data):
response = ErrorDialog.run() response = ErrorDialog.run()
if response: if response:
ErrorDialog.hide() ErrorDialog.hide()
else:
ProgressCancelButton.set_visible(False)
ProgressCloseButton.set_visible(True)
action_long_handler(_('Build process failed.'))
return False return False
elif build_proc.poll() == 1: elif build_proc.poll() == 1:
ProgressCancelButton.set_visible(False) ProgressCancelButton.set_visible(False)