Esempio n. 1
0
 def exportar_pdf(self):
     dialogo = QPageSetupDialog(self._printer, self)
     if dialogo.exec_():
         self._printer = dialogo.printer()
         nombre, _ = QtWidgets.QFileDialog.getSaveFileName(
             self, 'Exportar a PDF', 'Reporte.pdf', filter='pdf (*.pdf)')
         if nombre:
             pl = self._printer.pageLayout()
             self._vista_web.page().printToPdf(nombre, pl)
Esempio n. 2
0
 def on_btn_clicked(self):
     sender = self.sender()
     if sender == self.btn_openOneFile:
         # 选择文件
         file_name = QFileDialog.getOpenFileName(self, "打开文件", './')
         if file_name[0]:
             with open(file_name[0], 'r', encoding='utf-8',
                       errors='ignore') as f:
                 self.textedit.setText(f.read())
     elif sender == self.btn_openMultipleFile:
         # 打开多个文件
         filenames = QFileDialog.getOpenFileNames(self, "打开多个文件", './')
         print(filenames)
         if filenames[0]:
             for fname in filenames[0]:
                 with open(fname, 'r', encoding="utf-8",
                           errors='ignore') as f:
                     self.textedit.append(f.read())
     elif sender == self.btn_saveFile:
         filenames = QFileDialog.getSaveFileName(self, "保存文件", 'F:/temp/',
                                                 "Text file(*.txt)")
         if filenames[0]:
             with open(filenames[0], 'w', encoding='utf-8',
                       errors='ignore') as f:
                 f.write(self.textedit.toPlainText())
     elif sender == self.btn_color:
         # 选择颜色
         newcolor = QColorDialog.getColor()
         if newcolor.isValid():
             self.textedit.setTextColor(newcolor)
     elif sender == self.btn_font:
         # 选择字体
         font, ok = QFontDialog.getFont()
         if ok:
             self.textedit.setCurrentFont(font)
     elif sender == self.btn_pagesetting:
         # 打印页面设置
         pagesetting_dialog = QPageSetupDialog(self.printer, self)
         pagesetting_dialog.exec_()
     elif sender == self.btn_printdialog:
         # 打印开始执行
         print_dialog = QPrintDialog(self.printer, self)
         if QDialog.Accepted == print_dialog.exec_():
             self.textedit.print(self.printer)
Esempio n. 3
0
 def _q_pageSetup(self):
     pageSetup = QPageSetupDialog(self.printer, self)
     if pageSetup.exec_() == QDialog.Accepted:
         # update possible orientation changes
         if self.preview.orientation() == QPrinter.Portrait:
             self.portraitAction.setChecked(True)
             self.preview.setPortraitOrientation()
         else:
             self.landscapeAction.setChecked(True)
             self.preview.setLandscapeOrientation()
Esempio n. 4
0
 def _q_pageSetup(self):
     pageSetup = QPageSetupDialog(self.printer, self)
     if pageSetup.exec_() == QDialog.Accepted:
         # update possible orientation changes
         if self.preview.orientation() == QPrinter.Portrait:
             self.portraitAction.setChecked(True)
             self.preview.setPortraitOrientation()
         else:
             self.landscapeAction.setChecked(True)
             self.preview.setLandscapeOrientation()
Esempio n. 5
0
    def on_pageLayoutButton_clicked(self):
        """
        Private slot to define the page layout.
        """
        printer = QPrinter()
        printer.setPageLayout(self.__currentPageLayout)

        dlg = QPageSetupDialog(printer, self)
        if dlg.exec_() == QDialog.Accepted:
            self.__currentPageLayout = printer.pageLayout()
            self.__updatePageLayoutLabel()
Esempio n. 6
0
 def pagesettings(self):
     printsetdialog = QPageSetupDialog(self.printer, self)
     printsetdialog.exec_()
Esempio n. 7
0
 def show_page_setup(self):
     if not has_printing_support:
         raise Exception("Cannot print, Qt has no printing support")
     dlg = QPageSetupDialog(self.__printer)
     dlg.exec_()
Esempio n. 8
0
 def page_config(self):
     page_set = QPageSetupDialog(self.printer,self)
     page_set.exec_()
    def prt_setup_data(self):

        printsetdialog = QPageSetupDialog(self.printer, self)
        printsetdialog.exec_()
Esempio n. 10
0
 def pagesetup(self):
     setupdialog = QPageSetupDialog(self.printer, self)
     setupdialog.exec_()