pamac-daemon moved as bin, many fixes

This commit is contained in:
guinux 2013-03-01 19:11:55 +01:00
parent 96728a14b0
commit 5dd644ecc4
5 changed files with 170 additions and 515 deletions

View File

@ -36,111 +36,6 @@
</object>
</child>
</object>
<object class="GtkWindow" id="ProgressWindow">
<property name="width_request">250</property>
<property name="height_request">60</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Progress</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">250</property>
<property name="default_height">60</property>
<property name="icon">/usr/share/pamac/icons/22x22/status/setup.png</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<property name="has_resize_grip">False</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="action_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">/usr/share/pamac/icons/24x24/status/setup.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="progresslabel2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progressbar2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pulse_step">0.050000000000000003</property>
<property name="text" translatable="yes"> </property>
<property name="show_text">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ProgressCancelButton">
<property name="label">gtk-cancel</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="xalign">1</property>
<signal name="clicked" handler="on_ProgressCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkMessageDialog" id="QuestionDialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>

View File

@ -611,6 +611,111 @@
</object>
</child>
</object>
<object class="GtkWindow" id="ProgressWindow">
<property name="width_request">250</property>
<property name="height_request">60</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Progress</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">250</property>
<property name="default_height">60</property>
<property name="icon">/usr/share/pamac/icons/22x22/status/setup.png</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<property name="has_resize_grip">False</property>
<child>
<object class="GtkBox" id="box8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="action_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pixbuf">/usr/share/pamac/icons/24x24/status/setup.png</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="progresslabel2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progressbar2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="pulse_step">0.050000000000000003</property>
<property name="text" translatable="yes"> </property>
<property name="show_text">True</property>
<property name="ellipsize">end</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="buttonbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ProgressCancelButton">
<property name="label">gtk-cancel</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="xalign">1</property>
<signal name="clicked" handler="on_ProgressCancelButton_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkListStore" id="choose_list">
<columns>
<!-- column-name gboolean1 -->

View File

