예제 #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
파일: view.py 프로젝트: romannamor9/vmnetx
 def _attempt_connection(self, _backoff):
     self._disconnect_viewer()
     self._session = SpiceClientGtk.Session()
     self._session.set_property('password', self._password)
     self._session.set_property('enable-usbredir', False)
     # Ensure clipboard sharing is disabled
     self._gtk_session = SpiceClientGtk.spice_gtk_session_get(self._session)
     self._gtk_session.set_property('auto-clipboard', False)
     GObject.connect(self._session, 'channel-new', self._new_channel)
     self._session.open_fd(-1)
예제 #4
0
 def open_fd(self, fd, password=None):
     self.spice_session = spice.Session()
     if password:
         self.spice_session.set_property("password", password)
     gobject.GObject.connect(self.spice_session, "channel-new",
                             self._channel_new_cb)
     self.spice_session.open_fd(fd)
예제 #5
0
 def _connect_viewer(self, password):
     self._disconnect_viewer()
     self._session = SpiceClientGtk.Session()
     self._session.set_property('password', password)
     self._session.set_property('enable-usbredir', False)
     # Ensure clipboard sharing is disabled
     self._gtk_session = SpiceClientGtk.spice_gtk_session_get(self._session)
     self._gtk_session.set_property('auto-clipboard', False)
     try:
         # Enable audio
         self._audio = SpiceClientGtk.Audio(self._session)
     except RuntimeError:
         # No local PulseAudio, etc.
         pass
     self._session.connect_object('channel-new', self._new_channel,
             self._session)
     self._session.open_fd(-1)
예제 #6
0
    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
예제 #7
0
 def __init__(self, widget, host, port, conf):
     TcloudObject.__init__(self)
     self.disp_console = widget
     self.session = None
     self.conf = conf
     self.display = None
     self.main_channel = None
     self.audio = None
     self.display_channel = None
     self.connected = False
     self.usbManager = _spice.UsbDeviceManager()
     self.host = host
     self.port = port
예제 #8
0
    def open_host(self, ginfo, password=None):
        host, port = ginfo.get_conn_host()

        uri = "spice://"
        uri += str(host) + "?port=" + str(port)
        logging.debug("spice uri: %s", uri)

        self.spice_session = spice.Session()
        self.spice_session.set_property("uri", uri)
        if password:
            self.spice_session.set_property("password", password)
        gobject.GObject.connect(self.spice_session, "channel-new",
                                self._channel_new_cb)
        self.spice_session.connect()
예제 #9
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)
예제 #10
0
파일: view.py 프로젝트: jaharkes/vmnetx
 def _connect_viewer(self, password):
     self._disconnect_viewer()
     self._session = SpiceClientGtk.Session()
     self._session.set_property('password', password)
     self._session.set_property('enable-usbredir', False)
     # Ensure clipboard sharing is disabled
     self._gtk_session = SpiceClientGtk.spice_gtk_session_get(self._session)
     self._gtk_session.set_property('auto-clipboard', False)
     try:
         # Enable audio
         self._audio = SpiceClientGtk.Audio(self._session)
     except RuntimeError:
         # No local PulseAudio, etc.
         pass
     GObject.connect(self._session, 'channel-new', self._new_channel)
     self._session.open_fd(-1)
예제 #11
0
    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
예제 #12
0
파일: view.py 프로젝트: dayoonc/vmnetx
 def _new_channel(self, _session, channel):
     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':
         self._destroy_display()
         self.remove(self._placeholder)
         self.add(self._aspect)
         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._aspect.add(self._display)
         self._aspect.show_all()
         self.emit('viewer-connect')
예제 #13
0
파일: view.py 프로젝트: jaharkes/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')
         self._connect_display_signals(self._display)
예제 #14
0
 def settings(self):
     self.session = _spice.Session()
     uri = "spice://"
     uri += str(self.host) + "?port=" + str(self.port)
     self.session.set_property("uri", uri)