create: Allow cancelling 'customize' dialog
Selecting the 'cancel' option or hitting the window X will erase any customized changes and go back to the final screen of the wizard.
This commit is contained in:
parent
b83def97ea
commit
ad5bb2ab48
|
@ -90,7 +90,7 @@ class vmmCreate(vmmGObjectUI):
|
|||
|
||||
# 'Configure before install' window
|
||||
self.config_window = None
|
||||
self.config_window_signal = None
|
||||
self.config_window_signals = []
|
||||
|
||||
self.window.signal_autoconnect({
|
||||
"on_vmm_newcreate_delete_event" : self.close,
|
||||
|
@ -1205,6 +1205,15 @@ class vmmCreate(vmmGObjectUI):
|
|||
|
||||
notebook.set_current_page(next_page)
|
||||
|
||||
def _get_next_pagenum(self, curpage):
|
||||
next_page = curpage + 1
|
||||
|
||||
if next_page == PAGE_STORAGE and self.skip_disk_page():
|
||||
# Skip storage page for import installs
|
||||
next_page += 1
|
||||
|
||||
return next_page
|
||||
|
||||
def forward(self, src_ignore=None):
|
||||
notebook = self.widget("create-pages")
|
||||
curpage = notebook.get_current_page()
|
||||
|
@ -1225,10 +1234,7 @@ class vmmCreate(vmmGObjectUI):
|
|||
# See if we need to alter our default HV based on install method
|
||||
self.guest_from_install_type()
|
||||
|
||||
next_page = curpage + 1
|
||||
if next_page == PAGE_STORAGE and self.skip_disk_page():
|
||||
# Skip storage page for import installs
|
||||
next_page += 1
|
||||
next_page = self._get_next_pagenum(curpage)
|
||||
|
||||
self.widget("create-forward").grab_focus()
|
||||
notebook.set_current_page(next_page)
|
||||
|
@ -1337,16 +1343,16 @@ class vmmCreate(vmmGObjectUI):
|
|||
|
||||
return guest
|
||||
|
||||
def validate(self, pagenum):
|
||||
def validate(self, pagenum, revalidate=False):
|
||||
try:
|
||||
if pagenum == PAGE_NAME:
|
||||
return self.validate_name_page()
|
||||
elif pagenum == PAGE_INSTALL:
|
||||
return self.validate_install_page(revalidate=False)
|
||||
return self.validate_install_page(revalidate=revalidate)
|
||||
elif pagenum == PAGE_MEM:
|
||||
return self.validate_mem_page()
|
||||
elif pagenum == PAGE_STORAGE:
|
||||
return self.validate_storage_page(revalidate=False)
|
||||
return self.validate_storage_page(revalidate=revalidate)
|
||||
elif pagenum == PAGE_FINISH:
|
||||
return self.validate_final_page()
|
||||
|
||||
|
@ -1660,12 +1666,21 @@ class vmmCreate(vmmGObjectUI):
|
|||
def reset_guest_type(self):
|
||||
self.change_caps()
|
||||
|
||||
def rebuild_guest(self):
|
||||
pagenum = 0
|
||||
while True:
|
||||
self.validate(pagenum, revalidate=False)
|
||||
if pagenum >= PAGE_FINISH:
|
||||
break
|
||||
pagenum = self._get_next_pagenum(pagenum)
|
||||
|
||||
def finish(self, src_ignore):
|
||||
# Validate the final page
|
||||
page = self.widget("create-pages").get_current_page()
|
||||
if self.validate(page) != True:
|
||||
return False
|
||||
|
||||
self.rebuild_guest()
|
||||
guest = self.guest
|
||||
disk = len(guest.disks) and guest.disks[0]
|
||||
|
||||
|
@ -1697,14 +1712,15 @@ class vmmCreate(vmmGObjectUI):
|
|||
|
||||
self._check_start_error(start_install)
|
||||
|
||||
def _undo_finish(self, ignore=None):
|
||||
self.topwin.set_sensitive(True)
|
||||
self.topwin.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.TOP_LEFT_ARROW))
|
||||
|
||||
def _check_start_error(self, cb, *args, **kwargs):
|
||||
try:
|
||||
cb(*args, **kwargs)
|
||||
except Exception, e:
|
||||
self.topwin.set_sensitive(True)
|
||||
self.topwin.window.set_cursor(
|
||||
gtk.gdk.Cursor(gtk.gdk.TOP_LEFT_ARROW))
|
||||
|
||||
self._undo_finish()
|
||||
self.err.show_err(_("Error starting installation: ") + str(e))
|
||||
|
||||
def customize(self, guest):
|
||||
|
@ -1712,7 +1728,8 @@ class vmmCreate(vmmGObjectUI):
|
|||
|
||||
def cleanup_config_window():
|
||||
if self.config_window:
|
||||
self.config_window.disconnect(self.config_window_signal)
|
||||
for s in self.config_window_signals:
|
||||
self.config_window.disconnect(s)
|
||||
self.config_window.cleanup()
|
||||
self.config_window = None
|
||||
|
||||
|
@ -1722,14 +1739,20 @@ class vmmCreate(vmmGObjectUI):
|
|||
return
|
||||
self._check_start_error(self.start_install, guest)
|
||||
|
||||
def details_closed(ignore):
|
||||
self._undo_finish()
|
||||
self.widget("summary-customize").set_active(False)
|
||||
|
||||
cleanup_config_window()
|
||||
self.config_window = vmmDetails(virtinst_guest,
|
||||
self.topwin)
|
||||
self.config_window_signal = self.config_window.connect(
|
||||
"details-closed",
|
||||
self.config_window = vmmDetails(virtinst_guest, self.topwin)
|
||||
self.config_window_signals = []
|
||||
self.config_window_signals.append(self.config_window.connect(
|
||||
"customize-finished",
|
||||
start_install_wrapper,
|
||||
guest)
|
||||
guest))
|
||||
self.config_window_signals.append(self.config_window.connect(
|
||||
"details-closed",
|
||||
details_closed))
|
||||
self.config_window.show()
|
||||
|
||||
def start_install(self, guest):
|
||||
|
|
|
@ -332,7 +332,8 @@ class vmmDetails(vmmGObjectUI):
|
|||
"on_control_pause_toggled": self.control_vm_pause,
|
||||
"on_control_fullscreen_toggled": self.control_fullscreen,
|
||||
|
||||
"on_details_customize_finish_clicked": self.close,
|
||||
"on_details_customize_finish_clicked": self.customize_finish,
|
||||
"on_details_cancel_customize_clicked": self.close,
|
||||
|
||||
"on_details_menu_run_activate": self.control_vm_run,
|
||||
"on_details_menu_poweroff_activate": self.control_vm_shutdown,
|
||||
|
@ -511,7 +512,14 @@ class vmmDetails(vmmGObjectUI):
|
|||
self.emit("details-opened")
|
||||
self.refresh_vm_state()
|
||||
|
||||
def customize_finish(self, src):
|
||||
ignore = src
|
||||
return self._close(customize_finish=True)
|
||||
|
||||
def close(self, ignore1=None, ignore2=None):
|
||||
return self._close()
|
||||
|
||||
def _close(self, customize_finish=False):
|
||||
fs = self.widget("details-menu-view-fullscreen")
|
||||
if fs.get_active():
|
||||
fs.set_active(False)
|
||||
|
@ -520,14 +528,18 @@ class vmmDetails(vmmGObjectUI):
|
|||
return
|
||||
|
||||
self.topwin.hide()
|
||||
if (self.console.viewer and self.console.viewer.get_widget() and
|
||||
self.console.viewer.get_widget().flags() & gtk.VISIBLE):
|
||||
if (self.console.viewer and
|
||||
self.console.viewer.get_widget() and
|
||||
self.console.viewer.get_widget().flags() & gtk.VISIBLE):
|
||||
try:
|
||||
self.console.close_viewer()
|
||||
except:
|
||||
logging.error("Failure when disconnecting from desktop server")
|
||||
|
||||
self.emit("details-closed")
|
||||
if customize_finish:
|
||||
self.emit("customize-finished")
|
||||
else:
|
||||
self.emit("details-closed")
|
||||
return 1
|
||||
|
||||
def is_visible(self):
|
||||
|
@ -3267,3 +3279,4 @@ vmmDetails.signal_new(vmmDetails, "action-migrate-domain", [str, str])
|
|||
vmmDetails.signal_new(vmmDetails, "action-clone-domain", [str, str])
|
||||
vmmDetails.signal_new(vmmDetails, "details-closed", [])
|
||||
vmmDetails.signal_new(vmmDetails, "details-opened", [])
|
||||
vmmDetails.signal_new(vmmDetails, "customize-finished", [])
|
||||
|
|
|
@ -496,6 +496,20 @@
|
|||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkToolButton" id="details-cancel-customize">
|
||||
<property name="visible">True</property>
|
||||
<property name="is_important">True</property>
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-cancel</property>
|
||||
<signal name="clicked" handler="on_details_cancel_customize_clicked"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
|
@ -1249,7 +1263,6 @@
|
|||
<widget class="GtkTreeView" id="inspection-apps">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -3638,7 +3651,7 @@ I/O:</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label73">
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">Serial num_ber:</property>
|
||||
|
@ -3667,7 +3680,7 @@ I/O:</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment44">
|
||||
<widget class="GtkAlignment" id="alignment5">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
@ -4214,7 +4227,7 @@ I/O:</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment5">
|
||||
<widget class="GtkAlignment" id="alignment10">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
|
@ -4227,7 +4240,7 @@ I/O:</property>
|
|||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Virtual port</property>
|
||||
<property name="use_markup">True</property>
|
||||
|
@ -5076,7 +5089,7 @@ I/O:</property>
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment10">
|
||||
<widget class="GtkAlignment" id="alignment22">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">3</property>
|
||||
<property name="left_padding">12</property>
|
||||
|
@ -5155,7 +5168,7 @@ I/O:</property>
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment22">
|
||||
<widget class="GtkAlignment" id="alignment30">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">3</property>
|
||||
<property name="left_padding">12</property>
|
||||
|
@ -5312,7 +5325,7 @@ I/O:</property>
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment30">
|
||||
<widget class="GtkAlignment" id="alignment34">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">3</property>
|
||||
<property name="left_padding">12</property>
|
||||
|
@ -5458,7 +5471,7 @@ I/O:</property>
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment34">
|
||||
<widget class="GtkAlignment" id="alignment35">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">3</property>
|
||||
<property name="left_padding">12</property>
|
||||
|
@ -5526,7 +5539,7 @@ I/O:</property>
|
|||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment35">
|
||||
<widget class="GtkAlignment" id="alignment45">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">3</property>
|
||||
<property name="left_padding">12</property>
|
||||
|
@ -5664,7 +5677,7 @@ I/O:</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<widget class="GtkLabel" id="label41">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">fs</property>
|
||||
</widget>
|
||||
|
@ -5678,24 +5691,24 @@ I/O:</property>
|
|||
<widget class="GtkVBox" id="vbox16">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame17">
|
||||
<widget class="GtkFrame" id="frame18">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment43">
|
||||
<widget class="GtkAlignment" id="alignment46">
|
||||
<property name="visible">True</property>
|
||||
<property name="top_padding">3</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table17">
|
||||
<widget class="GtkTable" id="table18">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">3</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">8</property>
|
||||
<property name="row_spacing">4</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label41">
|
||||
<widget class="GtkLabel" id="label74">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">M_ode:</property>
|
||||
|
@ -5744,7 +5757,7 @@ I/O:</property>
|
|||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label70">
|
||||
<widget class="GtkLabel" id="label75">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Smartcard Device</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
|
@ -5764,7 +5777,7 @@ I/O:</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label71">
|
||||
<widget class="GtkLabel" id="label76">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">snd</property>
|
||||
</widget>
|
||||
|
@ -5836,7 +5849,7 @@ I/O:</property>
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label72">
|
||||
<widget class="GtkLabel" id="label77">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Details</property>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue