Пример #1
0
def wl_widgets_size(parent, size_min = 1, size_max = 100):
    def size_sync_changed():
        if checkbox_size_sync.isChecked():
            spin_box_size_min.setValue(spin_box_size_max.value())

    def size_min_changed():
        if checkbox_size_sync.isChecked() or spin_box_size_min.value() > spin_box_size_max.value():
            spin_box_size_max.setValue(spin_box_size_min.value())

    def size_max_changed():
        if checkbox_size_sync.isChecked() or spin_box_size_min.value() > spin_box_size_max.value():
            spin_box_size_min.setValue(spin_box_size_max.value())

    checkbox_size_sync = QCheckBox(parent.tr('Sync'), parent)
    label_size_min = QLabel(parent.tr('From'), parent)
    spin_box_size_min = wl_box.Wl_Spin_Box(parent)
    label_size_max = QLabel(parent.tr('To'), parent)
    spin_box_size_max = wl_box.Wl_Spin_Box(parent)

    spin_box_size_min.setRange(size_min, size_max)
    spin_box_size_max.setRange(size_min, size_max)

    checkbox_size_sync.stateChanged.connect(size_sync_changed)
    spin_box_size_min.valueChanged.connect(size_min_changed)
    spin_box_size_max.valueChanged.connect(size_max_changed)

    size_sync_changed()
    size_min_changed()
    size_max_changed()

    return checkbox_size_sync, label_size_min, spin_box_size_min, label_size_max, spin_box_size_max
Пример #2
0
    def __init__(self, main):
        super().__init__(main)

        # Rank Settings
        group_box_rank_settings = QGroupBox(self.tr('Rank Settings'), self)

        self.checkbox_continue_numbering_after_ties = QCheckBox(
            self.tr('Continue numbering after ties'), self)

        group_box_rank_settings.setLayout(wl_layout.Wl_Layout())
        group_box_rank_settings.layout().addWidget(
            self.checkbox_continue_numbering_after_ties, 0, 0)

        group_box_rank_settings.layout().setRowStretch(1, 0)

        # Precision Settings
        group_box_precision_settings = QGroupBox(self.tr('Precision Settings'),
                                                 self)

        self.label_precision_decimal = QLabel(self.tr('Decimal:'), self)
        self.spin_box_precision_decimal = wl_box.Wl_Spin_Box(self)
        self.label_precision_pct = QLabel(self.tr('Percentage:'), self)
        self.spin_box_precision_pct = wl_box.Wl_Spin_Box(self)
        self.label_precision_p_value = QLabel(self.tr('p-value:'), self)
        self.spin_box_precision_p_value = wl_box.Wl_Spin_Box(self)

        self.spin_box_precision_decimal.setRange(0, 10)
        self.spin_box_precision_pct.setRange(0, 10)
        self.spin_box_precision_p_value.setRange(0, 15)

        group_box_precision_settings.setLayout(wl_layout.Wl_Layout())
        group_box_precision_settings.layout().addWidget(
            self.label_precision_decimal, 0, 0)
        group_box_precision_settings.layout().addWidget(
            self.spin_box_precision_decimal, 0, 1)
        group_box_precision_settings.layout().addWidget(
            self.label_precision_pct, 1, 0)
        group_box_precision_settings.layout().addWidget(
            self.spin_box_precision_pct, 1, 1)
        group_box_precision_settings.layout().addWidget(
            self.label_precision_p_value, 2, 0)
        group_box_precision_settings.layout().addWidget(
            self.spin_box_precision_p_value, 2, 1)

        group_box_precision_settings.layout().setColumnStretch(2, 1)

        self.setLayout(wl_layout.Wl_Layout())
        self.layout().addWidget(group_box_rank_settings, 0, 0)
        self.layout().addWidget(group_box_precision_settings, 1, 0)

        self.layout().setContentsMargins(6, 4, 6, 4)
        self.layout().setRowStretch(2, 1)
Пример #3
0
def wl_widgets_number_sections(parent):
    label_divide = QLabel(parent.tr('Divide each text into'), parent)
    spin_box_number_sections = wl_box.Wl_Spin_Box(parent)
    label_sections = QLabel(parent.tr('sections'), parent)

    spin_box_number_sections.setRange(2, 1000)

    return label_divide, spin_box_number_sections, label_sections
Пример #4
0
def wl_widgets_no_limit(parent, double = False):
    def no_limit_changed():
        if checkbox_no_limit.isChecked():
            spin_box_no_limit.setEnabled(False)
        else:
            spin_box_no_limit.setEnabled(True)

    if double:
        spin_box_no_limit = wl_box.Wl_Double_Spin_Box(parent)
    else:
        spin_box_no_limit = wl_box.Wl_Spin_Box(parent)

    checkbox_no_limit = QCheckBox(parent.tr('No Limit'), parent)

    checkbox_no_limit.stateChanged.connect(no_limit_changed)

    no_limit_changed()

    return spin_box_no_limit, checkbox_no_limit
