def on_resource_load_finished(self, func, *args ): from gobject import GObject def WebView_C_Callable( _webview, _webframe, _webresource, data): from .webkit3__WebKitWebFrame import WebKitWebFrame from .webkit3__WebKitWebResource import WebKitWebResource func( self, self.get_main_frame(), WebKitWebResource(None, obj=_webresource), *args)#WebKitWebFrame(None,obj=_webframe), WebKitWebResource(None,obj=_webresource), *args) return None CFUNC = CFUNCTYPE(None, POINTER(c_int), POINTER(c_int), POINTER(c_int), POINTER(c_int)) GObject.connect( self, 'resource-load-finished', func, *args, cfunc = (CFUNC(WebView_C_Callable),CFUNC))
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)
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)
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
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)
def on_view_ready(self, func, *args): from gobject import GObject GObject.connect( self, 'load-finished', func, *args)