last fixes for next release

This commit is contained in:
guinux 2013-03-18 15:29:20 +01:00
parent 8a5abb4b47
commit caca63de0e
4 changed files with 37 additions and 21 deletions

View File

@ -26,12 +26,17 @@ class PamacDBusService(dbus.service.Object):
self.percent = 0 self.percent = 0
self.total_size = 0 self.total_size = 0
self.already_transferred = 0 self.already_transferred = 0
config.handle.dlcb = self.cb_dl self.handle = config.handle()
config.handle.totaldlcb = self.totaldlcb
config.handle.eventcb = self.cb_event def get_handle(self):
config.handle.questioncb = self.cb_conv print('daemon get handle')
config.handle.progresscb = self.cb_progress self.handle = config.handle()
config.handle.logcb = self.cb_log self.handle.dlcb = self.cb_dl
self.handle.totaldlcb = self.totaldlcb
self.handle.eventcb = self.cb_event
self.handle.questioncb = self.cb_conv
self.handle.progresscb = self.cb_progress
self.handle.logcb = self.cb_log
@dbus.service.signal('org.manjaro.pamac') @dbus.service.signal('org.manjaro.pamac')
def EmitAction(self, action): def EmitAction(self, action):
@ -181,8 +186,16 @@ class PamacDBusService(dbus.service.Object):
def CheckUpdates(self): def CheckUpdates(self):
updates = 0 updates = 0
for pkg in config.handle.get_localdb().pkgcache: if config.syncfirst:
candidate = pyalpm.sync_newversion(pkg, config.handle.get_syncdbs()) for name in config.syncfirst:
pkg = self.handle.get_localdb().get_pkg(name)
if pkg:
candidate = pyalpm.sync_newversion(pkg, self.handle.get_syncdbs())
if candidate:
updates += 1
if not updates:
for pkg in self.handle.get_localdb().pkgcache:
candidate = pyalpm.sync_newversion(pkg, self.handle.get_syncdbs())
if candidate: if candidate:
updates += 1 updates += 1
self.EmitAvailableUpdates(updates) self.EmitAvailableUpdates(updates)
@ -193,20 +206,23 @@ class PamacDBusService(dbus.service.Object):
self.target = '' self.target = ''
self.percent = 0 self.percent = 0
self.error = '' self.error = ''
for db in config.handle.get_syncdbs(): for db in self.handle.get_syncdbs():
try: try:
self.t = config.handle.init_transaction() self.t = self.handle.init_transaction()
db.update(force=False) db.update(force=False)
except pyalpm.error as e: except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n' self.error += ' --> '+str(e)+'\n'
#break #break
finally: finally:
try:
self.t.release() self.t.release()
self.CheckUpdates() except:
pass
if self.error: if self.error:
self.EmitTransactionError(self.error) self.EmitTransactionError(self.error)
else: else:
self.EmitTransactionDone('') self.EmitTransactionDone('')
self.CheckUpdates()
self.task = Process(target=refresh) self.task = Process(target=refresh)
self.task.start() self.task.start()
success('') success('')
@ -216,7 +232,8 @@ class PamacDBusService(dbus.service.Object):
self.error = '' self.error = ''
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'): if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
try: try:
self.t = config.handle.init_transaction(**options) self.get_handle()
self.t = self.handle.init_transaction(**options)
print('Init:',self.t.flags) print('Init:',self.t.flags)
except pyalpm.error as e: except pyalpm.error as e:
self.error += ' --> '+str(e)+'\n' self.error += ' --> '+str(e)+'\n'
@ -240,7 +257,7 @@ class PamacDBusService(dbus.service.Object):
def Remove(self, pkgname): def Remove(self, pkgname):
self.error = '' self.error = ''
try: try:
pkg = config.handle.get_localdb().get_pkg(pkgname) pkg = self.handle.get_localdb().get_pkg(pkgname)
if pkg is not None: if pkg is not None:
self.t.remove_pkg(pkg) self.t.remove_pkg(pkg)
except pyalpm.error as e: except pyalpm.error as e:
@ -252,7 +269,7 @@ class PamacDBusService(dbus.service.Object):
def Add(self, pkgname): def Add(self, pkgname):
self.error = '' self.error = ''
try: try:
for repo in config.handle.get_syncdbs(): for repo in self.handle.get_syncdbs():
pkg = repo.get_pkg(pkgname) pkg = repo.get_pkg(pkgname)
if pkg: if pkg:
self.t.add_pkg(pkg) self.t.add_pkg(pkg)

View File

@ -91,7 +91,6 @@ def set_icon(updates):
if updates: if updates:
icon = update_icon icon = update_icon
info = update_info.format(updates) info = update_info.format(updates)
if not common.pid_file_exists():
call(['notify-send', '-i', icon, '-u', 'normal', 'Pamac', info]) call(['notify-send', '-i', icon, '-u', 'normal', 'Pamac', info])
else: else:
icon = noupdate_icon icon = noupdate_icon

View File

@ -185,7 +185,7 @@ class PacmanConfig(object):
return("PacmanConfig(options=%s, repos=%s)" % (str(self.options), str(self.repos))) return("PacmanConfig(options=%s, repos=%s)" % (str(self.options), str(self.repos)))
pacman_conf = PacmanConfig(conf = "/etc/pacman.conf") pacman_conf = PacmanConfig(conf = "/etc/pacman.conf")
handle = pacman_conf.initialize_alpm() handle = pacman_conf.initialize_alpm
holdpkg = [] holdpkg = []
syncfirst = [] syncfirst = []
if 'HoldPkg' in pacman_conf.options: if 'HoldPkg' in pacman_conf.options:

View File

@ -680,7 +680,7 @@ class Handler:
def on_Manager_RefreshButton_clicked(self, *arg): def on_Manager_RefreshButton_clicked(self, *arg):
do_refresh() do_refresh()
set_packages_list() #set_packages_list()
def on_TransCancelButton_clicked(self, *arg): def on_TransCancelButton_clicked(self, *arg):
global transaction_type global transaction_type