mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Merge heads
This commit is contained in:
commit
fdb0678c46
@ -49,9 +49,10 @@
|
|||||||
<property name="label" translatable="yes">New machine...</property>
|
<property name="label" translatable="yes">New machine...</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<signal name="activate" handler="on_menu_file_new_activate" last_modification_time="Tue, 28 Mar 2006 17:06:34 GMT"/>
|
<signal name="activate" handler="on_menu_file_new_activate" last_modification_time="Tue, 28 Mar 2006 17:06:34 GMT"/>
|
||||||
|
<accelerator key="n" modifiers="GDK_MOD1_MASK" signal="activate"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image42">
|
<widget class="GtkImage" id="image65">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-new</property>
|
<property name="stock">gtk-new</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -64,6 +65,29 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImageMenuItem" id="restore_saved">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="tooltip" translatable="yes">Restore a saved machine from a filesystem image</property>
|
||||||
|
<property name="label" translatable="yes">Restore saved machine...</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="activate" handler="on_menu_restore_saved_activate" last_modification_time="Wed, 19 Jul 2006 18:10:04 GMT"/>
|
||||||
|
<accelerator key="r" modifiers="GDK_MOD1_MASK" signal="activate"/>
|
||||||
|
|
||||||
|
<child internal-child="image">
|
||||||
|
<widget class="GtkImage" id="image66">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="stock">gtk-open</property>
|
||||||
|
<property name="icon_size">1</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkSeparatorMenuItem" id="separator4">
|
<widget class="GtkSeparatorMenuItem" id="separator4">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -78,7 +102,7 @@
|
|||||||
<signal name="activate" handler="on_menu_file_open_connection_activate" last_modification_time="Mon, 12 Jun 2006 20:34:47 GMT"/>
|
<signal name="activate" handler="on_menu_file_open_connection_activate" last_modification_time="Mon, 12 Jun 2006 20:34:47 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image43">
|
<widget class="GtkImage" id="image67">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-connect</property>
|
<property name="stock">gtk-connect</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -136,7 +160,7 @@
|
|||||||
<signal name="activate" handler="on_menu_edit_details_activate" last_modification_time="Tue, 28 Mar 2006 17:06:34 GMT"/>
|
<signal name="activate" handler="on_menu_edit_details_activate" last_modification_time="Tue, 28 Mar 2006 17:06:34 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image44">
|
<widget class="GtkImage" id="image68">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-properties</property>
|
<property name="stock">gtk-properties</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -157,7 +181,7 @@
|
|||||||
<signal name="activate" handler="on_menu_edit_delete_activate" last_modification_time="Tue, 28 Mar 2006 17:06:34 GMT"/>
|
<signal name="activate" handler="on_menu_edit_delete_activate" last_modification_time="Tue, 28 Mar 2006 17:06:34 GMT"/>
|
||||||
|
|
||||||
<child internal-child="image">
|
<child internal-child="image">
|
||||||
<widget class="GtkImage" id="image45">
|
<widget class="GtkImage" id="image69">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="stock">gtk-delete</property>
|
<property name="stock">gtk-delete</property>
|
||||||
<property name="icon_size">1</property>
|
<property name="icon_size">1</property>
|
||||||
@ -3269,7 +3293,7 @@ Máirín Duffy <duffy@redhat.com>
|
|||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget class="GtkWindow" id="vmm-save-progress">
|
<widget class="GtkWindow" id="vmm-progress">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="title" translatable="yes">Saving VM Image</property>
|
<property name="title" translatable="yes">Saving VM Image</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
@ -3294,7 +3318,7 @@ Máirín Duffy <duffy@redhat.com>
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label94">
|
<widget class="GtkLabel" id="label94">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Please wait while the VM image saves...</property>
|
<property name="label" translatable="yes">Please wait...</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
gtk.threads_init()
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.glib
|
import dbus.glib
|
||||||
|
54
src/virtManager/asyncjob.py
Normal file
54
src/virtManager/asyncjob.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2006 Red Hat, Inc.
|
||||||
|
# Copyright (C) 2006 Hugh O. Brock <hbrock@redhat.com>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
import threading
|
||||||
|
import gtk
|
||||||
|
import gtk.glade
|
||||||
|
import gobject
|
||||||
|
|
||||||
|
# Displays a progress bar while executing the "callback" method.
|
||||||
|
|
||||||
|
class asyncJob(gobject.GObject):
|
||||||
|
def __init__(self, config, callback, args=None, title="Progress"):
|
||||||
|
self.__gobject_init__()
|
||||||
|
self.config = config
|
||||||
|
self.callback = callback
|
||||||
|
self.args = args
|
||||||
|
self.pbar_glade = gtk.glade.XML(self.config.get_glade_file(), "vmm-progress")
|
||||||
|
self.pbar_win = self.pbar_glade.get_widget("vmm-progress")
|
||||||
|
self.pbar = self.pbar_glade.get_widget("pbar")
|
||||||
|
self.pbar_win.set_title(title)
|
||||||
|
self.pbar_win.hide()
|
||||||
|
self.bg_thread = threading.Thread(target=self.callback, args=self.args)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.timer = gobject.timeout_add (100, self.pulse_pbar)
|
||||||
|
self.pbar_win.present()
|
||||||
|
self.bg_thread.start()
|
||||||
|
gtk.main()
|
||||||
|
gobject.source_remove(self.timer)
|
||||||
|
self.timer = 0
|
||||||
|
self.pbar_win.destroy()
|
||||||
|
|
||||||
|
def pulse_pbar(self):
|
||||||
|
print "About to frobnicate the pbar"
|
||||||
|
if(self.bg_thread.isAlive()):
|
||||||
|
self.pbar.pulse()
|
||||||
|
else:
|
||||||
|
gtk.main_quit()
|
@ -85,6 +85,8 @@ class vmmConnection(gobject.GObject):
|
|||||||
def host_maximum_processor_count(self):
|
def host_maximum_processor_count(self):
|
||||||
return self.hostinfo[4] * self.hostinfo[5] * self.hostinfo[6] * self.hostinfo[7]
|
return self.hostinfo[4] * self.hostinfo[5] * self.hostinfo[6] * self.hostinfo[7]
|
||||||
|
|
||||||
|
def restore(self, frm):
|
||||||
|
self.vmm.restore(frm)
|
||||||
|
|
||||||
def tick(self):
|
def tick(self):
|
||||||
if self.vmm == None:
|
if self.vmm == None:
|
||||||
|
@ -28,6 +28,7 @@ from virtManager.preferences import vmmPreferences
|
|||||||
from virtManager.manager import vmmManager
|
from virtManager.manager import vmmManager
|
||||||
from virtManager.details import vmmDetails
|
from virtManager.details import vmmDetails
|
||||||
from virtManager.console import vmmConsole
|
from virtManager.console import vmmConsole
|
||||||
|
from virtManager.asyncjob import asyncJob
|
||||||
|
|
||||||
class vmmEngine:
|
class vmmEngine:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
@ -65,7 +66,7 @@ class vmmEngine:
|
|||||||
if len(self.connections.keys()) == 0:
|
if len(self.connections.keys()) == 0:
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
def _connect_cancelled(self, connect):
|
def _connect_cancelled(self, connect):
|
||||||
self.windowConnect = None
|
self.windowConnect = None
|
||||||
if len(self.connections.keys()) == 0:
|
if len(self.connections.keys()) == 0:
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
@ -216,24 +217,11 @@ class vmmEngine:
|
|||||||
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT),
|
gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT),
|
||||||
None)
|
None)
|
||||||
self.fcdialog.set_do_overwrite_confirmation(True)
|
self.fcdialog.set_do_overwrite_confirmation(True)
|
||||||
# also set up the progress bar now
|
|
||||||
self.pbar_glade = gtk.glade.XML(self.get_config().get_glade_file(), "vmm-save-progress")
|
|
||||||
self.pbar_win = self.pbar_glade.get_widget("vmm-save-progress")
|
|
||||||
self.pbar_win.hide()
|
|
||||||
|
|
||||||
response = self.fcdialog.run()
|
response = self.fcdialog.run()
|
||||||
self.fcdialog.hide()
|
self.fcdialog.hide()
|
||||||
if(response == gtk.RESPONSE_ACCEPT):
|
if(response == gtk.RESPONSE_ACCEPT):
|
||||||
uri_to_save = self.fcdialog.get_filename()
|
file_to_save = self.fcdialog.get_filename()
|
||||||
# show a lovely bouncing progress bar until the vm actually saves
|
progWin = asyncJob(self.config, vm.save,
|
||||||
self.timer = gobject.timeout_add (100,
|
[file_to_save], "Saving Virtual Machine")
|
||||||
self.pbar_glade.get_widget("pbar").pulse)
|
progWin.run()
|
||||||
self.pbar_win.present()
|
self.fcdialog.destroy()
|
||||||
|
|
||||||
# actually save the vm
|
|
||||||
vm.save( uri_to_save )
|
|
||||||
gobject.source_remove(self.timer)
|
|
||||||
self.timer = 0
|
|
||||||
self.pbar_win.hide()
|
|
||||||
self.fcdialog.destroy()
|
|
||||||
self.pbar_win.destroy()
|
|
||||||
|
@ -20,9 +20,12 @@
|
|||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
|
import threading
|
||||||
|
|
||||||
import sparkline
|
import sparkline
|
||||||
|
|
||||||
|
from virtManager.asyncjob import asyncJob
|
||||||
|
|
||||||
VMLIST_SORT_ID = 1
|
VMLIST_SORT_ID = 1
|
||||||
VMLIST_SORT_NAME = 2
|
VMLIST_SORT_NAME = 2
|
||||||
VMLIST_SORT_CPU_USAGE = 3
|
VMLIST_SORT_CPU_USAGE = 3
|
||||||
@ -104,6 +107,7 @@ class vmmManager(gobject.GObject):
|
|||||||
"on_menu_file_open_connection_activate": self.open_connection,
|
"on_menu_file_open_connection_activate": self.open_connection,
|
||||||
"on_menu_file_quit_activate": self.exit_app,
|
"on_menu_file_quit_activate": self.exit_app,
|
||||||
"on_menu_file_close_activate": self.close,
|
"on_menu_file_close_activate": self.close,
|
||||||
|
"on_menu_restore_saved_activate": self.restore_saved,
|
||||||
"on_vmm_close_clicked": self.close,
|
"on_vmm_close_clicked": self.close,
|
||||||
"on_vm_details_clicked": self.show_vm_details,
|
"on_vm_details_clicked": self.show_vm_details,
|
||||||
"on_vm_open_clicked": self.open_vm_console,
|
"on_vm_open_clicked": self.open_vm_console,
|
||||||
@ -138,6 +142,25 @@ class vmmManager(gobject.GObject):
|
|||||||
def open_connection(self, src=None):
|
def open_connection(self, src=None):
|
||||||
self.emit("action-show-connect")
|
self.emit("action-show-connect")
|
||||||
|
|
||||||
|
def restore_saved(self, src=None):
|
||||||
|
# get filename
|
||||||
|
self.fcdialog = gtk.FileChooserDialog("Restore Virtual Machine",
|
||||||
|
self.window.get_widget("vmm-manager"),
|
||||||
|
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||||
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||||
|
gtk.STOCK_OPEN, gtk.RESPONSE_ACCEPT),
|
||||||
|
None)
|
||||||
|
# pop up progress dialog
|
||||||
|
response = self.fcdialog.run()
|
||||||
|
self.fcdialog.hide()
|
||||||
|
if(response == gtk.RESPONSE_ACCEPT):
|
||||||
|
file_to_load = self.fcdialog.get_filename()
|
||||||
|
progWin = asyncJob(self.config, self.connection.restore,
|
||||||
|
[file_to_load], "Restoring Virtual Machine")
|
||||||
|
progWin.run()
|
||||||
|
|
||||||
|
self.fcdialog.destroy()
|
||||||
|
|
||||||
def vm_added(self, connection, uri, vmuuid):
|
def vm_added(self, connection, uri, vmuuid):
|
||||||
vmlist = self.window.get_widget("vm-list")
|
vmlist = self.window.get_widget("vm-list")
|
||||||
model = vmlist.get_model()
|
model = vmlist.get_model()
|
||||||
|
Loading…
Reference in New Issue
Block a user