Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes
jobviewer.CancelJobsOperation Class Reference

List of all members.

Public Member Functions

def __init__
def __del__
def do_destroy
def destroy
def on_job_cancel_prompt_delete
def on_job_cancel_prompt_response
def cancelJob_error
def cancelJob_finish

Public Attributes

 jobids
 purge_job
 host
 port
 encryption
 dialog
 connection

Private Member Functions

def _connect_failed
def _connected

Static Private Attributes

dictionary __gsignals__

Detailed Description

Definition at line 164 of file jobviewer.py.


Constructor & Destructor Documentation

def jobviewer.CancelJobsOperation.__init__ (   self,
  parent,
  host,
  port,
  encryption,
  jobids,
  purge_job 
)

Definition at line 174 of file jobviewer.py.

00174 
00175     def __init__ (self, parent, host, port, encryption, jobids, purge_job):
00176         gobject.GObject.__init__ (self)
00177         self.jobids = list (jobids)
00178         self.purge_job = purge_job
00179         self.host = host
00180         self.port = port
00181         self.encryption = encryption
00182         if purge_job:
00183             if len(self.jobids) > 1:
00184                 dialog_title = _("Delete Jobs")
00185                 dialog_label = _("Do you really want to delete these jobs?")
00186             else:
00187                 dialog_title = _("Delete Job")
00188                 dialog_label = _("Do you really want to delete this job?")
00189         else:
00190             if len(self.jobids) > 1:
00191                 dialog_title = _("Cancel Jobs")
00192                 dialog_label = _("Do you really want to cancel these jobs?")
00193             else:
00194                 dialog_title = _("Cancel Job")
00195                 dialog_label = _("Do you really want to cancel this job?")
00196 
00197         dialog = gtk.Dialog (dialog_title, parent,
00198                              gtk.DIALOG_MODAL |
00199                              gtk.DIALOG_DESTROY_WITH_PARENT |
00200                              gtk.DIALOG_NO_SEPARATOR,
00201                              (_("Keep Printing"), gtk.RESPONSE_NO,
00202                               dialog_title, gtk.RESPONSE_YES))
00203         dialog.set_default_response (gtk.RESPONSE_NO)
00204         dialog.set_border_width (6)
00205         dialog.set_resizable (False)
00206         hbox = gtk.HBox (False, 12)
00207         image = gtk.Image ()
00208         image.set_from_stock (gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
00209         image.set_alignment (0.0, 0.0)
00210         hbox.pack_start (image, False, False, 0)
00211         label = gtk.Label (dialog_label)
00212         label.set_line_wrap (True)
00213         label.set_alignment (0.0, 0.0)
00214         hbox.pack_start (label, False, False, 0)
00215         dialog.vbox.pack_start (hbox, False, False, 0)
00216         dialog.connect ("response", self.on_job_cancel_prompt_response)
00217         dialog.connect ("delete-event", self.on_job_cancel_prompt_delete)
00218         dialog.show_all ()
00219         self.dialog = dialog
00220         self.connection = None
00221         debugprint ("+%s" % self)

Definition at line 222 of file jobviewer.py.

00222 
00223     def __del__ (self):
00224         debugprint ("-%s" % self)


Member Function Documentation

def jobviewer.CancelJobsOperation._connect_failed (   self,
  connection,
  exc 
) [private]

Definition at line 260 of file jobviewer.py.

00260 
00261     def _connect_failed (self, connection, exc):
00262         debugprint ("CancelJobsOperation._connect_failed %s:%s" % (connection, repr (exc)))

Here is the caller graph for this function:

def jobviewer.CancelJobsOperation._connected (   self,
  connection,
  result 
) [private]

Definition at line 263 of file jobviewer.py.

00263 
00264     def _connected (self, connection, result):
00265         self.connection = connection
00266 
00267         if self.purge_job:
00268             operation = _("deleting job")
00269         else:
00270             operation = _("canceling job")
00271 
00272         self.connection._begin_operation (operation)
00273         self.connection.cancelJob (self.jobids[0], self.purge_job,
00274                                    reply_handler=self.cancelJob_finish,
00275                                    error_handler=self.cancelJob_error)

Here is the call graph for this function:

Here is the caller graph for this function:

def jobviewer.CancelJobsOperation.cancelJob_error (   self,
  connection,
  exc 
)

Definition at line 276 of file jobviewer.py.

00276 
00277     def cancelJob_error (self, connection, exc):
00278         debugprint ("cancelJob_error %s:%s" % (connection, repr (exc)))
00279         if type (exc) == cups.IPPError:
00280             (e, m) = exc.args
00281             if (e != cups.IPP_NOT_POSSIBLE and
00282                 e != cups.IPP_NOT_FOUND):
00283                 self.emit ('ipp-error', self.jobids[0], exc)
00284             self.cancelJob_finish(connection, None)
00285         else:
00286             self.connection._end_operation ()
00287             self.connection.destroy ()
00288             self.connection = None
00289             self.emit ('ipp-error', self.jobids[0], exc)
00290             # Give up.
00291             self.emit ('finished')
00292             return

Here is the call graph for this function:

Here is the caller graph for this function:

def jobviewer.CancelJobsOperation.cancelJob_finish (   self,
  connection,
  result 
)

Definition at line 293 of file jobviewer.py.

00293 
00294     def cancelJob_finish (self, connection, result):
00295         debugprint ("cancelJob_finish %s:%s" % (connection, repr (result)))
00296         self.emit ('job-deleted', self.jobids[0])
00297         del self.jobids[0]
00298         if not self.jobids:
00299             # Last job canceled.
00300             self.connection._end_operation ()
00301             self.connection.destroy ()
00302             self.connection = None
00303             self.emit ('finished')
00304             return
00305         else:
00306             # there are other jobs to cancel/delete
00307             connection.cancelJob (self.jobids[0], self.purge_job,
00308                                   reply_handler=self.cancelJob_finish,
00309                                   error_handler=self.cancelJob_error)
00310 
00311 gobject.type_register (CancelJobsOperation)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 236 of file jobviewer.py.

00236 
00237     def destroy (self):
00238         self.emit ('destroy')

Definition at line 225 of file jobviewer.py.

00225 
00226     def do_destroy (self):
00227         if self.connection:
00228             self.connection.destroy ()
00229             self.connection = None
00230 
00231         if self.dialog:
00232             self.dialog.destroy ()
00233             self.dialog = None
00234 
00235         debugprint ("DESTROY: %s" % self)

def jobviewer.CancelJobsOperation.on_job_cancel_prompt_delete (   self,
  dialog,
  event 
)

Definition at line 239 of file jobviewer.py.

00239 
00240     def on_job_cancel_prompt_delete (self, dialog, event):
00241         self.on_job_cancel_prompt_response (dialog, gtk.RESPONSE_NO)

Here is the call graph for this function:

def jobviewer.CancelJobsOperation.on_job_cancel_prompt_response (   self,
  dialog,
  response 
)

Definition at line 242 of file jobviewer.py.

00242 
00243     def on_job_cancel_prompt_response (self, dialog, response):
00244         dialog.destroy ()
00245         self.dialog = None
00246 
00247         if response != gtk.RESPONSE_YES:
00248             self.emit ('finished')
00249             return
00250 
00251         if len(self.jobids) == 0:
00252             self.emit ('finished')
00253             return
00254 
00255         asyncconn.Connection (host=self.host,
00256                               port=self.port,
00257                               encryption=self.encryption,
00258                               reply_handler=self._connected,
00259                               error_handler=self._connect_failed)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

dictionary jobviewer.CancelJobsOperation.__gsignals__ [static, private]
Initial value:
{
        'destroy':     (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, []),
        'job-deleted': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                        [gobject.TYPE_INT]),
        'ipp-error':   (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                        [gobject.TYPE_INT, gobject.TYPE_PYOBJECT]),
        'finished':    (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, [])
        }

Definition at line 165 of file jobviewer.py.

Definition at line 219 of file jobviewer.py.

Definition at line 218 of file jobviewer.py.

Definition at line 180 of file jobviewer.py.

Definition at line 178 of file jobviewer.py.

Definition at line 176 of file jobviewer.py.

Definition at line 179 of file jobviewer.py.

Definition at line 177 of file jobviewer.py.


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