forked from cromer/pamac-classic
some fixes and continue tray work
This commit is contained in:
parent
0adb27f955
commit
91f3411f28
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
__pycache__
|
||||
.goutputstream*
|
||||
test.py
|
||||
|
@ -4,6 +4,9 @@
|
||||
from gi.repository import Gtk
|
||||
from subprocess import Popen
|
||||
from pamac import transaction
|
||||
import dbus
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
|
||||
class Tray:
|
||||
def __init__(self, icon, info):
|
||||
@ -66,6 +69,8 @@ def do_refresh():
|
||||
transaction.get_handle()
|
||||
transaction.Refresh(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
|
||||
bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
|
||||
|
||||
if __name__ == "__main__":
|
||||
do_refresh()
|
||||
Gtk.main()
|
||||
|
@ -328,7 +328,7 @@ def do_sysupgrade():
|
||||
if do_syncfirst:
|
||||
for pkg in updates:
|
||||
transaction.to_add.append(pkg.name)
|
||||
if transaction.init_transaction(recurse = True):
|
||||
if transaction.init_transaction(recurse = True, needed = True):
|
||||
for pkgname in transaction.to_add:
|
||||
transaction.Add(pkgname)
|
||||
for pkgname in transaction.to_remove:
|
||||
@ -403,13 +403,14 @@ def check_conflicts(pkg_list):
|
||||
if provide:
|
||||
print(i,'local',provide)
|
||||
if provide.name != common.format_pkg_name(depend):
|
||||
if ('linux' in depend) or ('-module' in depend):
|
||||
if '-modules' in depend:
|
||||
for pkg in transaction.syncpkgs.values():
|
||||
if not pkg.name in transaction.localpkgs.keys():
|
||||
for name in pkg.provides:
|
||||
for linux in installed_linux:
|
||||
if linux in pkg.name:
|
||||
if common.format_pkg_name(depend) == common.format_pkg_name(name):
|
||||
if not pkg.name in transaction.to_add:
|
||||
depends[i+1].append(pkg)
|
||||
transaction.to_add.append(pkg.name)
|
||||
else:
|
||||
@ -417,19 +418,21 @@ def check_conflicts(pkg_list):
|
||||
if provide:
|
||||
print(i,'sync',provide)
|
||||
if provide.name != common.format_pkg_name(depend):
|
||||
if ('linux' in depend) or ('-module' in depend):
|
||||
if '-modules' in depend:
|
||||
for pkg in transaction.syncpkgs.values():
|
||||
if not pkg.name in transaction.localpkgs.keys():
|
||||
for name in pkg.provides:
|
||||
for linux in installed_linux:
|
||||
if linux in pkg.name:
|
||||
if common.format_pkg_name(depend) == common.format_pkg_name(name):
|
||||
if not pkg.name in transaction.to_add:
|
||||
depends[i+1].append(pkg)
|
||||
transaction.to_add.append(pkg.name)
|
||||
else:
|
||||
to_add_to_depends = choose_provides(depend)
|
||||
print(to_add_to_depends)
|
||||
for pkg in to_add_to_depends:
|
||||
if not pkg.name in transaction.to_add:
|
||||
depends[i+1].append(pkg)
|
||||
transaction.to_add.append(pkg.name)
|
||||
else:
|
||||
@ -511,6 +514,8 @@ def choose_provides(name):
|
||||
choose_list.append([False, name])
|
||||
ChooseDialog.run()
|
||||
return [provides[pkgname] for pkgname in transaction.to_provide]
|
||||
else:
|
||||
return []
|
||||
|
||||
class Handler:
|
||||
#Manager Handlers
|
||||
@ -535,7 +540,7 @@ class Handler:
|
||||
print('Transaction locked')
|
||||
else:
|
||||
if transaction_type is "remove":
|
||||
if transaction.init_transaction(cascade = True, unneeded = True):
|
||||
if transaction.init_transaction(cascade = True, recurse = True):
|
||||
for pkgname in transaction_dict.keys():
|
||||
transaction.Remove(pkgname)
|
||||
error = transaction.Prepare()
|
||||
@ -553,7 +558,7 @@ class Handler:
|
||||
transaction.to_remove = []
|
||||
check_conflicts(transaction_dict.values())
|
||||
if transaction.to_add:
|
||||
if transaction.init_transaction(noconflicts = True):
|
||||
if transaction.init_transaction(noconflicts = True, unneeded = True):
|
||||
for pkgname in transaction.to_add:
|
||||
transaction.Add(pkgname)
|
||||
for pkgname in transaction.to_remove:
|
||||
|
@ -175,6 +175,18 @@ class PamacDBusService(dbus.service.Object):
|
||||
break
|
||||
return error
|
||||
|
||||
@dbus.service.signal('org.manjaro.pamac')
|
||||
def EmitAvailableUpdates(self, available_updates):
|
||||
pass
|
||||
|
||||
@dbus.service.method('org.manjaro.pamac', '', '')
|
||||
def CheckUpdates(self):
|
||||
for pkg in config.handle.get_localdb().pkgcache:
|
||||
candidate = pyalpm.sync_newversion(pkg, config.handle.get_syncdbs())
|
||||
if candidate:
|
||||
EmitAvailableUpdates(self, True)
|
||||
return
|
||||
|
||||
@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
|
||||
@ -300,6 +312,11 @@ class PamacDBusService(dbus.service.Object):
|
||||
|
||||
@dbus.service.method('org.manjaro.pamac')
|
||||
def StopDaemon(self):
|
||||
global t
|
||||
try:
|
||||
t.release()
|
||||
except:
|
||||
pass
|
||||
mainloop.quit()
|
||||
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
@ -51,6 +51,7 @@ DBusGMainLoop(set_as_default=True)
|
||||
bus = dbus.SystemBus()
|
||||
proxy = bus.get_object('org.manjaro.pamac','/org/manjaro/pamac', introspect=False)
|
||||
Refresh = proxy.get_dbus_method('Refresh','org.manjaro.pamac')
|
||||
CheckUpdates = proxy.get_dbus_method('CheckUpdates','org.manjaro.pamac')
|
||||
Init = proxy.get_dbus_method('Init','org.manjaro.pamac')
|
||||
Sysupgrade = proxy.get_dbus_method('Sysupgrade','org.manjaro.pamac')
|
||||
Remove = proxy.get_dbus_method('Remove','org.manjaro.pamac')
|
||||
|
Loading…
Reference in New Issue
Block a user