def askInstallPackage(self, package, summary, description, homepage):
# populate the dialog
dia = self.dia
dia_xml = self.dia_xml
header = _("Install additional software?")
body = _("Do you want to install package '%s'?") % package
dia.set_title('')
header_label = dia_xml.get_object('header_label')
header_label.set_markup("<b><big>%s</big></b>" % header)
body_label = dia_xml.get_object('body_label')
body_label.set_label(body)
description_text_view = dia_xml.get_object('description_text_view')
tbuf = Gtk.TextBuffer()
desc = "%s\n\n%s" % (summary, Helpers.format_description(description))
tbuf.set_text(desc)
description_text_view.set_buffer(tbuf)
dia.set_icon(Gtk.IconTheme.get_default().load_icon('package-x-generic', 16, False))
# check if another package manager is already running
# FIXME: just checking for the existance of the file is
# not sufficient, it need to be tested if it can
# be locked via apt_pkg.get_lock()
# - but that needs to run as root
# - a dbus helper might be the best answer here
#args = (update_button_status, dia_xml.get_object("yes_button"),
# dia_xml.get_object("infolabel"))
#args[0](*args[1:])
#timer_id = GObject.timeout_add(750, *args )
# show the dialog
res = dia.run()
#GObject.source_remove(timer_id)
if res != Gtk.ResponseType.YES:
dia.hide()
return False
return True
# progress etc
评论列表
文章目录