Some things actually work now. Working out collecting data, and obnoxious edge cases.

This commit is contained in:
Hugh O. Brock 2006-08-09 18:53:30 -04:00
parent 5bdb1817dd
commit 43bc0936ca
3 changed files with 217 additions and 42 deletions

View File

@ -3789,7 +3789,7 @@ Máirín Duffy <duffy@redhat.com>
<widget class="GtkTable" id="remote-xen-options">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="n_rows">1</property>
<property name="n_rows">2</property>
<property name="n_columns">4</property>
<property name="homogeneous">False</property>
<property name="row_spacing">3</property>
@ -3892,6 +3892,28 @@ Máirín Duffy &lt;duffy@redhat.com&gt;
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="remote-xen-secure">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Secure connection</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -5617,6 +5639,7 @@ TB</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="delete_event" handler="on_vmm_create_delete_event" last_modification_time="Wed, 09 Aug 2006 18:11:39 GMT"/>
<child>
<widget class="GtkVBox" id="vbox23">
@ -5634,6 +5657,7 @@ TB</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="enable_popup">False</property>
<signal name="switch_page" handler="on_create_pages_switch_page" last_modification_time="Wed, 09 Aug 2006 18:04:01 GMT"/>
<child>
<widget class="GtkVBox" id="vbox22">
@ -6183,7 +6207,6 @@ TB</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">entry5</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
@ -6258,16 +6281,17 @@ TB</property>
</child>
<child>
<widget class="GtkEntry" id="entry5">
<widget class="GtkEntry" id="create-vm-name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="max_length">31</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">•</property>
<property name="activates_default">False</property>
<signal name="focus_out_event" handler="on_create_vm_name_focus_out_event" last_modification_time="Wed, 09 Aug 2006 20:52:25 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
@ -6439,7 +6463,7 @@ TB</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkRadioButton" id="radiobutton14">
<widget class="GtkRadioButton" id="virt-method-pv">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Paravirtualized:</property>
@ -6449,6 +6473,7 @@ TB</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_virt_method_toggled" last_modification_time="Wed, 09 Aug 2006 21:30:22 GMT"/>
</widget>
</child>
</widget>
@ -6497,7 +6522,7 @@ TB</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkRadioButton" id="radiobutton15">
<widget class="GtkRadioButton" id="virt-method-fv">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Fully Virtualized:</property>
@ -6507,6 +6532,8 @@ TB</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">virt-method-pv</property>
<signal name="toggled" handler="on_virt_method_toggled" last_modification_time="Wed, 09 Aug 2006 21:30:36 GMT"/>
</widget>
</child>
</widget>
@ -6744,6 +6771,7 @@ TB</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_media_toggled" last_modification_time="Wed, 09 Aug 2006 21:54:33 GMT"/>
</widget>
</child>
</widget>
@ -6835,6 +6863,7 @@ TB</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">media-iso-image</property>
<signal name="toggled" handler="on_media_toggled" last_modification_time="Wed, 09 Aug 2006 21:54:24 GMT"/>
</widget>
</child>
</widget>
@ -6904,7 +6933,7 @@ TB</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkEntry" id="entry6">
<widget class="GtkEntry" id="fv-iso-location">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@ -7166,7 +7195,7 @@ TB</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkRadioButton" id="radiobutton8">
<widget class="GtkRadioButton" id="media-url-tree">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
@ -7176,6 +7205,7 @@ TB</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_media_toggled" last_modification_time="Wed, 09 Aug 2006 21:54:46 GMT"/>
</widget>
</child>
</widget>
@ -7228,7 +7258,7 @@ TB</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkRadioButton" id="radiobutton9">
<widget class="GtkRadioButton" id="media-url-ks">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes"></property>
@ -7238,7 +7268,8 @@ TB</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">media-iso-image</property>
<property name="group">media-url-tree</property>
<signal name="toggled" handler="on_media_toggled" last_modification_time="Wed, 09 Aug 2006 21:54:57 GMT"/>
</widget>
</child>
</widget>
@ -7337,7 +7368,7 @@ TB</property>
</child>
<child>
<widget class="GtkEntry" id="entry10">
<widget class="GtkEntry" id="pv-media-url">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@ -7500,7 +7531,7 @@ TB</property>
</child>
<child>
<widget class="GtkEntry" id="entry11">
<widget class="GtkEntry" id="pv-ks-url">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@ -8965,13 +8996,14 @@ You'll now be able to view and work with $SYSTEM_NAME in the virtual machine man
</child>
<child>
<widget class="GtkButton" id="button26">
<widget class="GtkButton" id="create-cancel">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_create_cancel_clicked" last_modification_time="Wed, 09 Aug 2006 17:55:38 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@ -8981,13 +9013,14 @@ You'll now be able to view and work with $SYSTEM_NAME in the virtual machine man
</child>
<child>
<widget class="GtkButton" id="button27">
<widget class="GtkButton" id="create-back">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-back</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_create_back_clicked" last_modification_time="Wed, 09 Aug 2006 17:54:59 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
@ -8997,13 +9030,30 @@ You'll now be able to view and work with $SYSTEM_NAME in the virtual machine man
</child>
<child>
<widget class="GtkButton" id="button28">
<widget class="GtkButton" id="create-forward">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-go-forward</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_create_forward_clicked" last_modification_time="Wed, 09 Aug 2006 17:55:24 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="create-finish">
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Finish</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_create_finish_clicked" last_modification_time="Wed, 09 Aug 2006 18:56:13 GMT"/>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -25,60 +25,184 @@ import gtk.glade
from rhpl.exception import installExceptionHandler
from rhpl.translate import _, N_, textdomain, utf8
VM_PARAVIRT = 1
VM_FULLY_VIRT = 2
VM_INSTALL_FROM_ISO = 1
VM_INSTALL_FROM_CD = 2
VM_INSTALL_FROM_URL = 3
VM_INSTALL_FROM_KS_URL = 4
VM_STORAGE_PARTITION = 1
VM_STORAGE_FILE = 2
class vmmCreate(gobject.GObject):
def __init__(self, config):
self.__gobject_init__()
self.xml = gtk.glade.XML(config.get_glade_file(), "vmm-create")
self.window = self.xml.get_widget("vmm-create")
self.window.hide()
self.set_initial_state()
self.config = config
self.window = gtk.glade.XML(config.get_glade_file(), "vmm-create")
self.topwin = self.window.get_widget("vmm-create")
self.topwin.hide()
self.window.signal_autoconnect({
"on_create_pages_switch_page" : self.page_changed,
"on_create_cancel_clicked" : self.close,
"on_vmm_create_delete_event" : self.close,
"on_create_back_clicked" : self.back,
"on_create_forward_clicked" : self.forward,
"on_create_finish_clicked" : self.finish,
"on_create_vm_name_focus_out_event" : self.set_name,
"on_virt_method_toggled" : self.set_virt_method,
"on_media_toggled" : self.set_install_from
})
self.set_initial_state()
def show(self):
self.window.show_all()
self.topwin.show()
def _init_members(self):
#the dahta
self.vm_name = ""
self.virt_method = VM_PARAVIRT
self.install_media_type = VM_INSTALL_FROM_ISO
self.install_media_address = ""
self.storage_method = VM_STORAGE_PARTITION
self.memory = 0
self.vcpus = 0
def set_initial_state(self):
# set up graphics and events for the create wizard
notebook = self.xml.get_widget("create-pages")
notebook = self.window.get_widget("create-pages")
notebook.set_show_tabs(False)
#XXX I don't think I should have to go through and set a bunch of background colors
# in code, but apparently I do...
black = gtk.gdk.color_parse("#000")
self.xml.get_widget("intro-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page1-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page2-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page3-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page3a-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page4-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page5-title").modify_bg(gtk.STATE_NORMAL,black)
self.xml.get_widget("page6-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("intro-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page1-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page2-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page3-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page3a-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page4-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page5-title").modify_bg(gtk.STATE_NORMAL,black)
self.window.get_widget("page6-title").modify_bg(gtk.STATE_NORMAL,black)
self.reset_state()
def reset_state(self):
notebook = self.xml.get_widget("create-pages")
self._init_members()
notebook = self.window.get_widget("create-pages")
notebook.set_current_page(0)
# Hide the "finish" button until the appropriate time
self.window.get_widget("create-finish").hide()
self.window.get_widget("create-forward").show()
self.window.get_widget("create-back").set_sensitive(False)
# add code here to clear any previously set create wizard values and set
# the buttons to the proper state
def forward(self):
notebook = self.xml.get_widget("create-pages")
notebook.next_page()
def forward(self, ignore=None):
notebook = self.window.get_widget("create-pages")
# do this always, since there's no "leaving a notebook page" event.
self.window.get_widget("create-back").set_sensitive(True)
if (notebook.get_current_page() == 2 and self.virt_method == VM_PARAVIRT):
notebook.set_current_page(4)
elif (notebook.get_current_page() == 3 and self.virt_method == VM_FULLY_VIRT):
notebook.set_current_page(5)
else:
notebook.next_page()
def back(self, ignore=None):
notebook = self.window.get_widget("create-pages")
# do this always, since there's no "leaving a notebook page" event.
self.window.get_widget("create-finish").hide()
self.window.get_widget("create-forward").show()
if notebook.get_current_page() == 4 and self.virt_method == VM_PARAVIRT:
notebook.set_current_page(2)
elif notebook.get_current_page() == 5 and self.virt_method == VM_FULLY_VIRT:
notebook.set_current_page(3)
else:
notebook.prev_page()
def back(self):
notebook = self.xml.get_widget("create-pages")
notebook.prev_page()
def page_changed(self):
notebook = self.xml.get_widget("create-pages")
page_number = notebook.get_current_page()
def page_changed(self, notebook, page, page_number):
if page_number == 0:
#set up the front page
print "page 0"
self.window.get_widget("create-back").set_sensitive(False)
elif page_number == 1:
#set up the system-name page
print "page 1"
self.window.get_widget("create-vm-name").set_text(self.vm_name)
elif page_number == 2:
#set up the virt method page
if self.virt_method == VM_PARAVIRT:
self.window.get_widget("virt-method-pv").set_active(True)
else:
self.window.get_widget("virt-method-fv").set_active(True)
elif page_number == 3:
#set up the fv install media page
if self.install_media_type != VM_INSTALL_FROM_ISO and \
self.install_media_type != VM_INSTALL_FROM_CD:
self.install_media_type = VM_INSTALL_FROM_ISO
if self.install_media_type == VM_INSTALL_FROM_ISO:
self.window.get_widget("media-iso-image").set_active(True)
else:
self.window.get_widget("media-physical").set_active(True)
elif page_number == 4:
#set up the pv install media page
if self.install_media_type != VM_INSTALL_FROM_URL and \
self.install_media_type != VM_INSTALL_FROM_KS_URL:
self.install_media_type = VM_INSTALL_FROM_URL
if self.install_media_type == VM_INSTALL_FROM_URL:
self.window.get_widget("media-url-tree").set_active(True)
else:
self.window.get_widget("media-url-ks").set_active(True)
elif page_number == 5:
#set up the storage space page
print "loaded storage space page"
elif page_number == 6:
#set up the CPU and Memory page
# if the user went backwards
print "loaded cpu/memory page"
elif page_number == 7:
#set up the congrats page
self.window.get_widget("create-forward").hide()
self.window.get_widget("create-finish").show()
def close(self, ignore1=None,ignore2=None):
self.topwin.hide()
return 1
def finish(self, ignore=None):
print "your vm properties: \n Name=" + self.vm_name + \
"\n Virt method: " + `self.virt_method` + \
"\n Install media type: " + `self.install_media_type`
self.close()
def set_name(self, src, ignore=None):
self.vm_name = src.get_text()
def set_virt_method(self, button):
if button.get_active():
if button.name == "virt-method-pv":
self.virt_method = VM_PARAVIRT
else:
self.virt_method = VM_FULLY_VIRT
def set_install_from(self, button):
if button.get_active():
if button.name == "media-iso-image":
self.install_media_type = VM_INSTALL_FROM_ISO
self.window.get_widget("fv-iso-location").set_sensitive(True)
elif button.name == "media-physical":
self.install_media_type = VM_INSTALL_FROM_CD
self.window.get_widget("fv-iso-location").set_sensitive(False)
elif button.name == "media-url-tree":
self.install_media_type = VM_INSTALL_FROM_URL
self.window.get_widget("pv-media-url").set_sensitive(True)
self.window.get_widget("pv-ks-url").set_sensitive(False)
else:
self.install_media_type = VM_INSTALL_FROM_KS_URL
self.window.get_widget("pv-media-url").set_sensitive(False)
self.window.get_widget("pv-ks-url").set_sensitive(True)

View File

@ -195,6 +195,7 @@ class vmmEngine:
def show_create(self):
if self.windowCreate == None:
self.windowCreate = vmmCreate(self.get_config())
self.windowCreate.reset_state()
self.windowCreate.show()
def get_connection(self, uri, readOnly=True):