[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 1 of 5] addhardware: add SPICE support



# HG changeset patch
# User Marc-André Lureau <marcandre lureau redhat com>
# Date 1292958961 -3600
# Node ID 707b594a1ab7e80be1dc29c3c61be13c9e95c803
# Parent  41a46b884b1e84199eaeb0fccb7cb64e4e98f1ab
addhardware: add SPICE support

diff -r 41a46b884b1e -r 707b594a1ab7 src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py	Mon Dec 20 12:48:14 2010 -0500
+++ b/src/virtManager/addhardware.py	Tue Dec 21 20:16:01 2010 +0100
@@ -493,6 +493,7 @@
     def populate_graphics_model(self, model):
         model.clear()
         model.append([_("VNC server"), "vnc"])
+        model.append([_("SPICE server"), "spice"])
         model.append([_("Local SDL window"), "sdl"])
 
     def populate_host_device_model(self, devtype, devcap, subtype, subcap):
@@ -583,20 +584,27 @@
             return None
         return _type.get_model().get_value(_type.get_active_iter(), 1)
 
-    def get_config_vnc_port(self):
+    def get_config_graphics_port(self):
         port = self.window.get_widget("graphics-port")
         portAuto = self.window.get_widget("graphics-port-auto")
         if portAuto.get_active():
             return -1
         return int(port.get_value())
 
-    def get_config_vnc_address(self):
+    def get_config_graphics_tls_port(self):
+        port = self.window.get_widget("graphics-tls-port")
+        portAuto = self.window.get_widget("graphics-port-auto")
+        if portAuto.get_active():
+            return -1
+        return int(port.get_value())
+
+    def get_config_graphics_address(self):
         addr = self.window.get_widget("graphics-address")
         if addr.get_active():
             return "0.0.0.0"
         return "127.0.0.1"
 
-    def get_config_vnc_password(self):
+    def get_config_graphics_password(self):
         pw = self.window.get_widget("graphics-password")
         return pw.get_text()
 
@@ -762,7 +770,7 @@
     # Graphics listeners
     def change_graphics_type(self, ignore=None):
         graphics = self.get_config_graphics()
-        if graphics == "vnc":
+        if graphics in ["vnc", "spice"]:
             self.window.get_widget("graphics-port-auto").set_sensitive(True)
             self.window.get_widget("graphics-address").set_sensitive(True)
             self.window.get_widget("graphics-password").set_sensitive(True)
@@ -770,6 +778,7 @@
             self.change_port_auto()
         else:
             self.window.get_widget("graphics-port").set_sensitive(False)
+            self.window.get_widget("graphics-tls-port").set_sensitive(False)
             self.window.get_widget("graphics-port-auto").set_sensitive(False)
             self.window.get_widget("graphics-address").set_sensitive(False)
             self.window.get_widget("graphics-password").set_sensitive(False)
@@ -777,10 +786,14 @@
             self.window.get_widget("graphics-keymap").set_sensitive(False)
 
     def change_port_auto(self, ignore=None):
+        graphics = self.get_config_graphics()
+        tls_enable = graphics == "spice"
         if self.window.get_widget("graphics-port-auto").get_active():
             self.window.get_widget("graphics-port").set_sensitive(False)
+            self.window.get_widget("graphics-tls-port").set_sensitive(False)
         else:
             self.window.get_widget("graphics-port").set_sensitive(True)
+            self.window.get_widget("graphics-tls-port").set_sensitive(tls_enable)
 
     def change_keymap(self, ignore=None):
         if self.window.get_widget("graphics-keymap-chk").get_active():
@@ -1079,17 +1092,17 @@
 
     def validate_page_graphics(self):
         graphics = self.get_config_graphics()
-        if graphics == "vnc":
-            _type = virtinst.VirtualGraphics.TYPE_VNC
-        else:
-            _type = virtinst.VirtualGraphics.TYPE_SDL
+        _type = {"vnc": virtinst.VirtualGraphics.TYPE_VNC,
+                 "spice": virtinst.VirtualGraphics.TYPE_SPICE,
+                 "sdl": virtinst.VirtualGraphics.TYPE_SDL}[graphics]
 
         self._dev = virtinst.VirtualGraphics(type=_type,
                                              conn=self.vm.get_connection().vmm)
         try:
-            self._dev.port   = self.get_config_vnc_port()
-            self._dev.passwd = self.get_config_vnc_password()
-            self._dev.listen = self.get_config_vnc_address()
+            self._dev.port   = self.get_config_graphics_port()
+            self._dev.tlsPort = self.get_config_graphics_tls_port()
+            self._dev.passwd = self.get_config_graphics_password()
+            self._dev.listen = self.get_config_graphics_address()
             self._dev.keymap = self.get_config_keymap()
         except ValueError, e:
             self.err.val_err(_("Graphics device parameter error"), str(e))
diff -r 41a46b884b1e -r 707b594a1ab7 src/vmm-add-hardware.glade
--- a/src/vmm-add-hardware.glade	Mon Dec 20 12:48:14 2010 -0500
+++ b/src/vmm-add-hardware.glade	Tue Dec 21 20:16:01 2010 +0100
@@ -393,7 +393,7 @@
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label29">
+                                          <widget class="GtkLabel" id="label1">
                                             <property name="visible">True</property>
                                             <property name="xalign">0</property>
                                             <property name="label" translatable="yes">Storage _format:</property>
@@ -646,7 +646,7 @@
                                                     <property name="visible">True</property>
                                                     <property name="spacing">6</property>
                                                     <child>
-                                                      <widget class="GtkLabel" id="label1">
+                                                      <widget class="GtkLabel" id="label2">
                                                         <property name="visible">True</property>
                                                         <property name="label" translatable="yes">_Bridge name:</property>
                                                         <property name="use_underline">True</property>
