def print_existing(self): ix = self.sender().ix print "reprint document %s" % ix try: data, version = docsprinted.getData(ix) f = open(localsettings.TEMP_PDF, "wb") f.write(data) f.close() localsettings.openPDF() except Exception: LOGGER.exception("view PDF error") QtGui.QMessageBox.warning(self, "error", _("error reviewing PDF file"))
def _open_document(self): """ open the chosen document """ doc = self.widg.selected_file() if doc is None: return try: doc = os.path.abspath(os.path.join(localsettings.DOCS_DIRECTORY, doc)) LOGGER.info("opening %s" % doc) localsettings.openPDF(doc) except Exception as exc: message = _("Error opening PDF file") LOGGER.exception(message) self.parent().advise(message, 2)
def _open_document(self): ''' open the chosen document ''' doc = self.widg.selected_file() if doc is None: return try: doc = os.path.abspath( os.path.join(localsettings.DOCS_DIRECTORY, doc)) LOGGER.info("opening %s" % doc) localsettings.openPDF(doc) except Exception: message = _("Error opening PDF file") LOGGER.exception(message) self.parent().advise(message, 2)
def nhsRegsPDF(om_gui): ''' I have some stored PDF documents the user wants to see these ''' Dialog = QtGui.QDialog(om_gui) dl = Ui_chooseDocument.Ui_Dialog() dl.setupUi(Dialog) if Dialog.exec_(): if dl.tabWidget.currentIndex() == 0: if dl.info_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "Dental_Information_Guide_2008_v4.pdf") else: doc = os.path.join(localsettings.wkdir, 'resources', "scotNHSremuneration08.pdf") elif dl.tabWidget.currentIndex() == 1: if dl.info2009_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "Dental_Information_Guide_2009.pdf") else: doc = os.path.join(localsettings.wkdir, 'resources', "scotNHSremuneration09.pdf") elif dl.tabWidget.currentIndex() == 2: if dl.info2010_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "information_guide_2010_v2.pdf") else: doc = os.path.join(localsettings.wkdir, 'resources', "scotNHSremuneration10.pdf") elif dl.tabWidget.currentIndex() == 3: if dl.info2012_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "information-guide-2012-final.pdf") elif dl.terms_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "ssi_20100208_en.pdf") else: doc = os.path.join(localsettings.wkdir, 'resources', "scotNHSremuneration12.pdf") else: if dl.info2013_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "information-guide-2012-final.pdf") elif dl.tooth_specific_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "guidance-issue-2-v17.pdf") elif dl.terms2013_radioButton.isChecked(): doc = os.path.join(localsettings.wkdir, 'resources', "ssi_20100208_en.pdf") else: doc = os.path.join(localsettings.wkdir, 'resources', "scotNHSremuneration13.pdf") try: print "opening %s"% doc localsettings.openPDF(doc) except Exception as exc: message = _("Error opening PDF file") LOGGER.exception(message) om_gui.advise(message, 2)