Ejemplo n.º 1
0
    def color_override(self, name):
        w = QWidget(self)
        l = QHBoxLayout(w)

        def b(name, text, tt):
            ans = QRadioButton(text, w)
            l.addWidget(ans)
            ans.setToolTip(tt)
            setattr(w, name, ans)
            ans.setObjectName(name)
            return ans

        b(
            'unset', _('No change'),
            _('Use the colors from the book styles, defaulting to black-on-white'
              ))
        b(
            'auto', _('Theme based'),
            _('When using a dark theme force dark colors, otherwise same as "No change"'
              ))
        b('manual', _('Custom'), _('Choose a custom color'))

        c = w.color_button = ColorButton(parent=w)
        l.addWidget(c)
        connect_lambda(c.clicked, w, lambda w: w.manual.setChecked(True))

        def getter(w):
            if w.unset.isChecked():
                return 'unset'
            if w.auto.isChecked():
                return 'auto'
            return w.color_button.color or 'auto'

        def setter(w, val):
            val = val or 'auto'
            if val == 'unset':
                w.unset.setChecked(True)
            elif val == 'auto':
                w.auto.setChecked(True)
            else:
                w.manual.setChecked(True)
                w.color_button.color = val

        self(name, widget=w, getter=getter, setter=setter)
        l.setContentsMargins(0, 0, 0, 0)
        return w