Пример #5
0
    def __init__(self, main):
        super().__init__(main)

        # Table
        self.table_overview = Wl_Table_Overview(self)

        self.wrapper_table.layout().addWidget(self.table_overview, 0, 0, 1, 4)
        self.wrapper_table.layout().addWidget(
            self.table_overview.button_generate_table, 1, 0)
        self.wrapper_table.layout().addWidget(
            self.table_overview.button_export_selected, 1, 1)
        self.wrapper_table.layout().addWidget(
            self.table_overview.button_export_all, 1, 2)
        self.wrapper_table.layout().addWidget(self.table_overview.button_clear,
                                              1, 3)

        # Token Settings
        self.group_box_token_settings = QGroupBox(self.tr('Token Settings'),
                                                  self)

        (self.checkbox_words, self.checkbox_lowercase, self.checkbox_uppercase,
         self.checkbox_title_case, self.checkbox_nums, self.checkbox_puncs,
         self.checkbox_treat_as_lowercase, self.checkbox_lemmatize_tokens,
         self.checkbox_filter_stop_words, self.stacked_widget_ignore_tags,
         self.checkbox_ignore_tags, self.checkbox_ignore_tags_tags,
         self.stacked_widget_ignore_tags_type, self.combo_box_ignore_tags,
         self.combo_box_ignore_tags_tags, self.label_ignore_tags,
         self.checkbox_use_tags) = wl_widgets.wl_widgets_token_settings(self)

        self.checkbox_words.stateChanged.connect(self.token_settings_changed)
        self.checkbox_lowercase.stateChanged.connect(
            self.token_settings_changed)
        self.checkbox_uppercase.stateChanged.connect(
            self.token_settings_changed)
        self.checkbox_title_case.stateChanged.connect(
            self.token_settings_changed)
        self.checkbox_nums.stateChanged.connect(self.token_settings_changed)
        self.checkbox_puncs.stateChanged.connect(self.token_settings_changed)

        self.checkbox_treat_as_lowercase.stateChanged.connect(
            self.token_settings_changed)
        self.checkbox_lemmatize_tokens.stateChanged.connect(
            self.token_settings_changed)
        self.checkbox_filter_stop_words.stateChanged.connect(
            self.token_settings_changed)

        self.checkbox_ignore_tags.stateChanged.connect(
            self.token_settings_changed)
        self.checkbox_ignore_tags_tags.stateChanged.connect(
            self.token_settings_changed)
        self.combo_box_ignore_tags.currentTextChanged.connect(
            self.token_settings_changed)
        self.combo_box_ignore_tags_tags.currentTextChanged.connect(
            self.token_settings_changed)
        self.checkbox_use_tags.stateChanged.connect(
            self.token_settings_changed)

        layout_ignore_tags = wl_layout.Wl_Layout()
        layout_ignore_tags.addWidget(self.stacked_widget_ignore_tags, 0, 0)
        layout_ignore_tags.addWidget(self.stacked_widget_ignore_tags_type, 0,
                                     1)
        layout_ignore_tags.addWidget(self.label_ignore_tags, 0, 2)

        layout_ignore_tags.setColumnStretch(3, 1)

        self.group_box_token_settings.setLayout(wl_layout.Wl_Layout())
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_words, 0, 0)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_lowercase, 0, 1)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_uppercase, 1, 0)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_title_case, 1, 1)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_nums, 2, 0)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_puncs, 2, 1)

        self.group_box_token_settings.layout().addWidget(
            wl_layout.Wl_Separator(self), 3, 0, 1, 2)

        self.group_box_token_settings.layout().addWidget(
            self.checkbox_treat_as_lowercase, 4, 0, 1, 2)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_lemmatize_tokens, 5, 0, 1, 2)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_filter_stop_words, 6, 0, 1, 2)

        self.group_box_token_settings.layout().addWidget(
            wl_layout.Wl_Separator(self), 7, 0, 1, 2)

        self.group_box_token_settings.layout().addLayout(
            layout_ignore_tags, 8, 0, 1, 2)
        self.group_box_token_settings.layout().addWidget(
            self.checkbox_use_tags, 9, 0, 1, 2)

        # Generation Settings
        self.group_box_generation_settings = QGroupBox(
            self.tr('Generation Settings'), self)

        self.label_base_sttr = QLabel(
            self.tr('Base of standardized type-token ratio:'), self)
        self.spin_box_base_sttr = wl_box.Wl_Spin_Box(self)

        self.spin_box_base_sttr.setRange(100, 10000)

        self.spin_box_base_sttr.valueChanged.connect(
            self.generation_settings_changed)

        self.group_box_generation_settings.setLayout(wl_layout.Wl_Layout())
        self.group_box_generation_settings.layout().addWidget(
            self.label_base_sttr, 0, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.spin_box_base_sttr, 1, 0)

        # Table Settings
        self.group_box_table_settings = QGroupBox(self.tr('Table Settings'),
                                                  self)

        (self.checkbox_show_pct, self.checkbox_show_cumulative,
         self.checkbox_show_breakdown) = wl_widgets.wl_widgets_table_settings(
             self, table=self.table_overview)

        self.checkbox_show_pct.stateChanged.connect(
            self.table_settings_changed)
        self.checkbox_show_cumulative.stateChanged.connect(
            self.table_settings_changed)
        self.checkbox_show_breakdown.stateChanged.connect(
            self.table_settings_changed)

        self.group_box_table_settings.setLayout(wl_layout.Wl_Layout())
        self.group_box_table_settings.layout().addWidget(
            self.checkbox_show_pct, 0, 0)
        self.group_box_table_settings.layout().addWidget(
            self.checkbox_show_cumulative, 1, 0)
        self.group_box_table_settings.layout().addWidget(
            self.checkbox_show_breakdown, 2, 0)

        self.wrapper_settings.layout().addWidget(self.group_box_token_settings,
                                                 0, 0)
        self.wrapper_settings.layout().addWidget(
            self.group_box_generation_settings, 1, 0)
        self.wrapper_settings.layout().addWidget(self.group_box_table_settings,
                                                 2, 0)

        self.wrapper_settings.layout().setRowStretch(3, 1)

        self.load_settings()