Beispiel #1
0
    def set_package_action_cb(self, action):
        comp = self.componentbook.get_visible_component()

        assert comp is not None

        pkgs = comp.get_current_packages()
        for pkg in pkgs:
            if red_pendingops.can_perform_action_single(pkg, action):
                red_pendingops.set_action(pkg, action)
Beispiel #2
0
    def set_package_action_cb(self, action):
        comp = self.componentbook.get_visible_component()

        assert comp is not None
        
        pkgs = comp.get_current_packages()
        for pkg in pkgs:
            if red_pendingops.can_perform_action_single(pkg, action):
                red_pendingops.set_action(pkg, action)
Beispiel #3
0
    def refresh(self):
        # We need to go through and delete packages in the pending actions
        # if they were going to be installed from a channel which no longer
        # exists.
        actions = (red_pendingops.TO_BE_INSTALLED,
                   red_pendingops.TO_BE_INSTALLED_CANCELLED)
        for pkg in red_pendingops.packages_with_actions(*actions):
            if not rcd_util.get_channel(pkg.get("channel", "")):
                red_pendingops.set_action(pkg, red_pendingops.NO_ACTION)

        self.changed(lambda x: x)  # noop
Beispiel #4
0
 def ready_cb(dw, p, d, tid):
     gtk.timeout_remove(tid)
     d.destroy()
     if p:
         red_pendingops.set_action(p, red_pendingops.TO_BE_INSTALLED)
     else:
         if not dw.cancelled:
             dialog = gtk.MessageDialog(
                 None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
                 _("%s is not a valid package") % dw.url)
             gtk.threads_enter()
             dialog.run()
             gtk.threads_leave()
             dialog.destroy()
Beispiel #5
0
 def ready_cb(dw, p, d, tid):
     gtk.timeout_remove(tid)
     d.destroy()
     if p:
         red_pendingops.set_action(p, red_pendingops.TO_BE_INSTALLED)
     else:
         if not dw.cancelled:
             dialog = gtk.MessageDialog(None, 0,
                                        gtk.MESSAGE_ERROR,
                                        gtk.BUTTONS_OK,
                                        _("%s is not a valid package") % dw.url)
             gtk.threads_enter()
             dialog.run()
             gtk.threads_leave()
             dialog.destroy()
Beispiel #6
0
            dialog.destroy()
            err = 1
        else:
            raise
    else:
        if not plist:
            dialog = gtk.MessageDialog(
                parent, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR,
                gtk.BUTTONS_OK, _("There are no valid packages to install"))
            dialog.run()
            dialog.destroy()
            err = 1

    if not err:
        [
            red_pendingops.set_action(x, red_pendingops.TO_BE_INSTALLED)
            for x in plist
        ]

    return err


def install_local(parent):
    def get_file_cb(b, fs):
        err = install_files(fs.get_selections(), fs)
        if not err:
            fs.destroy()

    filesel = gtk.FileSelection(_("Install from File"))
    filesel.set_filename(os.environ.get("HOME", "") + "/")  # need trailing /
    filesel.set_select_multiple(1)
Beispiel #7
0
            dialog.destroy()
            err = 1
        else:
            raise
    else:
        if not plist:
            dialog = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT,
                                       gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
                                       _("There are no valid packages to install"))
            dialog.run()
            dialog.destroy()
            err = 1
            

    if not err:
        [red_pendingops.set_action(x, red_pendingops.TO_BE_INSTALLED) for x in plist]

    return err


def install_local(parent):
    
    def get_file_cb(b, fs):
        err = install_files (fs.get_selections(), fs)
        if not err:
            fs.destroy()
            
    filesel = gtk.FileSelection(_("Install from File"))
    filesel.set_filename(os.environ.get("HOME", "") + "/") # need trailing /
    filesel.set_select_multiple(1)
    filesel.ok_button.connect("clicked", get_file_cb, filesel)
Beispiel #8
0
 def set_package_action(pkgs, action):
     for pkg in pkgs:
         if red_pendingops.can_perform_action_single(pkg, action):
             red_pendingops.set_action(pkg, action)