def __setstate__(self, state): bytes = state.pop('_ns_print_info', None) if bytes: data = NSData.dataWithBytes_length_(bytes, len(bytes)) self._ns_print_info = NSKeyedArchiver.unarchiveObjectWithData_(data) else: GPageSetup.__setstate__(self, state)
def __setstate__(self, state): gtk_setup = gtk_default_page_setup() self._gtk_page_setup = gtk_setup gtk_state = state.pop('_gtk_page_setup', None) if gtk_state: set_gtk_state(gtk_setup, gtk_state) self.margins = state['margins'] self.printer_name = state['printer_name'] else: GPageSetup.__setstate__(state)
def __setstate__(self, state): psd = self._win_psd dm = state.pop('_win_devmode', None) dn = state.pop('_win_devnames', None) GPageSetup.__setstate__(self, state) if dm: wps.GlobalFree(psd.hDevMode) psd.hDevMode = handle_with_contents(dm) if dn: wps.GlobalFree(psd.hDevNames) psd.hDevNames = handle_with_contents(dn)
def __getstate__(self): state = GPageSetup.__getstate__(self) state['_gtk_page_setup'] = get_gtk_state(self._gtk_page_setup) return state
def __getstate__(self): psd = self._win_psd state = GPageSetup.__getstate__(self) state['_win_devmode'] = wps.get_handle_contents(psd.hDevMode) state['_win_devnames'] = wps.get_handle_contents(psd.hDevNames) return state
def __new__(cls): self = GPageSetup.__new__(cls) self._win_psd = wps.get_defaults() return self
def __getstate__(self): state = GPageSetup.__getstate__(self) data = NSKeyedArchiver.archivedDataWithRootObject_(self._ns_print_info) state['_ns_print_info'] = data.bytes() return state