示例#1
0
    def init_table_styling_option(self):
        cb = self.create_checkbox(
            const.STYLE_TABLE, None,
            self.c.get(const.CONFIG_LABELS, "table_styling_label"))
        utility.set_tool_tip(
            cb, self.c.get(const.CONFIG_TOOLTIPS, "table_styling_tooltip"))

        return self.put_elems_in_box((cb, ), const.HBOX, const.WIDGET)
示例#2
0
    def init_table_styling_option(self):
        cb = self.create_checkbox(const.STYLE_TABLE,
                                  None,
                                  self.c.get(const.CONFIG_LABELS,
                                             "table_styling_label"))
        utility.set_tool_tip(cb, self.c.get(const.CONFIG_TOOLTIPS,
                                            "table_styling_tooltip"))

        return self.put_elems_in_box((cb,), const.HBOX, const.WIDGET)
示例#3
0
    def markdown_skip_warning_option(self):
        cb = self.create_checkbox(const.MARKDOWN_ALWAYS_REVERT,
                                  None,
                                  self.c.get(const.CONFIG_LABELS,
                                             "automatic_revert_cb_label"))
        utility.set_tool_tip(cb, self.c.get(const.CONFIG_TOOLTIPS,
                                            "automatic_revert_cb_tooltip"))

        return self.put_elems_in_box((cb,), const.HBOX, const.WIDGET)
示例#4
0
    def markdown_skip_warning_option(self):
        cb = self.create_checkbox(
            const.MARKDOWN_ALWAYS_REVERT, None,
            self.c.get(const.CONFIG_LABELS, "automatic_revert_cb_label"))
        utility.set_tool_tip(
            cb, self.c.get(const.CONFIG_TOOLTIPS,
                           "automatic_revert_cb_tooltip"))

        return self.put_elems_in_box((cb, ), const.HBOX, const.WIDGET)
示例#5
0
    def init_code_css_class(self):
        label = QtGui.QLabel(
            self.c.get(const.CONFIG_LABELS, "code_pre_label"), self)
        utility.set_tool_tip(label, self.c.get(const.CONFIG_TOOLTIPS,
                                               "code_pre_tooltip"))
        text = QtGui.QLineEdit(preferences.PREFS.get(const.CODE_CLASS), self)
        text.editingFinished.connect(
                lambda: self.value_comparison_event_handler(
                    const.CODE_CLASS, text.text()))

        return self.put_elems_in_box((label, text), const.HBOX, const.WIDGET)
示例#6
0
    def init_code_css_class(self):
        label = QtGui.QLabel(self.c.get(const.CONFIG_LABELS, "code_pre_label"),
                             self)
        utility.set_tool_tip(
            label, self.c.get(const.CONFIG_TOOLTIPS, "code_pre_tooltip"))
        text = QtGui.QLineEdit(preferences.PREFS.get(const.CODE_CLASS), self)
        text.editingFinished.connect(
            lambda: self.value_comparison_event_handler(
                const.CODE_CLASS, text.text()))

        return self.put_elems_in_box((label, text), const.HBOX, const.WIDGET)
示例#7
0
    def override_disabled_buttons_rendered_markdown(self):
        """
        Create a checkbox that controls whether or not to allow editing when
        the Markdown is rendered.
        """
        cb = self.create_checkbox(const.MARKDOWN_OVERRIDE_EDITING,
                                  None,
                                  self.c.get(const.CONFIG_LABELS,
                                             "edit_rendered_markdown_label"))
        utility.set_tool_tip(cb, self.c.get(const.CONFIG_TOOLTIPS,
                                            "edit_rendered_markdown_tooltip"))

        return self.put_elems_in_box((cb,), const.HBOX, const.WIDGET)
