settings: prevent changing VM name and label while the VM is running

Those changes will take effect after VM restart (at least for VM windows
borders), so to not confuse the user with partly updated colors, simply
block the change while the VM is running. The same applies to VM name.
This commit is contained in:
Marek Marczykowski-Górecki 2014-10-28 04:55:14 +01:00
부모 5a4c1f2382
커밋 c8a8a56c73
2개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제

파일 보기

@ -212,6 +212,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
def __init_basic_tab__(self):
self.vmname.setText(self.vm.name)
self.vmname.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-]*", Qt.CaseInsensitive), None))
self.vmname.setEnabled(not self.vm.is_running())
#self.qvm_collection.lock_db_for_reading()
#self.qvm_collection.load()
@ -230,6 +231,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
self.vmlabel.insertItem(i, label.name)
self.vmlabel.setItemIcon (i, QIcon(label.icon_path))
self.vmlabel.setCurrentIndex(self.label_idx)
self.vmlabel.setEnabled(not self.vm.is_running())
if not self.vm.is_template() and self.vm.template is not None:
template_vm_list = [vm for vm in self.qvm_collection.values() if not vm.internal and vm.is_template()]

파일 보기

@ -48,7 +48,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name &amp;&amp; label:</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Name &amp;amp;&amp;amp; label&lt;span style=&quot; color:#ff0000;&quot;&gt;*&lt;/span&gt;:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="buddy">
<cstring>vmname</cstring>
@ -271,7 +271,7 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -356,6 +356,13 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;* &lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;Cannot be changed while the VM is running&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="advanced_tab">