@@ -917,52 +917,6 @@
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkHBox" id="hbox68">
-                                            <property name="visible">True</property>
-                                            <property name="spacing">6</property>
-                                            <child>
-                                              <widget class="GtkSpinButton" id="graphics-port">
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">True</property>
-                                                <property name="invisible_char">●</property>
-                                                <property name="adjustment">5900 5900 5999 1 10 0</property>
-                                                <property name="climb_rate">1</property>
-                                                <property name="snap_to_ticks">True</property>
-                                                <property name="numeric">True</property>
-                                                <property name="update_policy">if-valid</property>
-                                              </widget>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="position">0</property>
-                                              </packing>
-                                            </child>
-                                            <child>
-                                              <widget class="GtkCheckButton" id="graphics-port-auto">
-                                                <property name="label" translatable="yes">A_utomatically allocated</property>
-                                                <property name="visible">True</property>
-                                                <property name="can_focus">True</property>
-                                                <property name="receives_default">False</property>
-                                                <property name="use_underline">True</property>
-                                                <property name="draw_indicator">True</property>
-                                                <signal name="toggled" handler="on_graphics_port_auto_toggled"/>
-                                              </widget>
-                                              <packing>
-                                                <property name="expand">False</property>
-                                                <property name="fill">False</property>
-                                                <property name="position">1</property>
-                                              </packing>
-                                            </child>
-                                          </widget>
-                                          <packing>
-                                            <property name="left_attach">1</property>
-                                            <property name="right_attach">2</property>
-                                            <property name="top_attach">3</property>
-                                            <property name="bottom_attach">4</property>
-                                            <property name="x_options">GTK_FILL</property>
-                                            <property name="y_options">GTK_FILL</property>
-                                          </packing>
-                                        </child>
-                                        <child>
                                           <widget class="GtkEntry" id="graphics-password">
                                             <property name="visible">True</property>
                                             <property name="can_focus">True</property>
@@ -1000,7 +954,7 @@
                                                   <widget class="GtkLabel" id="label428">
                                                     <property name="visible">True</property>
                                                     <property name="xpad">7</property>
-                                                    <property name="label" translatable="yes">&lt;small&gt;&lt;b&gt;Tip:&lt;/b&gt; VNC server is strongly recommended because it allows the virtual display to be embedded inside this application. It may also be used to allow access to the virtual display from a remote system.&lt;/small&gt;</property>
+                                                    <property name="label" translatable="yes">&lt;small&gt;&lt;b&gt;Tip:&lt;/b&gt; VNC or SPICE server is strongly recommended because it allows the virtual display to be embedded inside this application. It may also be used to allow access to the virtual display from a remote system.&lt;/small&gt;</property>
                                                     <property name="use_markup">True</property>
                                                     <property name="wrap">True</property>
                                                   </widget>
@@ -1106,7 +1060,7 @@
                                               </packing>
                                             </child>
                                             <child>
-                                              <widget class="GtkLabel" id="label2">
+                                              <widget class="GtkLabel" id="label5">
                                                 <property name="visible">True</property>
                                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                                                 <property name="xalign">0</property>
@@ -1169,6 +1123,76 @@
                                             <property name="x_options">GTK_FILL</property>
                                           </packing>
                                         </child>
+                                        <child>
+                                          <widget class="GtkTable" id="table8">
+                                            <property name="visible">True</property>
+                                            <property name="n_columns">4</property>
+                                            <property name="column_spacing">6</property>
+                                            <child>
+                                              <widget class="GtkLabel" id="label29">
+                                                <property name="visible">True</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes">_TLS port:</property>
+                                                <property name="use_underline">True</property>
+                                                <property name="mnemonic_widget">graphics-port</property>
+                                              </widget>
+                                              <packing>
+                                                <property name="left_attach">1</property>
+                                                <property name="right_attach">2</property>
+                                                <property name="y_options"></property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkSpinButton" id="graphics-port">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="invisible_char">●</property>
+                                                <property name="adjustment">5900 5900 5999 1 10 0</property>
+                                                <property name="climb_rate">1</property>
+                                                <property name="snap_to_ticks">True</property>
+                                                <property name="numeric">True</property>
+                                                <property name="update_policy">if-valid</property>
+                                              </widget>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkCheckButton" id="graphics-port-auto">
+                                                <property name="label" translatable="yes">A_utomatically allocated</property>
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="receives_default">False</property>
+                                                <property name="use_underline">True</property>
+                                                <property name="draw_indicator">True</property>
+                                                <signal name="toggled" handler="on_graphics_port_auto_toggled"/>
+                                              </widget>
+                                              <packing>
+                                                <property name="left_attach">3</property>
+                                                <property name="right_attach">4</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkSpinButton" id="graphics-tls-port">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="invisible_char">●</property>
+                                                <property name="adjustment">5901 5900 5999 1 10 0</property>
+                                                <property name="climb_rate">1</property>
+                                                <property name="snap_to_ticks">True</property>
+                                                <property name="numeric">True</property>
+                                                <property name="update_policy">if-valid</property>
+                                              </widget>
+                                              <packing>
+                                                <property name="left_attach">2</property>
+                                                <property name="right_attach">3</property>
+                                              </packing>
+                                            </child>
+                                          </widget>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">3</property>
+                                            <property name="bottom_attach">4</property>
+                                          </packing>
+                                        </child>
                                       </widget>
                                     </child>
                                   </widget>
@@ -1272,7 +1296,7 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label5">
+                          <widget class="GtkLabel" id="label7">
                             <property name="visible">True</property>
                             <property name="label">sound</property>
                           </widget>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]