2013-10-27 21:59:46 +01:00
# Copyright (C) 2006, 2012-2013 Red Hat, Inc.
2006-06-28 15:50:17 -04:00
# Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.com>
#
2018-04-04 14:35:41 +01:00
# This work is licensed under the GNU GPLv2 or later.
2018-03-20 15:00:02 -04:00
# See the COPYING file in the top-level directory.
2007-11-20 11:12:20 -05:00
2012-05-14 14:24:56 +01:00
from gi . repository import Gtk
from gi . repository import Gdk
2006-06-14 10:59:40 -04:00
2018-10-04 14:19:32 -04:00
from virtinst import DomainCpu
2019-06-16 21:12:39 -04:00
from virtinst import log
2018-10-04 14:19:32 -04:00
2019-06-16 22:19:17 -04:00
from . lib import uiutil
2014-09-12 16:10:45 -04:00
from . baseclass import vmmGObjectUI
2019-06-16 22:19:17 -04:00
from . lib . inspection import vmmInspection
2019-06-14 20:04:35 -04:00
from . systray import vmmSystray
2009-12-14 16:45:55 -05:00
2013-04-13 14:34:52 -04:00
2010-12-08 17:26:19 -05:00
class vmmPreferences ( vmmGObjectUI ) :
2018-03-13 11:58:36 -04:00
@classmethod
def show_instance ( cls , parentobj ) :
try :
if not cls . _instance :
2018-03-17 16:08:20 -04:00
cls . _instance = vmmPreferences ( )
2018-03-13 11:58:36 -04:00
cls . _instance . show ( parentobj . topwin )
2020-08-20 13:34:01 -04:00
except Exception as e : # pragma: no cover
2018-03-13 11:58:36 -04:00
parentobj . err . show_err (
_ ( " Error launching preferences: %s " ) % str ( e ) )
2010-12-08 17:26:19 -05:00
def __init__ ( self ) :
2013-09-22 16:10:16 -04:00
vmmGObjectUI . __init__ ( self , " preferences.ui " , " vmm-preferences " )
2018-03-15 07:43:56 -04:00
self . _cleanup_on_app_close ( )
2006-06-14 10:59:40 -04:00
2013-10-02 14:47:21 -04:00
self . _init_ui ( )
2018-03-13 13:00:59 -04:00
self . _orig_libguestfs_val = None
2009-07-27 22:30:01 -04:00
self . refresh_view_system_tray ( )
2019-06-05 17:40:54 -04:00
self . refresh_xmleditor ( )
2018-03-13 13:00:59 -04:00
self . refresh_libguestfs ( )
2006-06-14 10:59:40 -04:00
self . refresh_update_interval ( )
2009-02-23 18:50:47 -05:00
self . refresh_console_scaling ( )
2014-01-31 09:13:53 -05:00
self . refresh_console_resizeguest ( )
2018-03-16 14:38:22 -04:00
self . refresh_console_autoredir ( )
2020-09-09 19:04:44 -04:00
self . refresh_console_autoconnect ( )
2011-03-18 13:59:14 +01:00
self . refresh_graphics_type ( )
2012-02-13 14:49:00 -05:00
self . refresh_storage_format ( )
2014-01-17 15:32:40 -05:00
self . refresh_cpu_default ( )
2022-01-25 19:48:19 -05:00
self . refresh_firmware_default ( )
2014-02-11 15:29:30 -05:00
self . refresh_cpu_poll ( )
2008-12-17 15:27:06 -05:00
self . refresh_disk_poll ( )
self . refresh_net_poll ( )
2014-01-12 17:39:21 -05:00
self . refresh_memory_poll ( )
2010-08-23 11:50:36 -04:00
self . refresh_grabkeys_combination ( )
2009-11-18 16:11:17 -05:00
self . refresh_confirm_forcepoweroff ( )
self . refresh_confirm_poweroff ( )
self . refresh_confirm_pause ( )
2009-11-18 16:46:36 -05:00
self . refresh_confirm_removedev ( )
2011-07-19 20:29:07 -04:00
self . refresh_confirm_unapplied ( )
2012-12-03 17:12:59 +01:00
self . refresh_confirm_delstorage ( )
2006-06-14 10:59:40 -04:00
2013-02-16 13:31:46 -05:00
self . builder . connect_signals ( {
2014-02-04 15:12:23 -05:00
" on_vmm_preferences_delete_event " : self . close ,
" on_prefs_close_clicked " : self . close ,
2017-08-05 14:39:32 +08:00
" on_prefs_system_tray_toggled " : self . change_view_system_tray ,
2019-06-05 17:40:54 -04:00
" on_prefs_xmleditor_toggled " : self . change_xmleditor ,
2018-03-13 13:00:59 -04:00
" on_prefs_libguestfs_toggled " : self . change_libguestfs ,
2008-12-17 15:27:06 -05:00
" on_prefs_stats_update_interval_changed " : self . change_update_interval ,
2009-02-23 18:50:47 -05:00
" on_prefs_console_scaling_changed " : self . change_console_scaling ,
2014-01-31 09:13:53 -05:00
" on_prefs_console_resizeguest_changed " : self . change_console_resizeguest ,
2018-03-16 14:38:22 -04:00
" on_prefs_console_autoredir_changed " : self . change_console_autoredir ,
2020-09-09 19:04:44 -04:00
" on_prefs_console_autoconnect_toggled " : self . change_console_autoconnect ,
2014-01-17 15:32:40 -05:00
" on_prefs_graphics_type_changed " : self . change_graphics_type ,
" on_prefs_storage_format_changed " : self . change_storage_format ,
" on_prefs_cpu_default_changed " : self . change_cpu_default ,
2022-01-25 19:48:19 -05:00
" on_prefs_firmware_default_changed " : self . change_firmware_default ,
2014-02-11 15:29:30 -05:00
" on_prefs_stats_enable_cpu_toggled " : self . change_cpu_poll ,
2008-12-17 15:27:06 -05:00
" on_prefs_stats_enable_disk_toggled " : self . change_disk_poll ,
" on_prefs_stats_enable_net_toggled " : self . change_net_poll ,
2014-01-12 17:39:21 -05:00
" on_prefs_stats_enable_memory_toggled " : self . change_memory_poll ,
2009-11-18 16:11:17 -05:00
" on_prefs_confirm_forcepoweroff_toggled " : self . change_confirm_forcepoweroff ,
" on_prefs_confirm_poweroff_toggled " : self . change_confirm_poweroff ,
" on_prefs_confirm_pause_toggled " : self . change_confirm_pause ,
2009-11-18 16:46:36 -05:00
" on_prefs_confirm_removedev_toggled " : self . change_confirm_removedev ,
2011-07-19 20:29:07 -04:00
" on_prefs_confirm_unapplied_toggled " : self . change_confirm_unapplied ,
2012-12-03 17:12:59 +01:00
" on_prefs_confirm_delstorage_toggled " : self . change_confirm_delstorage ,
2010-08-23 11:50:36 -04:00
" on_prefs_btn_keys_define_clicked " : self . change_grab_keys ,
2012-11-08 14:15:02 +01:00
} )
2014-02-04 15:12:23 -05:00
self . widget ( " prefs-graphics-type " ) . emit ( " changed " )
2011-04-18 11:25:28 -04:00
self . bind_escape_key_close ( )
2006-06-14 10:59:40 -04:00
2008-12-17 15:27:06 -05:00
def close ( self , ignore1 = None , ignore2 = None ) :
2019-06-16 21:12:39 -04:00
log . debug ( " Closing preferences " )
2008-12-17 15:27:06 -05:00
self . topwin . hide ( )
2006-06-14 10:59:40 -04:00
return 1
2011-04-14 08:47:42 -04:00
def show ( self , parent ) :
2019-06-16 21:12:39 -04:00
log . debug ( " Showing preferences " )
2011-04-14 08:47:42 -04:00
self . topwin . set_transient_for ( parent )
2008-12-17 15:27:06 -05:00
self . topwin . present ( )
2011-07-23 21:16:54 -04:00
def _cleanup ( self ) :
pass
2013-10-02 14:47:21 -04:00
def _init_ui ( self ) :
combo = self . widget ( " prefs-console-scaling " )
# [gsettings value, string]
model = Gtk . ListStore ( int , str )
for row in [ [ 0 , _ ( " Never " ) ] ,
[ 1 , _ ( " Fullscreen only " ) ] ,
[ 2 , _ ( " Always " ) ] ] :
model . append ( row )
combo . set_model ( model )
2015-04-10 13:04:02 -04:00
uiutil . init_combo_text_column ( combo , 1 )
2013-10-02 14:47:21 -04:00
2014-01-31 09:13:53 -05:00
combo = self . widget ( " prefs-console-resizeguest " )
# [gsettings value, string]
model = Gtk . ListStore ( int , str )
vals = {
0 : _ ( " Off " ) ,
1 : _ ( " On " ) ,
}
model . append ( [ - 1 , _ ( " System default ( %s ) " ) %
vals [ self . config . default_console_resizeguest ] ] )
for key , val in vals . items ( ) :
model . append ( [ key , val ] )
combo . set_model ( model )
2015-04-10 13:04:02 -04:00
uiutil . init_combo_text_column ( combo , 1 )
2014-01-31 09:13:53 -05:00
2018-03-16 14:38:22 -04:00
combo = self . widget ( " prefs-console-autoredir " )
# [gsettings value, string]
model = Gtk . ListStore ( bool , str )
vals = {
False : _ ( " Manual redirect only " ) ,
True : _ ( " Auto redirect on USB attach " ) ,
}
for key , val in vals . items ( ) :
model . append ( [ key , val ] )
combo . set_model ( model )
uiutil . init_combo_text_column ( combo , 1 )
2013-10-02 14:47:21 -04:00
combo = self . widget ( " prefs-graphics-type " )
# [gsettings value, string]
model = Gtk . ListStore ( str , str )
for row in [ [ " system " , _ ( " System default ( %s ) " ) %
self . config . default_graphics_from_config ] ,
[ " vnc " , " VNC " ] , [ " spice " , " Spice " ] ] :
model . append ( row )
combo . set_model ( model )
2015-04-10 13:04:02 -04:00
uiutil . init_combo_text_column ( combo , 1 )
2013-10-02 14:47:21 -04:00
combo = self . widget ( " prefs-storage-format " )
# [gsettings value, string]
model = Gtk . ListStore ( str , str )
for row in [ [ " default " , _ ( " System default ( %s ) " ) %
self . config . default_storage_format_from_config ] ,
[ " raw " , " Raw " ] ,
[ " qcow2 " , " QCOW2 " ] ] :
model . append ( row )
combo . set_model ( model )
2015-04-10 13:04:02 -04:00
uiutil . init_combo_text_column ( combo , 1 )
2013-10-02 14:47:21 -04:00
2014-01-17 15:32:40 -05:00
combo = self . widget ( " prefs-cpu-default " )
# [gsettings value, string]
model = Gtk . ListStore ( str , str )
2018-10-04 14:19:32 -04:00
for row in [
[ DomainCpu . SPECIAL_MODE_APP_DEFAULT , _ ( " Application default " ) ] ,
[ DomainCpu . SPECIAL_MODE_HV_DEFAULT , _ ( " Hypervisor default " ) ] ,
[ DomainCpu . SPECIAL_MODE_HOST_MODEL_ONLY ,
_ ( " Nearest host CPU model " ) ] ,
2020-09-20 17:20:10 -04:00
[ DomainCpu . SPECIAL_MODE_HOST_MODEL , " host-model " ] ,
[ DomainCpu . SPECIAL_MODE_HOST_PASSTHROUGH , " host-passthrough " ] ] :
2014-01-17 15:32:40 -05:00
model . append ( row )
combo . set_model ( model )
2015-04-10 13:04:02 -04:00
uiutil . init_combo_text_column ( combo , 1 )
2014-01-17 15:32:40 -05:00
2022-01-25 19:48:19 -05:00
combo = self . widget ( " prefs-firmware-default " )
# [gsettings value, string]
model = Gtk . ListStore ( str , str )
2022-01-31 14:10:03 -05:00
for row in [ [ " default " , _ ( " System default " ) ] ,
2022-01-25 19:48:19 -05:00
[ " uefi " , " UEFI " ] ] :
model . append ( row )
combo . set_model ( model )
uiutil . init_combo_text_column ( combo , 1 )
2020-08-24 19:46:28 -04:00
if not vmmInspection . libguestfs_installed ( ) : # pragma: no cover
2018-03-13 13:00:59 -04:00
self . widget ( " prefs-libguestfs " ) . set_sensitive ( False )
self . widget ( " prefs-libguestfs " ) . set_tooltip_text (
_ ( " python libguestfs support is not installed " ) )
2013-10-02 14:47:21 -04:00
2008-12-17 15:27:06 -05:00
#########################
# Config Change Options #
#########################
2006-06-14 10:59:40 -04:00
2013-04-17 17:39:25 -04:00
def refresh_view_system_tray ( self ) :
2019-06-14 20:04:35 -04:00
errmsg = vmmSystray . systray_disabled_message ( )
2020-08-20 13:34:01 -04:00
val = bool ( self . config . get_view_system_tray ( ) and not errmsg )
2019-06-14 20:04:35 -04:00
self . widget ( " prefs-system-tray " ) . set_sensitive ( not bool ( errmsg ) )
self . widget ( " prefs-system-tray " ) . set_tooltip_text ( errmsg )
2020-08-20 13:34:01 -04:00
self . widget ( " prefs-system-tray " ) . set_active ( val )
2009-07-27 22:30:01 -04:00
2019-06-05 17:40:54 -04:00
def refresh_xmleditor ( self ) :
val = self . config . get_xmleditor_enabled ( )
self . widget ( " prefs-xmleditor " ) . set_active ( bool ( val ) )
2018-03-13 13:00:59 -04:00
def refresh_libguestfs ( self ) :
val = self . config . get_libguestfs_inspect_vms ( )
if self . _orig_libguestfs_val is None :
self . _orig_libguestfs_val = val
self . widget ( " prefs-libguestfs " ) . set_active ( bool ( val ) )
2013-04-17 17:39:25 -04:00
def refresh_update_interval ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-stats-update-interval " ) . set_value (
2010-11-29 14:06:43 -05:00
self . config . get_stats_update_interval ( ) )
2013-04-17 17:39:25 -04:00
def refresh_console_scaling ( self ) :
2013-10-02 14:47:21 -04:00
combo = self . widget ( " prefs-console-scaling " )
2009-05-11 10:45:25 -04:00
val = self . config . get_console_scaling ( )
2015-05-19 18:13:33 -04:00
uiutil . set_list_selection ( combo , val )
2014-01-31 09:13:53 -05:00
def refresh_console_resizeguest ( self ) :
combo = self . widget ( " prefs-console-resizeguest " )
val = self . config . get_console_resizeguest ( )
2015-05-19 18:13:33 -04:00
uiutil . set_list_selection ( combo , val )
2018-03-16 14:38:22 -04:00
def refresh_console_autoredir ( self ) :
combo = self . widget ( " prefs-console-autoredir " )
val = self . config . get_auto_usbredir ( )
uiutil . set_list_selection ( combo , val )
2020-09-09 19:04:44 -04:00
def refresh_console_autoconnect ( self ) :
val = self . config . get_console_autoconnect ( )
self . widget ( " prefs-console-autoconnect " ) . set_active ( val )
2006-10-31 14:29:22 -05:00
2013-04-17 17:39:25 -04:00
def refresh_graphics_type ( self ) :
2011-07-14 13:13:13 -04:00
combo = self . widget ( " prefs-graphics-type " )
2013-10-02 14:47:21 -04:00
gtype = self . config . get_graphics_type ( raw = True )
2015-05-19 18:13:33 -04:00
uiutil . set_list_selection ( combo , gtype )
2013-04-17 17:39:25 -04:00
def refresh_storage_format ( self ) :
2012-02-13 14:49:00 -05:00
combo = self . widget ( " prefs-storage-format " )
2013-10-02 15:17:15 -04:00
val = self . config . get_default_storage_format ( raw = True )
2015-05-19 18:13:33 -04:00
uiutil . set_list_selection ( combo , val )
2014-01-17 15:32:40 -05:00
def refresh_cpu_default ( self ) :
combo = self . widget ( " prefs-cpu-default " )
2018-10-04 14:19:32 -04:00
val = self . config . get_default_cpu_setting ( )
2015-05-19 18:13:33 -04:00
uiutil . set_list_selection ( combo , val )
2022-01-25 19:48:19 -05:00
def refresh_firmware_default ( self ) :
combo = self . widget ( " prefs-firmware-default " )
2022-01-31 14:10:03 -05:00
val = self . config . get_default_firmware_setting ( )
2022-01-25 19:48:19 -05:00
uiutil . set_list_selection ( combo , val )
2008-12-17 15:27:06 -05:00
2014-02-11 15:29:30 -05:00
def refresh_cpu_poll ( self ) :
self . widget ( " prefs-stats-enable-cpu " ) . set_active (
self . config . get_stats_enable_cpu_poll ( ) )
2013-04-17 17:39:25 -04:00
def refresh_disk_poll ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-stats-enable-disk " ) . set_active (
2010-11-29 14:06:43 -05:00
self . config . get_stats_enable_disk_poll ( ) )
2013-04-17 17:39:25 -04:00
def refresh_net_poll ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-stats-enable-net " ) . set_active (
2010-11-29 14:06:43 -05:00
self . config . get_stats_enable_net_poll ( ) )
2014-01-12 17:39:21 -05:00
def refresh_memory_poll ( self ) :
self . widget ( " prefs-stats-enable-memory " ) . set_active (
self . config . get_stats_enable_memory_poll ( ) )
2008-09-02 12:09:39 -04:00
2020-08-24 19:46:28 -04:00
def _process_grabkeys ( self , val ) :
2012-01-29 21:51:20 -05:00
# We convert keysyms to names
2020-08-24 19:46:28 -04:00
keys = [ ]
for k in val . split ( ' , ' ) :
try :
key = int ( k )
keys . append ( Gdk . keyval_name ( key ) )
except Exception : # pragma: no cover
continue
return " + " . join ( keys )
2012-01-29 21:51:20 -05:00
2020-08-24 19:46:28 -04:00
def refresh_grabkeys_combination ( self ) :
val = self . config . get_keys_combination ( )
keystr = self . _process_grabkeys ( val )
2020-04-13 12:44:47 -04:00
self . widget ( " prefs-keys-grab-sequence " ) . set_text ( keystr or " " )
2010-08-23 11:50:36 -04:00
2013-04-17 17:39:25 -04:00
def refresh_confirm_forcepoweroff ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-confirm-forcepoweroff " ) . set_active (
self . config . get_confirm_forcepoweroff ( ) )
2013-04-17 17:39:25 -04:00
def refresh_confirm_poweroff ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-confirm-poweroff " ) . set_active (
self . config . get_confirm_poweroff ( ) )
2013-04-17 17:39:25 -04:00
def refresh_confirm_pause ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-confirm-pause " ) . set_active (
self . config . get_confirm_pause ( ) )
2013-04-17 17:39:25 -04:00
def refresh_confirm_removedev ( self ) :
2011-07-14 13:13:13 -04:00
self . widget ( " prefs-confirm-removedev " ) . set_active (
self . config . get_confirm_removedev ( ) )
2013-04-17 17:39:25 -04:00
def refresh_confirm_unapplied ( self ) :
2011-07-19 20:29:07 -04:00
self . widget ( " prefs-confirm-unapplied " ) . set_active (
self . config . get_confirm_unapplied ( ) )
2013-04-17 17:39:25 -04:00
def refresh_confirm_delstorage ( self ) :
2012-12-03 17:12:59 +01:00
self . widget ( " prefs-confirm-delstorage " ) . set_active (
self . config . get_confirm_delstorage ( ) )
2009-11-18 16:11:17 -05:00
2012-02-07 13:52:26 -05:00
def grabkeys_get_string ( self , events ) :
keystr = " "
for ignore , keyval in events :
if keystr :
keystr + = " + "
2012-05-14 14:24:56 +01:00
keystr + = Gdk . keyval_name ( keyval )
2010-08-23 11:50:36 -04:00
return keystr
2012-02-07 13:52:26 -05:00
def grabkeys_dlg_press ( self , src_ignore , event , label , events ) :
2013-04-11 16:32:00 -04:00
if not [ e for e in events if e [ 0 ] == event . hardware_keycode ] :
2012-02-07 13:52:26 -05:00
events . append ( ( event . hardware_keycode , event . keyval ) )
2010-08-23 11:50:36 -04:00
2012-02-07 13:52:26 -05:00
label . set_text ( self . grabkeys_get_string ( events ) )
2010-08-23 11:50:36 -04:00
2012-02-07 13:52:26 -05:00
def grabkeys_dlg_release ( self , src_ignore , event , label , events ) :
2013-04-11 16:32:00 -04:00
for e in [ e for e in events if e [ 0 ] == event . hardware_keycode ] :
2012-02-07 13:52:26 -05:00
events . remove ( e )
label . set_text ( self . grabkeys_get_string ( events ) )
2010-08-23 11:50:36 -04:00
2010-12-09 11:22:35 -05:00
def change_grab_keys ( self , src_ignore ) :
2012-05-14 14:24:56 +01:00
dialog = Gtk . Dialog ( _ ( " Configure grab key combination " ) ,
2011-04-14 08:47:42 -04:00
self . topwin ,
2012-05-14 14:24:56 +01:00
Gtk . DialogFlags . MODAL | Gtk . DialogFlags . DESTROY_WITH_PARENT ,
( Gtk . STOCK_CANCEL , Gtk . ResponseType . REJECT ,
Gtk . STOCK_OK , Gtk . ResponseType . ACCEPT ) )
2011-04-14 08:47:42 -04:00
dialog . set_default_size ( 325 , 160 )
dialog . set_border_width ( 6 )
2014-05-02 10:20:59 -04:00
infolabel = Gtk . Label (
label = _ ( " You can now define grab keys by pressing them. \n "
" To confirm your selection please click OK button \n "
" while you have desired keys pressed. " ) )
2012-05-14 14:24:56 +01:00
keylabel = Gtk . Label ( label = _ ( " Please press desired grab key combination " ) )
2011-04-14 08:47:42 -04:00
2012-05-14 14:24:56 +01:00
vbox = Gtk . VBox ( )
2011-04-14 08:47:42 -04:00
vbox . set_spacing ( 12 )
2013-04-18 12:45:00 -04:00
vbox . pack_start ( infolabel , False , False , 0 )
vbox . pack_start ( keylabel , False , False , 0 )
2011-04-14 08:47:42 -04:00
dialog . get_content_area ( ) . add ( vbox )
2012-02-07 13:52:26 -05:00
events = [ ]
dialog . connect ( " key-press-event " , self . grabkeys_dlg_press ,
keylabel , events )
dialog . connect ( " key-release-event " , self . grabkeys_dlg_release ,
keylabel , events )
2010-08-23 11:50:36 -04:00
dialog . show_all ( )
result = dialog . run ( )
2012-05-14 14:24:56 +01:00
if result == Gtk . ResponseType . ACCEPT :
2013-04-11 16:32:00 -04:00
self . config . set_keys_combination ( [ e [ 1 ] for e in events ] )
2010-08-23 11:50:36 -04:00
self . refresh_grabkeys_combination ( )
dialog . destroy ( )
2009-07-27 22:30:01 -04:00
def change_view_system_tray ( self , src ) :
self . config . set_view_system_tray ( src . get_active ( ) )
2019-06-05 17:40:54 -04:00
def change_xmleditor ( self , src ) :
self . config . set_xmleditor_enabled ( src . get_active ( ) )
2018-03-13 13:00:59 -04:00
def change_libguestfs ( self , src ) :
val = src . get_active ( )
self . config . set_libguestfs_inspect_vms ( val )
vis = ( val != self . _orig_libguestfs_val and
self . widget ( " prefs-libguestfs " ) . get_sensitive ( ) )
uiutil . set_grid_row_visible (
self . widget ( " prefs-libguestfs-warn-box " ) , vis )
2009-07-27 22:30:01 -04:00
2006-06-14 10:59:40 -04:00
def change_update_interval ( self , src ) :
self . config . set_stats_update_interval ( src . get_value_as_int ( ) )
2009-02-23 18:50:47 -05:00
def change_console_scaling ( self , box ) :
self . config . set_console_scaling ( box . get_active ( ) )
2014-01-31 09:13:53 -05:00
def change_console_resizeguest ( self , box ) :
2015-05-19 17:17:53 -04:00
val = uiutil . get_list_selection ( box )
2014-01-31 09:13:53 -05:00
self . config . set_console_resizeguest ( val )
2018-03-16 14:38:22 -04:00
def change_console_autoredir ( self , box ) :
val = uiutil . get_list_selection ( box )
self . config . set_auto_usbredir ( val )
2020-09-09 19:04:44 -04:00
def change_console_autoconnect ( self , src ) :
self . config . set_console_autoconnect ( bool ( src . get_active ( ) ) )
2006-11-06 15:01:28 -05:00
2014-01-17 15:32:40 -05:00
def change_graphics_type ( self , src ) :
2015-05-19 17:17:53 -04:00
val = uiutil . get_list_selection ( src )
2014-02-04 15:12:23 -05:00
self . config . set_graphics_type ( val )
2014-01-17 15:32:40 -05:00
def change_storage_format ( self , src ) :
2015-05-19 17:17:53 -04:00
typ = uiutil . get_list_selection ( src ) or " default "
2014-01-17 15:32:40 -05:00
self . config . set_storage_format ( typ . lower ( ) )
def change_cpu_default ( self , src ) :
2015-05-19 17:17:53 -04:00
typ = uiutil . get_list_selection ( src ) or " default "
2014-01-17 15:32:40 -05:00
self . config . set_default_cpu_setting ( typ . lower ( ) )
2022-01-25 19:48:19 -05:00
def change_firmware_default ( self , src ) :
typ = uiutil . get_list_selection ( src ) or " default "
self . config . set_firmware_setting ( typ . lower ( ) )
2008-09-02 12:09:39 -04:00
2014-02-11 15:29:30 -05:00
def change_cpu_poll ( self , src ) :
self . config . set_stats_enable_cpu_poll ( src . get_active ( ) )
2008-12-17 15:27:06 -05:00
def change_disk_poll ( self , src ) :
self . config . set_stats_enable_disk_poll ( src . get_active ( ) )
def change_net_poll ( self , src ) :
self . config . set_stats_enable_net_poll ( src . get_active ( ) )
2014-01-12 17:39:21 -05:00
def change_memory_poll ( self , src ) :
self . config . set_stats_enable_memory_poll ( src . get_active ( ) )
2008-12-17 15:27:06 -05:00
2009-11-18 16:11:17 -05:00
def change_confirm_forcepoweroff ( self , src ) :
self . config . set_confirm_forcepoweroff ( src . get_active ( ) )
def change_confirm_poweroff ( self , src ) :
self . config . set_confirm_poweroff ( src . get_active ( ) )
def change_confirm_pause ( self , src ) :
self . config . set_confirm_pause ( src . get_active ( ) )
2009-11-18 16:46:36 -05:00
def change_confirm_removedev ( self , src ) :
self . config . set_confirm_removedev ( src . get_active ( ) )
2011-07-19 20:29:07 -04:00
def change_confirm_unapplied ( self , src ) :
self . config . set_confirm_unapplied ( src . get_active ( ) )
2012-12-03 17:12:59 +01:00
def change_confirm_delstorage ( self , src ) :
self . config . set_confirm_delstorage ( src . get_active ( ) )