mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-25 23:21:45 +03:00
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:
parent
4c61287e01
commit
297afef5f5
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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 #
|
||||
############################################################
|
||||
|
Loading…
Reference in New Issue
Block a user