示例#8
0
    def override_disabled_buttons_rendered_markdown(self):
        """
        Create a checkbox that controls whether or not to allow editing when
        the Markdown is rendered.
        """
        cb = self.create_checkbox(
            const.MARKDOWN_OVERRIDE_EDITING, None,
            self.c.get(const.CONFIG_LABELS, "edit_rendered_markdown_label"))
        utility.set_tool_tip(
            cb,
            self.c.get(const.CONFIG_TOOLTIPS,
                       "edit_rendered_markdown_tooltip"))

        return self.put_elems_in_box((cb, ), const.HBOX, const.WIDGET)
    def create_fixed_list_options(self, config_prop_name, tooltip_prop_name,
                                  prefname, types_iter):
        check_box = QtGui.QCheckBox(
            self.c.get(const.CONFIG_LABELS, config_prop_name), self)

        utility.set_tool_tip(
            check_box, self.c.get(const.CONFIG_TOOLTIPS, tooltip_prop_name))

        # preference value is empty string when False, otherwise len > 0
        check_box.setChecked(bool(self.p.get(prefname)))

        radio_buttons = list()
        for type_symbol in types_iter:
            radio_button = self.create_radiobutton(type_symbol)
            radio_button.clicked.connect(
                lambda: self.fixed_lists_radio_button_event_handler(prefname))
            radio_buttons.append(radio_button)

        check_box.stateChanged.connect(lambda: self.enable_radio_buttons(
            check_box, radio_buttons, prefname))

        list_type = self.p.get(prefname)
        if not list_type:
            radio_buttons[0].toggle()
        else:
            for radio_button in radio_buttons:
                if list_type == radio_button.text():
                    radio_button.toggle()
                    break

        button_group = QtGui.QButtonGroup(self)

        num_radio_button = 0
        for radio_button in radio_buttons:
            button_group.addButton(radio_button, num_radio_button)
            num_radio_button += 1

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(check_box)
        hbox.addStretch(1)
        for radio_button in radio_buttons:
            if not check_box.isChecked():
                radio_button.setEnabled(False)
            hbox.addWidget(radio_button)

        return hbox
示例#10
0
    def init_fixed_ol_options(self):
        cb = QtGui.QCheckBox(self.c.get(const.CONFIG_LABELS,
                             "ordered_list_type_option_label"),
                             self)

        utility.set_tool_tip(cb, self.c.get(const.CONFIG_TOOLTIPS,
                                            "ordered_list_type_tooltip"))

        # const.FIXED_OL_TYPE is empty string when False, otherwise len > 0
        cb.setChecked(bool(preferences.PREFS.get(const.FIXED_OL_TYPE)))

        cb.stateChanged.connect(lambda: self.enable_radio_buttons(cb))

        # make sure self.radio_buttons is empty before adding new buttons
        self.radio_buttons = list()
        for type_ol in ("1.", "A.", "a.", "I.", "i."):
            rb = self.create_radiobutton(type_ol)
            rb.clicked.connect(self.rb_event_handler)
            self.radio_buttons.append(rb)

        ol_type = preferences.PREFS.get(const.FIXED_OL_TYPE)
        if not ol_type:
            self.radio_buttons[0].toggle()
        else:
            for rb in self.radio_buttons:
                if ol_type == rb.text():
                    rb.toggle()
                    break

        buttonGroup = QtGui.QButtonGroup(self)

        num_radio_button = 0
        for rb in self.radio_buttons:
            buttonGroup.addButton(rb, num_radio_button)
            num_radio_button += 1

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(cb)
        for rb in self.radio_buttons:
            if not cb.isChecked():
                rb.setEnabled(False)
            hbox.addWidget(rb)

        return hbox
示例#11
0
    def init_fixed_ol_options(self):
        cb = QtGui.QCheckBox(
            self.c.get(const.CONFIG_LABELS, "ordered_list_type_option_label"),
            self)

        utility.set_tool_tip(
            cb, self.c.get(const.CONFIG_TOOLTIPS, "ordered_list_type_tooltip"))

        # const.FIXED_OL_TYPE is empty string when False, otherwise len > 0
        cb.setChecked(bool(preferences.PREFS.get(const.FIXED_OL_TYPE)))

        cb.stateChanged.connect(lambda: self.enable_radio_buttons(cb))

        # make sure self.radio_buttons is empty before adding new buttons
        self.radio_buttons = list()
        for type_ol in ("1.", "A.", "a.", "I.", "i."):
            rb = self.create_radiobutton(type_ol)
            rb.clicked.connect(self.rb_event_handler)
            self.radio_buttons.append(rb)

        ol_type = preferences.PREFS.get(const.FIXED_OL_TYPE)
        if not ol_type:
            self.radio_buttons[0].toggle()
        else:
            for rb in self.radio_buttons:
                if ol_type == rb.text():
                    rb.toggle()
                    break

        buttonGroup = QtGui.QButtonGroup(self)

        num_radio_button = 0
        for rb in self.radio_buttons:
            buttonGroup.addButton(rb, num_radio_button)
            num_radio_button += 1

        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(cb)
        for rb in self.radio_buttons:
            if not cb.isChecked():
                rb.setEnabled(False)
            hbox.addWidget(rb)

        return hbox