コード例 #1
0
    def _channel_new_cb(self, session, channel):
        gobject.GObject.connect(channel, "open-fd",
                                self._channel_open_fd_request)

        if type(channel) == spice.MainChannel:
            channel.connect_after("channel-event", self._main_channel_event_cb)
            return

        if type(channel) == spice.DisplayChannel:
            channel_id = channel.get_property("channel-id")

            if channel_id != 0:
                logging.debug("Spice multi-head unsupported")
                return

            self.display_channel = channel
            self.display = spice.Display(self.spice_session, channel_id)
            self.console.window.get_object("console-vnc-viewport").add(self.display)
            self._init_widget()
            self.console.connected()
            return

        if (type(channel) in [spice.PlaybackChannel, spice.RecordChannel] and
            not self.audio):
            self.audio = spice.Audio(self.spice_session)
            return
コード例 #2
0
ファイル: view.py プロジェクト: romannamor9/vmnetx
 def _new_channel(self, session, channel):
     if session != self._session:
         # Stale channel; ignore
         return
     GObject.connect(channel, 'open-fd', self._request_fd)
     GObject.connect(channel, 'channel-event', self._channel_event)
     type = SpiceClientGtk.spice_channel_type_to_string(
             channel.get_property('channel-type'))
     if type == 'display':
         # Create the display but don't show it until configured by
         # the server
         GObject.connect(channel, 'display-primary-create',
                 self._display_create)
         self._destroy_display()
         self._display_channel = channel
         self._display = SpiceClientGtk.Display(self._session,
                 channel.get_property('channel-id'))
         # Default was False in spice-gtk < 0.14
         self._display.set_property('scaling', True)
         self._display.connect('size-request', self._size_request)
         self._display.connect('keyboard-grab', self._grab, 'keyboard')
         self._display.connect('mouse-grab', self._grab, 'mouse')
         if self._motion_interval is not None:
             self._display.connect('motion-notify-event', self._motion)
     elif type == 'playback':
         if self._audio is None:
             try:
                 # Enable audio
                 self._audio = SpiceClientGtk.Audio(self._session)
             except RuntimeError:
                 # No local PulseAudio, etc.
                 pass
コード例 #3
0
ファイル: tcloudViewer.py プロジェクト: ezzze/tcloud-pyclient
    def _channel_new(self, session, channel):

        if type(channel) == _spice.MainChannel and \
            not self.main_channel:

            self.main_channel = channel
            self.main_channel.connect_after("channel-event",
                                            self._main_channel_event)
            self.main_channel.connect_after("notify::agent-connected",
                                            self._agent_connected_cb)
            return

        if type(channel) == _spice.DisplayChannel and \
            not self.display:
            channel_id = channel.get_property("channel-id")

            if channel_id != 0:
                LOG.debug("Spice multi-head unsupported")
                return

            self.display_channel = channel
            self.display = _spice.Display(self.session, channel_id)
            self.disp_console.viewer_widget.add(self.display)
            self._init_widget()
            self.connected = True
            return

        if (type(channel) in [_spice.PlaybackChannel, _spice.RecordChannel]
                and not self.audio):

            try:
                self.audio = _spice.Audio(self.session)
                LOG.debug("audio channel is establish")
            except Exception as e:
                LOG.debug("SPICE AUDIO OBJECT could not create %s" % e)
            finally:
                return

        if type(channel) == _spice.UsbredirChannel:
            LOG.debug("usb channel is establish")
            u = _spice.spice_usb_device_manager_get(self.session)
            u.set_property("auto_connect", self.auto_detect_usb_rediect())
            u.connect("auto-connect-failed", self._usbdev_redirect_error)
            u.connect("device-error", self._usbdev_redirect_error)
            return
コード例 #4
0
 def _new_channel(self, session, channel):
     if session != self._session:
         # Stale channel; ignore
         return
     channel.connect_object('open-fd', self._request_fd, channel)
     channel.connect_object('channel-event', self._channel_event, channel)
     type = SpiceClientGtk.spice_channel_type_to_string(
             channel.get_property('channel-type'))
     if type == 'display':
         # Create the display but don't show it until configured by
         # the server
         channel.connect_object('display-primary-create',
                 self._display_create, channel)
         self._destroy_display()
         self._display_channel = channel
         self._display = SpiceClientGtk.Display(self._session,
                 channel.get_property('channel-id'))
         # Default was False in spice-gtk < 0.14
         self._display.set_property('scaling', True)
         self._display.connect('size-request', self._size_request)
         self._display.connect('keyboard-grab', self._grab, 'keyboard')
         self._display.connect('mouse-grab', self._grab, 'mouse')
         self._connect_display_signals(self._display)