2006-06-29 03:50:17 +08:00
|
|
|
#
|
2013-10-28 04:59:46 +08:00
|
|
|
# Copyright (C) 2006, 2012-2013 Red Hat, Inc.
|
2006-06-29 03:50:17 +08:00
|
|
|
# Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-11-21 00:12:20 +08:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301 USA.
|
2006-06-29 03:50:17 +08:00
|
|
|
#
|
2007-11-21 00:12:20 +08:00
|
|
|
|
2012-02-01 07:16:54 +08:00
|
|
|
import logging
|
|
|
|
|
2012-05-14 21:24:56 +08:00
|
|
|
from gi.repository import Gtk
|
|
|
|
from gi.repository import Gdk
|
2006-06-14 22:59:40 +08:00
|
|
|
|
2014-09-13 04:10:45 +08:00
|
|
|
from . import uiutil
|
|
|
|
from .baseclass import vmmGObjectUI
|
2009-12-15 05:45:55 +08:00
|
|
|
|
2013-04-14 02:34:52 +08:00
|
|
|
|
2010-12-09 06:26:19 +08:00
|
|
|
class vmmPreferences(vmmGObjectUI):
|
|
|
|
def __init__(self):
|
2013-09-23 04:10:16 +08:00
|
|
|
vmmGObjectUI.__init__(self, "preferences.ui", "vmm-preferences")
|
2006-06-14 22:59:40 +08:00
|
|
|
|
2013-10-03 02:47:21 +08:00
|
|
|
self._init_ui()
|
|
|
|
|
2009-07-28 10:30:01 +08:00
|
|
|
self.refresh_view_system_tray()
|
2006-06-14 22:59:40 +08:00
|
|
|
self.refresh_update_interval()
|
2010-12-03 02:41:22 +08:00
|
|
|
self.refresh_console_accels()
|
2009-02-24 07:50:47 +08:00
|
|
|
self.refresh_console_scaling()
|
2014-01-31 22:13:53 +08:00
|
|
|
self.refresh_console_resizeguest()
|
2013-04-24 02:02:46 +08:00
|
|
|
self.refresh_new_vm_sound()
|
2011-03-18 20:59:14 +08:00
|
|
|
self.refresh_graphics_type()
|
2014-02-05 04:12:23 +08:00
|
|
|
self.refresh_add_spice_usbredir()
|
2012-02-14 03:49:00 +08:00
|
|
|
self.refresh_storage_format()
|
2014-01-18 04:32:40 +08:00
|
|
|
self.refresh_cpu_default()
|
2014-02-12 04:29:30 +08:00
|
|
|
self.refresh_cpu_poll()
|
2008-12-18 04:27:06 +08:00
|
|
|
self.refresh_disk_poll()
|
|
|
|
self.refresh_net_poll()
|
2014-01-13 06:39:21 +08:00
|
|
|
self.refresh_memory_poll()
|
2010-08-23 23:50:36 +08:00
|
|
|
self.refresh_grabkeys_combination()
|
2009-11-19 05:11:17 +08:00
|
|
|
self.refresh_confirm_forcepoweroff()
|
|
|
|
self.refresh_confirm_poweroff()
|
|
|
|
self.refresh_confirm_pause()
|
2009-11-19 05:46:36 +08:00
|
|
|
self.refresh_confirm_removedev()
|
2010-02-09 11:34:23 +08:00
|
|
|
self.refresh_confirm_interface()
|
2011-07-20 08:29:07 +08:00
|
|
|
self.refresh_confirm_unapplied()
|
2012-12-04 00:12:59 +08:00
|
|
|
self.refresh_confirm_delstorage()
|
2006-06-14 22:59:40 +08:00
|
|
|
|
2013-02-17 02:31:46 +08:00
|
|
|
self.builder.connect_signals({
|
2014-02-05 04:12:23 +08:00
|
|
|
"on_vmm_preferences_delete_event": self.close,
|
|
|
|
"on_prefs_close_clicked": self.close,
|
|
|
|
|
2009-07-28 10:30:01 +08:00
|
|
|
"on_prefs_system_tray_toggled" : self.change_view_system_tray,
|
2008-12-18 04:27:06 +08:00
|
|
|
"on_prefs_stats_update_interval_changed": self.change_update_interval,
|
2010-12-03 02:41:22 +08:00
|
|
|
"on_prefs_console_accels_toggled": self.change_console_accels,
|
2009-02-24 07:50:47 +08:00
|
|
|
"on_prefs_console_scaling_changed": self.change_console_scaling,
|
2014-01-31 22:13:53 +08:00
|
|
|
"on_prefs_console_resizeguest_changed": self.change_console_resizeguest,
|
2013-04-24 02:02:46 +08:00
|
|
|
"on_prefs_new_vm_sound_toggled": self.change_new_vm_sound,
|
2014-01-18 04:32:40 +08:00
|
|
|
"on_prefs_graphics_type_changed": self.change_graphics_type,
|
2014-02-05 04:12:23 +08:00
|
|
|
"on_prefs_add_spice_usbredir_changed": self.change_add_spice_usbredir,
|
2014-01-18 04:32:40 +08:00
|
|
|
"on_prefs_storage_format_changed": self.change_storage_format,
|
|
|
|
"on_prefs_cpu_default_changed": self.change_cpu_default,
|
2014-02-12 04:29:30 +08:00
|
|
|
"on_prefs_stats_enable_cpu_toggled": self.change_cpu_poll,
|
2008-12-18 04:27:06 +08:00
|
|
|
"on_prefs_stats_enable_disk_toggled": self.change_disk_poll,
|
|
|
|
"on_prefs_stats_enable_net_toggled": self.change_net_poll,
|
2014-01-13 06:39:21 +08:00
|
|
|
"on_prefs_stats_enable_memory_toggled": self.change_memory_poll,
|
2009-11-19 05:11:17 +08: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-19 05:46:36 +08:00
|
|
|
"on_prefs_confirm_removedev_toggled": self.change_confirm_removedev,
|
2010-02-09 11:34:23 +08:00
|
|
|
"on_prefs_confirm_interface_toggled": self.change_confirm_interface,
|
2011-07-20 08:29:07 +08:00
|
|
|
"on_prefs_confirm_unapplied_toggled": self.change_confirm_unapplied,
|
2012-12-04 00:12:59 +08:00
|
|
|
"on_prefs_confirm_delstorage_toggled": self.change_confirm_delstorage,
|
2010-08-23 23:50:36 +08:00
|
|
|
"on_prefs_btn_keys_define_clicked": self.change_grab_keys,
|
2012-11-08 21:15:02 +08:00
|
|
|
})
|
2014-02-05 04:12:23 +08:00
|
|
|
|
|
|
|
self.widget("prefs-graphics-type").emit("changed")
|
|
|
|
|
2011-04-18 23:25:28 +08:00
|
|
|
self.bind_escape_key_close()
|
2006-06-14 22:59:40 +08:00
|
|
|
|
2008-12-18 04:27:06 +08:00
|
|
|
def close(self, ignore1=None, ignore2=None):
|
2012-02-01 07:16:54 +08:00
|
|
|
logging.debug("Closing preferences")
|
2008-12-18 04:27:06 +08:00
|
|
|
self.topwin.hide()
|
2006-06-14 22:59:40 +08:00
|
|
|
return 1
|
|
|
|
|
2011-04-14 20:47:42 +08:00
|
|
|
def show(self, parent):
|
2012-02-01 07:16:54 +08:00
|
|
|
logging.debug("Showing preferences")
|
2011-04-14 20:47:42 +08:00
|
|
|
self.topwin.set_transient_for(parent)
|
2008-12-18 04:27:06 +08:00
|
|
|
self.topwin.present()
|
|
|
|
|
2011-07-24 09:16:54 +08:00
|
|
|
def _cleanup(self):
|
|
|
|
pass
|
|
|
|
|
2013-10-03 02:47:21 +08: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-11 01:04:02 +08:00
|
|
|
uiutil.init_combo_text_column(combo, 1)
|
2013-10-03 02:47:21 +08:00
|
|
|
|
2014-01-31 22:13:53 +08: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-11 01:04:02 +08:00
|
|
|
uiutil.init_combo_text_column(combo, 1)
|
2014-01-31 22:13:53 +08:00
|
|
|
|
2013-10-03 02:47:21 +08: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-11 01:04:02 +08:00
|
|
|
uiutil.init_combo_text_column(combo, 1)
|
2013-10-03 02:47:21 +08:00
|
|
|
|
2014-02-05 04:12:23 +08:00
|
|
|
combo = self.widget("prefs-add-spice-usbredir")
|
|
|
|
# [gsettings value, string]
|
|
|
|
model = Gtk.ListStore(str, str)
|
|
|
|
for row in [["system", _("System default (%s)") %
|
|
|
|
self.config.default_add_spice_usbredir],
|
2016-02-05 23:18:16 +08:00
|
|
|
["yes", _("Yes")], ["no", _("No")]]:
|
2014-02-05 04:12:23 +08:00
|
|
|
model.append(row)
|
|
|
|
combo.set_model(model)
|
2015-04-11 01:04:02 +08:00
|
|
|
uiutil.init_combo_text_column(combo, 1)
|
2014-02-05 04:12:23 +08:00
|
|
|
|
2013-10-03 02:47:21 +08: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-11 01:04:02 +08:00
|
|
|
uiutil.init_combo_text_column(combo, 1)
|
2013-10-03 02:47:21 +08:00
|
|
|
|
2014-01-18 04:32:40 +08:00
|
|
|
combo = self.widget("prefs-cpu-default")
|
|
|
|
# [gsettings value, string]
|
|
|
|
model = Gtk.ListStore(str, str)
|
|
|
|
for row in [["default", _("System default (%s)") %
|
|
|
|
self.config.cpu_default_from_config],
|
|
|
|
["hv-default", _("Hypervisor default")],
|
|
|
|
["host-cpu-model", _("Nearest host CPU model")],
|
|
|
|
["host-model", _("Copy host CPU definition")]]:
|
|
|
|
model.append(row)
|
|
|
|
combo.set_model(model)
|
2015-04-11 01:04:02 +08:00
|
|
|
uiutil.init_combo_text_column(combo, 1)
|
2014-01-18 04:32:40 +08:00
|
|
|
|
2013-10-03 02:47:21 +08:00
|
|
|
|
2008-12-18 04:27:06 +08:00
|
|
|
#########################
|
|
|
|
# Config Change Options #
|
|
|
|
#########################
|
2006-06-14 22:59:40 +08:00
|
|
|
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_view_system_tray(self):
|
2009-07-28 10:30:01 +08:00
|
|
|
val = self.config.get_view_system_tray()
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-system-tray").set_active(bool(val))
|
2009-07-28 10:30:01 +08:00
|
|
|
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_update_interval(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-stats-update-interval").set_value(
|
2010-11-30 03:06:43 +08:00
|
|
|
self.config.get_stats_update_interval())
|
|
|
|
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_console_accels(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-console-accels").set_active(
|
2010-12-03 02:41:22 +08:00
|
|
|
self.config.get_console_accels())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_console_scaling(self):
|
2013-10-03 02:47:21 +08:00
|
|
|
combo = self.widget("prefs-console-scaling")
|
2009-05-11 22:45:25 +08:00
|
|
|
val = self.config.get_console_scaling()
|
2015-05-20 06:13:33 +08:00
|
|
|
uiutil.set_list_selection(combo, val)
|
2014-01-31 22:13:53 +08:00
|
|
|
def refresh_console_resizeguest(self):
|
|
|
|
combo = self.widget("prefs-console-resizeguest")
|
|
|
|
val = self.config.get_console_resizeguest()
|
2015-05-20 06:13:33 +08:00
|
|
|
uiutil.set_list_selection(combo, val)
|
2006-11-01 03:29:22 +08:00
|
|
|
|
2013-04-24 02:02:46 +08:00
|
|
|
def refresh_new_vm_sound(self):
|
|
|
|
self.widget("prefs-new-vm-sound").set_active(
|
|
|
|
self.config.get_new_vm_sound())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_graphics_type(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
combo = self.widget("prefs-graphics-type")
|
2013-10-03 02:47:21 +08:00
|
|
|
gtype = self.config.get_graphics_type(raw=True)
|
2015-05-20 06:13:33 +08:00
|
|
|
uiutil.set_list_selection(combo, gtype)
|
2014-02-05 04:12:23 +08:00
|
|
|
def refresh_add_spice_usbredir(self):
|
|
|
|
combo = self.widget("prefs-add-spice-usbredir")
|
|
|
|
val = self.config.get_add_spice_usbredir(raw=True)
|
2015-05-20 06:13:33 +08:00
|
|
|
uiutil.set_list_selection(combo, val)
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_storage_format(self):
|
2012-02-14 03:49:00 +08:00
|
|
|
combo = self.widget("prefs-storage-format")
|
2013-10-03 03:17:15 +08:00
|
|
|
val = self.config.get_default_storage_format(raw=True)
|
2015-05-20 06:13:33 +08:00
|
|
|
uiutil.set_list_selection(combo, val)
|
2014-01-18 04:32:40 +08:00
|
|
|
def refresh_cpu_default(self):
|
|
|
|
combo = self.widget("prefs-cpu-default")
|
|
|
|
val = self.config.get_default_cpu_setting(raw=True)
|
2015-05-20 06:13:33 +08:00
|
|
|
uiutil.set_list_selection(combo, val)
|
2008-12-18 04:27:06 +08:00
|
|
|
|
2014-02-12 04:29:30 +08:00
|
|
|
def refresh_cpu_poll(self):
|
|
|
|
self.widget("prefs-stats-enable-cpu").set_active(
|
|
|
|
self.config.get_stats_enable_cpu_poll())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_disk_poll(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-stats-enable-disk").set_active(
|
2010-11-30 03:06:43 +08:00
|
|
|
self.config.get_stats_enable_disk_poll())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_net_poll(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-stats-enable-net").set_active(
|
2010-11-30 03:06:43 +08:00
|
|
|
self.config.get_stats_enable_net_poll())
|
2014-01-13 06:39:21 +08:00
|
|
|
def refresh_memory_poll(self):
|
|
|
|
self.widget("prefs-stats-enable-memory").set_active(
|
|
|
|
self.config.get_stats_enable_memory_poll())
|
2008-09-03 00:09:39 +08:00
|
|
|
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_grabkeys_combination(self):
|
2010-08-23 23:50:36 +08:00
|
|
|
val = self.config.get_keys_combination()
|
2012-01-30 10:51:20 +08:00
|
|
|
|
|
|
|
# We convert keysyms to names
|
|
|
|
if not val:
|
|
|
|
keystr = "Control_L+Alt_L"
|
|
|
|
else:
|
|
|
|
keystr = None
|
|
|
|
for k in val.split(','):
|
|
|
|
try:
|
|
|
|
key = int(k)
|
|
|
|
except:
|
|
|
|
key = None
|
|
|
|
|
|
|
|
if key is not None:
|
|
|
|
if keystr is None:
|
2012-05-14 21:24:56 +08:00
|
|
|
keystr = Gdk.keyval_name(key)
|
2012-01-30 10:51:20 +08:00
|
|
|
else:
|
2012-05-14 21:24:56 +08:00
|
|
|
keystr = keystr + "+" + Gdk.keyval_name(key)
|
2012-01-30 10:51:20 +08:00
|
|
|
|
2010-08-23 23:50:36 +08:00
|
|
|
|
2012-01-30 10:51:20 +08:00
|
|
|
self.widget("prefs-keys-grab-sequence").set_text(keystr)
|
2010-08-23 23:50:36 +08:00
|
|
|
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_forcepoweroff(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-confirm-forcepoweroff").set_active(
|
|
|
|
self.config.get_confirm_forcepoweroff())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_poweroff(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-confirm-poweroff").set_active(
|
|
|
|
self.config.get_confirm_poweroff())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_pause(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-confirm-pause").set_active(
|
|
|
|
self.config.get_confirm_pause())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_removedev(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-confirm-removedev").set_active(
|
|
|
|
self.config.get_confirm_removedev())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_interface(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("prefs-confirm-interface").set_active(
|
|
|
|
self.config.get_confirm_interface())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_unapplied(self):
|
2011-07-20 08:29:07 +08:00
|
|
|
self.widget("prefs-confirm-unapplied").set_active(
|
|
|
|
self.config.get_confirm_unapplied())
|
2013-04-18 05:39:25 +08:00
|
|
|
def refresh_confirm_delstorage(self):
|
2012-12-04 00:12:59 +08:00
|
|
|
self.widget("prefs-confirm-delstorage").set_active(
|
|
|
|
self.config.get_confirm_delstorage())
|
2009-11-19 05:11:17 +08:00
|
|
|
|
2012-02-08 02:52:26 +08:00
|
|
|
def grabkeys_get_string(self, events):
|
|
|
|
keystr = ""
|
|
|
|
for ignore, keyval in events:
|
|
|
|
if keystr:
|
|
|
|
keystr += "+"
|
2012-05-14 21:24:56 +08:00
|
|
|
keystr += Gdk.keyval_name(keyval)
|
2010-08-23 23:50:36 +08:00
|
|
|
return keystr
|
|
|
|
|
2012-02-08 02:52:26 +08:00
|
|
|
def grabkeys_dlg_press(self, src_ignore, event, label, events):
|
2013-04-12 04:32:00 +08:00
|
|
|
if not [e for e in events if e[0] == event.hardware_keycode]:
|
2012-02-08 02:52:26 +08:00
|
|
|
events.append((event.hardware_keycode, event.keyval))
|
2010-08-23 23:50:36 +08:00
|
|
|
|
2012-02-08 02:52:26 +08:00
|
|
|
label.set_text(self.grabkeys_get_string(events))
|
2010-08-23 23:50:36 +08:00
|
|
|
|
2012-02-08 02:52:26 +08:00
|
|
|
def grabkeys_dlg_release(self, src_ignore, event, label, events):
|
2013-04-12 04:32:00 +08:00
|
|
|
for e in [e for e in events if e[0] == event.hardware_keycode]:
|
2012-02-08 02:52:26 +08:00
|
|
|
events.remove(e)
|
|
|
|
|
|
|
|
label.set_text(self.grabkeys_get_string(events))
|
2010-08-23 23:50:36 +08:00
|
|
|
|
2010-12-10 00:22:35 +08:00
|
|
|
def change_grab_keys(self, src_ignore):
|
2012-05-14 21:24:56 +08:00
|
|
|
dialog = Gtk.Dialog(_("Configure grab key combination"),
|
2011-04-14 20:47:42 +08:00
|
|
|
self.topwin,
|
2012-05-14 21:24:56 +08:00
|
|
|
Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
|
|
|
|
(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
|
|
|
|
Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
|
2011-04-14 20:47:42 +08:00
|
|
|
dialog.set_default_size(325, 160)
|
|
|
|
dialog.set_border_width(6)
|
|
|
|
|
2014-05-02 22:20:59 +08: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 21:24:56 +08:00
|
|
|
keylabel = Gtk.Label(label=_("Please press desired grab key combination"))
|
2011-04-14 20:47:42 +08:00
|
|
|
|
2012-05-14 21:24:56 +08:00
|
|
|
vbox = Gtk.VBox()
|
2011-04-14 20:47:42 +08:00
|
|
|
vbox.set_spacing(12)
|
2013-04-19 00:45:00 +08:00
|
|
|
vbox.pack_start(infolabel, False, False, 0)
|
|
|
|
vbox.pack_start(keylabel, False, False, 0)
|
2011-04-14 20:47:42 +08:00
|
|
|
dialog.get_content_area().add(vbox)
|
|
|
|
|
2012-02-08 02:52:26 +08: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 23:50:36 +08:00
|
|
|
dialog.show_all()
|
|
|
|
result = dialog.run()
|
|
|
|
|
2012-05-14 21:24:56 +08:00
|
|
|
if result == Gtk.ResponseType.ACCEPT:
|
2013-04-12 04:32:00 +08:00
|
|
|
self.config.set_keys_combination([e[1] for e in events])
|
2010-08-23 23:50:36 +08:00
|
|
|
|
|
|
|
self.refresh_grabkeys_combination()
|
|
|
|
dialog.destroy()
|
|
|
|
|
2009-07-28 10:30:01 +08:00
|
|
|
def change_view_system_tray(self, src):
|
|
|
|
self.config.set_view_system_tray(src.get_active())
|
|
|
|
|
2006-06-14 22:59:40 +08:00
|
|
|
def change_update_interval(self, src):
|
|
|
|
self.config.set_stats_update_interval(src.get_value_as_int())
|
|
|
|
|
2010-12-03 02:41:22 +08:00
|
|
|
def change_console_accels(self, src):
|
|
|
|
self.config.set_console_accels(src.get_active())
|
2009-02-24 07:50:47 +08:00
|
|
|
def change_console_scaling(self, box):
|
|
|
|
self.config.set_console_scaling(box.get_active())
|
2014-01-31 22:13:53 +08:00
|
|
|
def change_console_resizeguest(self, box):
|
2015-05-20 05:17:53 +08:00
|
|
|
val = uiutil.get_list_selection(box)
|
2014-01-31 22:13:53 +08:00
|
|
|
self.config.set_console_resizeguest(val)
|
2006-11-07 04:01:28 +08:00
|
|
|
|
2013-04-24 02:02:46 +08:00
|
|
|
def change_new_vm_sound(self, src):
|
|
|
|
self.config.set_new_vm_sound(src.get_active())
|
2014-01-18 04:32:40 +08:00
|
|
|
def change_graphics_type(self, src):
|
2015-05-20 05:17:53 +08:00
|
|
|
val = uiutil.get_list_selection(src)
|
2014-02-05 04:12:23 +08:00
|
|
|
self.config.set_graphics_type(val)
|
|
|
|
uiutil.set_grid_row_visible(
|
|
|
|
self.widget("prefs-add-spice-usbredir"),
|
|
|
|
self.config.get_graphics_type() == "spice")
|
|
|
|
def change_add_spice_usbredir(self, src):
|
2015-05-20 05:17:53 +08:00
|
|
|
self.config.set_add_spice_usbredir(uiutil.get_list_selection(src))
|
2014-01-18 04:32:40 +08:00
|
|
|
def change_storage_format(self, src):
|
2015-05-20 05:17:53 +08:00
|
|
|
typ = uiutil.get_list_selection(src) or "default"
|
2014-01-18 04:32:40 +08:00
|
|
|
self.config.set_storage_format(typ.lower())
|
|
|
|
def change_cpu_default(self, src):
|
2015-05-20 05:17:53 +08:00
|
|
|
typ = uiutil.get_list_selection(src) or "default"
|
2014-01-18 04:32:40 +08:00
|
|
|
self.config.set_default_cpu_setting(typ.lower())
|
2008-09-03 00:09:39 +08:00
|
|
|
|
2014-02-12 04:29:30 +08:00
|
|
|
def change_cpu_poll(self, src):
|
|
|
|
self.config.set_stats_enable_cpu_poll(src.get_active())
|
2008-12-18 04:27:06 +08: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-13 06:39:21 +08:00
|
|
|
def change_memory_poll(self, src):
|
|
|
|
self.config.set_stats_enable_memory_poll(src.get_active())
|
2008-12-18 04:27:06 +08:00
|
|
|
|
2009-11-19 05:11:17 +08: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-19 05:46:36 +08:00
|
|
|
def change_confirm_removedev(self, src):
|
|
|
|
self.config.set_confirm_removedev(src.get_active())
|
2010-02-09 11:34:23 +08:00
|
|
|
def change_confirm_interface(self, src):
|
|
|
|
self.config.set_confirm_interface(src.get_active())
|
2011-07-20 08:29:07 +08:00
|
|
|
def change_confirm_unapplied(self, src):
|
|
|
|
self.config.set_confirm_unapplied(src.get_active())
|
2012-12-04 00:12:59 +08:00
|
|
|
def change_confirm_delstorage(self, src):
|
|
|
|
self.config.set_confirm_delstorage(src.get_active())
|