def eventFilter(self, receiver, event): """ Event filter; processes clicking ln links in What's This window. """ if receiver == self.title and event.type() == QEvent.WhatsThisClicked: QDesktopServices.openUrl(QUrl(event.href())) return super(ParameterPanel, self).eventFilter(receiver, event)
def open_wiki(self): """ Opening wiki page with dissease of leaf. """ url = labels[self.detected_diss][1] url = QUrl(url) QDesktopServices.openUrl(url)
def redirect(self, i): if i.text() == 'Tutoriales en Youtube': url = QUrl("https://www.youtube.com/playlist?list=PLs65zkPMgyL0cje_YMB30NM6W9PRN4k09") QDesktopServices.openUrl(url) elif i.text() == 'Pagina Web': url = QUrl("http://dronex.pythonanywhere.com/home") QDesktopServices.openUrl(url)
def open_url(qurl): # Qt 5 requires QApplication to be constructed before trying to use # QDesktopServices::openUrl() ensure_app() if isinstance(qurl, basestring): qurl = QUrl(qurl) with sanitize_env_vars(): QDesktopServices.openUrl(qurl)
def _sendTextByMail(self): action = self.sender() if isinstance(action, QAction): data = action.data() if isinstance(data, QByteArray): data = data.data().decode() body = QUrl.toPercentEncoding(data) mailUrl = QUrl.fromEncoded(b'mailto:%%20?body=%s' % body) QDesktopServices.openUrl(mailUrl)
def open_browser(url: str): """ Öffnet den Standard Browser Args: url (str): URL welche geöffnet werden soll """ qurl = QUrl(url) QDesktopServices.openUrl(qurl)
def __openFile(self): if self._downloading: return fpath = pathjoin(self._path, self._fileName) if pathexists(fpath): QDesktopServices.openUrl(QUrl.fromLocalFile(abspath(fpath))) else: QMessageBox.warning( self._item.listWidget().parentWidget(), _("Not found"), _("Sorry, the file \n %s \n was not found!") % abspath(fpath))
def open_link(self): api = self.gui.current_db.new_api book_id = self.gui.library_view.current_id link = api.field_for('#attached_link', book_id) if not link: return match = re.match(r'\[.*?\]\((?P<url>.*?)\)', link) if match: link = match.groupdict()['url'] url = QUrl(link) QDesktopServices.openUrl(url)
def _openFolder(self): if const.OS_WIN: winFileName = '%s/%s' % (self._path, self._fileName) if self._downloading: winFileName += '.download' winFileName = winFileName.replace('/', '\\') shExArg = '/e,/select,"%s"' % winFileName system('explorer.exe ' + shExArg) else: QDesktopServices.openUrl(QUrl.fromLocalFile(self._path))
def __init__(self): QMainWindow.__init__(self) self.ui = PyQt5.uic.loadUi('gui/resources/ui/mainwindow.ui', self) # Restore window and docket windows location settings = QSettings("Retina", "AVEX") if settings.value("DOCK_LOCATIONS"): self.restoreState(settings.value("DOCK_LOCATIONS"), 1.2) # Set the main windows icon self.setWindowIcon(QIcon("gui/resources/icons/avex.ico")) # Create python shell self.python_shell = InternalShell(self.dockWidget_console, namespace=globals(), commands=[], message='', max_line_count=300, font=None, exitfunc=None, profile=False, multithreaded=False, light_background=False) self.dockWidget_console.setWidget(self.python_shell) self.dockWidget_console.setWindowTitle('Python '+platform.python_version()+ ' console') #Workspace toolbar for i in range(0, workspace.max_workspaces): button=QPushButton(str(i),self) button.setMaximumWidth(25) button.setCheckable(True) button.setFlat(True) button.setToolTip("Workspace "+str(i)) workspace.buttons.append(button) self.toolBar_workspaces.addWidget(button) workspace.buttons[0].setChecked(True) workspace.buttons[0].clicked.connect(lambda: workspace.switch(0)) workspace.buttons[1].clicked.connect(lambda: workspace.switch(1)) workspace.buttons[2].clicked.connect(lambda: workspace.switch(2)) workspace.buttons[3].clicked.connect(lambda: workspace.switch(3)) # Connect up the buttons. #File menu self.actionOpen.triggered.connect(self.open_file) self.actionNew_Script.triggered.connect(self.open_python_editor) #Help menu self.actionGithub_Repository.triggered.connect(lambda : QDesktopServices.openUrl(QUrl("https://github.com/jromang/retina"))) self.actionQt_Version.triggered.connect(lambda : QMessageBox.aboutQt(self)) self.actionUser_Forum.triggered.connect(lambda : QDesktopServices.openUrl(QUrl("http://www.avex-asso.org/forum/viewforum.php?f=34"))) # Set model #self.listView_images.setModel(cw.image_list_model) process_widget=ProcessIconWidget() self.mdiArea.addSubWindow(process_widget) workspace.add(process_widget) self.ui.show()
def desktopServicesOpen(self, url): ''' @param: url QUrl ''' # Open same url only once in 2 secs sameUrlTimeout = 2 * 1000 if self.s_lastUnsupportedUrl != url or self.s_lastUnsupportedUrlTime.isNull() or \ self.s_lastUnsupportedUrlTime.elapsed() > sameUrlTimeout: self.s_lastUnsupportedUrl = url self.s_lastUnsupportedUrlTime.restart() QDesktopServices.openUrl(url) else: print('WARNING: WebPage::desktopServicesOpen Url', url, 'has already been opened!\n', 'Ignoring it to prevent infinite loop!')
def generatePDF(self, contenido): hoy = str(datetime.datetime.now().year) + str( datetime.datetime.now().month) + str( datetime.datetime.now().day) + str( datetime.datetime.now().hour) + str( datetime.datetime.now().minute) + str( datetime.datetime.now().second) nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf' fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> <hr> <br> <p> SALDOS </p> <br> """ + contenido doc = QTextDocument() doc.setHtml(html) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url)
def mousePressEvent(self, event): #======================================================================= # cursor = self.cursorForPosition(event.pos()) # charFmt = cursor.charFormat() # if charFmt.isImageFormat(): # imgFmt = charFmt.toImageFormat() # print("IMAGE {}: {} x {}".format(imgFmt.name(), imgFmt.width(), imgFmt.height())) #======================================================================= cursor = self.exactCursorForPosition(event.pos()) charFmt = cursor.charFormat( ) # get the QTextCharFormat at the current cursor position if charFmt.objectType() == QTextCharFormat.UserObject + 1: if self.selectedObject is not None: self.selectedObject.setSelected(False) self.selectedObject = charFmt.property( QTextCharFormat.UserProperty + 1) self.selectedObject.setSelected(True) self.setCursorWidth(0) self.viewport().update() self.objectSelectionChanged.emit() else: if self.selectedObject is not None: self.selectedObject.setSelected(False) self.selectedObject = None self.setCursorWidth(self.orgCursorWidth) self.viewport().update() self.objectSelectionChanged.emit() if self.tracking: style = charFmt.property(QTextFormat.UserProperty) if style and style[0] == 'link': url = charFmt.anchorHref() QDesktopServices.openUrl(QUrl(url)) return if style and style[0] == 'olink': keyword = self.getTextForCurrentFragment(cursor) self.navigate.emit(keyword) return return QTextEdit.mousePressEvent(self, event)
def mousePressEvent(self, event): #======================================================================= # cursor = self.cursorForPosition(event.pos()) # charFmt = cursor.charFormat() # if charFmt.isImageFormat(): # imgFmt = charFmt.toImageFormat() # print("IMAGE {}: {} x {}".format(imgFmt.name(), imgFmt.width(), imgFmt.height())) #======================================================================= cursor = self.exactCursorForPosition(event.pos()) charFmt = cursor.charFormat() # get the QTextCharFormat at the current cursor position if charFmt.objectType() == QTextCharFormat.UserObject+1: if self.selectedObject is not None: self.selectedObject.setSelected(False) self.selectedObject = charFmt.property(QTextCharFormat.UserProperty + 1) self.selectedObject.setSelected(True) self.setCursorWidth(0) self.viewport().update() self.objectSelectionChanged.emit() else: if self.selectedObject is not None: self.selectedObject.setSelected(False) self.selectedObject = None self.setCursorWidth(self.orgCursorWidth) self.viewport().update() self.objectSelectionChanged.emit() if self.tracking: style = charFmt.property(QTextFormat.UserProperty) if style and style[0] == 'link': url = charFmt.anchorHref() QDesktopServices.openUrl(QUrl(url)) return if style and style[0] == 'olink': keyword = self.getTextForCurrentFragment(cursor) self.navigate.emit(keyword) return return QTextEdit.mousePressEvent(self, event)
def itemButton(value, icon_num): pwidget = QWidget() btn = QPushButton() if icon_num == 0: btn.setIcon(self.ui.link_icon) btn.setToolTip("Download Torrent") btn.clicked.connect( lambda: QDesktopServices.openUrl(QUrl(str(value)))) else: btn.setIcon(self.ui.search_icon) btn.setToolTip("Play with instant.io") btn.clicked.connect( lambda: QDesktopServices.openUrl(QUrl(str(value)))) pLayout = QHBoxLayout() pLayout.addWidget(btn) pLayout.setContentsMargins(0, 0, 0, 0) pwidget.setLayout(pLayout) return pwidget
def handleUnknownProtocol(self, url): ''' @param: url QUrl ''' protocol = url.scheme() if protocol == 'mailto': self.desktopServicesOpen(url) return if protocol in gVar.appSettings.blockedProtocols: print('DEBUG: WebPage::handleUnknownProtocol', protocol, 'is blocked!') return if protocol in gVar.appSettings.autoOpenProtocols: self.desktopServicesOpen(url) return dialog = CheckBoxDialog(QMessageBox.Yes | QMessageBox.No, self.view()) dialog.setDefaultButton(QMessageBox.Yes) wrappedUrl = gVar.appTools.alignTextToWidth(url.toString(), '<br/>', dialog.fontMetrics(), 450) text = _("Falkon cannot handle <b>%s:</b> links. The requested link " "is <ul><li>%s</li></ul>Do you want Falkon to try " "open this link in system application?") % (protocol, wrappedUrl) dialog.setText(text) dialog.setCheckBoxText(_("Remember my choice for this protocol")) dialog.setWindowTitle(_("External Protocol Request")) dialog.setIcon(QMessageBox.Question) ret = dialog.exec_() if ret == QMessageBox.Yes: if dialog.isChecked(): gVar.appSettings.autoOpenProtocols.append(protocol) gVar.appSettings.saveSettings() QDesktopServices.openUrl(url) elif ret == QMessageBox.No: if dialog.isChecked(): gVar.appSettings.autoOpenProtocols.append(protocol) gVar.appSettings.saveSettings()
def generatePDF(self, contenido): hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second) nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf' fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> <hr> <br> <p> SALDOS </p> <br> """+ contenido doc = QTextDocument() doc.setHtml(html) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url)
def create_url_button(url, kind): result = QPushButton() url_opener = lambda: QDesktopServices.openUrl(QUrl(str(url))) if kind == 'Download': result.setIcon(self.ui.link_icon) result.setToolTip('Download Torrent') elif kind == 'Play': result.setIcon(self.ui.search_icon) result.setToolTip('Play with instant.io') result.clicked.connect(url_opener) return result
def open_explorer(path): path = Path(path).resolve() system = platform.system().lower() if system == "windows": if path.is_dir(): # The path is a directory. QProcess.startDetached(f'explorer.exe "{path}"') else: # THe path is a file, open the parent directory and select the file in the view. QProcess.startDetached(f'explorer.exe /select,"{path}"') elif system == "darwin": # Apple's "open" command handles "show in folder" with the "--reveal" flag. QProcess.startDetached(f'open -R "{path}"') else: # The platform is not Windows or Mac, must be Linux? # Open the directory with generic handling provided by Qt. if path.is_dir(): QDesktopServices.openUrl(QUrl(path.as_uri())) else: # If the path provided is a file, Qt needs to open the parent directory. QDesktopServices.openUrl(QUrl(path.parent.as_uri()))
def itemButton(value, icon_num): pwidget = QWidget() btn = QPushButton() if icon_num == 0: btn.setIcon(self.ui.link_icon) btn.setToolTip("Open WebPage: %s" % str(value)) btn.clicked.connect(lambda: QDesktopServices.openUrl(QUrl(str(value)))) else: btn.setIcon(self.ui.search_icon) btn.setToolTip("Check proposal details...") btn.clicked.connect(lambda: ProposalDetails_dlg(self.ui, value).exec_()) pLayout = QHBoxLayout() pLayout.addWidget(btn) pLayout.setContentsMargins(0, 0, 0, 0) pwidget.setLayout(pLayout) return pwidget
def createList(self): hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second) nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf' listTable = "" for lista in self.listFinal: listTable += """ <tr height="80"> <td width="40%" align="center" > <br>""" + str(lista[0]) + """<br> </td> <td width="40%" > <br> """ + str(lista[1]) + """<br> </td> <td width="20%" > <br> """ + str(lista[2]) + """<br> </td> </tr> """ subtitle = "Listado de clientes con deudas : " if self.type == 'PROV': subtitle = "Listado de deudas a proveedores : " fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> <hr> <br> <p> """+ subtitle + """ </p> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr style=" background-color: gray; border-style: inset;"> <td width="40%" align="center" valign="middle"> <b> APELLIDO </b> </td> <td width="40%" align="center" valign="middle"> <b> NOMBRE </b> </td> <td width="20%" align="center" valign="middle"> <b> DEUDA </b> </td> </tr> </table> <br> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> """ + listTable + """ </table> <br> <br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br> <hr> <br> <table width="600"> <tr> <td align="right" width="100%"> FECHA/HORA : """+ fecha + """ </td> </tr> </table> <hr> """ doc = QTextDocument() doc.setHtml(html) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url)
def open_report(self, _): QDesktopServices.openUrl(QUrl("https://github.com/scriptsmith/reaper/issues"))
def open_website(self, _): QDesktopServices.openUrl(QUrl("http://reaper.social"))
def openDocs(self): url = QUrl("https://github.com/f34rl00/pitch-perfect#documentation") QDesktopServices.openUrl(url)
def openMail(self): QDesktopServices.openUrl( QUrl("mailto:[email protected]?subject=Error&body=REPORTAR ERROR :" ))
def openManual(self): url = QUrl url = QUrl("../Recursos/Manual.pdf") QDesktopServices.openUrl(url)
def _sendLink(self): url = self._window.weView().url().toEncoded().toPercentEncoding() title = QUrl.toPercentEncoding(self._window.weView().title()).data() mainUrl = QUrl.fromEncoded(b'mailto:%20?body=' + url + b'&subject=' + title) QDesktopServices.openUrl(mainUrl)
def play_selected(self): selected_row = next(iter(self.getSelection().keys())) url = "https://instant.io/#" + str( self.ui.torrentBox.item(selected_row, 6).text()) QDesktopServices.openUrl(QUrl(str(url)))
def generateList(self): hoy = str(datetime.datetime.now().year) + str( datetime.datetime.now().month) + str( datetime.datetime.now().day) + str( datetime.datetime.now().hour) + str( datetime.datetime.now().minute) + str( datetime.datetime.now().second) nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf' listTable = "" for lista in self.listProducto: listTable += """ <tr height="80"> <td width="60%" align="left" > <br>""" + str(lista[1]) + """<br> </td> <td width="20%" align="center"> <br> """ + str( lista[3]) + """<br> </td> <td width="20%" align="center"> <br> """ + str( lista[2]) + """<br> </td> </tr> """ fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> <hr> <br> <p> LISTADO DE PRODUCTOS SIN STOCK : </p> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr style=" background-color: gray; border-style: inset;"> <td width="60%" align="center" valign="middle"> <b> PRODUCTOS </b> </td> <td width="20%" align="center" valign="middle"> <b> CANTIDAD MINIMA </b> </td> <td width="20%" align="center" valign="middle"> <b> CANTIDAD </b> </td> </tr> </table> <br> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> """ + listTable + """ </table> <br> <br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br> <hr> <br> <table width="600"> <tr> <td align="right" width="100%"> FECHA/HORA : """ + fecha + """ </td> </tr> </table> <hr> """ doc = QTextDocument() doc.setHtml(html) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url)
def generateList(self): hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second) nombrePdf = '../archivos/' + str(hoy + 'LIST') + '.pdf' listTable = "" for lista in self.listProducto: listTable += """ <tr height="80"> <td width="60%" align="left" > <br>""" + str(lista[1]) + """<br> </td> <td width="20%" align="center"> <br> """ + str(lista[3]) + """<br> </td> <td width="20%" align="center"> <br> """ + str(lista[2]) + """<br> </td> </tr> """ fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> <hr> <br> <p> LISTADO DE PRODUCTOS SIN STOCK : </p> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr style=" background-color: gray; border-style: inset;"> <td width="60%" align="center" valign="middle"> <b> PRODUCTOS </b> </td> <td width="20%" align="center" valign="middle"> <b> CANTIDAD MINIMA </b> </td> <td width="20%" align="center" valign="middle"> <b> CANTIDAD </b> </td> </tr> </table> <br> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> """ + listTable + """ </table> <br> <br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <br> <hr> <br> <table width="600"> <tr> <td align="right" width="100%"> FECHA/HORA : """+ fecha + """ </td> </tr> </table> <hr> """ doc = QTextDocument() doc.setHtml(html) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url)
def open_HoG_url(self): QDesktopServices.openUrl( QUrl("https://hog.grinvin.org/MetaDirectory.action"))
def mouseReleaseEvent(self, e): if self.anchor: QDesktopServices.openUrl(QUrl(self.anchor)) QApplication.setOverrideCursor(Qt.CursorShape.ArrowCursor) self.anchor = None
def generarRecibo(self, listDetail, subName, id, header): """ @param listDetail: lista de detalles @param subName: Sub-nombre para generar el PDF @param id: Id del recibo """ self.nombrePdf = '../archivos/' + str(self.hoy + subName) + '.pdf' listDetalHtml = self.generateTableTransaction(listDetail, header) nombre = "" apellido = "" if (self.tipoTransaccion == "VENTA"): nombre = self.cliente.getNombre() apellido = self.cliente.getApellido() elif (self.tipoTransaccion == "COMPRA"): nombre = self.proveedor.getNombre() apellido = self.proveedor.getDescripcion() total = self.winPrincipal.lblTotal.text() fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> Perfumeria La que vende perfumes <br> LABOULAYE, CORDOBA, ARGENTINA <br> TEL: 0351-111111 <br> MAIL: [email protected] <br> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> _______________________________________________________________________________________________________ <p> DATOS DEL CLIENTE: </p> <br> <table> <tr> <td> NOMBRE: """ + nombre + """ <br> APELLIDO: """ + apellido + """ <br> </td> <td> </td> </tr> </table> <br> _______________________________________________________________________________________________________ <br> <p> DETALLES DE LA COMPRA: </p> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr style=" background-color: gray; border-style: inset;"> <td width="10%" align="center" valign="middle"> <b> CANT </b> </td> <td width="20%" align="center" valign="middle"> <b> PRODUCTO </b> </td> <td width="50%" align="center" valign="middle"> <b> DESCRIPCION </b> </td> <td width="10%" align="center" valign="middle"> <b> PREC <br>UNIT </b> </td> <td width="10%" align="center" valign="middle"> <b> PREC <br>TOT </b> </td> </tr> </table> <br> <br> <br> <br> <table height="350" width="600" style="border-color: gray; border-width: .4px; border-collapse: collapse;"> """ + listTransaccionTable + """ </table> <br> <br> <table width="600" border="0.5" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr > <td width="90%" align="right"> <br> TOTAL.................................................................................................................. <br> </td> <td width="10%" align="center"> <br> $ """ + total + """<br> </td> </tr> </table> <br> <br> <br> <p width="600" align="center" style=" font-size: 10; " > Por cualquier consulta, sobre este recibo, dirigirse al local que se encuentra ubicado en la calle independencia 450. <br> O Comunicarse a los telefonos 03382-123123123 / 4231231 </p> <br> <br> <br> <br> <br> _______________________________________________________________________________________________________ <br> <table width="600"> <tr> <td align="right" width="80%"> FECHA/HORA : """ + fecha + """ </td> <td align="right"> N° : """ + str(idRecibo) + """ </td> </tr> </table> _______________________________________________________________________________________________________ """ doc = QTextDocument() doc.setHtml(html) #doc.setDefaultStyleSheet(style) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url)
def openMail(self): QDesktopServices.openUrl(QUrl("mailto:[email protected]?subject=Error&body=REPORTAR ERROR :"))
def open_url(qurl): if isinstance(qurl, basestring): qurl = QUrl(qurl) with SanitizeLibraryPath(): QDesktopServices.openUrl(qurl)
def helptriggeraction(self): QDesktopServices.openUrl(QUrl( "https://maqifrnswa.github.io/scimpy/doc/html/scimpy.html"))
def reportToGithub(self): qurl = QUrl("http://github.com/Xinkai/XwareDesktop/issues/new") QDesktopServices.openUrl(qurl)
def open_local_file(path): QDesktopServices.openUrl(QUrl.fromLocalFile(path))
def createFactura(self, listTransaccion, subNom, idRecibo): hoy = str(datetime.datetime.now().year) + str(datetime.datetime.now().month) + str(datetime.datetime.now().day) + str(datetime.datetime.now().hour) + str(datetime.datetime.now().minute) + str(datetime.datetime.now().second) nombrePdf = '../archivos/' + str(hoy + subNom) + '.pdf' listTransaccionTable = "" for transaccion in listTransaccion: listTransaccionTable += """ <tr height="80"> <td width="10%" align="center" > <br>""" + str(transaccion[1]) + """<br> </td> <td width="20%" > <br> """ + str(transaccion[3]) + """<br> </td> <td width="50%" > <br> """ + str(transaccion[4]) + """<br> </td> <td width="10%" align="right" > <br> $ """ + str(transaccion[5]) + """ <br> </td> <td width="10%" align="right" > <br> $ """ + str( int(transaccion[1]) * float(transaccion[5])) + """ <br> </td> </tr> """ nombre = "" apellido = "" if(self.tipoTransaccion == "VENTA"): nombre = self.cliente.getNombre() apellido = self.cliente.getApellido() elif(self.tipoTransaccion == "COMPRA"): nombre = self.proveedor.getNombre() apellido = self.proveedor.getDescripcion() total = self.winPrincipal.lblTotal.text() fecha = str(datetime.datetime.now()) html = """ <table width="600"> <tr width="600" color="#000000"> <td width="80%"> Perfumeria La que vende perfumes <br> LABOULAYE, CORDOBA, ARGENTINA <br> TEL: 0351-111111 <br> MAIL: [email protected] <br> </td> <td width="20%" align="right"> <IMG SRC="kde1.png"> </td> </tr> </table> _______________________________________________________________________________________________________ <p> DATOS DEL CLIENTE: </p> <br> <table> <tr> <td> NOMBRE: """+ nombre +""" <br> APELLIDO: """ + apellido + """ <br> </td> <td> </td> </tr> </table> <br> _______________________________________________________________________________________________________ <br> <p> DETALLES DE LA COMPRA: </p> <br> <table width="600" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr style=" background-color: gray; border-style: inset;"> <td width="10%" align="center" valign="middle"> <b> CANT </b> </td> <td width="20%" align="center" valign="middle"> <b> PRODUCTO </b> </td> <td width="50%" align="center" valign="middle"> <b> DESCRIPCION </b> </td> <td width="10%" align="center" valign="middle"> <b> PREC <br>UNIT </b> </td> <td width="10%" align="center" valign="middle"> <b> PREC <br>TOT </b> </td> </tr> </table> <br> <br> <br> <br> <table height="350" width="600" style="border-color: gray; border-width: .4px; border-collapse: collapse;"> """ + listTransaccionTable + """ </table> <br> <br> <table width="600" border="0.5" height="0" style="border-color: black; border-width: 0.5px; border-spacing: 0;"> <tr > <td width="90%" align="right"> <br> TOTAL.................................................................................................................. <br> </td> <td width="10%" align="center"> <br> $ """ + total + """<br> </td> </tr> </table> <br> <br> <br> <p width="600" align="center" style=" font-size: 10; " > Por cualquier consulta, sobre este recibo, dirigirse al local que se encuentra ubicado en la calle independencia 450. <br> O Comunicarse a los telefonos 03382-123123123 / 4231231 </p> <br> <br> <br> <br> <br> _______________________________________________________________________________________________________ <br> <table width="600"> <tr> <td align="right" width="80%"> FECHA/HORA : """+ fecha + """ </td> <td align="right"> N° : """+ str(idRecibo) +""" </td> </tr> </table> _______________________________________________________________________________________________________ """ doc = QTextDocument() doc.setHtml(html) #doc.setDefaultStyleSheet(style) printer = QPrinter() printer.setOutputFileName(nombrePdf) printer.setOutputFormat(QPrinter.PdfFormat) doc.print(printer) printer.newPage() url = QUrl url = QUrl(nombrePdf) QDesktopServices.openUrl(url) """