create: Read storage size from text field in spinner

Not just the spun value. Reuse the helper from details.py
This commit is contained in:
Cole Robinson 2011-07-19 14:02:39 -04:00
parent 4c61287e01
commit 297afef5f5
3 changed files with 15 additions and 15 deletions

View File

@ -931,7 +931,7 @@ class vmmCreate(vmmGObjectUI):
def get_storage_info(self):
path = None
size = self.widget("config-storage-size").get_value()
size = uihelpers.spin_get_helper(self.widget("config-storage-size"))
sparse = not self.widget("config-storage-nosparse").get_active()
if self.get_config_install_page() == INSTALL_PAGE_IMPORT:

View File

@ -1513,16 +1513,6 @@ class vmmDetails(vmmGObjectUI):
##############################
# Details/Hardware listeners #
##############################
def _spin_get_helper(self, wname):
widget = self.widget(wname)
adj = widget.get_adjustment()
txt = widget.get_text()
try:
ret = int(txt)
except:
ret = adj.value
return ret
def _browse_file(self, callback, is_media=False):
if is_media:
@ -1579,9 +1569,9 @@ class vmmDetails(vmmGObjectUI):
# Memory
def config_get_maxmem(self):
return self._spin_get_helper("config-maxmem")
return uihelpers.spin_get_helper(self.widget("config-maxmem"))
def config_get_memory(self):
return self._spin_get_helper("config-memory")
return uihelpers.spin_get_helper(self.widget("config-memory"))
def config_maxmem_changed(self, src_ignore):
self.enable_apply(EDIT_MEM)
@ -1602,9 +1592,9 @@ class vmmDetails(vmmGObjectUI):
# VCPUS
def config_get_vcpus(self):
return self._spin_get_helper("config-vcpus")
return uihelpers.spin_get_helper(self.widget("config-vcpus"))
def config_get_maxvcpus(self):
return self._spin_get_helper("config-maxvcpus")
return uihelpers.spin_get_helper(self.widget("config-maxvcpus"))
def config_vcpupin_generate(self, ignore):
try:

View File

@ -53,6 +53,16 @@ def cleanup():
global err_dial
err_dial = None
def spin_get_helper(widget):
adj = widget.get_adjustment()
txt = widget.get_text()
try:
ret = int(txt)
except:
ret = adj.value
return ret
############################################################
# Helpers for shared storage UI between create/addhardware #
############################################################