def _browse_file(self, dialog_name, startfolder=None, foldermode=False):
        mode = gtk.FILE_CHOOSER_ACTION_OPEN
        if foldermode:
            mode = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER

        return util.browse_local(self.topwin, dialog_name, self.conn,
                                 dialog_type=mode,
                                 start_folder=startfolder)
    def _browse_file(self, dialog_name, startfolder=None, foldermode=False):
        mode = Gtk.FileChooserAction.OPEN
        if foldermode:
            mode = Gtk.FileChooserAction.SELECT_FOLDER

        return util.browse_local(self.topwin, dialog_name, self.conn,
                                 dialog_type=mode,
                                 start_folder=startfolder)
    def browse_local(self, src_ignore):
        if not self.local_args.get("dialog_name"):
            self.local_args["dialog_name"] = None

        filename = util.browse_local(parent=self.topwin,
                                     conn=self.conn,
                                     **self.local_args)
        if filename:
            self._do_finish(path=filename)
    def browse_local(self, src_ignore):
        if not self.local_args.get("dialog_name"):
            self.local_args["dialog_name"] = None

        filename = util.browse_local(parent=self.topwin,
                                     conn=self.conn,
                                     **self.local_args)
        if filename:
            self._do_finish(path=filename)
Exemple #5
0
    def _browse_file(self, dialog_name, startfolder=None, foldermode=False):
        mode = Gtk.FileChooserAction.OPEN
        if foldermode:
            mode = Gtk.FileChooserAction.SELECT_FOLDER

        return util.browse_local(self.topwin,
                                 dialog_name,
                                 self.conn,
                                 dialog_type=mode,
                                 start_folder=startfolder)
    def _do_save_domain(self, src, uri, uuid):
        conn = self._lookup_conn(uri)
        vm = conn.get_vm(uuid)
        managed = bool(vm.managedsave_supported)

        if not managed and conn.is_remote():
            src.err.val_err(
                _(
                    "Saving virtual machines over remote "
                    "connections is not supported with this "
                    "libvirt version or hypervisor."
                )
            )
            return

        if not util.chkbox_helper(
            src,
            self.config.get_confirm_poweroff,
            self.config.set_confirm_poweroff,
            text1=_("Are you sure you want to save '%s'?" % vm.get_name()),
        ):
            return

        path = None
        if not managed:
            path = util.browse_local(
                src.topwin,
                _("Save Virtual Machine"),
                conn,
                dialog_type=gtk.FILE_CHOOSER_ACTION_SAVE,
                browse_reason=self.config.CONFIG_DIR_SAVE,
            )
            if not path:
                return

        _cancel_back = None
        _cancel_args = []
        if vm.getjobinfo_supported:
            _cancel_back = self._save_cancel
            _cancel_args = [vm]

        progWin = vmmAsyncJob(
            self._save_callback,
            [vm, path],
            _("Saving Virtual Machine"),
            _("Saving virtual machine memory to disk "),
            src.topwin,
            cancel_back=_cancel_back,
            cancel_args=_cancel_args,
        )
        error, details = progWin.run()

        if error is not None:
            error = _("Error saving domain: %s") % error
            src.err.show_err(error, details=details)
Exemple #7
0
    def _do_save_domain(self, src, uri, uuid):
        conn = self._lookup_conn(uri)
        vm = conn.get_vm(uuid)
        managed = bool(vm.managedsave_supported)

        if not managed and conn.is_remote():
            src.err.val_err(
                _("Saving virtual machines over remote "
                  "connections is not supported with this "
                  "libvirt version or hypervisor."))
            return

        if not util.chkbox_helper(
                src,
                self.config.get_confirm_poweroff,
                self.config.set_confirm_poweroff,
                text1=_(
                    "Are you sure you want to save '%s'?" % vm.get_name())):
            return

        path = None
        if not managed:
            path = util.browse_local(src.topwin,
                                     _("Save Virtual Machine"),
                                     conn,
                                     dialog_type=gtk.FILE_CHOOSER_ACTION_SAVE,
                                     browse_reason=self.config.CONFIG_DIR_SAVE)
            if not path:
                return

        _cancel_back = None
        _cancel_args = []
        if vm.getjobinfo_supported:
            _cancel_back = self._save_cancel
            _cancel_args = [vm]

        progWin = vmmAsyncJob(self._save_callback, [vm, path],
                              _("Saving Virtual Machine"),
                              _("Saving virtual machine memory to disk "),
                              src.topwin,
                              cancel_back=_cancel_back,
                              cancel_args=_cancel_args)
        error, details = progWin.run()

        if error is not None:
            error = _("Error saving domain: %s") % error
            src.err.show_err(error, details=details)
    def _do_restore_domain(self, src, uri):
        conn = self._lookup_conn(uri)
        if conn.is_remote():
            src.err.val_err(_("Restoring virtual machines over remote " "connections is not yet supported"))
            return

        path = util.browse_local(
            src.topwin, _("Restore Virtual Machine"), conn, browse_reason=self.config.CONFIG_DIR_RESTORE
        )

        if not path:
            return

        def cb():
            newconn = util.dup_conn(conn)
            newconn.restore(path)

        vmmAsyncJob.simple_async_noshow(cb, [], src, _("Error restoring domain"))
Exemple #9
0
    def _do_restore_domain(self, src, uri):
        conn = self._lookup_conn(uri)
        if conn.is_remote():
            src.err.val_err(_("Restoring virtual machines over remote "
                              "connections is not yet supported"))
            return

        path = util.browse_local(src.topwin,
                                 _("Restore Virtual Machine"),
                                 conn,
                                 browse_reason=self.config.CONFIG_DIR_RESTORE)

        if not path:
            return

        def cb():
            newconn = util.dup_conn(conn)
            newconn.restore(path)

        vmmAsyncJob.simple_async_noshow(cb, [], src,
                                        _("Error restoring domain"))