'refresh available apps' button in VM Setting
added a button in VM Settings, Applications tab to refresh the list of available apps
This commit is contained in:
parent
d349248b35
commit
2dda433fd3
@ -62,9 +62,9 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
|
|
||||||
self.vm = vm
|
self.vm = vm
|
||||||
self.qapp = qapp
|
self.qapp = qapp
|
||||||
if self.vm.template:
|
try:
|
||||||
self.source_vm = self.vm.template
|
self.source_vm = self.vm.template
|
||||||
else:
|
except AttributeError:
|
||||||
self.source_vm = self.vm
|
self.source_vm = self.vm
|
||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
@ -117,6 +117,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.app_list = multiselectwidget.MultiSelectWidget(self)
|
self.app_list = multiselectwidget.MultiSelectWidget(self)
|
||||||
self.apps_layout.addWidget(self.app_list)
|
self.apps_layout.addWidget(self.app_list)
|
||||||
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
||||||
|
self.refresh_apps_button.clicked.connect(self.refresh_apps_button_pressed)
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
self.done(0)
|
self.done(0)
|
||||||
@ -446,7 +447,7 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
else:
|
else:
|
||||||
self.kernel_groupbox.setVisible(False)
|
self.kernel_groupbox.setVisible(False)
|
||||||
|
|
||||||
if not hasattr(self.vm, "drive"):
|
if True or not hasattr(self.vm, "drive"):
|
||||||
self.drive_groupbox.setVisible(False)
|
self.drive_groupbox.setVisible(False)
|
||||||
else:
|
else:
|
||||||
self.drive_groupbox.setVisible(True)
|
self.drive_groupbox.setVisible(True)
|
||||||
@ -661,6 +662,46 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
self.dmm_warning_adv.hide()
|
self.dmm_warning_adv.hide()
|
||||||
self.dmm_warning_dev.hide()
|
self.dmm_warning_dev.hide()
|
||||||
|
|
||||||
|
######## applications tab
|
||||||
|
|
||||||
|
def refresh_apps_in_vm(self, t_monitor):
|
||||||
|
try:
|
||||||
|
target_vm = self.vm.template
|
||||||
|
except AttributeError:
|
||||||
|
target_vm = self.vm
|
||||||
|
|
||||||
|
if not target_vm.is_running():
|
||||||
|
not_running = True
|
||||||
|
target_vm.start()
|
||||||
|
else:
|
||||||
|
not_running = False
|
||||||
|
|
||||||
|
subprocess.check_call(['qvm-sync-appmenus', target_vm.name])
|
||||||
|
|
||||||
|
if not_running:
|
||||||
|
target_vm.shutdown()
|
||||||
|
|
||||||
|
t_monitor.set_finished()
|
||||||
|
|
||||||
|
def refresh_apps_button_pressed(self):
|
||||||
|
|
||||||
|
self.refresh_apps_button.setEnabled(False)
|
||||||
|
self.refresh_apps_button.setText(self.tr('Refresh in progress...'))
|
||||||
|
|
||||||
|
t_monitor = thread_monitor.ThreadMonitor()
|
||||||
|
thread = threading.Thread(target=self.refresh_apps_in_vm, args=(t_monitor,))
|
||||||
|
thread.daemon = True
|
||||||
|
thread.start()
|
||||||
|
|
||||||
|
while not t_monitor.is_finished():
|
||||||
|
self.qapp.processEvents()
|
||||||
|
time.sleep (0.1)
|
||||||
|
|
||||||
|
self.AppListManager = AppmenuSelectManager(self.vm, self.app_list)
|
||||||
|
|
||||||
|
self.refresh_apps_button.setEnabled(True)
|
||||||
|
self.refresh_apps_button.setText(self.tr('Refresh Applications'))
|
||||||
|
|
||||||
######## services tab
|
######## services tab
|
||||||
|
|
||||||
def __init_services_tab__(self):
|
def __init_services_tab__(self):
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>708</width>
|
<width>773</width>
|
||||||
<height>529</height>
|
<height>573</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -29,7 +29,7 @@
|
|||||||
<locale language="English" country="UnitedStates"/>
|
<locale language="English" country="UnitedStates"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="basic_tab">
|
<widget class="QWidget" name="basic_tab">
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
@ -1027,9 +1027,16 @@
|
|||||||
<string>Applications</string>
|
<string>Applications</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_7">
|
<layout class="QGridLayout" name="gridLayout_7">
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QVBoxLayout" name="apps_layout"/>
|
<layout class="QVBoxLayout" name="apps_layout"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="refresh_apps_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh Applications</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="services_tab">
|
<widget class="QWidget" name="services_tab">
|
||||||
|
Loading…
Reference in New Issue
Block a user