@ -4,6 +4,7 @@
from gi.repository import Gtk
import pyalpm
import dbus
from collections import OrderedDict
from time import strftime, localtime
@ -15,11 +16,6 @@ interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
ErrorDialog = interface.get_object('ErrorDialog')
WarningDialog = interface.get_object('WarningDialog')
QuestionDialog = interface.get_object('QuestionDialog')
ProgressWindow = interface.get_object('ProgressWindow')
progress_bar = interface.get_object('progressbar2')
progress_label = interface.get_object('progresslabel2')
action_icon = interface.get_object('action_icon')
ProgressCancelButton = interface.get_object('ProgressCancelButton')
interface.add_from_file('/usr/share/pamac/gui/manager.glade')
ManagerWindow = interface.get_object("ManagerWindow")
@ -39,15 +35,56 @@ sum_bottom_label = interface.get_object('sum_bottom_label')
ChooseDialog = interface.get_object('ChooseDialog')
choose_list = interface.get_object('choose_list')
choose_label = interface.get_object('choose_label')
ProgressWindow = interface.get_object('ProgressWindow')
progress_bar = interface.get_object('progressbar2')
progress_label = interface.get_object('progresslabel2')
action_icon = interface.get_object('action_icon')
ProgressCancelButton = interface.get_object('ProgressCancelButton')
interface.add_from_file('/usr/share/pamac/gui/updater.glade')
UpdaterWindow = interface.get_object("UpdaterWindow")
update_listore = interface.get_object('update_list')
update_label = interface.get_object('update_label')
def action_signal_handler(action):
progress_label.set_text(action)
#if 'Downloading' in action:
# print('cancel enabled')
# ProgressCancelButton.set_visible(True)
#else:
ProgressCancelButton.set_visible(False)
#print('cancel disabled')
def icon_signal_handler(icon):
action_icon.set_from_file(icon)
def target_signal_handler(target):
progress_bar.set_text(target)
def percent_signal_handler(percent):
if percent == '0':
progress_bar.pulse()
else:
progress_bar.set_fraction(float(percent))
bus = dbus.SystemBus()
bus.add_signal_receiver(action_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAction")
bus.add_signal_receiver(icon_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitIcon")
bus.add_signal_receiver(target_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTarget")
bus.add_signal_receiver(percent_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitPercent")
installed_column.set_sort_column_id(1)
name_column.set_sort_column_id(0)
pkg_name_list = []
pkg_object_dict = {}
pkg_installed_dict = {}
list_dict = None
current_group = None
transaction_type = None
transaction_dict = {}
mode = None
def get_groups():
tmp_list = []
for repo in transaction.handle.get_syncdbs():
@ -58,15 +95,6 @@ def get_groups():
for name in tmp_list:
groups_list.append([name])
pkg_name_list = []
pkg_object_dict = {}
pkg_installed_dict = {}
list_dict = None
current_group = None
transaction_type = None
transaction_dict = {}
mode = None
def set_list_dict_search(*patterns):
global pkg_name_list
global pkg_object_dict
@ -255,7 +283,7 @@ def handle_error(error):
transaction.ErrorDialog.hide()
transaction.t_lock = False
transaction.Release()
transaction.ProgressWindow.hide()
ProgressWindow.hide()
if mode == 'manager':
transaction.to_add = []
transaction.to_remove = []
@ -278,7 +306,7 @@ def handle_reply(reply):
transaction.ErrorDialog.hide()
transaction.t_lock = False
transaction.Release()
transaction.ProgressWindow.hide()
ProgressWindow.hide()
transaction.to_add = []
transaction.to_remove = []
transaction_dict.clear()
@ -297,9 +325,9 @@ def do_refresh():
"""Sync databases like pacman -Sy"""
if transaction.t_lock is False:
transaction.t_lock = True
transaction.progress_label.set_text('Refreshing...')
transaction.action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
transaction.ProgressWindow.show_all()
progress_label.set_text('Refreshing...')
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
ProgressWindow.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
transaction.Refresh(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
@ -377,10 +405,10 @@ def do_sysupgrade():
ConfDialog.show_all()
def finalize():
transaction.progress_label.set_text('Preparing...')
transaction.action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/setup.png')
transaction.progress_bar.set_text('')
transaction.ProgressWindow.show_all()
progress_label.set_text('Preparing...')
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/setup.png')
progress_bar.set_text('')
ProgressWindow.show_all()
while Gtk.events_pending():
Gtk.main_iteration()
transaction.Commit(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
@ -522,8 +550,16 @@ def check_conflicts(pkg_list):
response = transaction.WarningDialog.run()
if response:
transaction.WarningDialog.hide()
pkg_list = {}
for pkgname in transaction.to_remove:
pkg = transaction.localpkgs[pkgname]
pkg_list[pkgname] = transaction.localpkgs[pkgname]
for pkgname in transaction.to_add:
pkg = transaction.syncpkgs[pkgname]
for replace in pkg.replaces:
provide = pyalpm.find_satisfier(pkg_list.values(), replace)
if provide:
pkg_list.pop(provide.name)
for pkg in pkg_list.values():
required = pkg.compute_requiredby()
if required:
str_required = ''
@ -633,7 +669,7 @@ class Handler:
def on_TransCancelButton_clicked(self, *arg):
global transaction_type
transaction.ProgressWindow.hide()
ProgressWindow.hide()
ConfDialog.hide()
transaction.t_lock = False
transaction.Release()
@ -758,10 +794,8 @@ class Handler:
do_refresh()
def on_ProgressCancelButton_clicked(self, *arg):
transaction.t_lock = False
transaction.Release()
transaction.ProgressWindow.hide()
have_updates()
print('cancelled')
#handle_reply('')
def main(_mode):
if common.pid_file_exists():

View File

@ -1,340 +0,0 @@
#! /usr/bin/python
# -*-coding:utf-8-*-
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GObject
import pyalpm
import traceback
from pamac import config, common
class PamacDBusService(dbus.service.Object):
def __init__(self):
bus=dbus.SystemBus()
bus_name = dbus.service.BusName('org.manjaro.pamac', bus)
dbus.service.Object.__init__(self, bus_name, '/org/manjaro/pamac')
self.t = None
self.error = ''
self.warning = ''
self.action = 'Preparing...'
self.icon = '/usr/share/pamac/icons/24x24/status/setup.png'
self.target = ''
self.percent = 0
self.total_size = 0
self.already_transferred = 0
config.handle.dlcb = self.cb_dl
config.handle.totaldlcb = self.totaldlcb
config.handle.eventcb = self.cb_event
config.handle.questioncb = self.cb_conv
config.handle.progresscb = self.cb_progress
config.handle.logcb = self.cb_log
@dbus.service.signal('org.manjaro.pamac')
def EmitAction(self, action):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitIcon(self, icon):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitTarget(self, target):
pass
@dbus.service.signal('org.manjaro.pamac')
def EmitPercent(self, percent):
pass
def cb_event(self, ID, event, tupel):
if ID is 1:
self.action = 'Checking dependencies...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 3:
self.action = 'Checking file conflicts...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 5:
self.action = 'Resolving dependencies...'
self.icon = '/usr/share/pamac/icons/24x24/status/setup.png'
elif ID is 7:
self.action = 'Checking inter conflicts...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 9:
self.action = 'Installing...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
elif ID is 10:
formatted_event = 'Installed {} ({})'.format(tupel[0].name, tupel[0].version)
common.write_log_file(formatted_event)
print(formatted_event)
elif ID is 11:
self.action = 'Removing...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-delete.png'
elif ID is 12:
formatted_event = 'Removed {} ({})'.format(tupel[0].name, tupel[0].version)
common.write_log_file(formatted_event)
print(formatted_event)
elif ID is 13:
self.action = 'Upgrading...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-update.png'
elif ID is 14:
formatted_event = 'Upgraded {} ({} -> {})'.format(tupel[1].name, tupel[1].version, tupel[0].version)
common.write_log_file(formatted_event)
print(formatted_event)
elif ID is 15:
self.action = 'Checking integrity...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
self.already_transferred = 0
elif ID is 17:
self.action = 'Loading packages files...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
print('Loading packages files')
elif ID is 26:
self.action = 'Configuring...'
self.icon = '/usr/share/pamac/icons/24x24/status/setup.png'
print('Configuring a package')
elif ID is 27:
print('Downloading a file')
else :
self.action = ''
self.EmitTarget('')
self.EmitPercent(str(0))
self.EmitAction(self.action)
self.EmitIcon(self.icon)
print(ID,event)
def cb_conv(self, *args):
print("conversation", args)
def cb_log(self, level, line):
#global t
_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
if not (level & _logmask):
return
if level & pyalpm.LOG_ERROR:
self.error += "ERROR: "+line
#t.release()
elif level & pyalpm.LOG_WARNING:
self.warning += "WARNING: "+line
elif level & pyalpm.LOG_DEBUG:
line = "DEBUG: " + line
print(line)
elif level & pyalpm.LOG_FUNCTION:
line = "FUNC: " + line
print(line)
def totaldlcb(self, _total_size):
self.total_size = _total_size
def cb_dl(self, _target, _transferred, total):
if self.total_size > 0:
fraction = (_transferred+self.already_transferred)/self.total_size
size = 0
if (t.to_remove or t.to_add):
for pkg in t.to_remove+t.to_add:
if pkg.name+'-'+pkg.version in _target:
size = pkg.size
if _transferred == size:
self.already_transferred += size
self.action = 'Downloading '+common.format_size(self.total_size)
self.target = _target
if fraction > 1:
self.percent = 0
else:
self.percent = fraction
self.icon = '/usr/share/pamac/icons/24x24/status/package-download.png'
else:
self.action = 'Refreshing...'
self.target = _target
self.percent = 0
self.icon = '/usr/share/pamac/icons/24x24/status/refresh-cache.png'
self.EmitAction(self.action)
self.EmitIcon(self.icon)
self.EmitTarget(self.target)
self.EmitPercent(str(self.percent))
def cb_progress(self, _target, _percent, n, i):
self.target = _target+' ('+str(i)+'/'+str(n)+')'
self.percent = _percent/100
self.EmitTarget(self.target)
self.EmitPercent(str(self.percent))
def policykit_test(self, sender,connexion, action):
bus = dbus.SystemBus()
proxy_dbus = connexion.get_object('org.freedesktop.DBus','/org/freedesktop/DBus/Bus', False)
dbus_info = dbus.Interface(proxy_dbus,'org.freedesktop.DBus')
sender_pid = dbus_info.GetConnectionUnixProcessID(sender)
proxy_policykit = bus.get_object('org.freedesktop.PolicyKit1','/org/freedesktop/PolicyKit1/Authority',False)
policykit_authority = dbus.Interface(proxy_policykit,'org.freedesktop.PolicyKit1.Authority')
Subject = ('unix-process', {'pid': dbus.UInt32(sender_pid, variant_level=1),
'start-time': dbus.UInt64(0, variant_level=1)})
(is_authorized,is_challenge,details) = policykit_authority.CheckAuthorization(Subject, action, {'': ''}, dbus.UInt32(1), '')
return is_authorized
@dbus.service.signal('org.manjaro.pamac')
def EmitAvailableUpdates(self, updates_nb):
pass
def CheckUpdates(self):
updates = False
for pkg in config.handle.get_localdb().pkgcache:
candidate = pyalpm.sync_newversion(pkg, config.handle.get_syncdbs())
if candidate:
updates = True
self.EmitAvailableUpdates(updates)
@dbus.service.method('org.manjaro.pamac', '', 's')
def Refresh(self):
global t
#~ global error
#~ error = ''
for db in config.handle.get_syncdbs():
try:
t = config.handle.init_transaction()
db.update(force=False)
t.release()
except pyalpm.error as e:
self.error += str(e)+'\n'
t.release()
#break
self.CheckUpdates()
return self.error
@dbus.service.method('org.manjaro.pamac', 'a{sb}', 's', sender_keyword='sender', connection_keyword='connexion')
def Init(self, options, sender=None, connexion=None):
global t
global error
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
error = ''
try:
t = config.handle.init_transaction(**options)
print('Init:',t.flags)
except pyalpm.error:
error = traceback.format_exc()
finally:
return error
else :
return 'You are not authorized'
@dbus.service.method('org.manjaro.pamac', '', 's')
def Sysupgrade(self):
global t
global error
error = ''
try:
t.sysupgrade(downgrade=False)
print('to_upgrade:',t.to_add)
except pyalpm.error:
error = traceback.format_exc()
finally:
return error
@dbus.service.method('org.manjaro.pamac', 's', 's')
def Remove(self, pkgname):
global t
global error
error = ''
try:
pkg = config.handle.get_localdb().get_pkg(pkgname)
if pkg is not None:
t.remove_pkg(pkg)
except pyalpm.error:
error = traceback.format_exc()
finally:
return error
@dbus.service.method('org.manjaro.pamac', 's', 's')
def Add(self, pkgname):
global t
global error
error = ''
try:
for repo in config.handle.get_syncdbs():
pkg = repo.get_pkg(pkgname)
if pkg:
t.add_pkg(pkg)
break
except pyalpm.error:
error = traceback.format_exc()
finally:
return error
@dbus.service.method('org.manjaro.pamac', '', 's')
def Prepare(self):
global t
global error
error = ''
try:
t.prepare()
print('to_add:',t.to_add)
print('to_remove:',t.to_remove)
except pyalpm.error:
error = traceback.format_exc()
finally:
return error
@dbus.service.method('org.manjaro.pamac', '', 'as')
def To_Remove(self):
global t
liste = []
for pkg in t.to_remove:
liste.append(pkg.name)
return liste
@dbus.service.method('org.manjaro.pamac', '', 'as')
def To_Add(self):
global t
liste = []
for pkg in t.to_add:
liste.append(pkg.name)
return liste
@dbus.service.method('org.manjaro.pamac', '', 's', sender_keyword='sender', connection_keyword='connexion')#, async_callbacks=('success', 'nosuccess'))
def Commit(self, sender=None, connexion=None):#success, nosuccess, sender=None, connexion=None):
global t
global error
error = ''
if self.policykit_test(sender,connexion,'org.manjaro.pamac.commit'):
try:
t.commit()
#success('')
except pyalpm.error:
error = traceback.format_exc()
#nosuccess(error)
except dbus.exceptions.DBusException:
pass
finally:
self.CheckUpdates()
return error
else :
return 'You are not authorized'
@dbus.service.method('org.manjaro.pamac', '', 's', sender_keyword='sender', connection_keyword='connexion')
def Release(self, sender=None, connexion=None):
global t
global error
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
error = ''
try:
t.release()
except pyalpm.error:
error = traceback.format_exc()
finally:
return error
else :
return 'You are not authorized'
@dbus.service.method('org.manjaro.pamac')
def StopDaemon(self):
global t
try:
t.release()
except:
pass
mainloop.quit()
DBusGMainLoop(set_as_default=True)
myservice = PamacDBusService()
mainloop = GObject.MainLoop()
mainloop.run()

View File

@ -25,11 +25,6 @@ interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
ErrorDialog = interface.get_object('ErrorDialog')
WarningDialog = interface.get_object('WarningDialog')
QuestionDialog = interface.get_object('QuestionDialog')
ProgressWindow = interface.get_object('ProgressWindow')
progress_bar = interface.get_object('progressbar2')
progress_label = interface.get_object('progresslabel2')
action_icon = interface.get_object('action_icon')
ProgressCancelButton = interface.get_object('ProgressCancelButton')
def get_handle():
global handle
@ -65,32 +60,6 @@ Commit = proxy.get_dbus_method('Commit','org.manjaro.pamac')
Release = proxy.get_dbus_method('Release','org.manjaro.pamac')
StopDaemon = proxy.get_dbus_method('StopDaemon','org.manjaro.pamac')
def action_signal_handler(action):
progress_label.set_text(action)
#~ if 'Downloading' in action:
#~ print('cancel enabled')
#~ ProgressCancelButton.set_visible(True)
#~ else:
ProgressCancelButton.set_visible(False)
#~ print('cancel disabled')
def icon_signal_handler(icon):
action_icon.set_from_file(icon)
def target_signal_handler(target):
progress_bar.set_text(target)
def percent_signal_handler(percent):
#~ if percent == '0':
#~ progress_bar.pulse()
#~ else:
progress_bar.set_fraction(float(percent))
bus.add_signal_receiver(action_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAction")
bus.add_signal_receiver(icon_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitIcon")
bus.add_signal_receiver(target_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTarget")
bus.add_signal_receiver(percent_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitPercent")
def init_transaction(**options):
"Transaction initialization"
global t_lock
@ -123,11 +92,7 @@ def get_updates():
if name in localpkgs.keys():
candidate = pyalpm.sync_newversion(localpkgs[name], handle.get_syncdbs())
if candidate:
for repo in handle.get_syncdbs():
pkg = repo.get_pkg(candidate.name)
if pkg:
list_first.append(pkg)
break
list_first.append(candidate)
if list_first:
do_syncfirst = True
return do_syncfirst, list_first
@ -135,9 +100,5 @@ def get_updates():
for pkg in localpkgs.values():
candidate = pyalpm.sync_newversion(pkg, handle.get_syncdbs())
if candidate:
for repo in handle.get_syncdbs():
pkg = repo.get_pkg(candidate.name)
if pkg:
result.append(pkg)
break
result.append(candidate)
return do_syncfirst, result