Skip to content
Snippets Groups Projects
Commit 4b859f0e authored by guinux's avatar guinux
Browse files

some improvements

parent a769f4e3
No related branches found
No related tags found
No related merge requests found
...@@ -99,12 +99,11 @@ def refresh_packages_list(): ...@@ -99,12 +99,11 @@ def refresh_packages_list():
global packages_list global packages_list
packages_list.clear() packages_list.clear()
if not pkg_name_list: if not pkg_name_list:
packages_list.append([" ", False, False]) packages_list.append(["No package found", False, False])
else: else:
for name in pkg_name_list: for name in pkg_name_list:
if name in config.holdpkg: if name in config.holdpkg:
packages_list.append([name, pkg_installed_dict[name], False]) packages_list.append([name, pkg_installed_dict[name], False])
break
elif transaction_type is "install": elif transaction_type is "install":
if pkg_installed_dict[name] is True: if pkg_installed_dict[name] is True:
packages_list.append([name, pkg_installed_dict[name], False]) packages_list.append([name, pkg_installed_dict[name], False])
......
...@@ -49,34 +49,38 @@ class PamacDBusService(dbus.service.Object): ...@@ -49,34 +49,38 @@ class PamacDBusService(dbus.service.Object):
def cb_event(self, ID, event, tupel): def cb_event(self, ID, event, tupel):
if ID is 1: if ID is 1:
self.action = 'Checking dependencies' self.action = 'Checking dependencies...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 3: elif ID is 3:
self.action = 'Checking file conflicts' self.action = 'Checking file conflicts...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 5: elif ID is 5:
self.action = 'Resolving dependencies' self.action = 'Resolving dependencies...'
self.icon = '/usr/share/pamac/icons/24x24/status/setup.png' self.icon = '/usr/share/pamac/icons/24x24/status/setup.png'
elif ID is 7: elif ID is 7:
self.action = 'Checking inter conflicts' self.action = 'Checking inter conflicts...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
elif ID is 9: elif ID is 9:
self.action = 'Installing packages' self.action = 'Installing...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png'
elif ID is 11: elif ID is 11:
self.action = 'Removing packages' self.action = 'Removing...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-delete.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-delete.png'
elif ID is 13: elif ID is 13:
self.action = 'Upgrading packages' self.action = 'Upgrading...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-update.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-update.png'
elif ID is 15: elif ID is 15:
self.action = 'Checking integrity' self.action = 'Checking integrity...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
self.already_transferred = 0 self.already_transferred = 0
elif ID is 17: elif ID is 17:
self.action = 'Checking signatures' self.action = 'Checking signatures...'
self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png'
print('Checking signatures') print('Checking signatures')
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: elif ID is 27:
print('Downloading a file') print('Downloading a file')
else : else :
......
...@@ -92,6 +92,9 @@ def check_conflicts(): ...@@ -92,6 +92,9 @@ def check_conflicts():
global to_add global to_add
global to_remove global to_remove
to_check = [] to_check = []
installed_pkg_name = []
syncdbs_pkg_name = []
depends = []
warning = '' warning = ''
for pkgname in to_add: for pkgname in to_add:
for repo in handle.get_syncdbs(): for repo in handle.get_syncdbs():
...@@ -99,16 +102,20 @@ def check_conflicts(): ...@@ -99,16 +102,20 @@ def check_conflicts():
if pkg: if pkg:
to_check.append(pkg) to_check.append(pkg)
break break
for installed_pkg in handle.get_localdb().pkgcache:
installed_pkg_name.append(installed_pkg.name)
for target in to_check: for target in to_check:
if target.depends:
for name in target.depends:
depends.append(name)
if target.replaces: if target.replaces:
for name in target.replaces: for name in target.replaces:
pkg = handle.get_localdb().get_pkg(name) if name in installed_pkg_name:
if pkg: if not name in to_remove:
if not pkg.name in to_remove: to_remove.append(name)
to_remove.append(pkg.name)
if warning: if warning:
warning = warning+'\n' warning = warning+'\n'
warning = warning+pkg.name+' will be replaced by '+target.name warning = warning+name+' will be replaced by '+target.name
if target.conflicts: if target.conflicts:
for name in target.conflicts: for name in target.conflicts:
if name in to_add: if name in to_add:
...@@ -117,13 +124,12 @@ def check_conflicts(): ...@@ -117,13 +124,12 @@ def check_conflicts():
if warning: if warning:
warning = warning+'\n' warning = warning+'\n'
warning = warning+name+' conflicts with '+target.name+'\nNone of them will be installed' warning = warning+name+' conflicts with '+target.name+'\nNone of them will be installed'
pkg = handle.get_localdb().get_pkg(name) if name in installed_pkg_name:
if pkg: if not name in to_remove:
if not pkg.name in to_remove: to_remove.append(name)
to_remove.append(pkg.name)
if warning: if warning:
warning = warning+'\n' warning = warning+'\n'
warning = warning+pkg.name+' conflicts with '+target.name warning = warning+name+' conflicts with '+target.name
for installed_pkg in handle.get_localdb().pkgcache: for installed_pkg in handle.get_localdb().pkgcache:
if installed_pkg.conflicts: if installed_pkg.conflicts:
for name in installed_pkg.conflicts: for name in installed_pkg.conflicts:
...@@ -133,20 +139,23 @@ def check_conflicts(): ...@@ -133,20 +139,23 @@ def check_conflicts():
if warning: if warning:
warning = warning+'\n' warning = warning+'\n'
warning = warning+installed_pkg.name+' conflicts with '+target.name warning = warning+installed_pkg.name+' conflicts with '+target.name
if installed_pkg.name in depends:
depends.remove(installed_pkg.name)
for repo in handle.get_syncdbs(): for repo in handle.get_syncdbs():
for pkg in repo.pkgcache: for pkg in repo.pkgcache:
if pkg.replaces: if pkg.replaces:
for name in pkg.replaces: for name in pkg.replaces:
for installed_pkg in handle.get_localdb().pkgcache: if name == installed_pkg_name:
if name == installed_pkg.name: if not name in to_remove:
if not name in to_remove: to_remove.append(name)
to_remove.append(installed_pkg.name) if warning:
if warning: warning = warning+'\n'
warning = warning+'\n' warning = warning+name+' will be replaced by '+pkg.name
warning = warning+installed_pkg.name+' will be replaced by '+pkg.name if not pkg.name in to_add:
print(name) to_add.append(pkg.name)
if not pkg.name in to_add: if pkg.name in depends:
to_add.append(pkg.name) depends.remove(pkg.name)
print(depends)
if warning: if warning:
WarningDialog.format_secondary_text(warning) WarningDialog.format_secondary_text(warning)
response = WarningDialog.run() response = WarningDialog.run()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment