[sulfur] fix various installation handling glitches
:: make installation errors handling easier :: better handle package masking install abortions :: when not accepting a license, push user back to install queue tab :: make the "show license" button work better (use gtk.Window.show() and not show_all()) :: make possible to accept a package license by also clicking on packages, which are children of the license identifier TreeIter parent object
This commit is contained in:
@@ -1486,6 +1486,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.switch_notebook_page('packages')
|
||||
return False
|
||||
|
||||
switch_back_page = None
|
||||
self.hide_notebook_tabs_for_install()
|
||||
self.disable_ugc = True
|
||||
self.set_status_ticker(_("Running tasks"))
|
||||
@@ -1525,11 +1526,11 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.ui_lock(True)
|
||||
|
||||
controller = QueueExecutor(self)
|
||||
self.my_inst_errors = None
|
||||
self.my_inst_error = 0
|
||||
self.my_inst_abort = False
|
||||
def run_tha_bstrd():
|
||||
try:
|
||||
e, i = controller.run(install_queue[:],
|
||||
e = controller.run(install_queue[:],
|
||||
removal_queue[:], do_purge_cache,
|
||||
fetch_only = fetch_only,
|
||||
download_sources = download_sources,
|
||||
@@ -1540,7 +1541,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
except:
|
||||
entropy.tools.print_traceback()
|
||||
e, i = 1, None
|
||||
self.my_inst_errors = (e, i,)
|
||||
self.my_inst_error = e
|
||||
|
||||
t = ParallelTask(run_tha_bstrd)
|
||||
t.start()
|
||||
@@ -1556,7 +1557,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
if self.do_debug and (dbg_count % 500 == 0):
|
||||
print "process_queue: after QueueExecutor loop"
|
||||
|
||||
e,i = self.my_inst_errors
|
||||
err = self.my_inst_error
|
||||
if self.do_debug:
|
||||
print "process_queue: left all"
|
||||
|
||||
@@ -1572,7 +1573,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
if self.do_debug:
|
||||
print "process_queue: gui unlocked"
|
||||
|
||||
if (e == 0) and ((not fetch_only) and (not download_sources)):
|
||||
if (err == 0) and ((not fetch_only) and (not download_sources)):
|
||||
# this triggers post-branch upgrade function inside
|
||||
# Entropy Client SystemSettings plugin
|
||||
self.Equo.SystemSettings.clear()
|
||||
@@ -1580,12 +1581,18 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
if self.my_inst_abort:
|
||||
okDialog(self.ui.main,
|
||||
_("Attention. You chose to abort the processing."))
|
||||
elif (e != 0):
|
||||
elif err == 1: # install failed
|
||||
okDialog(self.ui.main,
|
||||
_("Attention. An error occured when processing the queue."
|
||||
"\nPlease have a look in the processing terminal.")
|
||||
)
|
||||
elif (e == 0) and restart_needed and \
|
||||
elif err in (2, 3):
|
||||
# 2: masked package cannot be unmasked
|
||||
# 3: license not accepted, move back to queue page
|
||||
switch_back_page = 'queue'
|
||||
state = False
|
||||
|
||||
elif (err == 0) and restart_needed and \
|
||||
((not fetch_only) and (not download_sources)):
|
||||
okDialog(self.ui.main,
|
||||
_("Attention. You have updated Entropy."
|
||||
@@ -1625,7 +1632,7 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
self.Equo.FileUpdates.scanfs(dcache = False, quiet = True)
|
||||
if self.Equo.FileUpdates.scandata:
|
||||
if len(self.Equo.FileUpdates.scandata) > 0:
|
||||
self.switch_notebook_page('filesconf')
|
||||
switch_back_page = 'filesconf'
|
||||
if self.do_debug:
|
||||
print "process_queue: all done"
|
||||
|
||||
@@ -1634,6 +1641,8 @@ class SulfurApplication(Controller, SulfurApplicationEventsMixin):
|
||||
|
||||
self.show_notebook_tabs_after_install()
|
||||
self.disable_ugc = False
|
||||
if switch_back_page is not None:
|
||||
self.switch_notebook_page(switch_back_page)
|
||||
return state
|
||||
|
||||
def ui_lock(self, lock):
|
||||
|
||||
@@ -6303,11 +6303,16 @@ class LicenseDialog:
|
||||
self.licenseView.set_buffer(mybuffer)
|
||||
txt = "[%s] %s" % (license_identifier, _("license text"),)
|
||||
self.read_dialog.set_title(txt)
|
||||
self.read_dialog.show_all()
|
||||
self.read_dialog.show()
|
||||
|
||||
def accept_selected_license(self, widget):
|
||||
model, iterator = self.view.get_selection().get_selected()
|
||||
if model != None and iterator != None:
|
||||
|
||||
if model.iter_depth(iterator):
|
||||
# we need to get its parent
|
||||
iterator = model.get_iter_root()
|
||||
|
||||
license_identifier = model.get_value( iterator, 0 )
|
||||
chief = model.get_value( iterator, 1 )
|
||||
if chief:
|
||||
|
||||
@@ -59,7 +59,7 @@ class QueueExecutor:
|
||||
time.sleep(0.2)
|
||||
return self.__on_lic_rc
|
||||
|
||||
return 0,licenses
|
||||
return 0, licenses
|
||||
|
||||
def ok_dialog(self, msg):
|
||||
def do_dialog():
|
||||
@@ -70,6 +70,14 @@ class QueueExecutor:
|
||||
def run(self, install_queue, removal_queue, do_purge_cache = [],
|
||||
fetch_only = False, download_sources = False, selected_by_user = None):
|
||||
|
||||
"""
|
||||
return statuses:
|
||||
0 = no errors
|
||||
1 = install/removal error
|
||||
2 = license massk error
|
||||
3 = license not accepted
|
||||
"""
|
||||
|
||||
if selected_by_user == None:
|
||||
selected_by_user = set()
|
||||
|
||||
@@ -81,7 +89,7 @@ class QueueExecutor:
|
||||
atom = dbconn.retrieveAtom(match[0])
|
||||
self.ok_dialog("%s: %s" % (
|
||||
_("Error enabling masked package"), atom))
|
||||
return -2,1
|
||||
return 2
|
||||
|
||||
removalQueue = []
|
||||
runQueue = []
|
||||
@@ -95,14 +103,15 @@ class QueueExecutor:
|
||||
|
||||
rc, licenses = self.handle_licenses(runQueue)
|
||||
if rc != 0:
|
||||
return 0,0
|
||||
return 3
|
||||
|
||||
for lic in licenses:
|
||||
self.Entropy.clientDbconn.acceptLicense(lic)
|
||||
|
||||
totalqueue = len(runQueue)
|
||||
steps_here = 2
|
||||
if fetch_only: steps_here = 1
|
||||
if fetch_only:
|
||||
steps_here = 1
|
||||
progress_step = float(1)/((totalqueue*steps_here)+len(removalQueue))
|
||||
step = progress_step
|
||||
myrange = []
|
||||
@@ -157,7 +166,7 @@ class QueueExecutor:
|
||||
)
|
||||
rc = Package.run()
|
||||
if rc != 0:
|
||||
return -1,rc
|
||||
return 1
|
||||
Package.kill()
|
||||
del Package
|
||||
self.Entropy.cycleDone()
|
||||
@@ -180,7 +189,7 @@ class QueueExecutor:
|
||||
gobject.timeout_add(0, do_skip_hide)
|
||||
|
||||
if fetch_only or download_sources:
|
||||
return 0,0
|
||||
return 0
|
||||
|
||||
# then removalQueue
|
||||
# NOT conflicts! :-)
|
||||
@@ -209,7 +218,7 @@ class QueueExecutor:
|
||||
|
||||
rc = Package.run()
|
||||
if rc != 0:
|
||||
return -1,rc
|
||||
return 1
|
||||
|
||||
Package.kill()
|
||||
|
||||
@@ -252,7 +261,7 @@ class QueueExecutor:
|
||||
|
||||
rc = Package.run()
|
||||
if rc != 0:
|
||||
return -1,rc
|
||||
return 1
|
||||
|
||||
Package.kill()
|
||||
self.Entropy.cycleDone()
|
||||
@@ -265,7 +274,7 @@ class QueueExecutor:
|
||||
return False
|
||||
gobject.timeout_add(0, do_skip_hide_again)
|
||||
|
||||
return 0,0
|
||||
return 0
|
||||
|
||||
|
||||
class Equo(EquoInterface):
|
||||
|
||||
@@ -460,7 +460,7 @@
|
||||
<widget class="GtkLabel" id="rbPkgSetsLabel1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Queued</property>
|
||||
<property name="label" translatable="yes">Installation</property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
|
||||
Reference in New Issue
Block a user