qubesmanager/settings: imports
This commit is contained in:
parent
37d501c42b
commit
cae10193e7
@ -27,19 +27,26 @@
|
|||||||
import collections
|
import collections
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
|
||||||
import qubesadmin
|
import qubesadmin
|
||||||
import qubesadmin.tools
|
import qubesadmin.tools
|
||||||
|
|
||||||
from . import utils
|
from . import utils
|
||||||
from . import multiselectwidget
|
from . import multiselectwidget
|
||||||
|
from . import thread_monitor
|
||||||
|
|
||||||
from .ui_settingsdlg import *
|
|
||||||
from .firewall import *
|
from .firewall import *
|
||||||
from .appmenu_select import AppmenuSelectManager
|
from .appmenu_select import AppmenuSelectManager
|
||||||
from .backup_utils import get_path_for_vm
|
from .backup_utils import get_path_for_vm
|
||||||
|
|
||||||
|
from .ui_settingsdlg import *
|
||||||
|
|
||||||
class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
||||||
tabs_indices = collections.OrderedDict((
|
tabs_indices = collections.OrderedDict((
|
||||||
('basic', 0),
|
('basic', 0),
|
||||||
@ -120,8 +127,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def save_and_apply(self):
|
def save_and_apply(self):
|
||||||
thread_monitor = ThreadMonitor()
|
t_monitor = thread_monitor.ThreadMonitor()
|
||||||
thread = threading.Thread (target=self.__save_changes__, args=(thread_monitor,))
|
thread = threading.Thread(target=self.__save_changes__, args=(t_monitor,))
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
@ -131,20 +138,20 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
progress.setModal(True)
|
progress.setModal(True)
|
||||||
progress.show()
|
progress.show()
|
||||||
|
|
||||||
while not thread_monitor.is_finished():
|
while not t_monitor.is_finished():
|
||||||
self.qapp.processEvents()
|
self.qapp.processEvents()
|
||||||
time.sleep (0.1)
|
time.sleep (0.1)
|
||||||
|
|
||||||
progress.hide()
|
progress.hide()
|
||||||
|
|
||||||
if not thread_monitor.success:
|
if not t_monitor.success:
|
||||||
QMessageBox.warning(None,
|
QMessageBox.warning(None,
|
||||||
self.tr("Error while changing settings for {0}!").format(self.vm.name),
|
self.tr("Error while changing settings for {0}!").format(self.vm.name),
|
||||||
self.tr("ERROR: {0}").format(thread_monitor.error_msg))
|
self.tr("ERROR: {0}").format(t_monitor.error_msg))
|
||||||
|
|
||||||
self.done(0)
|
self.done(0)
|
||||||
|
|
||||||
def __save_changes__(self, thread_monitor):
|
def __save_changes__(self, t_monitor):
|
||||||
|
|
||||||
self.anything_changed = False
|
self.anything_changed = False
|
||||||
|
|
||||||
@ -186,10 +193,11 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
ret += [self.tr("Applications tab:"), str(ex)]
|
ret += [self.tr("Applications tab:"), str(ex)]
|
||||||
|
|
||||||
if len(ret) > 0 :
|
if len(ret) > 0 :
|
||||||
thread_monitor.set_error_msg('\n'.join(ret))
|
t_monitor.set_error_msg('\n'.join(ret))
|
||||||
|
|
||||||
utils.debug('\n'.join(ret))
|
utils.debug('\n'.join(ret))
|
||||||
|
|
||||||
|
t_monitor.set_finished()
|
||||||
|
|
||||||
def current_tab_changed(self, idx):
|
def current_tab_changed(self, idx):
|
||||||
if idx == self.tabs_indices["firewall"]:
|
if idx == self.tabs_indices["firewall"]:
|
||||||
@ -925,9 +933,6 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
|
|||||||
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
# Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
|
||||||
|
|
||||||
def handle_exception(exc_type, exc_value, exc_traceback):
|
def handle_exception(exc_type, exc_value, exc_traceback):
|
||||||
import sys
|
|
||||||
import os.path
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
filename, line, dummy, dummy = traceback.extract_tb(exc_traceback).pop()
|
filename, line, dummy, dummy = traceback.extract_tb(exc_traceback).pop()
|
||||||
filename = os.path.basename(filename)
|
filename = os.path.basename(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user