aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext/orderform/orderform.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/richtext/orderform/orderform.py')
-rw-r--r--examples/widgets/richtext/orderform/orderform.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/examples/widgets/richtext/orderform/orderform.py b/examples/widgets/richtext/orderform/orderform.py
index 9f16c40a2..9725624c3 100644
--- a/examples/widgets/richtext/orderform/orderform.py
+++ b/examples/widgets/richtext/orderform/orderform.py
@@ -6,14 +6,14 @@
import sys
-from PySide6.QtCore import QDate, Qt, Signal, Slot
+from PySide6.QtCore import QDate, Qt, Slot
from PySide6.QtGui import (QFont, QTextCharFormat, QTextCursor,
QTextFrameFormat, QTextLength, QTextTableFormat)
from PySide6.QtWidgets import (QApplication, QCheckBox, QDialog,
QDialogButtonBox, QGridLayout, QLabel,
QLineEdit, QMainWindow, QMenu, QMessageBox,
QTableWidget, QTableWidgetItem, QTabWidget,
- QTextEdit, QWidget)
+ QTextEdit)
from PySide6.QtPrintSupport import QAbstractPrintDialog, QPrintDialog, QPrinter
@@ -89,8 +89,7 @@ class MainWindow(QMainWindow):
body_frame_format.setWidth(QTextLength(QTextLength.PercentageLength, 100))
cursor.insertFrame(body_frame_format)
- cursor.insertText("I would like to place an order for the following "
- "items:", text_format)
+ cursor.insertText("I would like to place an order for the following items:", text_format)
cursor.insertBlock()
cursor.insertBlock()
@@ -121,17 +120,17 @@ class MainWindow(QMainWindow):
cursor.insertBlock()
cursor.insertText("Please update my records to take account of the "
- "following privacy information:")
+ "following privacy information:")
cursor.insertBlock()
offers_table = cursor.insertTable(2, 2)
cursor = offers_table.cellAt(0, 1).firstCursorPosition()
cursor.insertText("I want to receive more information about your "
- "company's products and special offers.", text_format)
+ "company's products and special offers.", text_format)
cursor = offers_table.cellAt(1, 1).firstCursorPosition()
cursor.insertText("I do not want to receive any promotional "
- "information from your company.", text_format)
+ "information from your company.", text_format)
if sendOffers:
cursor = offers_table.cellAt(0, 0).firstCursorPosition()
@@ -153,16 +152,18 @@ class MainWindow(QMainWindow):
def create_sample(self):
dialog = DetailsDialog('Dialog with default values', self)
self.create_letter('Mr Smith',
- '12 High Street\nSmall Town\nThis country',
- dialog.order_items(), True)
+ '12 High Street\nSmall Town\nThis country',
+ dialog.order_items(), True)
+ @Slot()
def open_dialog(self):
dialog = DetailsDialog("Enter Customer Details", self)
if dialog.exec() == QDialog.Accepted:
self.create_letter(dialog.sender_name(), dialog.sender_address(),
- dialog.order_items(), dialog.send_offers())
+ dialog.order_items(), dialog.send_offers())
+ @Slot()
def print_file(self):
editor = self.letters.currentWidget()
printer = QPrinter()
@@ -191,8 +192,7 @@ class DetailsDialog(QDialog):
self._name_edit = QLineEdit()
self._address_edit = QTextEdit()
- self._offers_check_box = QCheckBox("Send information about "
- "products and special offers:")
+ self._offers_check_box = QCheckBox("Send information about products and special offers:")
self.setup_items_table()
@@ -241,15 +241,16 @@ class DetailsDialog(QDialog):
def send_offers(self):
return self._offers_check_box.isChecked()
+ @Slot()
def verify(self):
if self._name_edit.text() and self._address_edit.toPlainText():
self.accept()
return
answer = QMessageBox.warning(self, "Incomplete Form",
- "The form does not contain all the necessary information.\n"
- "Do you want to discard it?",
- QMessageBox.Yes, QMessageBox.No)
+ "The form does not contain all the necessary information.\n"
+ "Do you want to discard it?",
+ QMessageBox.Yes, QMessageBox.No)
if answer == QMessageBox.Yes:
self.reject()