~ubuntu-branches/ubuntu/gutsy/hplip/gutsy-security

« back to all changes in this revision

Viewing changes to ui/faxsendjobform.py

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2006-09-15 18:00:07 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060915180007-96mez3nck3oy5wij
Tags: 1.6.7-2ubuntu1
* Merge from debian unstable.
* Removed patches 50_ui-supportform-cleanups.dpatch and
  55_ui-supportform-debian.dpatch, there is no support window in the HP
  toolbox any more.
* HPLIP (file io/hpiod/usbext.h) includes linux/compiler.h which is not
  part of Ubuntu Linux and not needed. Removed the include with patch
  80_no-compiler.h.dpatch.
* debian/control: Let the "Conflicts:" of hpijs-ppds be only a "Breaks:"
  to facilitate an update from the previous version when both hpijs and
  hpijs-ppds are installed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
from faxsettingsform import FaxSettingsForm
43
43
from faxallowabletypesdlg import FaxAllowableTypesDlg
44
44
 
45
 
coverpages_enabled = False
46
45
try:
47
46
    import reportlab
48
47
except ImportError:
49
 
    log.error("Coverpages disabled. Reportlab not installed.")
 
48
    coverpages_enabled = False
50
49
else:
51
50
    from fax import coverpages
52
51
    from coverpageform import CoverpageForm
53
52
    coverpages_enabled = True
54
53
 
 
54
# Used to store MIME types for files
 
55
# added directly in interface.
 
56
job_types = {} # { job_id : "mime_type", ...}
 
57
 
55
58
 
56
59
class FileListViewItem(QListViewItem):
57
60
    def __init__(self, parent, title, mime_type_desc, path, str_pages):
145
148
            "image/x-sgi-rgb" : (self.__tr("SGI RGB"), '.rgb'),
146
149
            "image/x-xbitmap" : (self.__tr("X11 Bitmap (XBM)"), '.xbm'),
147
150
            "image/x-xpixmap" : (self.__tr("X11 Pixmap (XPM)"), '.xpm'),
148
 
            "image/x-sun-raster" : (self.__tr("Sun Raster Format"), '.ras'),
 
151
            "image/x-sun-raster" : (self.__tr("Sucoverpages_enabledn Raster Format"), '.ras'),
149
152
            "application/hplip-fax" : (self.__tr("HP Fax"), '.g3'),
150
153
            "application/hplip-fax-coverpage" : (self.__tr("HP Fax Coverpage"), 'n/a'),
151
154
        }
202
205
 
203
206
        self.cmd_fab = user_cfg.commands.fab or cmd_fab
204
207
        log.debug("FAB command: %s" % self.cmd_fab)
 
208
        
 
209
        if not coverpages_enabled:
 
210
            log.warn("Coverpages disabled. Reportlab not installed.")
205
211
 
206
212
        QTimer.singleShot(0, self.InitialUpdate)
207
213
 
429
435
        ppd_file = cups.getPPD(self.current_printer)
430
436
 
431
437
        if ppd_file is not None and os.path.exists(ppd_file):
432
 
            if file(ppd_file, 'r').read().find('HPLIP Fax') == -1:
 
438
            if file(ppd_file, 'r').read().find('HP Fax') == -1:
433
439
                self.FailureUI(self.__tr("<b>Fax configuration error.</b><p>The CUPS fax queue for '%1' is incorrectly configured.<p>Please make sure that the CUPS fax queue is configured with the 'HPLIP Fax' Model/Driver.").arg(self.current_printer))
434
440
                return
435
441
 
690
696
            self.UpdateSelectionEdit()
691
697
 
692
698
        else: # Printer status...
693
 
            if device_uri == self.dev.device_uri:
 
699
            if self.dev is not None and device_uri == self.dev.device_uri:
694
700
                log.debug("Device status update event received for %s." % device_uri)
695
701
                self.StateText.setText(error_string_short) 
696
702
 
738
744
                                      "job-id": job_id,
739
745
                                     })
740
746
 
741
 
            if data and result_code == ERROR_SUCCESS:
 
747
            log.debug(repr(data)), len(data)
 
748
            if len(data) and result_code == ERROR_SUCCESS:
742
749
                fd.write(data)
743
750
                bytes_read += len(data)
744
751
 
766
773
 
767
774
        log.debug("Transfered %d bytes" % bytes_read)
768
775
 
769
 
        self.file_list.append((fax_file, "application/hplip-fax", "HP Fax", title, total_pages))
 
776
        #self.file_list.append((fax_file, "application/hplip-fax", "HP Fax", title, total_pages))
 
777
        mime_type = job_types.get(job_id, "application/hplip-fax")
 
778
        mime_type_desc = self.MIME_TYPES_DESC.get(mime_type, ('Unknown', 'n/a'))[0]
 
779
        log.debug("%s (%s)" % (mime_type, mime_type_desc))
 
780
        self.file_list.append((fax_file, mime_type, mime_type_desc, title, total_pages))
770
781
 
771
782
        self.UpdateFileList()
772
783
        self.document_num += 1
838
849
                
839
850
                if printer_state == cups.IPP_PRINTER_STATE_IDLE:
840
851
                    sent_job_id = cups.printFile(self.current_printer, path, os.path.basename(path))
 
852
                    job_types[sent_job_id] = mime_type # save for later
841
853
                    log.debug("Job ID=%d" % sent_job_id)  
842
854
 
843
855
                    QApplication.setOverrideCursor(QApplication.waitCursor)