Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Private Member Functions | Private Attributes
asyncpk1._PK1AsyncMethodCall Class Reference

A class to handle an asynchronous method call. More...

List of all members.

Public Member Functions

def __init__
def __del__
def call
def call_fallback_fn

Private Member Functions

def _destroy
def _pk_reply_handler
def _pk_error_handler
def _ipp_reply_handler
def _ipp_error_handler

Private Attributes

 _bus
 _conn
 _pk_method_name
 _pk_args
 _client_reply_handler
 _client_error_handler
 _unpack_fn
 _fallback_fn
 _fallback_args
 _fallback_kwds
 _destroyed

Detailed Description

A class to handle an asynchronous method call.

Definition at line 52 of file asyncpk1.py.


Constructor & Destructor Documentation

def asyncpk1._PK1AsyncMethodCall.__init__ (   self,
  bus,
  conn,
  pk_method_name,
  pk_args,
  reply_handler,
  error_handler,
  unpack_fn,
  fallback_fn,
  args,
  kwds 
)

Definition at line 55 of file asyncpk1.py.

00055 
00056                   fallback_fn, args, kwds):
00057         self._bus = bus
00058         self._conn = conn
00059         self._pk_method_name = pk_method_name
00060         self._pk_args = pk_args
00061         self._client_reply_handler = reply_handler
00062         self._client_error_handler = error_handler
00063         self._unpack_fn = unpack_fn
00064         self._fallback_fn = fallback_fn
00065         self._fallback_args = args
00066         self._fallback_kwds = kwds
00067         self._destroyed = False
00068         debugprint ("+_PK1AsyncMethodCall: %s" % self)

Definition at line 69 of file asyncpk1.py.

00069 
00070     def __del__ (self):
00071         debug.debugprint ("-_PK1AsyncMethodCall: %s" % self)


Member Function Documentation

def asyncpk1._PK1AsyncMethodCall._destroy (   self) [private]

Definition at line 86 of file asyncpk1.py.

00086 
00087     def _destroy (self):
00088         debugprint ("DESTROY: %s" % self)
00089         self._destroyed = True
00090         del self._bus
00091         del self._conn
00092         del self._pk_method_name
00093         del self._pk_args
00094         del self._client_reply_handler
00095         del self._client_error_handler
00096         del self._unpack_fn
00097         del self._fallback_fn
00098         del self._fallback_args
00099         del self._fallback_kwds

Here is the caller graph for this function:

def asyncpk1._PK1AsyncMethodCall._ipp_error_handler (   self,
  conn,
  args 
) [private]

Definition at line 143 of file asyncpk1.py.

00143 
00144     def _ipp_error_handler (self, conn, *args):
00145         if self._destroyed:
00146             return
00147 
00148         self._client_error_handler (self._conn, *args)
00149         self._destroy ()

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncpk1._PK1AsyncMethodCall._ipp_reply_handler (   self,
  conn,
  args 
) [private]

Definition at line 136 of file asyncpk1.py.

00136 
00137     def _ipp_reply_handler (self, conn, *args):
00138         if self._destroyed:
00139             return
00140 
00141         self._client_reply_handler (self._conn, *args)
00142         self._destroy ()

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncpk1._PK1AsyncMethodCall._pk_error_handler (   self,
  exc 
) [private]

Definition at line 114 of file asyncpk1.py.

00114 
00115     def _pk_error_handler (self, exc):
00116         if self._destroyed:
00117             return
00118 
00119         if exc.get_dbus_name () == CUPS_PK_NEED_AUTH:
00120             exc = cups.IPPError (cups.IPP_NOT_AUTHORIZED, 'pkcancel')
00121             gtk.gdk.threads_enter ()
00122             self._client_error_handler (self._conn, exc)
00123             gtk.gdk.threads_leave ()
00124             self._destroy ()
00125             return
00126 
00127         debugprint ("PolicyKit call to %s did not work: %s" %
00128                     (self._pk_method_name, exc))
00129         self.call_fallback_fn ()

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncpk1._PK1AsyncMethodCall._pk_reply_handler (   self,
  error,
  args 
) [private]

Definition at line 100 of file asyncpk1.py.

00100 
00101     def _pk_reply_handler (self, error, *args):
00102         if self._destroyed:
00103             return
00104 
00105         if str (error) == '':
00106             gtk.gdk.threads_enter ()
00107             self._client_reply_handler (self._conn, self._unpack_fn (*args))
00108             gtk.gdk.threads_leave ()
00109             self._destroy ()
00110             return
00111 
00112         debugprint ("PolicyKit method failed with: %s" % repr (str (error)))
00113         self.call_fallback_fn ()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 72 of file asyncpk1.py.

00072 
00073     def call (self):
00074         object = self._bus.get_object(CUPS_PK_NAME, CUPS_PK_PATH)
00075         proxy = dbus.Interface (object, CUPS_PK_IFACE)
00076         pk_method = proxy.get_dbus_method (self._pk_method_name)
00077 
00078         try:
00079             pk_method (*self._pk_args,
00080                         reply_handler=self._pk_reply_handler,
00081                         error_handler=self._pk_error_handler,
00082                         timeout=3600)
00083         except TypeError, e:
00084             debugprint ("Type error in PK call: %s" % e)
00085             self.call_fallback_fn ()

Here is the call graph for this function:

Definition at line 130 of file asyncpk1.py.

00130 
00131     def call_fallback_fn (self):
00132         # Make the 'connection' parameter consistent with PK callbacks.
00133         self._fallback_kwds["reply_handler"] = self._ipp_reply_handler
00134         self._fallback_kwds["error_handler"] = self._ipp_error_handler
00135         self._fallback_fn (*self._fallback_args, **self._fallback_kwds)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 56 of file asyncpk1.py.

Definition at line 61 of file asyncpk1.py.

Definition at line 60 of file asyncpk1.py.

Definition at line 57 of file asyncpk1.py.

Definition at line 66 of file asyncpk1.py.

Definition at line 64 of file asyncpk1.py.

Definition at line 63 of file asyncpk1.py.

Definition at line 65 of file asyncpk1.py.

Definition at line 59 of file asyncpk1.py.

Definition at line 58 of file asyncpk1.py.

Definition at line 62 of file asyncpk1.py.


The documentation for this class was generated from the following file: