Beispiel #1
0
def can_set_action(pkg):
    ## Make sure we don't add different "package" types
    this_type = rcd_util.get_package_type(pkg)

    for p in package_data.values():
        if p.has_key("action") and p["action"] != NO_ACTION and \
           p.has_key("__package") and \
           this_type != rcd_util.get_package_type(p["__package"]):
            return 0

    return 1
Beispiel #2
0
def can_set_action(pkg):
    ## Make sure we don't add different "package" types
    this_type = rcd_util.get_package_type(pkg)

    for p in package_data.values():
        if p.has_key("action") and p["action"] != NO_ACTION and \
           p.has_key("__package") and \
           this_type != rcd_util.get_package_type(p["__package"]):
            return 0

    return 1
Beispiel #3
0
def show_package_info(pkg, parent=None):

    key = rcd_util.get_package_key(pkg)
    if package_infos.has_key(key):
        dialog = package_infos[key]
        dialog.present()
        return

    book = PackageBook()
    book.set_tab_pos(gtk.POS_TOP)
    book.add_page(red_packagepage_info.PackagePage_Info())
    if rcd_util.get_package_type(pkg) == rcd_util.PACKAGE_TYPE_PACKAGE:
        book.add_page(red_packagepage.PackagePage_History())
        book.add_page(red_packagepage_deps.PackagePage_Deps())

    book.set_package(pkg)

    title = _("Package Information") + ": " + pkg["name"]
    dialog = gtk.Dialog(title, parent=parent)
    dialog.set_default_size(450, 350)
    button = dialog.add_button(gtk.STOCK_CLOSE, 0)
    # grab_default() is not sufficient here.
    button.grab_focus()
    dialog.connect("response", lambda d, code: d.destroy())

    dialog.vbox.add(book)

    def destroy_cb(dialog, key):
        del package_infos[key]

    package_infos[key] = dialog
    dialog.connect("destroy", destroy_cb, key)

    book.show_all()
    dialog.show_all()
Beispiel #4
0
def can_remove_package(pkg):
	this_type = rcd_util.get_package_type(pkg)

	if this_type == rcd_util.PACKAGE_TYPE_PACKAGE:
		return 1
	if this_type == rcd_util.PACKAGE_TYPE_PATCH:
		return 0
	if this_type == rcd_util.PACKAGE_TYPE_BUNDLE:
		return 1

	return 0
Beispiel #5
0
def can_remove_package(pkg):
    this_type = rcd_util.get_package_type(pkg)

    if this_type == rcd_util.PACKAGE_TYPE_PACKAGE:
        return 1
    if this_type == rcd_util.PACKAGE_TYPE_PATCH:
        return 0
    if this_type == rcd_util.PACKAGE_TYPE_BUNDLE:
        return 1

    return 0
Beispiel #6
0
def run_transaction_cb(app):
    install_packages = red_pendingops.packages_with_actions(
        red_pendingops.TO_BE_INSTALLED)
    remove_packages = red_pendingops.packages_with_actions(
        red_pendingops.TO_BE_REMOVED)

    # FIXME: This feels like a hack.  Go through the remove_packages and
    # if any of them have an __old_package field, use that package for
    # the removal instead of the actual package.  This is so you can right
    # click on an upgrade and select "remove".
    remove_packages = [x.get("__old_package", x) for x in remove_packages]

    transaction_type = rcd_util.PACKAGE_TYPE_PACKAGE
    if len(install_packages) > 0:
        transaction_type = rcd_util.get_package_type(install_packages[0])
    elif len(remove_packages) > 0:
        transaction_type = rcd_util.get_package_type(remove_packages[0])

    dep_comp = red_depcomponent.DepComponent(install_packages, remove_packages,
                                             0, transaction_type)
    app.componentbook.push_component(dep_comp)
Beispiel #7
0
def run_transaction_cb(app):
    install_packages = red_pendingops.packages_with_actions(
        red_pendingops.TO_BE_INSTALLED)
    remove_packages = red_pendingops.packages_with_actions(
        red_pendingops.TO_BE_REMOVED)

    # FIXME: This feels like a hack.  Go through the remove_packages and
    # if any of them have an __old_package field, use that package for
    # the removal instead of the actual package.  This is so you can right
    # click on an upgrade and select "remove".
    remove_packages = [x.get("__old_package", x) for x in remove_packages]

    transaction_type = rcd_util.PACKAGE_TYPE_PACKAGE
    if len(install_packages) > 0:
        transaction_type = rcd_util.get_package_type(install_packages[0])
    elif len(remove_packages) > 0:
        transaction_type = rcd_util.get_package_type(remove_packages[0])

    dep_comp = red_depcomponent.DepComponent(install_packages,
                                             remove_packages,
                                             0,
                                             transaction_type)
    app.componentbook.push_component(dep_comp)