first release using dbus
This commit is contained in:
parent
faf63b6780
commit
5974e58935
@ -6,9 +6,12 @@
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes"> </property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="urgency_hint">True</property>
|
||||
<property name="has_resize_grip">False</property>
|
||||
<property name="message_type">error</property>
|
||||
<property name="buttons">ok</property>
|
||||
<child internal-child="vbox">
|
||||
@ -39,12 +42,13 @@
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Progress</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="window_position">center</property>
|
||||
<property name="modal">True</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="skip_taskbar_hint">True</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>
|
||||
@ -54,6 +58,7 @@
|
||||
<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>
|
||||
@ -97,7 +102,7 @@
|
||||
<property name="pulse_step">0.050000000000000003</property>
|
||||
<property name="text" translatable="yes"> </property>
|
||||
<property name="show_text">True</property>
|
||||
<property name="ellipsize">middle</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -105,6 +110,33 @@
|
||||
<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>
|
||||
|
@ -4,11 +4,14 @@
|
||||
<object class="GtkWindow" id="ConfDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes"> </property>
|
||||
<property name="window_position">center</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="default_width">350</property>
|
||||
<property name="default_height">250</property>
|
||||
<property name="icon">/usr/share/pamac/icons/22x22/status/package-info.png</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="urgency_hint">True</property>
|
||||
<property name="deletable">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box7">
|
||||
|
@ -4,11 +4,14 @@
|
||||
<object class="GtkWindow" id="ConfDialog">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes"> </property>
|
||||
<property name="window_position">center</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="default_width">350</property>
|
||||
<property name="default_height">250</property>
|
||||
<property name="icon">/usr/share/pamac/icons/22x22/status/package-info.png</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="urgency_hint">True</property>
|
||||
<property name="deletable">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box7">
|
||||
@ -162,6 +165,21 @@
|
||||
<property name="has_focus">True</property>
|
||||
<property name="spacing">5</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="RefreshButton">
|
||||
<property name="label">gtk-refresh</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="clicked" handler="on_RefreshButton_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="ApplyButton">
|
||||
<property name="label">gtk-apply</property>
|
||||
@ -239,8 +257,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="width_request">300</property>
|
||||
<property name="height_request">420</property>
|
||||
<property name="width_request">400</property>
|
||||
<property name="height_request">450</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
|
0
pamac/__init__.py
Normal file → Executable file
0
pamac/__init__.py
Normal file → Executable file
0
pamac/common.py
Normal file → Executable file
0
pamac/common.py
Normal file → Executable file
0
pamac/config.py
Normal file → Executable file
0
pamac/config.py
Normal file → Executable file
18
pamac/manager.py
Normal file → Executable file
18
pamac/manager.py
Normal file → Executable file
@ -14,7 +14,7 @@ from pamac import config, common, transaction
|
||||
|
||||
interface = Gtk.Builder()
|
||||
interface.add_from_file('/usr/share/pamac/gui/manager.glade')
|
||||
interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
|
||||
#interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
|
||||
|
||||
MainWindow = interface.get_object("MainWindow")
|
||||
|
||||
@ -128,6 +128,7 @@ def refresh_packages_list():
|
||||
|
||||
def set_packages_list():
|
||||
global list_dict
|
||||
transaction.get_handle()
|
||||
if list_dict == "search":
|
||||
search_strings_list = search_entry.get_text().split()
|
||||
set_list_dict_search(*search_strings_list)
|
||||
@ -246,6 +247,11 @@ def handle_error(error):
|
||||
def handle_reply(reply):
|
||||
global transaction_type
|
||||
global transaction_dict
|
||||
if str(reply):
|
||||
transaction.ErrorDialog.format_secondary_text('Commit Error:\n'+str(reply))
|
||||
response = transaction.ErrorDialog.run()
|
||||
if response:
|
||||
transaction.ErrorDialog.hide()
|
||||
transaction.t_lock = False
|
||||
transaction.Release()
|
||||
transaction.ProgressWindow.hide()
|
||||
@ -257,24 +263,20 @@ def handle_reply(reply):
|
||||
|
||||
class Handler:
|
||||
def on_MainWindow_delete_event(self, *arg):
|
||||
transaction.StopDaemon()
|
||||
if __name__ == "__main__":
|
||||
Gtk.main_quit()
|
||||
else:
|
||||
MainWindow.hide()
|
||||
|
||||
def on_QuitButton_clicked(self, *arg):
|
||||
transaction.StopDaemon()
|
||||
if __name__ == "__main__":
|
||||
Gtk.main_quit()
|
||||
else:
|
||||
MainWindow.hide()
|
||||
|
||||
def on_ValidButton_clicked(self, *arg):
|
||||
#if not geteuid() == 0:
|
||||
#transaction.ErrorDialog.format_secondary_text("You need to be root to run packages transactions")
|
||||
#response = transaction.ErrorDialog.run()
|
||||
#if response:
|
||||
#transaction.ErrorDialog.hide()
|
||||
#el
|
||||
if not transaction_dict:
|
||||
transaction.ErrorDialog.format_secondary_text("No package is selected")
|
||||
response = transaction.ErrorDialog.run()
|
||||
@ -337,6 +339,8 @@ class Handler:
|
||||
|
||||
def on_TransValidButton_clicked(self, *arg):
|
||||
ConfDialog.hide()
|
||||
progress_label.set_text('Preparing...')
|
||||
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/setup.png')
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
if transaction_type is "remove":
|
||||
|
27
pamac/pamac-daemon.py
Normal file → Executable file
27
pamac/pamac-daemon.py
Normal file → Executable file
@ -18,12 +18,18 @@ class PamacDBusService(dbus.service.Object):
|
||||
self.t = None
|
||||
self.error = ''
|
||||
self.warning = ''
|
||||
self.action = ''
|
||||
self.icon = ''
|
||||
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):
|
||||
@ -116,6 +122,9 @@ class PamacDBusService(dbus.service.Object):
|
||||
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:
|
||||
@ -152,16 +161,10 @@ class PamacDBusService(dbus.service.Object):
|
||||
global t
|
||||
global error
|
||||
error = ''
|
||||
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
|
||||
for db in config.handle.get_syncdbs():
|
||||
try:
|
||||
t = config.handle.init_transaction()
|
||||
db.update(force=True)
|
||||
db.update(force=False)
|
||||
print('refresh')
|
||||
t.release()
|
||||
except pyalpm.error:
|
||||
@ -175,12 +178,6 @@ class PamacDBusService(dbus.service.Object):
|
||||
global error
|
||||
if self.policykit_test(sender,connexion,'org.manjaro.pamac.init_release'):
|
||||
error = ''
|
||||
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
|
||||
try:
|
||||
t = config.handle.init_transaction(**options)
|
||||
print('Init:',t.flags)
|
||||
|
90
pamac/transaction.py
Normal file → Executable file
90
pamac/transaction.py
Normal file → Executable file
@ -19,6 +19,7 @@ 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')
|
||||
|
||||
t_lock = False
|
||||
do_syncfirst = False
|
||||
@ -26,6 +27,11 @@ list_first = []
|
||||
to_remove = []
|
||||
to_add = []
|
||||
to_update = []
|
||||
handle = None
|
||||
|
||||
def get_handle():
|
||||
global handle
|
||||
handle = config.pacman_conf.initialize_alpm()
|
||||
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
bus = dbus.SystemBus()
|
||||
@ -40,9 +46,16 @@ To_Remove = proxy.get_dbus_method('To_Remove','org.manjaro.pamac')
|
||||
To_Add = proxy.get_dbus_method('To_Add','org.manjaro.pamac')
|
||||
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)
|
||||
@ -51,6 +64,9 @@ 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")
|
||||
@ -61,7 +77,7 @@ bus.add_signal_receiver(percent_signal_handler, dbus_interface = "org.manjaro.pa
|
||||
def init_transaction(**options):
|
||||
"Transaction initialization"
|
||||
global t_lock
|
||||
error = Init(options)
|
||||
error = Init(dbus.Dictionary(options, signature='sb'))
|
||||
if not error:
|
||||
t_lock = True
|
||||
return True
|
||||
@ -78,7 +94,7 @@ def check_conflicts():
|
||||
to_check = []
|
||||
warning = ''
|
||||
for pkgname in to_add:
|
||||
for repo in config.pacman_conf.initialize_alpm().get_syncdbs():
|
||||
for repo in handle.get_syncdbs():
|
||||
pkg = repo.get_pkg(pkgname)
|
||||
if pkg:
|
||||
to_check.append(pkg)
|
||||
@ -86,7 +102,7 @@ def check_conflicts():
|
||||
for target in to_check:
|
||||
if target.replaces:
|
||||
for name in target.replaces:
|
||||
pkg = config.pacman_conf.initialize_alpm().get_localdb().get_pkg(name)
|
||||
pkg = handle.get_localdb().get_pkg(name)
|
||||
if pkg:
|
||||
if not pkg.name in to_remove:
|
||||
to_remove.append(pkg.name)
|
||||
@ -95,11 +111,11 @@ def check_conflicts():
|
||||
warning = warning+pkg.name+' will be replaced by '+target.name
|
||||
if target.conflicts:
|
||||
for name in target.conflicts:
|
||||
pkg = config.pacman_conf.initialize_alpm().get_localdb().get_pkg(name)
|
||||
pkg = handle.get_localdb().get_pkg(name)
|
||||
if pkg:
|
||||
if not pkg.name in to_remove:
|
||||
to_remove.append(pkg.name)
|
||||
for installed_pkg in config.pacman_conf.initialize_alpm().get_localdb().pkgcache:
|
||||
for installed_pkg in handle.get_localdb().pkgcache:
|
||||
if installed_pkg.conflicts:
|
||||
for name in installed_pkg.conflicts:
|
||||
if name == target.name:
|
||||
@ -119,83 +135,49 @@ def get_to_add():
|
||||
global to_add
|
||||
to_add = To_Add()
|
||||
|
||||
def finalize():
|
||||
def do_refresh():
|
||||
"""Sync databases like pacman -Sy"""
|
||||
global t_lock
|
||||
error = Prepare()
|
||||
ProgressWindow.show_all()
|
||||
print('show')
|
||||
if t_lock is False:
|
||||
t_lock = True
|
||||
ProgressWindow.show_all()
|
||||
error = Refresh(timeout = 2000*1000)
|
||||
if error:
|
||||
ErrorDialog.format_secondary_text(error)
|
||||
response = ErrorDialog.run()
|
||||
if response:
|
||||
ErrorDialog.hide()
|
||||
Release()
|
||||
t_lock = False
|
||||
else:
|
||||
ProgressWindow.show_all()
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
Commit(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
|
||||
def handle_error(error):
|
||||
global t_lock
|
||||
global to_add
|
||||
global to_remove
|
||||
if not 'DBus.Error.NoReply' in str(error):
|
||||
ErrorDialog.format_secondary_text('Commit Error:\n'+str(error))
|
||||
response = ErrorDialog.run()
|
||||
if response:
|
||||
ErrorDialog.hide()
|
||||
t_lock = False
|
||||
Release()
|
||||
ProgressWindow.hide()
|
||||
to_add = []
|
||||
to_remove = []
|
||||
|
||||
def handle_reply(reply):
|
||||
global t_lock
|
||||
global to_add
|
||||
global to_remove
|
||||
print('reply',reply)
|
||||
print('hide')
|
||||
t_lock = False
|
||||
Release()
|
||||
ProgressWindow.hide()
|
||||
to_add = []
|
||||
to_remove = []
|
||||
|
||||
def do_refresh():
|
||||
"""Sync databases like pacman -Sy"""
|
||||
global t
|
||||
global t_lock
|
||||
if t_lock is False:
|
||||
progress_label.set_text('Refreshing...')
|
||||
progress_bar.pulse()
|
||||
action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/refresh-cache.png')
|
||||
ProgressWindow.show_all()
|
||||
t_lock = True
|
||||
Refresh(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
|
||||
def get_updates():
|
||||
"""Return a list of package objects in local db which can be updated"""
|
||||
global do_syncfirst
|
||||
global list_first
|
||||
get_handle()
|
||||
if config.syncfirst:
|
||||
for name in config.syncfirst:
|
||||
pkg = config.pacman_conf.initialize_alpm().get_localdb().get_pkg(name)
|
||||
candidate = pyalpm.sync_newversion(pkg, config.pacman_conf.initialize_alpm().get_syncdbs())
|
||||
pkg = handle.get_localdb().get_pkg(name)
|
||||
candidate = pyalpm.sync_newversion(pkg, handle.get_syncdbs())
|
||||
if candidate:
|
||||
list_first.append(candidate)
|
||||
if list_first:
|
||||
do_syncfirst = True
|
||||
return list_first
|
||||
result = []
|
||||
installed_pkglist = config.pacman_conf.initialize_alpm().get_localdb().pkgcache
|
||||
installed_pkglist = handle.get_localdb().pkgcache
|
||||
for pkg in installed_pkglist:
|
||||
candidate = pyalpm.sync_newversion(pkg, config.pacman_conf.initialize_alpm().get_syncdbs())
|
||||
candidate = pyalpm.sync_newversion(pkg, handle.get_syncdbs())
|
||||
if candidate:
|
||||
result.append(candidate)
|
||||
return result
|
||||
|
||||
def get_new_version_available(pkgname):
|
||||
for repo in config.pacman_conf.initialize_alpm().get_syncdbs():
|
||||
for repo in handle.get_syncdbs():
|
||||
pkg = repo.get_pkg(pkgname)
|
||||
if pkg is not None:
|
||||
return pkg.version
|
||||
|
0
pamac/tray.py
Normal file → Executable file
0
pamac/tray.py
Normal file → Executable file
70
pamac/updater.py
Normal file → Executable file
70
pamac/updater.py
Normal file → Executable file
@ -10,7 +10,7 @@ from pamac import config, common, transaction
|
||||
|
||||
interface = Gtk.Builder()
|
||||
interface.add_from_file('/usr/share/pamac/gui/updater.glade')
|
||||
interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
|
||||
#interface.add_from_file('/usr/share/pamac/gui/dialogs.glade')
|
||||
|
||||
UpdateWindow = interface.get_object("UpdateWindow")
|
||||
|
||||
@ -49,7 +49,7 @@ def set_transaction_add():
|
||||
bottom_label.set_markup('')
|
||||
if transaction.to_add:
|
||||
installed_name = []
|
||||
for pkg_object in config.handle.get_localdb().pkgcache:
|
||||
for pkg_object in transaction.handle.get_localdb().pkgcache:
|
||||
installed_name.append(pkg_object.name)
|
||||
transaction.to_update = sorted(set(installed_name).intersection(transaction.to_add))
|
||||
to_remove_from_add_name = sorted(set(transaction.to_update).intersection(transaction.to_add))
|
||||
@ -65,20 +65,59 @@ def set_transaction_add():
|
||||
#bottom_label.set_markup('<b>Total Download size: </b>'+format_size(totaldlcb))
|
||||
top_label.set_markup('<big><b>Additionnal Transaction(s)</b></big>')
|
||||
|
||||
def finalize():
|
||||
error = transaction.Prepare()
|
||||
if error:
|
||||
ErrorDialog.format_secondary_text(error)
|
||||
response = ErrorDialog.run()
|
||||
if response:
|
||||
ErrorDialog.hide()
|
||||
transaction.Release()
|
||||
transaction.t_lock = False
|
||||
else:
|
||||
transaction.progress_label.set_text('Preparing...')
|
||||
transaction.action_icon.set_from_file('/usr/share/pamac/icons/24x24/status/setup.png')
|
||||
transaction.ProgressWindow.show_all()
|
||||
while Gtk.events_pending():
|
||||
Gtk.main_iteration()
|
||||
transaction.Commit(reply_handler = handle_reply, error_handler = handle_error, timeout = 2000*1000)
|
||||
|
||||
def handle_error(error):
|
||||
if not 'DBus.Error.NoReply' in str(error):
|
||||
transaction.ErrorDialog.format_secondary_text('Commit Error:\n'+str(error))
|
||||
response = transaction.ErrorDialog.run()
|
||||
if response:
|
||||
transaction.ErrorDialog.hide()
|
||||
transaction.t_lock = False
|
||||
transaction.Release()
|
||||
transaction.ProgressWindow.hide()
|
||||
have_updates()
|
||||
|
||||
def handle_reply(reply):
|
||||
if str(reply):
|
||||
transaction.ErrorDialog.format_secondary_text('Commit Error:\n'+str(reply))
|
||||
response = transaction.ErrorDialog.run()
|
||||
if response:
|
||||
transaction.ErrorDialog.hide()
|
||||
transaction.t_lock = False
|
||||
transaction.Release()
|
||||
transaction.ProgressWindow.hide()
|
||||
have_updates()
|
||||
|
||||
def do_sysupgrade():
|
||||
"""Upgrade a system like pacman -Su"""
|
||||
if transaction.t_lock is False:
|
||||
if transaction.do_syncfirst is True:
|
||||
if transaction.init_transaction(recurse = True):
|
||||
for pkg in transaction.list_first:
|
||||
transaction.t.add_pkg(pkg)
|
||||
transaction.to_remove = transaction.t.to_remove
|
||||
transaction.to_add = transaction.t.to_add
|
||||
transaction.Add(pkg.name)
|
||||
transaction.get_to_remove()
|
||||
transaction.get_to_add()
|
||||
set_transaction_add()
|
||||
if len(transaction_add) != 0:
|
||||
if len(transaction.to_add) != 0:
|
||||
ConfDialog.show_all()
|
||||
else:
|
||||
transaction.t_finalize()
|
||||
finalize()
|
||||
transaction.do_syncfirst = False
|
||||
transaction.list_first = []
|
||||
else:
|
||||
@ -108,16 +147,18 @@ def do_sysupgrade():
|
||||
if len(transaction_add) != 0:
|
||||
ConfDialog.show_all()
|
||||
else:
|
||||
transaction.t_finalize()
|
||||
finalize()
|
||||
|
||||
class Handler:
|
||||
def on_UpdateWindow_delete_event(self, *arg):
|
||||
transaction.StopDaemon()
|
||||
if __name__ == "__main__":
|
||||
Gtk.main_quit()
|
||||
else:
|
||||
UpdateWindow.hide()
|
||||
|
||||
def on_QuitButton_clicked(self, *arg):
|
||||
transaction.StopDaemon()
|
||||
if __name__ == "__main__":
|
||||
Gtk.main_quit()
|
||||
else:
|
||||
@ -125,7 +166,6 @@ class Handler:
|
||||
|
||||
def on_ApplyButton_clicked(self, *arg):
|
||||
do_sysupgrade()
|
||||
have_updates()
|
||||
|
||||
def on_RefreshButton_clicked(self, *arg):
|
||||
transaction.do_refresh()
|
||||
@ -134,18 +174,24 @@ class Handler:
|
||||
def on_TransCancelButton_clicked(self, *arg):
|
||||
ConfDialog.hide()
|
||||
transaction.t_lock = False
|
||||
transaction.t.release()
|
||||
transaction.Release()
|
||||
|
||||
def on_TransValidButton_clicked(self, *arg):
|
||||
ConfDialog.hide()
|
||||
transaction.t_finalize(t)
|
||||
finalize()
|
||||
|
||||
def on_ProgressCancelButton_clicked(self, *arg):
|
||||
transaction.t_lock = False
|
||||
transaction.Release()
|
||||
transaction.ProgressWindow.hide()
|
||||
have_updates()
|
||||
|
||||
def main():
|
||||
#transaction.do_refresh()
|
||||
have_updates()
|
||||
interface.connect_signals(Handler())
|
||||
UpdateWindow.show_all()
|
||||
|
||||
if __name__ == "__main__":
|
||||
transaction.do_refresh()
|
||||
main()
|
||||
Gtk.main()
|
||||
|
Loading…
Reference in New Issue
Block a user