def __init__(self, parent=None): QtWidgets.QDialog.__init__(self, parent) self.setWindowTitle("Предварительный просмотр") self.resize(600, 400) vBox = QtWidgets.QVBoxLayout() hBox1 = QtWidgets.QHBoxLayout() btnZoomIn = QtWidgets.QPushButton("&+") btnZoomIn.setFocusPolicy(QtCore.Qt.NoFocus) hBox1.addWidget(btnZoomIn, alignment=QtCore.Qt.AlignLeft) btnZoomOut = QtWidgets.QPushButton("&-") btnZoomOut.setFocusPolicy(QtCore.Qt.NoFocus) hBox1.addWidget(btnZoomOut, alignment=QtCore.Qt.AlignLeft) btnZoomReset = QtWidgets.QPushButton("&Сброс") btnZoomReset.setFocusPolicy(QtCore.Qt.NoFocus) btnZoomReset.clicked.connect(self.zoomReset) hBox1.addWidget(btnZoomReset, alignment=QtCore.Qt.AlignLeft) hBox1.addStretch() vBox.addLayout(hBox1) hBox2 = QtWidgets.QHBoxLayout() self.ppw = QtPrintSupport.QPrintPreviewWidget(parent.printer) self.ppw.paintRequested.connect(parent.sudoku.print) hBox2.addWidget(self.ppw) btnZoomIn.clicked.connect(self.ppw.zoomIn) btnZoomOut.clicked.connect(self.ppw.zoomOut) box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Close, QtCore.Qt.Vertical) btnClose = box.button(QtWidgets.QDialogButtonBox.Close) btnClose.setText("&Закрыть") btnClose.setFixedSize(96, 64) btnClose.clicked.connect(self.accept) hBox2.addWidget(box, alignment=QtCore.Qt.AlignRight | QtCore.Qt.AlignTop) vBox.addLayout(hBox2) self.setLayout(vBox) self.zoomReset()
def setup_ui(self, print_service_dialog): """ Set up the UI """ print_service_dialog.setObjectName('print_service_dialog') print_service_dialog.setWindowIcon(UiIcons().main_icon) print_service_dialog.resize(664, 594) self.main_layout = QtWidgets.QVBoxLayout(print_service_dialog) self.main_layout.setSpacing(0) self.main_layout.setContentsMargins(0, 0, 0, 0) self.main_layout.setObjectName('main_layout') self.toolbar = QtWidgets.QToolBar(print_service_dialog) self.toolbar.setIconSize(QtCore.QSize(22, 22)) self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.print_button = self.toolbar.addAction(UiIcons().print, translate('OpenLP.PrintServiceForm', 'Print')) self.options_button = QtWidgets.QToolButton(self.toolbar) self.options_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) self.options_button.setIcon(UiIcons().settings) self.options_button.setCheckable(True) self.toolbar.addWidget(self.options_button) self.toolbar.addSeparator() self.plain_copy = self.toolbar.addAction(UiIcons().clone, translate('OpenLP.PrintServiceForm', 'Copy as Text')) self.html_copy = self.toolbar.addAction(UiIcons().clone, translate('OpenLP.PrintServiceForm', 'Copy as HTML')) self.toolbar.addSeparator() self.zoom_in_button = QtWidgets.QToolButton(self.toolbar) self.zoom_in_button.setIcon(UiIcons().search_plus) self.zoom_in_button.setObjectName('zoom_in_button') self.zoom_in_button.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoom_in_button) self.zoom_out_button = QtWidgets.QToolButton(self.toolbar) self.zoom_out_button.setIcon(UiIcons().search_minus) self.zoom_out_button.setObjectName('zoom_out_button') self.zoom_out_button.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoom_out_button) self.zoom_original_button = QtWidgets.QToolButton(self.toolbar) self.zoom_original_button.setIcon(UiIcons().search) self.zoom_original_button.setObjectName('zoom_original_button') self.zoom_original_button.setIconSize(QtCore.QSize(22, 22)) self.toolbar.addWidget(self.zoom_original_button) self.zoom_combo_box = QtWidgets.QComboBox(print_service_dialog) self.zoom_combo_box.setObjectName('zoom_combo_box') self.toolbar.addWidget(self.zoom_combo_box) self.main_layout.addWidget(self.toolbar) self.preview_widget = QtPrintSupport.QPrintPreviewWidget(print_service_dialog) self.main_layout.addWidget(self.preview_widget) self.options_widget = QtWidgets.QWidget(print_service_dialog) self.options_widget.hide() self.options_widget.resize(400, 350) self.options_widget.setAutoFillBackground(True) self.options_layout = QtWidgets.QVBoxLayout(self.options_widget) self.options_layout.setContentsMargins(8, 8, 8, 8) self.title_label = QtWidgets.QLabel(self.options_widget) self.title_label.setObjectName('title_label') self.options_layout.addWidget(self.title_label) self.title_line_edit = QtWidgets.QLineEdit(self.options_widget) self.title_line_edit.setObjectName('title_line_edit') self.options_layout.addWidget(self.title_line_edit) self.footer_label = QtWidgets.QLabel(self.options_widget) self.footer_label.setObjectName('footer_label') self.options_layout.addWidget(self.footer_label) self.footer_text_edit = SpellTextEdit(self.options_widget, False) self.footer_text_edit.setObjectName('footer_text_edit') self.options_layout.addWidget(self.footer_text_edit) self.options_group_box = QtWidgets.QGroupBox() self.group_layout = QtWidgets.QVBoxLayout() self.slide_text_check_box = QtWidgets.QCheckBox() self.group_layout.addWidget(self.slide_text_check_box) self.page_break_after_text = QtWidgets.QCheckBox() self.group_layout.addWidget(self.page_break_after_text) self.notes_check_box = QtWidgets.QCheckBox() self.group_layout.addWidget(self.notes_check_box) self.meta_data_check_box = QtWidgets.QCheckBox() self.group_layout.addWidget(self.meta_data_check_box) self.show_chords_check_box = QtWidgets.QCheckBox() self.group_layout.addWidget(self.show_chords_check_box) self.group_layout.addStretch(1) self.options_group_box.setLayout(self.group_layout) self.options_layout.addWidget(self.options_group_box) self.retranslate_ui(print_service_dialog) self.options_button.toggled.connect(self.toggle_options)