Ejemplo n.º 2
0
    def __init__(self, fm, pref_name, parent=None):
        QDialog.__init__(self, parent)
        self.fm = fm

        if pref_name == 'column_color_rules':
            self.rule_kind = 'color'
            rule_text = _('column coloring')
        elif pref_name == 'column_icon_rules':
            self.rule_kind = 'icon'
            rule_text = _('column icon')
        elif pref_name == 'cover_grid_icon_rules':
            self.rule_kind = 'emblem'
            rule_text = _('Cover grid emblem')

        self.setWindowIcon(QIcon(I('format-fill-color.png')))
        self.setWindowTitle(_('Create/edit a {0} rule').format(rule_text))

        self.l = l = QGridLayout(self)
        self.setLayout(l)

        self.l1 = l1 = QLabel(_('Create a {0} rule by'
            ' filling in the boxes below').format(rule_text))
        l.addWidget(l1, 0, 0, 1, 8)

        self.f1 = QFrame(self)
        self.f1.setFrameShape(QFrame.HLine)
        l.addWidget(self.f1, 1, 0, 1, 8)

        self.l2 = l2 = QLabel(_('Add the emblem:') if self.rule_kind == 'emblem' else _('Set the'))
        l.addWidget(l2, 2, 0)

        if self.rule_kind == 'color':
            l.addWidget(QLabel(_('color')))
        elif self.rule_kind == 'icon':
            self.kind_box = QComboBox(self)
            for tt, t in icon_rule_kinds:
                self.kind_box.addItem(tt, t)
            l.addWidget(self.kind_box, 2, 1)
            self.kind_box.setToolTip(textwrap.fill(_(
                'If you choose composed icons and multiple rules match, then all the'
                ' matching icons will be combined, otherwise the icon from the'
                ' first rule to match will be used.')))
        else:
            pass

        self.l3 = l3 = QLabel(_('of the column:'))
        l.addWidget(l3, 2, 2)

        self.column_box = QComboBox(self)
        l.addWidget(self.column_box, 2, 3)

        self.l4 = l4 = QLabel(_('to'))
        l.addWidget(l4, 2, 4)
        if self.rule_kind == 'emblem':
            l3.setVisible(False), self.column_box.setVisible(False), l4.setVisible(False)

        def create_filename_box():
            self.filename_box = f = QComboBox()
            self.filenamebox_view = v = QListView()
            v.setIconSize(QSize(32, 32))
            self.filename_box.setView(v)
            self.orig_filenamebox_view = f.view()
            f.setMinimumContentsLength(20), f.setSizeAdjustPolicy(f.AdjustToMinimumContentsLengthWithIcon)
            self.populate_icon_filenames()

        if self.rule_kind == 'color':
            self.color_box = ColorButton(parent=self)
            self.color_label = QLabel('Sample text Sample text')
            self.color_label.setTextFormat(Qt.RichText)
            l.addWidget(self.color_box, 2, 5)
            l.addWidget(self.color_label, 2, 6)
            l.addItem(QSpacerItem(10, 10, QSizePolicy.Expanding), 2, 7)
        elif self.rule_kind == 'emblem':
            create_filename_box()
            self.update_filename_box()
            self.filename_button = QPushButton(QIcon(I('document_open.png')),
                                               _('&Add new image'))
            l.addWidget(self.filename_box)
            l.addWidget(self.filename_button, 2, 6)
            l.addWidget(QLabel(_('(Images should be square-ish)')), 2, 7)
            l.setColumnStretch(7, 10)
        else:
            create_filename_box()

            vb = QVBoxLayout()
            self.multiple_icon_cb = QCheckBox(_('Choose &more than one icon'))
            vb.addWidget(self.multiple_icon_cb)
            self.update_filename_box()
            self.multiple_icon_cb.clicked.connect(self.multiple_box_clicked)
            vb.addWidget(self.filename_box)
            l.addLayout(vb, 2, 5)

            self.filename_button = QPushButton(QIcon(I('document_open.png')),
                                               _('&Add icon'))
            l.addWidget(self.filename_button, 2, 6)
            l.addWidget(QLabel(_('Icons should be square or landscape')), 2, 7)
            l.setColumnStretch(7, 10)

        self.l5 = l5 = QLabel(
            _('Only if the following conditions are all satisfied:'))
        l.addWidget(l5, 3, 0, 1, 7)

        self.scroll_area = sa = QScrollArea(self)
        sa.setMinimumHeight(300)
        sa.setMinimumWidth(950)
        sa.setWidgetResizable(True)
        l.addWidget(sa, 4, 0, 1, 8)

        self.add_button = b = QPushButton(QIcon(I('plus.png')),
                _('Add &another condition'))
        l.addWidget(b, 5, 0, 1, 8)
        b.clicked.connect(self.add_blank_condition)

        self.l6 = l6 = QLabel(_('You can disable a condition by'
            ' blanking all of its boxes'))
        l.addWidget(l6, 6, 0, 1, 8)

        self.bb = bb = QDialogButtonBox(
                QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
        bb.accepted.connect(self.accept)
        bb.rejected.connect(self.reject)
        l.addWidget(bb, 7, 0, 1, 8)
        if self.rule_kind != 'color':
            self.remove_button = b = bb.addButton(_('&Remove icon'), bb.ActionRole)
            b.setIcon(QIcon(I('minus.png')))
            b.setMenu(QMenu())
            b.setToolTip('<p>' + _('Remove a previously added icon. Note that doing so will cause rules that use it to stop working.'))
            self.update_remove_button()

        self.conditions_widget = QWidget(self)
        sa.setWidget(self.conditions_widget)
        self.conditions_widget.setLayout(QVBoxLayout())
        self.conditions_widget.layout().setAlignment(Qt.AlignTop)
        self.conditions = []

        if self.rule_kind == 'color':
            for b in (self.column_box, ):
                b.setSizeAdjustPolicy(b.AdjustToMinimumContentsLengthWithIcon)
                b.setMinimumContentsLength(15)

        for key in sorted(displayable_columns(fm),
                          key=lambda k: sort_key(fm[k]['name']) if k != color_row_key else 0):
            if key == color_row_key and self.rule_kind != 'color':
                continue
            name = all_columns_string if key == color_row_key else fm[key]['name']
            if name:
                self.column_box.addItem(name, key)
        self.column_box.setCurrentIndex(0)

        if self.rule_kind == 'color':
            self.color_box.color = '#000'
            self.update_color_label()
            self.color_box.color_changed.connect(self.update_color_label)
        else:
            self.rule_icon_files = []
            self.filename_button.clicked.connect(self.filename_button_clicked)

        self.resize(self.sizeHint())
Ejemplo n.º 3
0
    def __init__(self, parent, device):
        super().__init__(parent, device)
        self.setTitle(_("Upload covers"))

        self.options_layout = QGridLayout()
        self.options_layout.setObjectName("options_layout")
        self.setLayout(self.options_layout)

        self.setCheckable(True)
        self.setChecked(device.get_pref('upload_covers'))
        self.setToolTip(wrap_msg(_('Upload cover images from the calibre library when sending books to the device.')))

        self.upload_grayscale_checkbox = create_checkbox(
                             _('Upload black and white covers'),
                             _('Convert covers to grayscale when uploading.'),
                             device.get_pref('upload_grayscale')
                             )

        self.dithered_covers_checkbox = create_checkbox(
                             _('Upload dithered covers'),
                             _('Dither cover images to the appropriate 16c grayscale palette for an eInk screen.'
                               ' This usually ensures greater accuracy and avoids banding, making sleep covers look better.'
                               ' On FW >= 4.11, Nickel itself may sometimes do a decent job of it.'
                               ' Has no effect without "Upload black and white covers"!'),
                             device.get_pref('dithered_covers')
                             )
        # Make it visually depend on B&W being enabled!
        # c.f., https://stackoverflow.com/q/36281103
        self.dithered_covers_checkbox.setEnabled(device.get_pref('upload_grayscale'))
        self.upload_grayscale_checkbox.toggled.connect(self.dithered_covers_checkbox.setEnabled)
        self.upload_grayscale_checkbox.toggled.connect(
            lambda checked: not checked and self.dithered_covers_checkbox.setChecked(False))

        self.keep_cover_aspect_checkbox = create_checkbox(
                             _('Keep cover aspect ratio'),
                             _('When uploading covers, do not change the aspect ratio when resizing for the device.'
                               ' This is for firmware versions 2.3.1 and later.'),
                             device.get_pref('keep_cover_aspect'))

        self.letterbox_fs_covers_checkbox = create_checkbox(
                             _('Letterbox full-screen covers'),
                             _('Do it on our end, instead of letting Nickel handle it.'
                               ' Provides pixel-perfect results on devices where Nickel does not do extra processing.'
                               ' Obviously has no effect without "Keep cover aspect ratio".'
                               ' This is probably undesirable if you disable the "Show book covers full screen"'
                               ' setting on your device.'),
                             device.get_pref('letterbox_fs_covers'))

        self.letterbox_fs_covers_color_button = ColorButton(self.options_layout)
        self.letterbox_fs_covers_color_button.setToolTip(_('Choose the color to use when letterboxing the cover.'
                                                           ' The default color is black (#000000)'
                                                           )
        )
        self.letterbox_fs_covers_color_button.color = device.get_pref('letterbox_fs_covers_color')

        # Make it visually depend on AR being enabled!
        self.letterbox_fs_covers_checkbox.setEnabled(device.get_pref('keep_cover_aspect'))
        self.letterbox_fs_covers_color_button.setEnabled(device.get_pref('keep_cover_aspect') and device.get_pref('letterbox_fs_covers'))
        self.keep_cover_aspect_checkbox.toggled.connect(self.letterbox_fs_covers_checkbox.setEnabled)
        self.keep_cover_aspect_checkbox.toggled.connect(
            lambda checked: not checked and self.letterbox_fs_covers_checkbox.setChecked(False))
        self.letterbox_fs_covers_checkbox.toggled.connect(self.letterbox_fs_covers_color_button.setEnabled)

        self.png_covers_checkbox = create_checkbox(
                             _('Save covers as PNG'),
                             _('Use the PNG image format instead of JPG.'
                               ' Higher quality, especially with "Upload dithered covers" enabled,'
                               ' which will also help generate potentially smaller files.'
                               ' Behavior completely unknown on old (< 3.x) Kobo firmwares,'
                               ' known to behave on FW >= 4.8.'
                               ' Has no effect without "Upload black and white covers"!'),
                             device.get_pref('png_covers'))
        # Make it visually depend on B&W being enabled, to avoid storing ridiculously large color PNGs.
        self.png_covers_checkbox.setEnabled(device.get_pref('upload_grayscale'))
        self.upload_grayscale_checkbox.toggled.connect(self.png_covers_checkbox.setEnabled)
        self.upload_grayscale_checkbox.toggled.connect(
            lambda checked: not checked and self.png_covers_checkbox.setChecked(False))

        self.options_layout.addWidget(self.keep_cover_aspect_checkbox,          0, 0, 1, 1)
        self.options_layout.addWidget(self.letterbox_fs_covers_checkbox,        0, 1, 1, 2)
        self.options_layout.addWidget(self.letterbox_fs_covers_color_button,    1, 1, 1, 1)
        self.options_layout.addWidget(self.upload_grayscale_checkbox,           2, 0, 1, 1)
        self.options_layout.addWidget(self.dithered_covers_checkbox,            2, 1, 1, 2)
        self.options_layout.addWidget(self.png_covers_checkbox,                 3, 1, 1, 2)
        self.options_layout.setColumnStretch(0, 0)
        self.options_layout.setColumnStretch(1, 0)
        self.options_layout.setColumnStretch(2, 1)
Ejemplo n.º 4
0
    def setupUi(self, TemplateDialog):
        TemplateDialog.setObjectName("TemplateDialog")
        TemplateDialog.resize(588, 546)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(TemplateDialog.sizePolicy().hasHeightForWidth())
        TemplateDialog.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(TemplateDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.scroll_area = QtWidgets.QScrollArea(TemplateDialog)
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setObjectName("scroll_area")
        self.wid1 = QtWidgets.QWidget()
        self.wid1.setObjectName("wid1")
        self.verticalLayout1 = QtWidgets.QVBoxLayout(self.wid1)
        self.verticalLayout1.setObjectName("verticalLayout1")
        self.color_layout = QtWidgets.QWidget(self.wid1)
        self.color_layout.setObjectName("color_layout")
        self.gridlayout = QtWidgets.QGridLayout(self.color_layout)
        self.gridlayout.setObjectName("gridlayout")
        self.colored_field_label = QtWidgets.QLabel(self.color_layout)
        self.colored_field_label.setObjectName("colored_field_label")
        self.gridlayout.addWidget(self.colored_field_label, 0, 0, 1, 1)
        self.colored_field = QtWidgets.QComboBox(self.color_layout)
        self.colored_field.setObjectName("colored_field")
        self.gridlayout.addWidget(self.colored_field, 0, 1, 1, 1)
        self.color_chooser_label = QtWidgets.QLabel(self.color_layout)
        self.color_chooser_label.setObjectName("color_chooser_label")
        self.gridlayout.addWidget(self.color_chooser_label, 1, 0, 1, 1)
        self.color_name = ColorButton(self.color_layout)
        self.color_name.setObjectName("color_name")
        self.gridlayout.addWidget(self.color_name, 1, 1, 1, 1)
        self.color_copy_button = QtWidgets.QToolButton(self.color_layout)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(I("edit-copy.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.color_copy_button.setIcon(icon)
        self.color_copy_button.setObjectName("color_copy_button")
        self.gridlayout.addWidget(self.color_copy_button, 1, 2, 1, 1)
        self.verticalLayout1.addWidget(self.color_layout)
        self.icon_layout = QtWidgets.QWidget(self.wid1)
        self.icon_layout.setObjectName("icon_layout")
        self.gridlayout1 = QtWidgets.QGridLayout(self.icon_layout)
        self.gridlayout1.setObjectName("gridlayout1")
        self.hboxlayout = QtWidgets.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")
        self.icon_kind_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_kind_label.setObjectName("icon_kind_label")
        self.hboxlayout.addWidget(self.icon_kind_label)
        self.icon_kind = QtWidgets.QComboBox(self.icon_layout)
        self.icon_kind.setObjectName("icon_kind")
        self.hboxlayout.addWidget(self.icon_kind)
        self.gridlayout1.addLayout(self.hboxlayout, 0, 0, 1, 2)
        self.icon_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_chooser_label.setObjectName("icon_chooser_label")
        self.gridlayout1.addWidget(self.icon_chooser_label, 1, 0, 1, 1)
        self.icon_field = QtWidgets.QComboBox(self.icon_layout)
        self.icon_field.setObjectName("icon_field")
        self.gridlayout1.addWidget(self.icon_field, 1, 1, 1, 1)
        self.image_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.image_chooser_label.setObjectName("image_chooser_label")
        self.gridlayout1.addWidget(self.image_chooser_label, 2, 0, 1, 1)
        self.widget = QtWidgets.QWidget(self.icon_layout)
        self.widget.setObjectName("widget")
        self.hboxlayout1 = QtWidgets.QHBoxLayout(self.widget)
        self.hboxlayout1.setObjectName("hboxlayout1")
        self.icon_files = QtWidgets.QComboBox(self.widget)
        self.icon_files.setObjectName("icon_files")
        self.hboxlayout1.addWidget(self.icon_files)
        self.icon_copy_button = QtWidgets.QToolButton(self.widget)
        self.icon_copy_button.setIcon(icon)
        self.icon_copy_button.setObjectName("icon_copy_button")
        self.hboxlayout1.addWidget(self.icon_copy_button)
        self.filename_button = QtWidgets.QPushButton(self.widget)
        self.filename_button.setObjectName("filename_button")
        self.hboxlayout1.addWidget(self.filename_button)
        self.gridlayout1.addWidget(self.widget, 2, 1, 1, 1)
        self.verticalLayout1.addWidget(self.icon_layout)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.hboxlayout2 = QtWidgets.QHBoxLayout()
        self.hboxlayout2.setObjectName("hboxlayout2")
        self.template_name_label = QtWidgets.QLabel(self.wid1)
        self.template_name_label.setObjectName("template_name_label")
        self.hboxlayout2.addWidget(self.template_name_label)
        self.template_name = QtWidgets.QComboBox(self.wid1)
        self.template_name.setEditable(True)
        self.template_name.setObjectName("template_name")
        self.hboxlayout2.addWidget(self.template_name)
        self.gridLayout.addLayout(self.hboxlayout2, 0, 0, 1, 1)
        self.lowlayout = FlowLayout()
        self.lowlayout.setObjectName("lowlayout")
        self.label = QtWidgets.QLabel(self.wid1)
        self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.label.setObjectName("label")
        self.lowlayout.addWidget(self.label)
        self.label1 = QtWidgets.QLabel(self.wid1)
        self.label1.setObjectName("label1")
        self.lowlayout.addWidget(self.label1)
        self.break_box = QtWidgets.QCheckBox(self.wid1)
        self.break_box.setObjectName("break_box")
        self.lowlayout.addWidget(self.break_box)
        self.eparator = Separator(self.wid1)
        self.eparator.setObjectName("eparator")
        self.lowlayout.addWidget(self.eparator)
        self.go_button = QtWidgets.QToolButton(self.wid1)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(I("sync-right.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.go_button.setIcon(icon1)
        self.go_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.go_button.setObjectName("go_button")
        self.lowlayout.addWidget(self.go_button)
        self.eparator1 = Separator(self.wid1)
        self.eparator1.setObjectName("eparator1")
        self.lowlayout.addWidget(self.eparator1)
        self.breakpoint_line_box_label = QtWidgets.QLabel(self.wid1)
        self.breakpoint_line_box_label.setObjectName("breakpoint_line_box_label")
        self.lowlayout.addWidget(self.breakpoint_line_box_label)
        self.breakpoint_line_box = QtWidgets.QSpinBox(self.wid1)
        self.breakpoint_line_box.setMinimum(1)
        self.breakpoint_line_box.setMaximum(999)
        self.breakpoint_line_box.setProperty("value", 1)
        self.breakpoint_line_box.setAlignment(QtCore.Qt.AlignRight)
        self.breakpoint_line_box.setObjectName("breakpoint_line_box")
        self.lowlayout.addWidget(self.breakpoint_line_box)
        self.toggle_button = QtWidgets.QToolButton(self.wid1)
        self.toggle_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(I("swap.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.toggle_button.setIcon(icon2)
        self.toggle_button.setObjectName("toggle_button")
        self.lowlayout.addWidget(self.toggle_button)
        self.eparator2 = Separator(self.wid1)
        self.eparator2.setObjectName("eparator2")
        self.lowlayout.addWidget(self.eparator2)
        self.remove_all_button = QtWidgets.QToolButton(self.wid1)
        self.remove_all_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(I("list_remove.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.remove_all_button.setIcon(icon3)
        self.remove_all_button.setObjectName("remove_all_button")
        self.lowlayout.addWidget(self.remove_all_button)
        self.set_all_button = QtWidgets.QToolButton(self.wid1)
        self.set_all_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(I("plus.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.set_all_button.setIcon(icon4)
        self.set_all_button.setObjectName("set_all_button")
        self.lowlayout.addWidget(self.set_all_button)
        self.gridLayout.addLayout(self.lowlayout, 1, 0, 1, 3)
        self.textbox = CodeEditor(self.wid1)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.textbox.sizePolicy().hasHeightForWidth())
        self.textbox.setSizePolicy(sizePolicy)
        self.textbox.setObjectName("textbox")
        self.gridLayout.addWidget(self.textbox, 2, 0, 1, 3)
        self.new_doc_label = QtWidgets.QLabel(self.wid1)
        self.new_doc_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.new_doc_label.setObjectName("new_doc_label")
        self.gridLayout.addWidget(self.new_doc_label, 3, 0, 1, 1)
        self.new_doc = QtWidgets.QTextEdit(self.wid1)
        self.new_doc.setObjectName("new_doc")
        self.gridLayout.addWidget(self.new_doc, 4, 0, 1, 3)
        self.label2 = QtWidgets.QLabel(self.wid1)
        self.label2.setObjectName("label2")
        self.gridLayout.addWidget(self.label2, 7, 0, 1, 1)
        self.template_value = QtWidgets.QTableWidget(self.wid1)
        self.template_value.setObjectName("template_value")
        self.template_value.setColumnCount(0)
        self.template_value.setRowCount(0)
        self.gridLayout.addWidget(self.template_value, 8, 0, 1, 3)
        self.user_label_1 = QtWidgets.QLabel(self.wid1)
        self.user_label_1.setVisible(False)
        self.user_label_1.setObjectName("user_label_1")
        self.gridLayout.addWidget(self.user_label_1, 11, 0, 1, 1)
        self.user_layout_1 = BoxLayout()
        self.user_layout_1.setObjectName("user_layout_1")
        self.gridLayout.addLayout(self.user_layout_1, 11, 1, 1, 1)
        self.user_label_2 = QtWidgets.QLabel(self.wid1)
        self.user_label_2.setVisible(False)
        self.user_label_2.setObjectName("user_label_2")
        self.gridLayout.addWidget(self.user_label_2, 12, 0, 1, 1)
        self.user_layout_2 = BoxLayout()
        self.user_layout_2.setObjectName("user_layout_2")
        self.gridLayout.addLayout(self.user_layout_2, 12, 1, 1, 1)
        self.user_label_3 = QtWidgets.QLabel(self.wid1)
        self.user_label_3.setVisible(False)
        self.user_label_3.setObjectName("user_label_3")
        self.gridLayout.addWidget(self.user_label_3, 13, 0, 1, 1)
        self.user_layout_3 = BoxLayout()
        self.user_layout_3.setObjectName("user_layout_3")
        self.gridLayout.addLayout(self.user_layout_3, 13, 1, 1, 1)
        self.user_label_4 = QtWidgets.QLabel(self.wid1)
        self.user_label_4.setVisible(False)
        self.user_label_4.setObjectName("user_label_4")
        self.gridLayout.addWidget(self.user_label_4, 14, 0, 1, 1)
        self.user_layout_4 = BoxLayout()
        self.user_layout_4.setObjectName("user_layout_4")
        self.gridLayout.addLayout(self.user_layout_4, 14, 1, 1, 1)
        self.user_label_5 = QtWidgets.QLabel(self.wid1)
        self.user_label_5.setVisible(False)
        self.user_label_5.setObjectName("user_label_5")
        self.gridLayout.addWidget(self.user_label_5, 15, 0, 1, 1)
        self.user_layout_5 = BoxLayout()
        self.user_layout_5.setObjectName("user_layout_5")
        self.gridLayout.addLayout(self.user_layout_5, 15, 1, 1, 1)
        self.user_label_6 = QtWidgets.QLabel(self.wid1)
        self.user_label_6.setVisible(False)
        self.user_label_6.setObjectName("user_label_6")
        self.gridLayout.addWidget(self.user_label_6, 16, 0, 1, 1)
        self.user_layout_6 = BoxLayout()
        self.user_layout_6.setObjectName("user_layout_6")
        self.gridLayout.addLayout(self.user_layout_6, 16, 1, 1, 1)
        self.user_label_7 = QtWidgets.QLabel(self.wid1)
        self.user_label_7.setVisible(False)
        self.user_label_7.setObjectName("user_label_7")
        self.gridLayout.addWidget(self.user_label_7, 17, 0, 1, 1)
        self.user_layout_7 = BoxLayout()
        self.user_layout_7.setObjectName("user_layout_7")
        self.gridLayout.addLayout(self.user_layout_7, 17, 1, 1, 1)
        self.user_label_8 = QtWidgets.QLabel(self.wid1)
        self.user_label_8.setVisible(False)
        self.user_label_8.setObjectName("user_label_8")
        self.gridLayout.addWidget(self.user_label_8, 18, 0, 1, 1)
        self.user_layout_8 = BoxLayout()
        self.user_layout_8.setObjectName("user_layout_8")
        self.gridLayout.addLayout(self.user_layout_8, 18, 1, 1, 1)
        self.user_label_9 = QtWidgets.QLabel(self.wid1)
        self.user_label_9.setVisible(False)
        self.user_label_9.setObjectName("user_label_9")
        self.gridLayout.addWidget(self.user_label_9, 19, 0, 1, 1)
        self.hboxlayout3 = QtWidgets.QHBoxLayout()
        self.hboxlayout3.setObjectName("hboxlayout3")
        self.font_name_label = QtWidgets.QLabel(self.wid1)
        self.font_name_label.setObjectName("font_name_label")
        self.hboxlayout3.addWidget(self.font_name_label)
        self.font_box = QtWidgets.QFontComboBox(self.wid1)
        self.font_box.setObjectName("font_box")
        self.hboxlayout3.addWidget(self.font_box)
        self.font_size_label = QtWidgets.QLabel(self.wid1)
        self.font_size_label.setObjectName("font_size_label")
        self.hboxlayout3.addWidget(self.font_size_label)
        self.font_size_box = QtWidgets.QSpinBox(self.wid1)
        self.font_size_box.setObjectName("font_size_box")
        self.hboxlayout3.addWidget(self.font_size_box)
        self.frame = QtWidgets.QFrame(self.wid1)
        self.frame.setFrameShape(QtWidgets.QFrame.VLine)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.hboxlayout3.addWidget(self.frame)
        self.load_button = QtWidgets.QToolButton(self.wid1)
        self.load_button.setObjectName("load_button")
        self.hboxlayout3.addWidget(self.load_button)
        self.save_button = QtWidgets.QToolButton(self.wid1)
        self.save_button.setObjectName("save_button")
        self.hboxlayout3.addWidget(self.save_button)
        self.frame1 = QtWidgets.QFrame(self.wid1)
        self.frame1.setFrameShape(QtWidgets.QFrame.VLine)
        self.frame1.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame1.setLineWidth(3)
        self.frame1.setObjectName("frame1")
        self.hboxlayout3.addWidget(self.frame1)
        spacerItem = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.hboxlayout3.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.wid1)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.hboxlayout3.addWidget(self.buttonBox)
        self.gridLayout.addLayout(self.hboxlayout3, 24, 0, 1, 3)
        self.frame2 = QtWidgets.QFrame(self.wid1)
        self.frame2.setFrameShape(QtWidgets.QFrame.HLine)
        self.frame2.setObjectName("frame2")
        self.gridLayout.addWidget(self.frame2, 25, 0, 1, 3)
        self.gridlayout2 = QtWidgets.QGridLayout()
        self.gridlayout2.setObjectName("gridlayout2")
        self.label3 = QtWidgets.QLabel(self.wid1)
        self.label3.setObjectName("label3")
        self.gridlayout2.addWidget(self.label3, 0, 0, 1, 2)
        self.label4 = QtWidgets.QLabel(self.wid1)
        self.label4.setObjectName("label4")
        self.gridlayout2.addWidget(self.label4, 1, 0, 1, 1)
        self.function = QtWidgets.QComboBox(self.wid1)
        self.function.setObjectName("function")
        self.gridlayout2.addWidget(self.function, 1, 1, 1, 1)
        self.label_22 = QtWidgets.QLabel(self.wid1)
        self.label_22.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label_22.setObjectName("label_22")
        self.gridlayout2.addWidget(self.label_22, 2, 0, 1, 1)
        self.func_type = QtWidgets.QLineEdit(self.wid1)
        self.func_type.setReadOnly(True)
        self.func_type.setObjectName("func_type")
        self.gridlayout2.addWidget(self.func_type, 2, 1, 1, 1)
        self.label_2 = QtWidgets.QLabel(self.wid1)
        self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label_2.setObjectName("label_2")
        self.gridlayout2.addWidget(self.label_2, 3, 0, 1, 1)
        self.documentation = QtWidgets.QPlainTextEdit(self.wid1)
        self.documentation.setMaximumSize(QtCore.QSize(16777215, 75))
        self.documentation.setObjectName("documentation")
        self.gridlayout2.addWidget(self.documentation, 3, 1, 1, 1)
        self.label_3 = QtWidgets.QLabel(self.wid1)
        self.label_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label_3.setObjectName("label_3")
        self.gridlayout2.addWidget(self.label_3, 4, 0, 1, 1)
        self.source_code = QtWidgets.QPlainTextEdit(self.wid1)
        self.source_code.setMaximumSize(QtCore.QSize(16777215, 75))
        self.source_code.setObjectName("source_code")
        self.gridlayout2.addWidget(self.source_code, 4, 1, 1, 1)
        self.gridLayout.addLayout(self.gridlayout2, 30, 0, 1, 3)
        self.template_tutorial = QtWidgets.QLabel(self.wid1)
        self.template_tutorial.setOpenExternalLinks(True)
        self.template_tutorial.setObjectName("template_tutorial")
        self.gridLayout.addWidget(self.template_tutorial, 27, 1, 1, 1)
        self.template_func_reference = QtWidgets.QLabel(self.wid1)
        self.template_func_reference.setOpenExternalLinks(True)
        self.template_func_reference.setObjectName("template_func_reference")
        self.gridLayout.addWidget(self.template_func_reference, 28, 1, 1, 1)
        self.verticalLayout1.addLayout(self.gridLayout)
        self.scroll_area.setWidget(self.wid1)
        self.verticalLayout.addWidget(self.scroll_area)
        self.colored_field_label.setBuddy(self.colored_field)
        self.color_chooser_label.setBuddy(self.color_name)
        self.icon_chooser_label.setBuddy(self.icon_field)
        self.image_chooser_label.setBuddy(self.color_name)
        self.template_name_label.setBuddy(self.template_name)
        self.label.setBuddy(self.textbox)
        self.eparator.setBuddy(self.go_button)
        self.eparator1.setBuddy(self.go_button)
        self.breakpoint_line_box_label.setBuddy(self.breakpoint_line_box)
        self.eparator2.setBuddy(self.go_button)
        self.new_doc_label.setBuddy(self.new_doc)
        self.label2.setBuddy(self.template_value)
        self.user_label_1.setBuddy(self.template_value)
        self.user_label_2.setBuddy(self.template_value)
        self.user_label_3.setBuddy(self.template_value)
        self.user_label_4.setBuddy(self.template_value)
        self.user_label_5.setBuddy(self.template_value)
        self.user_label_6.setBuddy(self.template_value)
        self.user_label_7.setBuddy(self.template_value)
        self.user_label_8.setBuddy(self.template_value)
        self.user_label_9.setBuddy(self.template_value)
        self.font_name_label.setBuddy(self.font_box)
        self.font_size_label.setBuddy(self.font_size_box)
        self.label4.setBuddy(self.function)
        self.label_22.setBuddy(self.func_type)
        self.label_2.setBuddy(self.documentation)
        self.label_3.setBuddy(self.source_code)

        self.retranslateUi(TemplateDialog)
        self.buttonBox.accepted.connect(TemplateDialog.accept)
        self.buttonBox.rejected.connect(TemplateDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(TemplateDialog)
Ejemplo n.º 5
0
class Ui_TemplateDialog(object):
    def setupUi(self, TemplateDialog):
        TemplateDialog.setObjectName("TemplateDialog")
        TemplateDialog.resize(588, 546)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(TemplateDialog.sizePolicy().hasHeightForWidth())
        TemplateDialog.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(TemplateDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.scroll_area = QtWidgets.QScrollArea(TemplateDialog)
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setObjectName("scroll_area")
        self.wid1 = QtWidgets.QWidget()
        self.wid1.setObjectName("wid1")
        self.verticalLayout1 = QtWidgets.QVBoxLayout(self.wid1)
        self.verticalLayout1.setObjectName("verticalLayout1")
        self.color_layout = QtWidgets.QWidget(self.wid1)
        self.color_layout.setObjectName("color_layout")
        self.gridlayout = QtWidgets.QGridLayout(self.color_layout)
        self.gridlayout.setObjectName("gridlayout")
        self.colored_field_label = QtWidgets.QLabel(self.color_layout)
        self.colored_field_label.setObjectName("colored_field_label")
        self.gridlayout.addWidget(self.colored_field_label, 0, 0, 1, 1)
        self.colored_field = QtWidgets.QComboBox(self.color_layout)
        self.colored_field.setObjectName("colored_field")
        self.gridlayout.addWidget(self.colored_field, 0, 1, 1, 1)
        self.color_chooser_label = QtWidgets.QLabel(self.color_layout)
        self.color_chooser_label.setObjectName("color_chooser_label")
        self.gridlayout.addWidget(self.color_chooser_label, 1, 0, 1, 1)
        self.color_name = ColorButton(self.color_layout)
        self.color_name.setObjectName("color_name")
        self.gridlayout.addWidget(self.color_name, 1, 1, 1, 1)
        self.color_copy_button = QtWidgets.QToolButton(self.color_layout)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(I("edit-copy.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.color_copy_button.setIcon(icon)
        self.color_copy_button.setObjectName("color_copy_button")
        self.gridlayout.addWidget(self.color_copy_button, 1, 2, 1, 1)
        self.verticalLayout1.addWidget(self.color_layout)
        self.icon_layout = QtWidgets.QWidget(self.wid1)
        self.icon_layout.setObjectName("icon_layout")
        self.gridlayout1 = QtWidgets.QGridLayout(self.icon_layout)
        self.gridlayout1.setObjectName("gridlayout1")
        self.hboxlayout = QtWidgets.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")
        self.icon_kind_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_kind_label.setObjectName("icon_kind_label")
        self.hboxlayout.addWidget(self.icon_kind_label)
        self.icon_kind = QtWidgets.QComboBox(self.icon_layout)
        self.icon_kind.setObjectName("icon_kind")
        self.hboxlayout.addWidget(self.icon_kind)
        self.gridlayout1.addLayout(self.hboxlayout, 0, 0, 1, 2)
        self.icon_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_chooser_label.setObjectName("icon_chooser_label")
        self.gridlayout1.addWidget(self.icon_chooser_label, 1, 0, 1, 1)
        self.icon_field = QtWidgets.QComboBox(self.icon_layout)
        self.icon_field.setObjectName("icon_field")
        self.gridlayout1.addWidget(self.icon_field, 1, 1, 1, 1)
        self.image_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.image_chooser_label.setObjectName("image_chooser_label")
        self.gridlayout1.addWidget(self.image_chooser_label, 2, 0, 1, 1)
        self.widget = QtWidgets.QWidget(self.icon_layout)
        self.widget.setObjectName("widget")
        self.hboxlayout1 = QtWidgets.QHBoxLayout(self.widget)
        self.hboxlayout1.setObjectName("hboxlayout1")
        self.icon_files = QtWidgets.QComboBox(self.widget)
        self.icon_files.setObjectName("icon_files")
        self.hboxlayout1.addWidget(self.icon_files)
        self.icon_copy_button = QtWidgets.QToolButton(self.widget)
        self.icon_copy_button.setIcon(icon)
        self.icon_copy_button.setObjectName("icon_copy_button")
        self.hboxlayout1.addWidget(self.icon_copy_button)
        self.filename_button = QtWidgets.QPushButton(self.widget)
        self.filename_button.setObjectName("filename_button")
        self.hboxlayout1.addWidget(self.filename_button)
        self.gridlayout1.addWidget(self.widget, 2, 1, 1, 1)
        self.verticalLayout1.addWidget(self.icon_layout)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.hboxlayout2 = QtWidgets.QHBoxLayout()
        self.hboxlayout2.setObjectName("hboxlayout2")
        self.template_name_label = QtWidgets.QLabel(self.wid1)
        self.template_name_label.setObjectName("template_name_label")
        self.hboxlayout2.addWidget(self.template_name_label)
        self.template_name = QtWidgets.QComboBox(self.wid1)
        self.template_name.setEditable(True)
        self.template_name.setObjectName("template_name")
        self.hboxlayout2.addWidget(self.template_name)
        self.gridLayout.addLayout(self.hboxlayout2, 0, 0, 1, 1)
        self.lowlayout = FlowLayout()
        self.lowlayout.setObjectName("lowlayout")
        self.label = QtWidgets.QLabel(self.wid1)
        self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
        self.label.setObjectName("label")
        self.lowlayout.addWidget(self.label)
        self.label1 = QtWidgets.QLabel(self.wid1)
        self.label1.setObjectName("label1")
        self.lowlayout.addWidget(self.label1)
        self.break_box = QtWidgets.QCheckBox(self.wid1)
        self.break_box.setObjectName("break_box")
        self.lowlayout.addWidget(self.break_box)
        self.eparator = Separator(self.wid1)
        self.eparator.setObjectName("eparator")
        self.lowlayout.addWidget(self.eparator)
        self.go_button = QtWidgets.QToolButton(self.wid1)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(I("sync-right.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.go_button.setIcon(icon1)
        self.go_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        self.go_button.setObjectName("go_button")
        self.lowlayout.addWidget(self.go_button)
        self.eparator1 = Separator(self.wid1)
        self.eparator1.setObjectName("eparator1")
        self.lowlayout.addWidget(self.eparator1)
        self.breakpoint_line_box_label = QtWidgets.QLabel(self.wid1)
        self.breakpoint_line_box_label.setObjectName("breakpoint_line_box_label")
        self.lowlayout.addWidget(self.breakpoint_line_box_label)
        self.breakpoint_line_box = QtWidgets.QSpinBox(self.wid1)
        self.breakpoint_line_box.setMinimum(1)
        self.breakpoint_line_box.setMaximum(999)
        self.breakpoint_line_box.setProperty("value", 1)
        self.breakpoint_line_box.setAlignment(QtCore.Qt.AlignRight)
        self.breakpoint_line_box.setObjectName("breakpoint_line_box")
        self.lowlayout.addWidget(self.breakpoint_line_box)
        self.toggle_button = QtWidgets.QToolButton(self.wid1)
        self.toggle_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(I("swap.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.toggle_button.setIcon(icon2)
        self.toggle_button.setObjectName("toggle_button")
        self.lowlayout.addWidget(self.toggle_button)
        self.eparator2 = Separator(self.wid1)
        self.eparator2.setObjectName("eparator2")
        self.lowlayout.addWidget(self.eparator2)
        self.remove_all_button = QtWidgets.QToolButton(self.wid1)
        self.remove_all_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(I("list_remove.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.remove_all_button.setIcon(icon3)
        self.remove_all_button.setObjectName("remove_all_button")
        self.lowlayout.addWidget(self.remove_all_button)
        self.set_all_button = QtWidgets.QToolButton(self.wid1)
        self.set_all_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(I("plus.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.set_all_button.setIcon(icon4)
        self.set_all_button.setObjectName("set_all_button")
        self.lowlayout.addWidget(self.set_all_button)
        self.gridLayout.addLayout(self.lowlayout, 1, 0, 1, 3)
        self.textbox = CodeEditor(self.wid1)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(1)
        sizePolicy.setHeightForWidth(self.textbox.sizePolicy().hasHeightForWidth())
        self.textbox.setSizePolicy(sizePolicy)
        self.textbox.setObjectName("textbox")
        self.gridLayout.addWidget(self.textbox, 2, 0, 1, 3)
        self.new_doc_label = QtWidgets.QLabel(self.wid1)
        self.new_doc_label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.new_doc_label.setObjectName("new_doc_label")
        self.gridLayout.addWidget(self.new_doc_label, 3, 0, 1, 1)
        self.new_doc = QtWidgets.QTextEdit(self.wid1)
        self.new_doc.setObjectName("new_doc")
        self.gridLayout.addWidget(self.new_doc, 4, 0, 1, 3)
        self.label2 = QtWidgets.QLabel(self.wid1)
        self.label2.setObjectName("label2")
        self.gridLayout.addWidget(self.label2, 7, 0, 1, 1)
        self.template_value = QtWidgets.QTableWidget(self.wid1)
        self.template_value.setObjectName("template_value")
        self.template_value.setColumnCount(0)
        self.template_value.setRowCount(0)
        self.gridLayout.addWidget(self.template_value, 8, 0, 1, 3)
        self.user_label_1 = QtWidgets.QLabel(self.wid1)
        self.user_label_1.setVisible(False)
        self.user_label_1.setObjectName("user_label_1")
        self.gridLayout.addWidget(self.user_label_1, 11, 0, 1, 1)
        self.user_layout_1 = BoxLayout()
        self.user_layout_1.setObjectName("user_layout_1")
        self.gridLayout.addLayout(self.user_layout_1, 11, 1, 1, 1)
        self.user_label_2 = QtWidgets.QLabel(self.wid1)
        self.user_label_2.setVisible(False)
        self.user_label_2.setObjectName("user_label_2")
        self.gridLayout.addWidget(self.user_label_2, 12, 0, 1, 1)
        self.user_layout_2 = BoxLayout()
        self.user_layout_2.setObjectName("user_layout_2")
        self.gridLayout.addLayout(self.user_layout_2, 12, 1, 1, 1)
        self.user_label_3 = QtWidgets.QLabel(self.wid1)
        self.user_label_3.setVisible(False)
        self.user_label_3.setObjectName("user_label_3")
        self.gridLayout.addWidget(self.user_label_3, 13, 0, 1, 1)
        self.user_layout_3 = BoxLayout()
        self.user_layout_3.setObjectName("user_layout_3")
        self.gridLayout.addLayout(self.user_layout_3, 13, 1, 1, 1)
        self.user_label_4 = QtWidgets.QLabel(self.wid1)
        self.user_label_4.setVisible(False)
        self.user_label_4.setObjectName("user_label_4")
        self.gridLayout.addWidget(self.user_label_4, 14, 0, 1, 1)
        self.user_layout_4 = BoxLayout()
        self.user_layout_4.setObjectName("user_layout_4")
        self.gridLayout.addLayout(self.user_layout_4, 14, 1, 1, 1)
        self.user_label_5 = QtWidgets.QLabel(self.wid1)
        self.user_label_5.setVisible(False)
        self.user_label_5.setObjectName("user_label_5")
        self.gridLayout.addWidget(self.user_label_5, 15, 0, 1, 1)
        self.user_layout_5 = BoxLayout()
        self.user_layout_5.setObjectName("user_layout_5")
        self.gridLayout.addLayout(self.user_layout_5, 15, 1, 1, 1)
        self.user_label_6 = QtWidgets.QLabel(self.wid1)
        self.user_label_6.setVisible(False)
        self.user_label_6.setObjectName("user_label_6")
        self.gridLayout.addWidget(self.user_label_6, 16, 0, 1, 1)
        self.user_layout_6 = BoxLayout()
        self.user_layout_6.setObjectName("user_layout_6")
        self.gridLayout.addLayout(self.user_layout_6, 16, 1, 1, 1)
        self.user_label_7 = QtWidgets.QLabel(self.wid1)
        self.user_label_7.setVisible(False)
        self.user_label_7.setObjectName("user_label_7")
        self.gridLayout.addWidget(self.user_label_7, 17, 0, 1, 1)
        self.user_layout_7 = BoxLayout()
        self.user_layout_7.setObjectName("user_layout_7")
        self.gridLayout.addLayout(self.user_layout_7, 17, 1, 1, 1)
        self.user_label_8 = QtWidgets.QLabel(self.wid1)
        self.user_label_8.setVisible(False)
        self.user_label_8.setObjectName("user_label_8")
        self.gridLayout.addWidget(self.user_label_8, 18, 0, 1, 1)
        self.user_layout_8 = BoxLayout()
        self.user_layout_8.setObjectName("user_layout_8")
        self.gridLayout.addLayout(self.user_layout_8, 18, 1, 1, 1)
        self.user_label_9 = QtWidgets.QLabel(self.wid1)
        self.user_label_9.setVisible(False)
        self.user_label_9.setObjectName("user_label_9")
        self.gridLayout.addWidget(self.user_label_9, 19, 0, 1, 1)
        self.hboxlayout3 = QtWidgets.QHBoxLayout()
        self.hboxlayout3.setObjectName("hboxlayout3")
        self.font_name_label = QtWidgets.QLabel(self.wid1)
        self.font_name_label.setObjectName("font_name_label")
        self.hboxlayout3.addWidget(self.font_name_label)
        self.font_box = QtWidgets.QFontComboBox(self.wid1)
        self.font_box.setObjectName("font_box")
        self.hboxlayout3.addWidget(self.font_box)
        self.font_size_label = QtWidgets.QLabel(self.wid1)
        self.font_size_label.setObjectName("font_size_label")
        self.hboxlayout3.addWidget(self.font_size_label)
        self.font_size_box = QtWidgets.QSpinBox(self.wid1)
        self.font_size_box.setObjectName("font_size_box")
        self.hboxlayout3.addWidget(self.font_size_box)
        self.frame = QtWidgets.QFrame(self.wid1)
        self.frame.setFrameShape(QtWidgets.QFrame.VLine)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setLineWidth(3)
        self.frame.setObjectName("frame")
        self.hboxlayout3.addWidget(self.frame)
        self.load_button = QtWidgets.QToolButton(self.wid1)
        self.load_button.setObjectName("load_button")
        self.hboxlayout3.addWidget(self.load_button)
        self.save_button = QtWidgets.QToolButton(self.wid1)
        self.save_button.setObjectName("save_button")
        self.hboxlayout3.addWidget(self.save_button)
        self.frame1 = QtWidgets.QFrame(self.wid1)
        self.frame1.setFrameShape(QtWidgets.QFrame.VLine)
        self.frame1.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame1.setLineWidth(3)
        self.frame1.setObjectName("frame1")
        self.hboxlayout3.addWidget(self.frame1)
        spacerItem = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.hboxlayout3.addItem(spacerItem)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.wid1)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.hboxlayout3.addWidget(self.buttonBox)
        self.gridLayout.addLayout(self.hboxlayout3, 24, 0, 1, 3)
        self.frame2 = QtWidgets.QFrame(self.wid1)
        self.frame2.setFrameShape(QtWidgets.QFrame.HLine)
        self.frame2.setObjectName("frame2")
        self.gridLayout.addWidget(self.frame2, 25, 0, 1, 3)
        self.gridlayout2 = QtWidgets.QGridLayout()
        self.gridlayout2.setObjectName("gridlayout2")
        self.label3 = QtWidgets.QLabel(self.wid1)
        self.label3.setObjectName("label3")
        self.gridlayout2.addWidget(self.label3, 0, 0, 1, 2)
        self.label4 = QtWidgets.QLabel(self.wid1)
        self.label4.setObjectName("label4")
        self.gridlayout2.addWidget(self.label4, 1, 0, 1, 1)
        self.function = QtWidgets.QComboBox(self.wid1)
        self.function.setObjectName("function")
        self.gridlayout2.addWidget(self.function, 1, 1, 1, 1)
        self.label_22 = QtWidgets.QLabel(self.wid1)
        self.label_22.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label_22.setObjectName("label_22")
        self.gridlayout2.addWidget(self.label_22, 2, 0, 1, 1)
        self.func_type = QtWidgets.QLineEdit(self.wid1)
        self.func_type.setReadOnly(True)
        self.func_type.setObjectName("func_type")
        self.gridlayout2.addWidget(self.func_type, 2, 1, 1, 1)
        self.label_2 = QtWidgets.QLabel(self.wid1)
        self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label_2.setObjectName("label_2")
        self.gridlayout2.addWidget(self.label_2, 3, 0, 1, 1)
        self.documentation = QtWidgets.QPlainTextEdit(self.wid1)
        self.documentation.setMaximumSize(QtCore.QSize(16777215, 75))
        self.documentation.setObjectName("documentation")
        self.gridlayout2.addWidget(self.documentation, 3, 1, 1, 1)
        self.label_3 = QtWidgets.QLabel(self.wid1)
        self.label_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.label_3.setObjectName("label_3")
        self.gridlayout2.addWidget(self.label_3, 4, 0, 1, 1)
        self.source_code = QtWidgets.QPlainTextEdit(self.wid1)
        self.source_code.setMaximumSize(QtCore.QSize(16777215, 75))
        self.source_code.setObjectName("source_code")
        self.gridlayout2.addWidget(self.source_code, 4, 1, 1, 1)
        self.gridLayout.addLayout(self.gridlayout2, 30, 0, 1, 3)
        self.template_tutorial = QtWidgets.QLabel(self.wid1)
        self.template_tutorial.setOpenExternalLinks(True)
        self.template_tutorial.setObjectName("template_tutorial")
        self.gridLayout.addWidget(self.template_tutorial, 27, 1, 1, 1)
        self.template_func_reference = QtWidgets.QLabel(self.wid1)
        self.template_func_reference.setOpenExternalLinks(True)
        self.template_func_reference.setObjectName("template_func_reference")
        self.gridLayout.addWidget(self.template_func_reference, 28, 1, 1, 1)
        self.verticalLayout1.addLayout(self.gridLayout)
        self.scroll_area.setWidget(self.wid1)
        self.verticalLayout.addWidget(self.scroll_area)
        self.colored_field_label.setBuddy(self.colored_field)
        self.color_chooser_label.setBuddy(self.color_name)
        self.icon_chooser_label.setBuddy(self.icon_field)
        self.image_chooser_label.setBuddy(self.color_name)
        self.template_name_label.setBuddy(self.template_name)
        self.label.setBuddy(self.textbox)
        self.eparator.setBuddy(self.go_button)
        self.eparator1.setBuddy(self.go_button)
        self.breakpoint_line_box_label.setBuddy(self.breakpoint_line_box)
        self.eparator2.setBuddy(self.go_button)
        self.new_doc_label.setBuddy(self.new_doc)
        self.label2.setBuddy(self.template_value)
        self.user_label_1.setBuddy(self.template_value)
        self.user_label_2.setBuddy(self.template_value)
        self.user_label_3.setBuddy(self.template_value)
        self.user_label_4.setBuddy(self.template_value)
        self.user_label_5.setBuddy(self.template_value)
        self.user_label_6.setBuddy(self.template_value)
        self.user_label_7.setBuddy(self.template_value)
        self.user_label_8.setBuddy(self.template_value)
        self.user_label_9.setBuddy(self.template_value)
        self.font_name_label.setBuddy(self.font_box)
        self.font_size_label.setBuddy(self.font_size_box)
        self.label4.setBuddy(self.function)
        self.label_22.setBuddy(self.func_type)
        self.label_2.setBuddy(self.documentation)
        self.label_3.setBuddy(self.source_code)

        self.retranslateUi(TemplateDialog)
        self.buttonBox.accepted.connect(TemplateDialog.accept)
        self.buttonBox.rejected.connect(TemplateDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(TemplateDialog)

    def retranslateUi(self, TemplateDialog):

        TemplateDialog.setWindowTitle(_("Edit template"))
        self.colored_field_label.setText(_("Set the color of the column:"))
        self.color_chooser_label.setText(_("Copy a color name to the clipboard:"))
        self.color_copy_button.setToolTip(_("Copy the selected color name to the clipboard"))
        self.icon_kind_label.setText(_("Kind:"))
        self.icon_chooser_label.setText(_("Apply the icon to column:"))
        self.image_chooser_label.setText(_("Copy an icon file name to the clipboard:"))
        self.icon_copy_button.setToolTip(_("Copy the selected icon file name to the clipboard"))
        self.filename_button.setText(_("Add icon"))
        self.filename_button.setToolTip(_("Add an icon file to the set of choices"))
        self.template_name_label.setText(_("Template &name:"))
        self.template_name.setToolTip(_("The name of the callable template"))
        self.label.setText(_("T&emplate:"))
        self.label.setToolTip(_("The text of the template program goes into the box below"))
        self.label1.setText(_("        "))
        self.break_box.setText(_("Enable &breakpoints"))
        self.break_box.setToolTip(_("<p>If checked, the template evaluator will stop when it\n"
"evaluates an expression on a double-clicked line number, opening a dialog showing\n"
"you the value as well as all the local variables</p>"))
        self.go_button.setText(_("&Go"))
        self.go_button.setToolTip(_("If \'Enable breakpoints\' is checked then click this button to run your template"))
        self.breakpoint_line_box_label.setText(_("&Line:"))
        self.breakpoint_line_box_label.setToolTip(_("Line number to toggle"))
        self.breakpoint_line_box.setToolTip(_("Line number to toggle"))
        self.toggle_button.setText(_("&Toggle"))
        self.toggle_button.setToolTip(_("Toggle the breakpoint on the line number in the box"))
        self.remove_all_button.setText(_("&Remove all"))
        self.remove_all_button.setToolTip(_("Remove all breakpoints"))
        self.set_all_button.setText(_("&Set all"))
        self.set_all_button.setToolTip(_("Set breakpoint on every line"))
        self.textbox.setToolTip(_("<p>The text of the template program goes in this box.\n"
"            Don\'t forget that a General Program Mode template must begin with\n"
"            the word \"program:\".</p>"))
        self.new_doc_label.setText(_("D&ocumentation:"))
        self.new_doc.setToolTip(_("Documentation for the function being defined or edited"))
        self.label2.setText(_("Template value:"))
        self.label2.setToolTip(_("The value of the template using the current book in the library view"))
        self.user_label_1.setText(_("User label"))
        self.user_label_2.setText(_("User label"))
        self.user_label_3.setText(_("User label"))
        self.user_label_4.setText(_("User label"))
        self.user_label_5.setText(_("User label"))
        self.user_label_6.setText(_("User label"))
        self.user_label_7.setText(_("User label"))
        self.user_label_8.setText(_("User label"))
        self.user_label_9.setText(_("User label"))
        self.font_name_label.setText(_("Font:"))
        self.font_box.setToolTip(_("Select the font for the Template box"))
        self.font_size_label.setText(_("Size:"))
        self.font_size_box.setToolTip(_("Select the font size for the Template box"))
        self.load_button.setText(_("Lo&ad"))
        self.load_button.setToolTip(_("Load the template from a file"))
        self.save_button.setText(_("Sa&ve"))
        self.save_button.setToolTip(_("Save the template in a file"))
        self.label3.setText(_("Template Function Reference"))
        self.label4.setText(_("Function &name:"))
        self.label_22.setText(_("&Function type:"))
        self.label_2.setText(_("&Documentation:"))
        self.label_3.setText(_("&Code:"))
Ejemplo n.º 6
0
    def setupUi(self, TemplateDialog):
        TemplateDialog.setObjectName("TemplateDialog")
        TemplateDialog.resize(588, 546)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            TemplateDialog.sizePolicy().hasHeightForWidth())
        TemplateDialog.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(TemplateDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.color_layout = QtWidgets.QWidget(TemplateDialog)
        self.color_layout.setObjectName("color_layout")
        self.gridlayout = QtWidgets.QGridLayout(self.color_layout)
        self.gridlayout.setContentsMargins(0, 0, 0, 0)
        self.gridlayout.setObjectName("gridlayout")
        self.colored_field_label = QtWidgets.QLabel(self.color_layout)
        self.colored_field_label.setObjectName("colored_field_label")
        self.gridlayout.addWidget(self.colored_field_label, 0, 0, 1, 1)
        self.colored_field = QtWidgets.QComboBox(self.color_layout)
        self.colored_field.setObjectName("colored_field")
        self.gridlayout.addWidget(self.colored_field, 0, 1, 1, 1)
        self.color_chooser_label = QtWidgets.QLabel(self.color_layout)
        self.color_chooser_label.setObjectName("color_chooser_label")
        self.gridlayout.addWidget(self.color_chooser_label, 1, 0, 1, 1)
        self.color_name = ColorButton(self.color_layout)
        self.color_name.setObjectName("color_name")
        self.gridlayout.addWidget(self.color_name, 1, 1, 1, 1)
        self.color_copy_button = QtWidgets.QToolButton(self.color_layout)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(I("edit-copy.png")), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        self.color_copy_button.setIcon(icon)
        self.color_copy_button.setObjectName("color_copy_button")
        self.gridlayout.addWidget(self.color_copy_button, 1, 2, 1, 1)
        self.verticalLayout.addWidget(self.color_layout)
        self.icon_layout = QtWidgets.QWidget(TemplateDialog)
        self.icon_layout.setObjectName("icon_layout")
        self.gridlayout1 = QtWidgets.QGridLayout(self.icon_layout)
        self.gridlayout1.setContentsMargins(0, 0, 0, 0)
        self.gridlayout1.setObjectName("gridlayout1")
        self.hboxlayout = QtWidgets.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")
        self.icon_kind_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_kind_label.setObjectName("icon_kind_label")
        self.hboxlayout.addWidget(self.icon_kind_label)
        self.icon_kind = QtWidgets.QComboBox(self.icon_layout)
        self.icon_kind.setObjectName("icon_kind")
        self.hboxlayout.addWidget(self.icon_kind)
        self.gridlayout1.addLayout(self.hboxlayout, 0, 0, 1, 2)
        self.icon_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_chooser_label.setObjectName("icon_chooser_label")
        self.gridlayout1.addWidget(self.icon_chooser_label, 1, 0, 1, 1)
        self.icon_field = QtWidgets.QComboBox(self.icon_layout)
        self.icon_field.setObjectName("icon_field")
        self.gridlayout1.addWidget(self.icon_field, 1, 1, 1, 1)
        self.image_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.image_chooser_label.setObjectName("image_chooser_label")
        self.gridlayout1.addWidget(self.image_chooser_label, 2, 0, 1, 1)
        self.widget = QtWidgets.QWidget(self.icon_layout)
        self.widget.setObjectName("widget")
        self.hboxlayout1 = QtWidgets.QHBoxLayout(self.widget)
        self.hboxlayout1.setContentsMargins(0, 0, 0, 0)
        self.hboxlayout1.setObjectName("hboxlayout1")
        self.icon_files = QtWidgets.QComboBox(self.widget)
        self.icon_files.setObjectName("icon_files")
        self.hboxlayout1.addWidget(self.icon_files)
        self.icon_copy_button = QtWidgets.QToolButton(self.widget)
        self.icon_copy_button.setIcon(icon)
        self.icon_copy_button.setObjectName("icon_copy_button")
        self.hboxlayout1.addWidget(self.icon_copy_button)
        self.filename_button = QtWidgets.QPushButton(self.widget)
        self.filename_button.setObjectName("filename_button")
        self.hboxlayout1.addWidget(self.filename_button)
        self.gridlayout1.addWidget(self.widget, 2, 1, 1, 1)
        self.verticalLayout.addWidget(self.icon_layout)
        self.textbox = QtWidgets.QPlainTextEdit(TemplateDialog)
        self.textbox.setObjectName("textbox")
        self.verticalLayout.addWidget(self.textbox)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(TemplateDialog)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 5, 0, 1, 1)
        self.template_value = QtWidgets.QLineEdit(TemplateDialog)
        self.template_value.setReadOnly(True)
        self.template_value.setObjectName("template_value")
        self.gridLayout.addWidget(self.template_value, 5, 1, 1, 1)
        self.label1 = QtWidgets.QLabel(TemplateDialog)
        self.label1.setObjectName("label1")
        self.gridLayout.addWidget(self.label1, 6, 0, 1, 1)
        self.gridLayout1 = QtWidgets.QGridLayout()
        self.gridLayout1.setObjectName("gridLayout1")
        self.font_size_box = QtWidgets.QSpinBox(TemplateDialog)
        self.font_size_box.setObjectName("font_size_box")
        self.gridLayout1.addWidget(self.font_size_box, 1, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(0, 0,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.gridLayout1.addItem(spacerItem, 1, 1, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(TemplateDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                          | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout1.addWidget(self.buttonBox, 1, 2, 1, 1)
        self.gridLayout.addLayout(self.gridLayout1, 6, 1, 1, 1)
        self.frame = QtWidgets.QFrame(TemplateDialog)
        self.frame.setFrameShape(QtWidgets.QFrame.HLine)
        self.frame.setObjectName("frame")
        self.gridLayout.addWidget(self.frame, 7, 0, 1, 2)
        self.label2 = QtWidgets.QLabel(TemplateDialog)
        self.label2.setObjectName("label2")
        self.gridLayout.addWidget(self.label2, 8, 0, 1, 1)
        self.function = QtWidgets.QComboBox(TemplateDialog)
        self.function.setObjectName("function")
        self.gridLayout.addWidget(self.function, 8, 1, 1, 1)
        self.label_2 = QtWidgets.QLabel(TemplateDialog)
        self.label_2.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                  | QtCore.Qt.AlignTop)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 9, 0, 1, 1)
        self.label_3 = QtWidgets.QLabel(TemplateDialog)
        self.label_3.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                  | QtCore.Qt.AlignTop)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 10, 0, 1, 1)
        self.documentation = QtWidgets.QPlainTextEdit(TemplateDialog)
        self.documentation.setMaximumSize(QtCore.QSize(16777215, 75))
        self.documentation.setObjectName("documentation")
        self.gridLayout.addWidget(self.documentation, 9, 1, 1, 1)
        self.source_code = QtWidgets.QPlainTextEdit(TemplateDialog)
        self.source_code.setObjectName("source_code")
        self.gridLayout.addWidget(self.source_code, 10, 1, 1, 1)
        self.template_tutorial = QtWidgets.QLabel(TemplateDialog)
        self.template_tutorial.setOpenExternalLinks(True)
        self.template_tutorial.setObjectName("template_tutorial")
        self.gridLayout.addWidget(self.template_tutorial, 11, 1, 1, 1)
        self.template_func_reference = QtWidgets.QLabel(TemplateDialog)
        self.template_func_reference.setOpenExternalLinks(True)
        self.template_func_reference.setObjectName("template_func_reference")
        self.gridLayout.addWidget(self.template_func_reference, 12, 1, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.colored_field_label.setBuddy(self.colored_field)
        self.color_chooser_label.setBuddy(self.color_name)
        self.icon_chooser_label.setBuddy(self.icon_field)
        self.image_chooser_label.setBuddy(self.color_name)
        self.label.setBuddy(self.template_value)
        self.label2.setBuddy(self.function)
        self.label_2.setBuddy(self.documentation)
        self.label_3.setBuddy(self.source_code)

        self.retranslateUi(TemplateDialog)
        self.buttonBox.accepted.connect(TemplateDialog.accept)
        self.buttonBox.rejected.connect(TemplateDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(TemplateDialog)
Ejemplo n.º 7
0
    def setupUi(self, TemplateDialog):
        TemplateDialog.setObjectName("TemplateDialog")
        TemplateDialog.resize(588, 546)
        sizePolicy = QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.MinimumExpanding,
            QtWidgets.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            TemplateDialog.sizePolicy().hasHeightForWidth())
        TemplateDialog.setSizePolicy(sizePolicy)
        self.verticalLayout = QtWidgets.QVBoxLayout(TemplateDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.scroll_area = QtWidgets.QScrollArea(TemplateDialog)
        self.scroll_area.setWidgetResizable(True)
        self.scroll_area.setObjectName("scroll_area")
        self.wid1 = QtWidgets.QWidget()
        self.wid1.setObjectName("wid1")
        self.verticalLayout1 = QtWidgets.QVBoxLayout(self.wid1)
        self.verticalLayout1.setObjectName("verticalLayout1")
        self.color_layout = QtWidgets.QWidget(self.wid1)
        self.color_layout.setObjectName("color_layout")
        self.gridlayout = QtWidgets.QGridLayout(self.color_layout)
        self.gridlayout.setObjectName("gridlayout")
        self.colored_field_label = QtWidgets.QLabel(self.color_layout)
        self.colored_field_label.setObjectName("colored_field_label")
        self.gridlayout.addWidget(self.colored_field_label, 0, 0, 1, 1)
        self.colored_field = QtWidgets.QComboBox(self.color_layout)
        self.colored_field.setObjectName("colored_field")
        self.gridlayout.addWidget(self.colored_field, 0, 1, 1, 1)
        self.color_chooser_label = QtWidgets.QLabel(self.color_layout)
        self.color_chooser_label.setObjectName("color_chooser_label")
        self.gridlayout.addWidget(self.color_chooser_label, 1, 0, 1, 1)
        self.color_name = ColorButton(self.color_layout)
        self.color_name.setObjectName("color_name")
        self.gridlayout.addWidget(self.color_name, 1, 1, 1, 1)
        self.color_copy_button = QtWidgets.QToolButton(self.color_layout)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(I("edit-copy.png")), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        self.color_copy_button.setIcon(icon)
        self.color_copy_button.setObjectName("color_copy_button")
        self.gridlayout.addWidget(self.color_copy_button, 1, 2, 1, 1)
        self.verticalLayout1.addWidget(self.color_layout)
        self.icon_layout = QtWidgets.QWidget(self.wid1)
        self.icon_layout.setObjectName("icon_layout")
        self.gridlayout1 = QtWidgets.QGridLayout(self.icon_layout)
        self.gridlayout1.setObjectName("gridlayout1")
        self.hboxlayout = QtWidgets.QHBoxLayout()
        self.hboxlayout.setObjectName("hboxlayout")
        self.icon_kind_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_kind_label.setObjectName("icon_kind_label")
        self.hboxlayout.addWidget(self.icon_kind_label)
        self.icon_kind = QtWidgets.QComboBox(self.icon_layout)
        self.icon_kind.setObjectName("icon_kind")
        self.hboxlayout.addWidget(self.icon_kind)
        self.gridlayout1.addLayout(self.hboxlayout, 0, 0, 1, 2)
        self.icon_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.icon_chooser_label.setObjectName("icon_chooser_label")
        self.gridlayout1.addWidget(self.icon_chooser_label, 1, 0, 1, 1)
        self.icon_field = QtWidgets.QComboBox(self.icon_layout)
        self.icon_field.setObjectName("icon_field")
        self.gridlayout1.addWidget(self.icon_field, 1, 1, 1, 1)
        self.image_chooser_label = QtWidgets.QLabel(self.icon_layout)
        self.image_chooser_label.setObjectName("image_chooser_label")
        self.gridlayout1.addWidget(self.image_chooser_label, 2, 0, 1, 1)
        self.widget = QtWidgets.QWidget(self.icon_layout)
        self.widget.setObjectName("widget")
        self.hboxlayout1 = QtWidgets.QHBoxLayout(self.widget)
        self.hboxlayout1.setObjectName("hboxlayout1")
        self.icon_files = QtWidgets.QComboBox(self.widget)
        self.icon_files.setObjectName("icon_files")
        self.hboxlayout1.addWidget(self.icon_files)
        self.icon_copy_button = QtWidgets.QToolButton(self.widget)
        self.icon_copy_button.setIcon(icon)
        self.icon_copy_button.setObjectName("icon_copy_button")
        self.hboxlayout1.addWidget(self.icon_copy_button)
        self.filename_button = QtWidgets.QPushButton(self.widget)
        self.filename_button.setObjectName("filename_button")
        self.hboxlayout1.addWidget(self.filename_button)
        self.gridlayout1.addWidget(self.widget, 2, 1, 1, 1)
        self.verticalLayout1.addWidget(self.icon_layout)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.template_name_label = QtWidgets.QLabel(self.wid1)
        self.template_name_label.setObjectName("template_name_label")
        self.gridLayout.addWidget(self.template_name_label, 0, 0, 1, 1)
        self.template_name = QtWidgets.QComboBox(self.wid1)
        self.template_name.setEditable(True)
        self.template_name.setObjectName("template_name")
        self.gridLayout.addWidget(self.template_name, 0, 1, 1, 1)
        self.label = QtWidgets.QLabel(self.wid1)
        self.label.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                | QtCore.Qt.AlignTop)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
        self.textbox = QtWidgets.QPlainTextEdit(self.wid1)
        self.textbox.setObjectName("textbox")
        self.gridLayout.addWidget(self.textbox, 1, 1, 1, 1)
        self.new_doc_label = QtWidgets.QLabel(self.wid1)
        self.new_doc_label.setAlignment(QtCore.Qt.AlignLeading
                                        | QtCore.Qt.AlignLeft
                                        | QtCore.Qt.AlignTop)
        self.new_doc_label.setObjectName("new_doc_label")
        self.gridLayout.addWidget(self.new_doc_label, 3, 0, 1, 1)
        self.new_doc = QtWidgets.QTextEdit(self.wid1)
        self.new_doc.setObjectName("new_doc")
        self.gridLayout.addWidget(self.new_doc, 3, 1, 1, 1)
        self.label1 = QtWidgets.QLabel(self.wid1)
        self.label1.setObjectName("label1")
        self.gridLayout.addWidget(self.label1, 5, 0, 1, 1)
        self.template_value = QtWidgets.QLineEdit(self.wid1)
        self.template_value.setReadOnly(True)
        self.template_value.setObjectName("template_value")
        self.gridLayout.addWidget(self.template_value, 5, 1, 1, 1)
        self.user_label_1 = QtWidgets.QLabel(self.wid1)
        self.user_label_1.setVisible(False)
        self.user_label_1.setObjectName("user_label_1")
        self.gridLayout.addWidget(self.user_label_1, 11, 0, 1, 1)
        self.user_layout_1 = BoxLayout()
        self.user_layout_1.setObjectName("user_layout_1")
        self.gridLayout.addLayout(self.user_layout_1, 11, 1, 1, 1)
        self.user_label_2 = QtWidgets.QLabel(self.wid1)
        self.user_label_2.setVisible(False)
        self.user_label_2.setObjectName("user_label_2")
        self.gridLayout.addWidget(self.user_label_2, 12, 0, 1, 1)
        self.user_layout_2 = BoxLayout()
        self.user_layout_2.setObjectName("user_layout_2")
        self.gridLayout.addLayout(self.user_layout_2, 12, 1, 1, 1)
        self.user_label_3 = QtWidgets.QLabel(self.wid1)
        self.user_label_3.setVisible(False)
        self.user_label_3.setObjectName("user_label_3")
        self.gridLayout.addWidget(self.user_label_3, 13, 0, 1, 1)
        self.user_layout_3 = BoxLayout()
        self.user_layout_3.setObjectName("user_layout_3")
        self.gridLayout.addLayout(self.user_layout_3, 13, 1, 1, 1)
        self.user_label_4 = QtWidgets.QLabel(self.wid1)
        self.user_label_4.setVisible(False)
        self.user_label_4.setObjectName("user_label_4")
        self.gridLayout.addWidget(self.user_label_4, 14, 0, 1, 1)
        self.user_layout_4 = BoxLayout()
        self.user_layout_4.setObjectName("user_layout_4")
        self.gridLayout.addLayout(self.user_layout_4, 14, 1, 1, 1)
        self.user_label_5 = QtWidgets.QLabel(self.wid1)
        self.user_label_5.setVisible(False)
        self.user_label_5.setObjectName("user_label_5")
        self.gridLayout.addWidget(self.user_label_5, 15, 0, 1, 1)
        self.user_layout_5 = BoxLayout()
        self.user_layout_5.setObjectName("user_layout_5")
        self.gridLayout.addLayout(self.user_layout_5, 15, 1, 1, 1)
        self.user_label_6 = QtWidgets.QLabel(self.wid1)
        self.user_label_6.setVisible(False)
        self.user_label_6.setObjectName("user_label_6")
        self.gridLayout.addWidget(self.user_label_6, 16, 0, 1, 1)
        self.user_layout_6 = BoxLayout()
        self.user_layout_6.setObjectName("user_layout_6")
        self.gridLayout.addLayout(self.user_layout_6, 16, 1, 1, 1)
        self.user_label_7 = QtWidgets.QLabel(self.wid1)
        self.user_label_7.setVisible(False)
        self.user_label_7.setObjectName("user_label_7")
        self.gridLayout.addWidget(self.user_label_7, 17, 0, 1, 1)
        self.user_layout_7 = BoxLayout()
        self.user_layout_7.setObjectName("user_layout_7")
        self.gridLayout.addLayout(self.user_layout_7, 17, 1, 1, 1)
        self.user_label_8 = QtWidgets.QLabel(self.wid1)
        self.user_label_8.setVisible(False)
        self.user_label_8.setObjectName("user_label_8")
        self.gridLayout.addWidget(self.user_label_8, 18, 0, 1, 1)
        self.user_layout_8 = BoxLayout()
        self.user_layout_8.setObjectName("user_layout_8")
        self.gridLayout.addLayout(self.user_layout_8, 18, 1, 1, 1)
        self.user_label_9 = QtWidgets.QLabel(self.wid1)
        self.user_label_9.setVisible(False)
        self.user_label_9.setObjectName("user_label_9")
        self.gridLayout.addWidget(self.user_label_9, 19, 0, 1, 1)
        self.user_layout_9 = BoxLayout()
        self.user_layout_9.setObjectName("user_layout_9")
        self.gridLayout.addLayout(self.user_layout_9, 19, 1, 1, 1)
        self.label2 = QtWidgets.QLabel(self.wid1)
        self.label2.setObjectName("label2")
        self.gridLayout.addWidget(self.label2, 20, 0, 1, 1)
        self.gridLayout1 = QtWidgets.QGridLayout()
        self.gridLayout1.setObjectName("gridLayout1")
        self.font_size_box = QtWidgets.QSpinBox(self.wid1)
        self.font_size_box.setObjectName("font_size_box")
        self.gridLayout1.addWidget(self.font_size_box, 1, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(0, 0,
                                           QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Minimum)
        self.gridLayout1.addItem(spacerItem, 1, 1, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.wid1)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                          | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout1.addWidget(self.buttonBox, 1, 2, 1, 1)
        self.gridLayout.addLayout(self.gridLayout1, 20, 1, 1, 3)
        self.frame = QtWidgets.QFrame(self.wid1)
        self.frame.setFrameShape(QtWidgets.QFrame.HLine)
        self.frame.setObjectName("frame")
        self.gridLayout.addWidget(self.frame, 21, 0, 1, 5)
        self.label3 = QtWidgets.QLabel(self.wid1)
        self.label3.setObjectName("label3")
        self.gridLayout.addWidget(self.label3, 22, 0, 1, 2)
        self.label4 = QtWidgets.QLabel(self.wid1)
        self.label4.setObjectName("label4")
        self.gridLayout.addWidget(self.label4, 23, 0, 1, 1)
        self.function = QtWidgets.QComboBox(self.wid1)
        self.function.setObjectName("function")
        self.gridLayout.addWidget(self.function, 23, 1, 1, 3)
        self.label_22 = QtWidgets.QLabel(self.wid1)
        self.label_22.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                   | QtCore.Qt.AlignTop)
        self.label_22.setObjectName("label_22")
        self.gridLayout.addWidget(self.label_22, 24, 0, 1, 1)
        self.func_type = QtWidgets.QLineEdit(self.wid1)
        self.func_type.setReadOnly(True)
        self.func_type.setObjectName("func_type")
        self.gridLayout.addWidget(self.func_type, 24, 1, 1, 3)
        self.label_2 = QtWidgets.QLabel(self.wid1)
        self.label_2.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                  | QtCore.Qt.AlignTop)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 25, 0, 1, 1)
        self.label_3 = QtWidgets.QLabel(self.wid1)
        self.label_3.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft
                                  | QtCore.Qt.AlignTop)
        self.label_3.setObjectName("label_3")
        self.gridLayout.addWidget(self.label_3, 26, 0, 1, 1)
        self.documentation = QtWidgets.QPlainTextEdit(self.wid1)
        self.documentation.setMaximumSize(QtCore.QSize(16777215, 75))
        self.documentation.setObjectName("documentation")
        self.gridLayout.addWidget(self.documentation, 25, 1, 1, 3)
        self.source_code = QtWidgets.QPlainTextEdit(self.wid1)
        self.source_code.setMaximumSize(QtCore.QSize(16777215, 75))
        self.source_code.setObjectName("source_code")
        self.gridLayout.addWidget(self.source_code, 26, 1, 1, 3)
        self.template_tutorial = QtWidgets.QLabel(self.wid1)
        self.template_tutorial.setOpenExternalLinks(True)
        self.template_tutorial.setObjectName("template_tutorial")
        self.gridLayout.addWidget(self.template_tutorial, 27, 1, 1, 1)
        self.template_func_reference = QtWidgets.QLabel(self.wid1)
        self.template_func_reference.setOpenExternalLinks(True)
        self.template_func_reference.setObjectName("template_func_reference")
        self.gridLayout.addWidget(self.template_func_reference, 28, 1, 1, 1)
        self.verticalLayout1.addLayout(self.gridLayout)
        self.scroll_area.setWidget(self.wid1)
        self.verticalLayout.addWidget(self.scroll_area)
        self.colored_field_label.setBuddy(self.colored_field)
        self.color_chooser_label.setBuddy(self.color_name)
        self.icon_chooser_label.setBuddy(self.icon_field)
        self.image_chooser_label.setBuddy(self.color_name)
        self.template_name_label.setBuddy(self.template_name)
        self.label.setBuddy(self.textbox)
        self.new_doc_label.setBuddy(self.new_doc)
        self.label1.setBuddy(self.template_value)
        self.user_label_1.setBuddy(self.template_value)
        self.user_label_2.setBuddy(self.template_value)
        self.user_label_3.setBuddy(self.template_value)
        self.user_label_4.setBuddy(self.template_value)
        self.user_label_5.setBuddy(self.template_value)
        self.user_label_6.setBuddy(self.template_value)
        self.user_label_7.setBuddy(self.template_value)
        self.user_label_8.setBuddy(self.template_value)
        self.user_label_9.setBuddy(self.template_value)
        self.label3.setBuddy(self.function)
        self.label4.setBuddy(self.function)
        self.label_22.setBuddy(self.func_type)
        self.label_2.setBuddy(self.documentation)
        self.label_3.setBuddy(self.source_code)

        self.retranslateUi(TemplateDialog)
        self.buttonBox.accepted.connect(TemplateDialog.accept)
        self.buttonBox.rejected.connect(TemplateDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(TemplateDialog)
Ejemplo n.º 8
0
    def __init__(self, fm, pref_name, parent=None):
        QDialog.__init__(self, parent)
        self.fm = fm

        if pref_name == 'column_color_rules':
            self.rule_kind = 'color'
            rule_text = _('coloring')
        else:
            self.rule_kind = 'icon'
            rule_text = _('icon')

        self.setWindowIcon(QIcon(I('format-fill-color.png')))
        self.setWindowTitle(
            _('Create/edit a column {0} rule').format(rule_text))

        self.l = l = QGridLayout(self)
        self.setLayout(l)

        self.l1 = l1 = QLabel(
            _('Create a column {0} rule by'
              ' filling in the boxes below'.format(rule_text)))
        l.addWidget(l1, 0, 0, 1, 8)

        self.f1 = QFrame(self)
        self.f1.setFrameShape(QFrame.HLine)
        l.addWidget(self.f1, 1, 0, 1, 8)

        self.l2 = l2 = QLabel(_('Set the'))
        l.addWidget(l2, 2, 0)

        if self.rule_kind == 'color':
            l.addWidget(QLabel(_('color')))
        else:
            self.kind_box = QComboBox(self)
            for tt, t in icon_rule_kinds:
                self.kind_box.addItem(tt, t)
            l.addWidget(self.kind_box, 2, 1)
            self.kind_box.setToolTip(
                textwrap.fill(
                    _('If you choose composed icons and multiple rules match, then all the'
                      ' matching icons will be combined, otherwise the icon from the'
                      ' first rule to match will be used.')))

        self.l3 = l3 = QLabel(_('of the column:'))
        l.addWidget(l3, 2, 2)

        self.column_box = QComboBox(self)
        l.addWidget(self.column_box, 2, 3)

        self.l4 = l4 = QLabel(_('to'))
        l.addWidget(l4, 2, 4)

        if self.rule_kind == 'color':
            self.color_box = ColorButton(parent=self)
            self.color_label = QLabel('Sample text Sample text')
            self.color_label.setTextFormat(Qt.RichText)
            l.addWidget(self.color_box, 2, 5)
            l.addWidget(self.color_label, 2, 6)
            l.addItem(QSpacerItem(10, 10, QSizePolicy.Expanding), 2, 7)
        else:
            self.filename_box = QComboBox()
            d = os.path.join(config_dir, 'cc_icons')
            self.icon_file_names = []
            if os.path.exists(d):
                for icon_file in os.listdir(d):
                    icon_file = lower(icon_file)
                    if os.path.exists(os.path.join(d, icon_file)):
                        if icon_file.endswith('.png'):
                            self.icon_file_names.append(icon_file)
            self.icon_file_names.sort(key=sort_key)

            vb = QVBoxLayout()
            self.multiple_icon_cb = QCheckBox(_('Choose more than one icon'))
            vb.addWidget(self.multiple_icon_cb)
            self.update_filename_box()
            self.multiple_icon_cb.clicked.connect(self.multiple_box_clicked)
            vb.addWidget(self.filename_box)
            l.addLayout(vb, 2, 5)

            self.filename_button = QPushButton(QIcon(I('document_open.png')),
                                               _('&Add icon'))
            l.addWidget(self.filename_button, 2, 6)
            l.addWidget(QLabel(_('Icons should be square or landscape')), 2, 7)
            l.setColumnStretch(7, 10)

        self.l5 = l5 = QLabel(
            _('Only if the following conditions are all satisfied:'))
        l.addWidget(l5, 3, 0, 1, 7)

        self.scroll_area = sa = QScrollArea(self)
        sa.setMinimumHeight(300)
        sa.setMinimumWidth(950)
        sa.setWidgetResizable(True)
        l.addWidget(sa, 4, 0, 1, 8)

        self.add_button = b = QPushButton(QIcon(I('plus.png')),
                                          _('Add another condition'))
        l.addWidget(b, 5, 0, 1, 8)
        b.clicked.connect(self.add_blank_condition)

        self.l6 = l6 = QLabel(
            _('You can disable a condition by'
              ' blanking all of its boxes'))
        l.addWidget(l6, 6, 0, 1, 8)

        self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok
                                        | QDialogButtonBox.Cancel)
        bb.accepted.connect(self.accept)
        bb.rejected.connect(self.reject)
        l.addWidget(bb, 7, 0, 1, 8)

        self.conditions_widget = QWidget(self)
        sa.setWidget(self.conditions_widget)
        self.conditions_widget.setLayout(QVBoxLayout())
        self.conditions_widget.layout().setAlignment(Qt.AlignTop)
        self.conditions = []

        if self.rule_kind == 'color':
            for b in (self.column_box, ):
                b.setSizeAdjustPolicy(b.AdjustToMinimumContentsLengthWithIcon)
                b.setMinimumContentsLength(15)

        for key in sorted(displayable_columns(fm),
                          key=lambda (k): sort_key(fm[k]['name'])
                          if k != color_row_key else 0):
            if key == color_row_key and self.rule_kind != 'color':
                continue
            name = all_columns_string if key == color_row_key else fm[key][
                'name']
            if name:
                self.column_box.addItem(name, key)
        self.column_box.setCurrentIndex(0)

        if self.rule_kind == 'color':
            self.color_box.color = '#000'
            self.update_color_label()
            self.color_box.color_changed.connect(self.update_color_label)
        else:
            self.rule_icon_files = []
            self.filename_button.clicked.connect(self.filename_button_clicked)

        self.resize(self.sizeHint())