diff --git a/data/systemd/pamac.service b/data/systemd/pamac.service
index 6a9954f..321a759 100644
--- a/data/systemd/pamac.service
+++ b/data/systemd/pamac.service
@@ -5,4 +5,3 @@ Description=Pamac
Type=dbus
BusName=org.manjaro.pamac
ExecStart=/usr/bin/start-pamac-daemon
-RemainAfterExit=Yes
diff --git a/gui/dialogs.glade b/gui/dialogs.glade
index fb038f0..4b71a08 100644
--- a/gui/dialogs.glade
+++ b/gui/dialogs.glade
@@ -63,7 +63,7 @@
False
diff --git a/gui/updater.glade b/gui/updater.glade
index c0f9db4..610df60 100644
--- a/gui/updater.glade
+++ b/gui/updater.glade
@@ -210,7 +210,7 @@
False
diff --git a/pamac-updater b/pamac-updater
old mode 100755
new mode 100644
diff --git a/pamac/callbacks.py b/pamac/callbacks.py
deleted file mode 100755
index 83ca037..0000000
--- a/pamac/callbacks.py
+++ /dev/null
@@ -1,121 +0,0 @@
-#! /usr/bin/python
-# -*-coding:utf-8-*-
-
-from gi.repository import Gtk
-import pyalpm
-from pamac import config
-
-handle = config.handle
-
-# Callbacks
-interface = Gtk.Builder()
-interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
-
-ProgressWindow = interface.get_object('ProgressWindow')
-progress_bar = interface.get_object('progressbar2')
-progress_label = interface.get_object('progresslabel2')
-action_icon = interface.get_object('action_icon')
-
-event_text = ' '
-def cb_event(ID, event, tupel):
- global event_text
- while Gtk.events_pending():
- Gtk.main_iteration()
- if ID is 1:
- progress_label.set_text('Checking dependencies')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
- elif ID is 3:
- progress_label.set_text('Checking file conflicts')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
- elif ID is 5:
- progress_label.set_text('Resolving dependencies')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/setup.png')
- elif ID is 7:
- progress_label.set_text('Checking inter conflicts')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
- elif ID is 9:
- progress_label.set_text('Installing packages')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-add.png')
- elif ID is 11:
- progress_label.set_text('Removing packages')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-delete.png')
- elif ID is 13:
- progress_label.set_text('Upgrading packages')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-update.png')
- elif ID is 15:
- progress_label.set_text('Checking integrity')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
- elif ID is 17:
- progress_label.set_text('Checking signatures')
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
- print('Checking signatures')
- elif ID is 27:
- print('Downloading a file')
- else :
- progress_label.set_text('')
- progress_bar.set_fraction(0.0)
- progress_bar.set_text('')
- print(ID,event)
-
-def cb_conv(*args):
- print("conversation", args)
-
-_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
-
-def cb_log(level, line):
- #global t
- if not (level & _logmask):
- return
- if level & pyalpm.LOG_ERROR:
- ErrorDialog.format_secondary_text("ERROR: "+line)
- response = ErrorDialog.run()
- if response:
- ErrorDialog.hide()
- #t.release()
- elif level & pyalpm.LOG_WARNING:
- WarningDialog.format_secondary_text("WARNING: "+line)
- response = WarningDialog.run()
- if response:
- WarningDialog.hide()
- elif level & pyalpm.LOG_DEBUG:
- line = "DEBUG: " + line
- print(line)
- elif level & pyalpm.LOG_FUNCTION:
- line = "FUNC: " + line
- print(line)
-
-total_size = 0
-def totaldlcb(_total_size):
- global total_size
- total_size = _total_size
-
-already_transferred = 0
-def cb_dl(_target, _transferred, total):
- global already_transferred
- while Gtk.events_pending():
- Gtk.main_iteration()
- if total_size > 0:
- fraction = (_transferred+already_transferred)/total_size
- size = 0
- if (to_remove or to_add):
- for pkg in to_remove+to_add:
- if pkg.name+'-'+pkg.version in _target:
- size = pkg.size
- if _transferred == size:
- already_transferred += size
- progress_label.set_text('Downloading '+format_size(total_size))
- progress_bar.set_text(_target)
- progress_bar.set_fraction(fraction)
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-download.png')
- else:
- progress_label.set_text('Refreshing...')
- progress_bar.set_text(_target)
- progress_bar.pulse()
- action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
-
-def cb_progress(_target, _percent, n, i):
- while Gtk.events_pending():
- Gtk.main_iteration()
- target = _target+' ('+str(i)+'/'+str(n)+')'
- progress_bar.set_fraction(_percent/100)
- progress_bar.set_text(target)
diff --git a/pamac/common.py b/pamac/common.py
new file mode 100644
index 0000000..1dc57f7
--- /dev/null
+++ b/pamac/common.py
@@ -0,0 +1,23 @@
+#! /usr/bin/python
+# -*-coding:utf-8-*-
+
+from gi.repository import Gtk
+
+interface = Gtk.Builder()
+interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
+
+ErrorDialog = interface.get_object('ErrorDialog')
+WarningDialog = interface.get_object('WarningDialog')
+
+to_remove = []
+to_add = []
+to_update = []
+
+def format_size(size):
+ KiB_size = size / 1024
+ if KiB_size < 1000:
+ size_string = '%.1f KiB' % (KiB_size)
+ return size_string
+ else:
+ size_string = '%.2f MiB' % (KiB_size / 1024)
+ return size_string
diff --git a/pamac/config.py b/pamac/config.py
old mode 100755
new mode 100644
diff --git a/pamac/manager.py b/pamac/manager.py
old mode 100755
new mode 100644
index d13c48c..43eddf1
--- a/pamac/manager.py
+++ b/pamac/manager.py
@@ -1,7 +1,7 @@
#! /usr/bin/python
# -*-coding:utf-8 -*-
-from gi.repository import Gtk, GdkPixbuf, Gdk, GObject
+from gi.repository import Gtk
import pyalpm
import math
@@ -10,7 +10,7 @@ from time import strftime, localtime
from os import geteuid
import traceback
-from pamac import transaction, config, callbacks
+from pamac import config, common, transaction
interface = Gtk.Builder()
interface.add_from_file('/usr/share/pamac/gui/manager.glade')
@@ -66,7 +66,6 @@ def set_list_dict_search(*patterns):
pkg_object_dict[pkg_object.name] = pkg_object
pkg_installed_dict[pkg_object.name] = False
for pkg_object in config.pacman_conf.initialize_alpm().get_localdb().search(*patterns):
- print(pkg_object)
if not pkg_object.name in pkg_name_list:
pkg_name_list.append(pkg_object.name)
pkg_installed_dict[pkg_object.name] = True
@@ -126,7 +125,6 @@ def refresh_packages_list():
packages_list.append([name, pkg_installed_dict[name], True])
else:
packages_list.append([name, pkg_installed_dict[name], True])
- print(name,pkg_installed_dict[name])
def set_packages_list():
global list_dict
@@ -165,10 +163,10 @@ def set_desc(pkg, style):
package_desc.append(['Conflicts With:', ' '.join(pkg.conflicts)])
package_desc.append(['Replaces:', ' '.join(pkg.replaces)])
if style == 'sync':
- package_desc.append(['Download Size:', transaction.format_size(pkg.size)])
+ package_desc.append(['Download Size:', common.format_size(pkg.size)])
if style == 'file':
- package_desc.append(['Compressed Size:', transaction.format_size(pkg.size)])
- package_desc.append(['Installed Size:', transaction.format_size(pkg.isize)])
+ package_desc.append(['Compressed Size:', common.format_size(pkg.size)])
+ package_desc.append(['Installed Size:', common.format_size(pkg.isize)])
package_desc.append(['Packager:', pkg.packager])
package_desc.append(['Architecture:', pkg.arch])
package_desc.append(['Build Date:', strftime("%a %d %b %Y %X %Z", localtime(pkg.builddate))])
@@ -197,35 +195,35 @@ def set_desc(pkg, style):
def set_transaction_sum():
transaction_sum.clear()
- if transaction.to_remove:
- transaction_sum.append(['To remove:', transaction.to_remove[0]])
+ if common.to_remove:
+ transaction_sum.append(['To remove:', common.to_remove[0]])
i = 1
- while i < len(transaction.to_remove):
- transaction_sum.append([' ', transaction.to_remove[i]])
+ while i < len(common.to_remove):
+ transaction_sum.append([' ', common.to_remove[i]])
i += 1
bottom_label.set_markup('')
- if transaction.to_add:
+ if common.to_add:
installed = []
- for pkg_object in callbacks.handle.get_localdb().pkgcache:
+ for pkg_object in config.pacman_conf.initialize_alpm().get_localdb().pkgcache:
installed.append(pkg_object.name)
- transaction.to_update = sorted(set(installed).intersection(transaction.to_add))
- to_remove_from_add = sorted(set(transaction.to_update).intersection(transaction.to_add))
+ common.to_update = sorted(set(installed).intersection(common.to_add))
+ to_remove_from_add = sorted(set(common.to_update).intersection(common.to_add))
for name in to_remove_from_add:
- transaction.to_add.remove(name)
- if transaction.to_add:
- transaction_sum.append(['To install:', transaction.to_add[0]])
+ common.to_add.remove(name)
+ if common.to_add:
+ transaction_sum.append(['To install:', common.to_add[0]])
i = 1
- while i < len(transaction.to_add):
- transaction_sum.append([' ', transaction.to_add[i]])
+ while i < len(common.to_add):
+ transaction_sum.append([' ', common.to_add[i]])
i += 1
- if transaction.to_update:
- transaction_sum.append(['To update:', transaction.to_update[0]])
+ if common.to_update:
+ transaction_sum.append(['To update:', common.to_update[0]])
i = 1
- while i < len(transaction.to_update):
- transaction_sum.append([' ', transaction.to_update[i]])
+ while i < len(common.to_update):
+ transaction_sum.append([' ', common.to_update[i]])
i += 1
bottom_label.set_markup('')
- #bottom_label.set_markup('Total Download size: '+format_size(totaldlcb))
+ #bottom_label.set_markup('Total Download size: '+common.format_size(totaldlcb))
top_label.set_markup('Transaction Summary')
class Handler:
@@ -261,33 +259,33 @@ class Handler:
print('Transaction locked')
else:
if transaction_type is "remove":
- transaction.init_transaction(cascade = True)
- for pkgname in transaction_dict.keys():
- transaction.Remove(pkgname)
- error = transaction.Prepare()
- if error:
- transaction.ErrorDialog.format_secondary_text(error)
- response = transaction.ErrorDialog.run()
- if response:
- transaction.ErrorDialog.hide()
- transaction.Release()
- transaction.t_lock = False
- transaction.get_to_remove()
- transaction.get_to_add()
- set_transaction_sum()
- ConfDialog.show_all()
+ if transaction.init_transaction(cascade = True):
+ for pkgname in transaction_dict.keys():
+ transaction.Remove(pkgname)
+ error = transaction.Prepare()
+ if error:
+ transaction.ErrorDialog.format_secondary_text(error)
+ response = transaction.ErrorDialog.run()
+ if response:
+ transaction.ErrorDialog.hide()
+ transaction.Release()
+ transaction.t_lock = False
+ transaction.get_to_remove()
+ transaction.get_to_add()
+ set_transaction_sum()
+ ConfDialog.show_all()
if transaction_type is "install":
- transaction.init_transaction(noconflicts = True)
- for pkgname in transaction_dict.keys():
- transaction.Add(pkgname)
- error = transaction.Prepare()
- if error:
- transaction.ErrorDialog.format_secondary_text(error)
- response = transaction.ErrorDialog.run()
- if response:
- transaction.ErrorDialog.hide()
- transaction.Release()
- transaction.t_lock = False
+ if transaction.init_transaction(noconflicts = True):
+ for pkgname in transaction_dict.keys():
+ transaction.Add(pkgname)
+ error = transaction.Prepare()
+ if error:
+ transaction.ErrorDialog.format_secondary_text(error)
+ response = transaction.ErrorDialog.run()
+ if response:
+ transaction.ErrorDialog.hide()
+ transaction.Release()
+ transaction.t_lock = False
transaction.get_to_remove()
transaction.get_to_add()
transaction.check_conflicts()
@@ -324,13 +322,15 @@ class Handler:
if response:
transaction.ErrorDialog.hide()
transaction.Release()
+ common.to_add = []
+ common.to_remove = []
if transaction_type is "install":
- transaction.init_transaction(noconflicts = True, nodeps = True)
- for pkgname in transaction.to_add:
- transaction.Add(pkgname)
- for pkgname in transaction.to_remove:
- transaction.Remove(pkgname)
- transaction.finalize()
+ if transaction.init_transaction(noconflicts = True, nodeps = True):
+ for pkgname in common.to_add:
+ transaction.Add(pkgname)
+ for pkgname in common.to_remove:
+ transaction.Remove(pkgname)
+ transaction.finalize()
transaction_dict.clear()
transaction_type = None
set_packages_list()
diff --git a/pamac/pamac-daemon.py b/pamac/pamac-daemon.py
old mode 100755
new mode 100644
index e59905b..faa0242
--- a/pamac/pamac-daemon.py
+++ b/pamac/pamac-daemon.py
@@ -8,13 +8,124 @@ from gi.repository import GObject, Gtk
import pyalpm
import traceback
-from pamac import config, callbacks
+from pamac import config, common
loop = GObject.MainLoop()
t = None
error = ''
+interface = Gtk.Builder()
+interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
+
+ProgressWindow = interface.get_object('ProgressWindow')
+progress_bar = interface.get_object('progressbar2')
+progress_label = interface.get_object('progresslabel2')
+action_icon = interface.get_object('action_icon')
+
+def cb_event(ID, event, tupel):
+ while Gtk.events_pending():
+ Gtk.main_iteration()
+ if ID is 1:
+ progress_label.set_text('Checking dependencies')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
+ elif ID is 3:
+ progress_label.set_text('Checking file conflicts')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
+ elif ID is 5:
+ progress_label.set_text('Resolving dependencies')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/setup.png')
+ elif ID is 7:
+ progress_label.set_text('Checking inter conflicts')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
+ elif ID is 9:
+ progress_label.set_text('Installing packages')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-add.png')
+ elif ID is 11:
+ progress_label.set_text('Removing packages')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-delete.png')
+ elif ID is 13:
+ progress_label.set_text('Upgrading packages')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-update.png')
+ elif ID is 15:
+ progress_label.set_text('Checking integrity')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
+ elif ID is 17:
+ progress_label.set_text('Checking signatures')
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-search.png')
+ print('Checking signatures')
+ elif ID is 27:
+ print('Downloading a file')
+ else :
+ progress_label.set_text('')
+ progress_bar.set_fraction(0.0)
+ progress_bar.set_text('')
+ print(ID,event)
+
+def cb_conv(*args):
+ print("conversation", args)
+
+_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
+
+def cb_log(level, line):
+ #global t
+ if not (level & _logmask):
+ return
+ if level & pyalpm.LOG_ERROR:
+ common.ErrorDialog.format_secondary_text("ERROR: "+line)
+ response = common.ErrorDialog.run()
+ if response:
+ common.ErrorDialog.hide()
+ #t.release()
+ elif level & pyalpm.LOG_WARNING:
+ common.WarningDialog.format_secondary_text("WARNING: "+line)
+ response = common.WarningDialog.run()
+ if response:
+ common.WarningDialog.hide()
+ elif level & pyalpm.LOG_DEBUG:
+ line = "DEBUG: " + line
+ print(line)
+ elif level & pyalpm.LOG_FUNCTION:
+ line = "FUNC: " + line
+ print(line)
+
+total_size = 0
+def totaldlcb(_total_size):
+ global total_size
+ total_size = _total_size
+
+already_transferred = 0
+def cb_dl(_target, _transferred, total):
+ global already_transferred
+ while Gtk.events_pending():
+ Gtk.main_iteration()
+ if total_size > 0:
+ fraction = (_transferred+already_transferred)/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:
+ already_transferred += size
+ progress_label.set_text('Downloading '+common.format_size(total_size))
+ progress_bar.set_text(_target)
+ progress_bar.set_fraction(fraction)
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/package-download.png')
+ else:
+ progress_label.set_text('Refreshing...')
+ progress_bar.set_text(_target)
+ progress_bar.pulse()
+ action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
+
+def cb_progress(_target, _percent, n, i):
+ while Gtk.events_pending():
+ Gtk.main_iteration()
+ target = _target+' ('+str(i)+'/'+str(n)+')'
+ progress_bar.set_fraction(_percent/100)
+ progress_bar.set_text(target)
+
+
class PamacDBusService(dbus.service.Object):
def __init__(self):
bus=dbus.SystemBus()
@@ -40,14 +151,14 @@ class PamacDBusService(dbus.service.Object):
global error
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
error = ''
+ config.handle.dlcb = cb_dl
+ config.handle.totaldlcb = totaldlcb
+ config.handle.eventcb = cb_event
+ config.handle.questioncb = cb_conv
+ config.handle.progresscb = cb_progress
+ config.handle.logcb = cb_log
try:
- callbacks.handle.dlcb = callbacks.cb_dl
- callbacks.handle.totaldlcb = callbacks.totaldlcb
- callbacks.handle.eventcb = callbacks.cb_event
- callbacks.handle.questioncb = callbacks.cb_conv
- callbacks.handle.progresscb = callbacks.cb_progress
- callbacks.handle.logcb = callbacks.cb_log
- t = callbacks.handle.init_transaction(**options)
+ t = config.handle.init_transaction(**options)
print('Init:',t.flags)
except pyalpm.error:
error = traceback.format_exc()
@@ -62,7 +173,7 @@ class PamacDBusService(dbus.service.Object):
global error
error = ''
try:
- pkg = callbacks.handle.get_localdb().get_pkg(pkgname)
+ pkg = config.handle.get_localdb().get_pkg(pkgname)
if pkg is not None:
t.remove_pkg(pkg)
except pyalpm.error:
@@ -76,7 +187,7 @@ class PamacDBusService(dbus.service.Object):
global error
error = ''
try:
- for repo in callbacks.handle.get_syncdbs():
+ for repo in config.handle.get_syncdbs():
pkg = repo.get_pkg(pkgname)
if pkg:
t.add_pkg(pkg)
@@ -93,11 +204,11 @@ class PamacDBusService(dbus.service.Object):
error = ''
try:
t.prepare()
+ print('to_add:',t.to_add)
+ print('to_remove:',t.to_remove)
except pyalpm.error:
error = traceback.format_exc()
finally:
- print('to_add:',t.to_add)
- print('to_remove:',t.to_remove)
return error
@dbus.service.method('org.manjaro.pamac', '', 'as')
@@ -120,11 +231,11 @@ class PamacDBusService(dbus.service.Object):
def Commit(self, sender=None, connexion=None):
global t
global error
- if self.policykit_test(sender,connexion,'org.manjaro.pamac.commit'):
+ if self.policykit_test(sender,connexion,'org.manjaro.pamac.commit'):
+ ProgressWindow.show_all()
+ while Gtk.events_pending():
+ Gtk.main_iteration()
try:
- callbacks.ProgressWindow.show_all()
- while Gtk.events_pending():
- Gtk.main_iteration()
t.commit()
except pyalpm.error:
error = traceback.format_exc()
@@ -139,8 +250,8 @@ class PamacDBusService(dbus.service.Object):
global error
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
error = ''
+ ProgressWindow.hide()
try:
- callbacks.ProgressWindow.hide()
t.release()
except pyalpm.error:
error = traceback.format_exc()
diff --git a/pamac/transaction.py b/pamac/transaction.py
old mode 100755
new mode 100644
index ae4e37f..a4247b4
--- a/pamac/transaction.py
+++ b/pamac/transaction.py
@@ -7,20 +7,9 @@ import pyalpm
import traceback
import dbus
-from pamac import config, callbacks
+from pamac import config, common
-interface = Gtk.Builder()
-interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
-
-ErrorDialog = interface.get_object('ErrorDialog')
-WarningDialog = interface.get_object('WarningDialog')
-
-t = None
t_lock = False
-conflict_to_remove = None
-to_remove = None
-to_add = None
-to_update = None
do_syncfirst = False
list_first = []
@@ -37,28 +26,22 @@ Release = proxy.get_dbus_method('Release','org.manjaro.pamac')
def init_transaction(**options):
"Transaction initialization"
global t_lock
- global proxy
error = Init(options)
- print(error)
if not error:
t_lock = True
return True
else:
- ErrorDialog.format_secondary_text(error)
- response = ErrorDialog.run()
+ common.ErrorDialog.format_secondary_text(error)
+ response = common.ErrorDialog.run()
if response:
- ErrorDialog.hide()
+ common.ErrorDialog.hide()
return False
def check_conflicts():
- global conflict_to_remove
- global to_add
- global to_remove
- conflict_to_remove = {}
to_check = []
warning = ''
- for pkgname in to_add:
- for repo in callbacks.handle.get_syncdbs():
+ for pkgname in common.to_add:
+ for repo in config.pacman_conf.initialize_alpm().get_syncdbs():
pkg = repo.get_pkg(pkgname)
if pkg:
to_check.append(pkg)
@@ -66,38 +49,36 @@ def check_conflicts():
for target in to_check:
if target.replaces:
for name in target.replaces:
- pkg = callbacks.handle.get_localdb().get_pkg(name)
+ pkg = config.pacman_conf.initialize_alpm().get_localdb().get_pkg(name)
if pkg:
- if not pkg.name in to_remove:
- to_remove.append(pkg.name)
+ if not pkg.name in common.to_remove:
+ common.to_remove.append(pkg.name)
if warning:
warning = warning+'\n'
warning = warning+pkg.name+' will be replaced by '+target.name
if target.conflicts:
for name in target.conflicts:
- pkg = callbacks.handle.get_localdb().get_pkg(name)
+ pkg = config.pacman_conf.initialize_alpm().get_localdb().get_pkg(name)
if pkg:
- if not pkg.name in to_remove:
- to_remove.append(pkg.name)
- for installed_pkg in callbacks.handle.get_localdb().pkgcache:
+ if not pkg.name in common.to_remove:
+ common.to_remove.append(pkg.name)
+ for installed_pkg in config.pacman_conf.initialize_alpm().get_localdb().pkgcache:
if installed_pkg.conflicts:
for name in installed_pkg.conflicts:
if name == target.name:
- if not name in to_remove:
- to_remove.append(installed_pkg.name)
+ if not name in common.to_remove:
+ common.to_remove.append(installed_pkg.name)
if warning:
- WarningDialog.format_secondary_text(warning)
- response = WarningDialog.run()
+ common.WarningDialog.format_secondary_text(warning)
+ response = common.WarningDialog.run()
if response:
- WarningDialog.hide()
+ common.WarningDialog.hide()
def get_to_remove():
- global to_remove
- to_remove = To_Remove()
+ common.to_remove = To_Remove()
def get_to_add():
- global to_add
- to_add = To_Add()
+ common.to_add = To_Add()
def finalize():
global t_lock
@@ -105,24 +86,26 @@ def finalize():
Gtk.main_iteration()
error = Prepare()
if error:
- ErrorDialog.format_secondary_text(error)
- response = ErrorDialog.run()
+ common.ErrorDialog.format_secondary_text(error)
+ response = common.ErrorDialog.run()
if response:
- transaction.ErrorDialog.hide()
+ common.ErrorDialog.hide()
error = Commit()
if error:
- ErrorDialog.format_secondary_text(error)
- response = ErrorDialog.run()
+ common.ErrorDialog.format_secondary_text(error)
+ response = common.ErrorDialog.run()
if response:
- transaction.ErrorDialog.hide()
+ common.ErrorDialog.hide()
t_lock = False
Release()
+ common.to_add = []
+ common.to_remove = []
def do_refresh():
"""Sync databases like pacman -Sy"""
global t
global t_lock
- for db in callbacks.handle.get_syncdbs():
+ for db in config.pacman_conf.initialize_alpm().get_syncdbs():
if t_lock is False:
t = init_transaction()
try:
@@ -130,15 +113,13 @@ def do_refresh():
t.release()
t_lock = False
except pyalpm.error:
- ErrorDialog.format_secondary_text(traceback.format_exc())
- response = ErrorDialog.run()
+ common.ErrorDialog.format_secondary_text(traceback.format_exc())
+ response = common.ErrorDialog.run()
if response:
- ErrorDialog.hide()
+ common.ErrorDialog.hide()
t_lock = False
break
t_lock = False
- progress_label.set_text('')
- progress_bar.set_text('')
def get_updates():
"""Return a list of package objects in local db which can be updated"""
@@ -146,33 +127,24 @@ def get_updates():
global list_first
if config.syncfirst:
for name in config.syncfirst:
- pkg = callbacks.handle.get_localdb().get_pkg(name)
- candidate = pyalpm.sync_newversion(pkg, callbacks.handle.get_syncdbs())
+ pkg = config.pacman_conf.initialize_alpm().get_localdb().get_pkg(name)
+ candidate = pyalpm.sync_newversion(pkg, config.pacman_conf.initialize_alpm().get_syncdbs())
if candidate:
list_first.append(candidate)
if list_first:
do_syncfirst = True
return list_first
result = []
- installed_pkglist = callbacks.handle.get_localdb().pkgcache
+ installed_pkglist = config.pacman_conf.initialize_alpm().get_localdb().pkgcache
for pkg in installed_pkglist:
- candidate = pyalpm.sync_newversion(pkg, callbacks.handle.get_syncdbs())
+ candidate = pyalpm.sync_newversion(pkg, config.pacman_conf.initialize_alpm().get_syncdbs())
if candidate:
result.append(candidate)
return result
def get_new_version_available(pkgname):
- for repo in callbacks.handle.get_syncdbs():
+ for repo in config.pacman_conf.initialize_alpm().get_syncdbs():
pkg = repo.get_pkg(pkgname)
if pkg is not None:
return pkg.version
break
-
-def format_size(size):
- KiB_size = size / 1024
- if KiB_size < 1000:
- size_string = '%.1f KiB' % (KiB_size)
- return size_string
- else:
- size_string = '%.2f MiB' % (KiB_size / 1024)
- return size_string
diff --git a/pamac/tray.py b/pamac/tray.py
old mode 100755
new mode 100644
diff --git a/pamac/updater.py b/pamac/updater.py
old mode 100755
new mode 100644
diff --git a/start-pamac-daemon b/start-pamac-daemon
index a09fb06..79a7d2f 100755
--- a/start-pamac-daemon
+++ b/start-pamac-daemon
@@ -1,3 +1,3 @@
#! /bin/bash
-DISPLAY=:0.0 pamac-daemon.py &
+DISPLAY=:0.0 /usr/lib/python3.3/site-packages/pamac/pamac-daemon.py
diff --git a/tray b/tray
old mode 100755
new mode 100644