def __init__(self, main, table):
        super().__init__(main, main.tr('Sort Results'))

        self.table = table
        self.settings = self.main.settings_custom['concordancer'][
            'sort_results']

        self.table_sort = wordless_table.Wordless_Table_Results_Sort_Conordancer(
            self, self.table)

        self.button_reset_settings = wordless_button.Wordless_Button_Reset_Settings(
            self)
        self.button_sort = QPushButton(self.tr('Sort'), self)
        self.button_close = QPushButton(self.tr('Close'), self)

        self.table_sort.setFixedWidth(280)

        self.button_reset_settings.setFixedWidth(130)
        self.button_sort.setFixedWidth(80)
        self.button_close.setFixedWidth(80)

        self.table_sort.itemChanged.connect(self.sort_table_changed)

        self.button_sort.clicked.connect(
            lambda: self.table_sort.sort_results())
        self.button_close.clicked.connect(self.reject)

        layout_table_sort = wordless_layout.Wordless_Layout()
        layout_table_sort.addWidget(self.table_sort, 0, 0, 4, 1)
        layout_table_sort.addWidget(self.table_sort.button_add, 0, 1)
        layout_table_sort.addWidget(self.table_sort.button_insert, 1, 1)
        layout_table_sort.addWidget(self.table_sort.button_remove, 2, 1)

        layout_table_sort.setRowStretch(3, 1)

        self.setLayout(wordless_layout.Wordless_Layout())
        self.layout().addLayout(layout_table_sort, 0, 0, 1, 4)

        self.layout().addWidget(wordless_layout.Wordless_Separator(self), 1, 0,
                                1, 4)

        self.layout().addWidget(self.button_reset_settings, 2, 0)
        self.layout().addWidget(self.button_sort, 2, 2)
        self.layout().addWidget(self.button_close, 2, 3)

        self.layout().setColumnStretch(1, 1)

        self.set_fixed_size()
Example #2
0
    def init_central_widget(self):
        self.wordless_file_area = wordless_file_area.Wrapper_File_Area(self)
        self.init_work_area()

        wrapper_file_area = QWidget()

        wrapper_file_area.setLayout(wordless_layout.Wordless_Layout())
        wrapper_file_area.layout().addWidget(self.wordless_file_area, 0, 0)

        if platform.system() == 'Windows':
            self.wordless_file_area.layout().setContentsMargins(2, 0, 2, 0)
            wrapper_file_area.layout().setContentsMargins(0, 0, 2, 0)
        elif platform.system() == 'Darwin':
            wrapper_file_area.layout().setContentsMargins(3, 0, 3, 0)

        splitter_central_widget = wordless_layout.Wordless_Splitter(
            Qt.Vertical, self)
        splitter_central_widget.addWidget(self.wordless_work_area)
        splitter_central_widget.addWidget(wrapper_file_area)

        if platform.system() == 'Windows':
            splitter_central_widget.setHandleWidth(1)
        elif platform.system() == 'Darwin':
            splitter_central_widget.setHandleWidth(2)

        splitter_central_widget.setObjectName('splitter-central-widget')
        splitter_central_widget.setStyleSheet('''
            QSplitter#splitter-central-widget {
                padding: 4px 6px;
            }
        ''')

        splitter_central_widget.setStretchFactor(0, 1)

        self.setCentralWidget(splitter_central_widget)
    def __init__(self, main):
        if platform.system() == 'Windows':
            super().__init__(main,
                             main.tr('Citing'),
                             width=400,
                             height=200,
                             no_button=True)
        elif platform.system() == 'Darwin':
            super().__init__(main,
                             main.tr('Citing'),
                             width=400,
                             height=250,
                             no_button=True)

        self.label_citing = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    If you publish work that uses Wordless, please cite as follows.
                </div>
            '''), self)

        self.label_citation_sys = QLabel(self.tr('Citation System:'), self)
        self.combo_box_citation_sys = wordless_box.Wordless_Combo_Box(self)
        self.text_edit_citing = QTextEdit(self)

        self.button_copy = QPushButton(self.tr('Copy'), self)
        self.button_close = QPushButton(self.tr('Close'), self)

        self.combo_box_citation_sys.addItems([
            self.tr('MLA (8th Edition)'),
            self.tr('APA (6th Edition)'),
            self.tr('GB (GB/T 7714—2015)')
        ])

        self.button_copy.setFixedWidth(100)
        self.button_close.setFixedWidth(100)

        self.text_edit_citing.setFixedHeight(100)
        self.text_edit_citing.setReadOnly(True)

        self.combo_box_citation_sys.currentTextChanged.connect(
            self.citation_sys_changed)

        self.button_copy.clicked.connect(self.copy)
        self.button_close.clicked.connect(self.accept)

        layout_citation_sys = wordless_layout.Wordless_Layout()
        layout_citation_sys.addWidget(self.label_citation_sys, 0, 0)
        layout_citation_sys.addWidget(self.combo_box_citation_sys, 0, 1)

        layout_citation_sys.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_citing, 0, 0, 1, 2)
        self.wrapper_info.layout().addLayout(layout_citation_sys, 1, 0, 1, 2)
        self.wrapper_info.layout().addWidget(self.text_edit_citing, 2, 0, 1, 2)

        self.wrapper_buttons.layout().addWidget(self.button_copy, 0, 0)
        self.wrapper_buttons.layout().addWidget(self.button_close, 0, 1)

        self.load_settings()
Example #4
0
    def __init__(self, main, title, width, height, no_button=False):
        super().__init__(main, title)

        self.setFixedSize(width, height)
        self.setWindowFlag(Qt.MSWindowsFixedSizeDialogHint, True)
        self.setWindowFlag(Qt.WindowContextHelpButtonHint, False)

        self.wrapper_info = QWidget(self)

        self.wrapper_info.setObjectName('wrapper-info')
        self.wrapper_info.setStyleSheet('''
            QWidget#wrapper-info {
                border-bottom: 1px solid #B0B0B0;
                background-color: #FFF;
            }
        ''')

        self.wrapper_info.setLayout(wordless_layout.Wordless_Layout())
        self.wrapper_info.layout().setContentsMargins(20, 10, 20, 10)

        self.wrapper_buttons = QWidget(self)

        self.wrapper_buttons.setLayout(wordless_layout.Wordless_Layout())
        self.wrapper_buttons.layout().setContentsMargins(11, 0, 11, 11)

        if not no_button:
            self.button_ok = QPushButton(self.tr('OK'), self)

            self.button_ok.clicked.connect(self.accept)

            self.wrapper_buttons.layout().addWidget(self.button_ok, 0, 0,
                                                    Qt.AlignRight)

        self.setLayout(wordless_layout.Wordless_Layout())
        self.layout().addWidget(self.wrapper_info, 0, 0)
        self.layout().addWidget(self.wrapper_buttons, 1, 0)

        self.layout().setRowStretch(0, 1)
        self.layout().setContentsMargins(0, 0, 0, 0)
    def __init__(self, main):
        super().__init__(main)

        self.time_start = time.time()

        self.timer_time_elapsed = QTimer(self)

        self.label_progress = QLabel('', self)
        self.label_time_elapsed = QLabel(self.tr('Elapsed Time: 0:00:00'), self)
        self.label_processing = wordless_label.Wordless_Label_Dialog(self.tr('Please wait. It may take a few seconds to several minutes for the operation to be completed.'), self)

        self.timer_time_elapsed.timeout.connect(self.update_elapsed_time)
        self.timer_time_elapsed.start(1000)

        self.setLayout(wordless_layout.Wordless_Layout())
        self.layout().addWidget(self.label_progress, 0, 0)
        self.layout().addWidget(self.label_time_elapsed, 0, 1, Qt.AlignRight)
        self.layout().addWidget(self.label_processing, 1, 0, 1, 2)

        self.layout().setContentsMargins(20, 10, 20, 10)
    def __init__(self, main):
        super().__init__(main, main.tr('Donating'), width=400, height=510)

        self.label_donating = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    If you would like to support the development of Wordless, you may donate via PayPal, Alipay or WeChat.
                </div>
            '''), self)
        self.label_donating_via = QLabel(self.tr('Donating via:'), self)
        self.combo_box_donating_via = wordless_box.Wordless_Combo_Box(self)
        self.label_donating_via_img = wordless_label.Wordless_Label_Html(
            '', self)
        self.label_donating_note = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    <span style="color: #F00;"><b>Important Note</b></span>: I <b>WILL NOT PROVIDE</b> refund services, private email/phone support, information concerning my social media, gurantees on bug fixes, enhancements, new features or new releases of Wordless, invoices, receipts or detailed weekly/monthly/yearly/etc. spending report for donation. 
                </div>
            '''), self)

        self.combo_box_donating_via.addItems(
            [self.tr('PayPal'),
             self.tr('Alipay'),
             self.tr('WeChat')])

        self.combo_box_donating_via.currentTextChanged.connect(
            self.donating_via_changed)

        layout_donating_via = wordless_layout.Wordless_Layout()
        layout_donating_via.addWidget(self.label_donating_via, 0, 0)
        layout_donating_via.addWidget(self.combo_box_donating_via, 0, 1)

        layout_donating_via.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_donating, 0, 0)
        self.wrapper_info.layout().addLayout(layout_donating_via, 1, 0)
        self.wrapper_info.layout().addWidget(self.label_donating_via_img, 2, 0,
                                             Qt.AlignHCenter | Qt.AlignVCenter)
        self.wrapper_info.layout().addWidget(self.label_donating_note, 3, 0)

        self.load_settings()
Example #7
0
def wordless_widgets_search_settings(parent, tab):
    def multi_search_mode_changed():
        if checkbox_multi_search_mode.isChecked():
            label_search_term.setText(parent.tr('Search Terms:'))

            if line_edit_search_term.text() and list_search_terms.count() == 0:
                list_search_terms.load_items([line_edit_search_term.text()])

            stacked_widget_search_term.setCurrentIndex(1)
        else:
            label_search_term.setText(parent.tr('Search Term:'))

            stacked_widget_search_term.setCurrentIndex(0)

    def match_tags_changed():
        if checkbox_match_tags.isChecked():
            checkbox_match_inflected_forms.setEnabled(False)

            stacked_widget_ignore_tags.setCurrentIndex(1)
            stacked_widget_ignore_tags_type.setCurrentIndex(1)
        else:
            checkbox_match_inflected_forms.setEnabled(True)
            
            stacked_widget_ignore_tags.setCurrentIndex(0)
            stacked_widget_ignore_tags_type.setCurrentIndex(0)

    def token_settings_changed():
        token_settings = main.settings_custom[tab]['token_settings']
        
        if line_edit_search_term.isEnabled() == True:
            if token_settings['use_tags']:
                checkbox_match_tags.setEnabled(False)
                checkbox_match_tags.setChecked(True)

                if token_settings['ignore_tags_tags']:
                    stacked_widget_ignore_tags.setEnabled(False)
                    stacked_widget_ignore_tags_type.setEnabled(False)
                else:
                    stacked_widget_ignore_tags.setEnabled(True)
                    stacked_widget_ignore_tags_type.setEnabled(True)
            else:
                checkbox_match_tags.setChecked(False)

                if token_settings['ignore_tags']:
                    if token_settings['ignore_tags_type'] == parent.tr('All'):
                        stacked_widget_ignore_tags.setEnabled(False)
                        stacked_widget_ignore_tags_type.setEnabled(False)
                        checkbox_match_tags.setEnabled(False)
                    else:
                        if checkbox_match_tags.isChecked():
                            stacked_widget_ignore_tags.setEnabled(False)
                            stacked_widget_ignore_tags_type.setEnabled(False)
                        else:
                            stacked_widget_ignore_tags.setEnabled(True)
                            stacked_widget_ignore_tags_type.setEnabled(True)
                            
                        checkbox_match_tags.setEnabled(True)
                else:
                    stacked_widget_ignore_tags.setEnabled(True)
                    stacked_widget_ignore_tags_type.setEnabled(True)
                    checkbox_match_tags.setEnabled(True)

            if checkbox_match_tags.isEnabled():
                match_tags_changed()

    main = wordless_misc.find_wordless_main(parent)

    label_search_term = QLabel(parent.tr('Search Term:'), parent)
    checkbox_multi_search_mode = QCheckBox(parent.tr('Multi-search Mode'), parent)
    line_edit_search_term = QLineEdit(parent)
    list_search_terms = wordless_list.Wordless_List_Search_Terms(parent)
    label_separator = wordless_label.Wordless_Label_Hint(parent.tr('* Use space to separate multiple tokens'), parent)

    checkbox_ignore_case = QCheckBox(parent.tr('Ignore case'), parent)
    checkbox_match_inflected_forms = QCheckBox(parent.tr('Match all inflected forms'), parent)
    checkbox_match_whole_words = QCheckBox(parent.tr('Match whole words only'), parent)
    checkbox_use_regex = QCheckBox(parent.tr('Use regular expression'), parent)

    checkbox_ignore_tags = QCheckBox(parent.tr('Ignore'), parent)
    checkbox_ignore_tags_tags = QCheckBox(parent.tr('Ignore'), parent)
    combo_box_ignore_tags = wordless_box.Wordless_Combo_Box(parent)
    combo_box_ignore_tags_tags = wordless_box.Wordless_Combo_Box(parent)
    label_ignore_tags = QLabel(parent.tr('tags'), parent)
    checkbox_match_tags = QCheckBox(parent.tr('Match tags only'), parent)

    combo_box_ignore_tags.addItems([
        parent.tr('all'),
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    combo_box_ignore_tags_tags.addItems([
        parent.tr('POS'),
        parent.tr('non-POS')
    ])

    wrapper_search_terms = QWidget(parent)

    wrapper_search_terms.setLayout(wordless_layout.Wordless_Layout())
    wrapper_search_terms.layout().addWidget(list_search_terms, 0, 0, 5, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_add, 0, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_remove, 1, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_clear, 2, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_import, 3, 1)
    wrapper_search_terms.layout().addWidget(list_search_terms.button_export, 4, 1)

    wrapper_search_terms.layout().setContentsMargins(0, 0, 0, 0)

    stacked_widget_search_term = wordless_layout.Wordless_Stacked_Widget(parent)
    stacked_widget_search_term.addWidget(line_edit_search_term)
    stacked_widget_search_term.addWidget(wrapper_search_terms)

    stacked_widget_ignore_tags = wordless_layout.Wordless_Stacked_Widget(parent)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags)
    stacked_widget_ignore_tags.addWidget(checkbox_ignore_tags_tags)

    stacked_widget_ignore_tags_type = wordless_layout.Wordless_Stacked_Widget(parent)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags)
    stacked_widget_ignore_tags_type.addWidget(combo_box_ignore_tags_tags)

    checkbox_match_tags.token_settings_changed = token_settings_changed

    checkbox_multi_search_mode.stateChanged.connect(multi_search_mode_changed)
    checkbox_match_tags.stateChanged.connect(match_tags_changed)

    multi_search_mode_changed()
    match_tags_changed()

    return (label_search_term,
            checkbox_multi_search_mode,

            stacked_widget_search_term,
            line_edit_search_term,
            list_search_terms,

            label_separator,

            checkbox_ignore_case,
            checkbox_match_inflected_forms,
            checkbox_match_whole_words,
            checkbox_use_regex,

            stacked_widget_ignore_tags,
            checkbox_ignore_tags,
            checkbox_ignore_tags_tags,

            stacked_widget_ignore_tags_type,
            combo_box_ignore_tags,
            combo_box_ignore_tags_tags,

            label_ignore_tags,
            checkbox_match_tags)
    def __init__(self, main, tab):
        super().__init__(main, main.tr('Context Settings'))

        self.tab = tab

        self.settings = self.main.settings_custom[self.tab]['context_settings']

        # Inclusion
        self.inclusion_group_box = QGroupBox(self.tr('Inclusion'), self)

        self.inclusion_group_box.setCheckable(True)

        (self.inclusion_label_search_term,
         self.inclusion_checkbox_multi_search_mode,
         self.inclusion_stacked_widget_search_term,
         self.inclusion_line_edit_search_term,
         self.inclusion_list_search_terms, self.inclusion_label_separator,
         self.inclusion_checkbox_ignore_case,
         self.inclusion_checkbox_match_inflected_forms,
         self.inclusion_checkbox_match_whole_words,
         self.inclusion_checkbox_use_regex,
         self.inclusion_stacked_widget_ignore_tags,
         self.inclusion_checkbox_ignore_tags,
         self.inclusion_checkbox_ignore_tags_tags,
         self.inclusion_stacked_widget_ignore_tags_type,
         self.inclusion_combo_box_ignore_tags,
         self.inclusion_combo_box_ignore_tags_tags,
         self.inclusion_label_ignore_tags, self.inclusion_checkbox_match_tags
         ) = wordless_widgets.wordless_widgets_search_settings(self, tab=tab)

        self.inclusion_label_context_window = QLabel(
            self.tr('Context Window:'), self)
        (self.inclusion_checkbox_context_window_sync,
         self.inclusion_label_context_window_left,
         self.inclusion_spin_box_context_window_left,
         self.inclusion_label_context_window_right,
         self.inclusion_spin_box_context_window_right
         ) = wordless_widgets.wordless_widgets_window(self)

        self.inclusion_group_box.toggled.connect(self.inclusion_changed)

        self.inclusion_checkbox_multi_search_mode.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_checkbox_multi_search_mode.stateChanged.connect(
            self.multi_search_mode_changed)
        self.inclusion_line_edit_search_term.textChanged.connect(
            self.inclusion_changed)
        self.inclusion_list_search_terms.itemChanged.connect(
            self.inclusion_changed)

        self.inclusion_checkbox_ignore_case.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_checkbox_match_inflected_forms.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_checkbox_match_whole_words.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_checkbox_use_regex.stateChanged.connect(
            self.inclusion_changed)

        self.inclusion_checkbox_ignore_tags.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_checkbox_ignore_tags_tags.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_combo_box_ignore_tags.currentTextChanged.connect(
            self.inclusion_changed)
        self.inclusion_combo_box_ignore_tags_tags.currentTextChanged.connect(
            self.inclusion_changed)
        self.inclusion_checkbox_match_tags.stateChanged.connect(
            self.inclusion_changed)

        self.inclusion_checkbox_context_window_sync.stateChanged.connect(
            self.inclusion_changed)
        self.inclusion_spin_box_context_window_left.valueChanged.connect(
            self.inclusion_changed)
        self.inclusion_spin_box_context_window_right.valueChanged.connect(
            self.inclusion_changed)

        inclusion_layout_multi_search_mode = wordless_layout.Wordless_Layout()
        inclusion_layout_multi_search_mode.addWidget(
            self.inclusion_label_search_term, 0, 0)
        inclusion_layout_multi_search_mode.addWidget(
            self.inclusion_checkbox_multi_search_mode, 0, 1, Qt.AlignRight)

        inclusion_layout_ignore_tags = wordless_layout.Wordless_Layout()
        inclusion_layout_ignore_tags.addWidget(
            self.inclusion_stacked_widget_ignore_tags, 0, 0)
        inclusion_layout_ignore_tags.addWidget(
            self.inclusion_stacked_widget_ignore_tags_type, 0, 1)
        inclusion_layout_ignore_tags.addWidget(
            self.inclusion_label_ignore_tags, 0, 2)

        inclusion_layout_ignore_tags.setColumnStretch(3, 1)

        self.inclusion_group_box.setLayout(wordless_layout.Wordless_Layout())
        self.inclusion_group_box.layout().addLayout(
            inclusion_layout_multi_search_mode, 0, 0, 1, 4)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_stacked_widget_search_term, 1, 0, 1, 4)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_label_separator, 2, 0, 1, 4)

        self.inclusion_group_box.layout().addWidget(
            self.inclusion_checkbox_ignore_case, 3, 0, 1, 4)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_checkbox_match_inflected_forms, 4, 0, 1, 4)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_checkbox_match_whole_words, 5, 0, 1, 4)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_checkbox_use_regex, 6, 0, 1, 4)
        self.inclusion_group_box.layout().addLayout(
            inclusion_layout_ignore_tags, 7, 0, 1, 4)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_checkbox_match_tags, 8, 0, 1, 4)

        self.inclusion_group_box.layout().addWidget(
            wordless_layout.Wordless_Separator(self), 9, 0, 1, 4)

        self.inclusion_group_box.layout().addWidget(
            self.inclusion_label_context_window, 10, 0, 1, 3)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_checkbox_context_window_sync, 10, 3, Qt.AlignRight)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_label_context_window_left, 11, 0)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_spin_box_context_window_left, 11, 1)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_label_context_window_right, 11, 2)
        self.inclusion_group_box.layout().addWidget(
            self.inclusion_spin_box_context_window_right, 11, 3)

        self.inclusion_group_box.layout().setColumnStretch(1, 1)
        self.inclusion_group_box.layout().setColumnStretch(3, 1)

        # Exclusion
        self.exclusion_group_box = QGroupBox(self.tr('Exclusion'), self)

        self.exclusion_group_box.setCheckable(True)

        (self.exclusion_label_search_term,
         self.exclusion_checkbox_multi_search_mode,
         self.exclusion_stacked_widget_search_term,
         self.exclusion_line_edit_search_term,
         self.exclusion_list_search_terms, self.exclusion_label_separator,
         self.exclusion_checkbox_ignore_case,
         self.exclusion_checkbox_match_inflected_forms,
         self.exclusion_checkbox_match_whole_words,
         self.exclusion_checkbox_use_regex,
         self.exclusion_stacked_widget_ignore_tags,
         self.exclusion_checkbox_ignore_tags,
         self.exclusion_checkbox_ignore_tags_tags,
         self.exclusion_stacked_widget_ignore_tags_type,
         self.exclusion_combo_box_ignore_tags,
         self.exclusion_combo_box_ignore_tags_tags,
         self.exclusion_label_ignore_tags, self.exclusion_checkbox_match_tags
         ) = wordless_widgets.wordless_widgets_search_settings(self, tab=tab)

        self.exclusion_label_context_window = QLabel(
            self.tr('Context Window:'), self)
        (self.exclusion_checkbox_context_window_sync,
         self.exclusion_label_context_window_left,
         self.exclusion_spin_box_context_window_left,
         self.exclusion_label_context_window_right,
         self.exclusion_spin_box_context_window_right
         ) = wordless_widgets.wordless_widgets_window(self)

        self.exclusion_group_box.toggled.connect(self.exclusion_changed)

        self.exclusion_checkbox_multi_search_mode.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_checkbox_multi_search_mode.stateChanged.connect(
            self.multi_search_mode_changed)
        self.exclusion_line_edit_search_term.textChanged.connect(
            self.exclusion_changed)
        self.exclusion_list_search_terms.itemChanged.connect(
            self.exclusion_changed)

        self.exclusion_checkbox_ignore_case.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_checkbox_match_inflected_forms.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_checkbox_match_whole_words.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_checkbox_use_regex.stateChanged.connect(
            self.exclusion_changed)

        self.exclusion_checkbox_ignore_tags.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_checkbox_ignore_tags_tags.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_combo_box_ignore_tags.currentTextChanged.connect(
            self.exclusion_changed)
        self.exclusion_combo_box_ignore_tags_tags.currentTextChanged.connect(
            self.exclusion_changed)
        self.exclusion_checkbox_match_tags.stateChanged.connect(
            self.exclusion_changed)

        self.exclusion_checkbox_context_window_sync.stateChanged.connect(
            self.exclusion_changed)
        self.exclusion_spin_box_context_window_left.valueChanged.connect(
            self.exclusion_changed)
        self.exclusion_spin_box_context_window_right.valueChanged.connect(
            self.exclusion_changed)

        exclusion_layout_multi_search_mode = wordless_layout.Wordless_Layout()
        exclusion_layout_multi_search_mode.addWidget(
            self.exclusion_label_search_term, 0, 0)
        exclusion_layout_multi_search_mode.addWidget(
            self.exclusion_checkbox_multi_search_mode, 0, 1, Qt.AlignRight)

        exclusion_layout_ignore_tags = wordless_layout.Wordless_Layout()
        exclusion_layout_ignore_tags.addWidget(
            self.exclusion_stacked_widget_ignore_tags, 0, 0)
        exclusion_layout_ignore_tags.addWidget(
            self.exclusion_stacked_widget_ignore_tags_type, 0, 1)
        exclusion_layout_ignore_tags.addWidget(
            self.exclusion_label_ignore_tags, 0, 2)

        exclusion_layout_ignore_tags.setColumnStretch(3, 1)

        self.exclusion_group_box.setLayout(wordless_layout.Wordless_Layout())
        self.exclusion_group_box.layout().addLayout(
            exclusion_layout_multi_search_mode, 0, 0, 1, 4)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_stacked_widget_search_term, 1, 0, 1, 4)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_label_separator, 2, 0, 1, 4)

        self.exclusion_group_box.layout().addWidget(
            self.exclusion_checkbox_ignore_case, 3, 0, 1, 4)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_checkbox_match_inflected_forms, 4, 0, 1, 4)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_checkbox_match_whole_words, 5, 0, 1, 4)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_checkbox_use_regex, 6, 0, 1, 4)
        self.exclusion_group_box.layout().addLayout(
            exclusion_layout_ignore_tags, 7, 0, 1, 4)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_checkbox_match_tags, 8, 0, 1, 4)

        self.exclusion_group_box.layout().addWidget(
            wordless_layout.Wordless_Separator(self), 9, 0, 1, 4)

        self.exclusion_group_box.layout().addWidget(
            self.exclusion_label_context_window, 10, 0, 1, 3)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_checkbox_context_window_sync, 10, 3, Qt.AlignRight)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_label_context_window_left, 11, 0)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_spin_box_context_window_left, 11, 1)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_label_context_window_right, 11, 2)
        self.exclusion_group_box.layout().addWidget(
            self.exclusion_spin_box_context_window_right, 11, 3)

        self.exclusion_group_box.layout().setColumnStretch(1, 1)
        self.exclusion_group_box.layout().setColumnStretch(3, 1)

        self.button_reset_settings = wordless_button.Wordless_Button_Reset_Settings(
            self)
        self.button_ok = QPushButton(self.tr('OK'), self)

        self.button_ok.clicked.connect(self.accept)

        self.button_reset_settings.setFixedWidth(130)

        self.setLayout(wordless_layout.Wordless_Layout())
        self.layout().addWidget(self.inclusion_group_box, 0, 0, Qt.AlignTop)
        self.layout().addWidget(self.exclusion_group_box, 0, 1, Qt.AlignTop)
        self.layout().addWidget(self.button_reset_settings, 1, 0, Qt.AlignLeft)
        self.layout().addWidget(self.button_ok, 1, 1, Qt.AlignRight)

        self.layout().setColumnStretch(0, 1)
        self.layout().setColumnStretch(1, 1)

        self.load_settings()
    def __init__(self, main, tab, table):
        super().__init__(main, main.tr('Search in Results'))

        self.tab = tab
        self.table = table
        self.settings = self.main.settings_custom[self.tab]['search_results']
        self.items_found = []

        (self.label_search_term, self.checkbox_multi_search_mode,
         self.stacked_widget_search_term, self.line_edit_search_term,
         self.list_search_terms, self.label_separator,
         self.checkbox_ignore_case, self.checkbox_match_inflected_forms,
         self.checkbox_match_whole_words, self.checkbox_use_regex,
         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_match_tags
         ) = wordless_widgets.wordless_widgets_search_settings(self, self.tab)

        self.button_find_next = QPushButton(self.tr('Find Next'), self)
        self.button_find_prev = QPushButton(self.tr('Find Previous'), self)
        self.button_find_all = QPushButton(self.tr('Find All'), self)

        self.button_reset_settings = wordless_button.Wordless_Button_Reset_Settings(
            self)
        self.button_clear_hightlights = QPushButton(
            self.tr('Clear Highlights'), self)
        self.button_close = QPushButton(self.tr('Close'), self)

        self.button_reset_settings.setFixedWidth(130)
        self.button_close.setFixedWidth(80)

        self.checkbox_multi_search_mode.stateChanged.connect(
            self.search_settings_changed)
        self.line_edit_search_term.textChanged.connect(
            self.search_settings_changed)
        self.line_edit_search_term.returnPressed.connect(
            self.button_find_next.click)
        self.list_search_terms.itemChanged.connect(
            self.search_settings_changed)

        self.checkbox_ignore_case.stateChanged.connect(
            self.search_settings_changed)
        self.checkbox_match_inflected_forms.stateChanged.connect(
            self.search_settings_changed)
        self.checkbox_match_whole_words.stateChanged.connect(
            self.search_settings_changed)
        self.checkbox_use_regex.stateChanged.connect(
            self.search_settings_changed)

        self.checkbox_ignore_tags.stateChanged.connect(
            self.search_settings_changed)
        self.checkbox_ignore_tags_tags.stateChanged.connect(
            self.search_settings_changed)
        self.combo_box_ignore_tags.currentTextChanged.connect(
            self.search_settings_changed)
        self.combo_box_ignore_tags_tags.currentTextChanged.connect(
            self.search_settings_changed)
        self.checkbox_match_tags.stateChanged.connect(
            self.search_settings_changed)

        self.button_find_next.clicked.connect(lambda: self.find_next())
        self.button_find_prev.clicked.connect(lambda: self.find_prev())
        self.button_find_all.clicked.connect(lambda: self.find_all())

        self.button_clear_hightlights.clicked.connect(self.clear_highlights)
        self.button_close.clicked.connect(self.reject)

        layout_ignore_tags = wordless_layout.Wordless_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)

        layout_buttons_right = wordless_layout.Wordless_Layout()
        layout_buttons_right.addWidget(self.button_find_next, 0, 0)
        layout_buttons_right.addWidget(self.button_find_prev, 1, 0)
        layout_buttons_right.addWidget(self.button_find_all, 2, 0)
        layout_buttons_right.addWidget(self.button_clear_hightlights, 3, 0)

        layout_buttons_right.setRowStretch(4, 1)

        layout_buttons_bottom = wordless_layout.Wordless_Layout()
        layout_buttons_bottom.addWidget(self.button_reset_settings, 0, 0)
        layout_buttons_bottom.addWidget(self.button_close, 0, 1, Qt.AlignRight)

        self.setLayout(wordless_layout.Wordless_Layout())
        self.layout().addWidget(self.label_search_term, 0, 0)
        self.layout().addWidget(self.checkbox_multi_search_mode, 0, 1,
                                Qt.AlignRight)
        self.layout().addWidget(self.stacked_widget_search_term, 1, 0, 1, 2)
        self.layout().addWidget(self.label_separator, 2, 0, 1, 2)

        self.layout().addWidget(self.checkbox_ignore_case, 3, 0, 1, 2)
        self.layout().addWidget(self.checkbox_match_inflected_forms, 4, 0, 1,
                                2)
        self.layout().addWidget(self.checkbox_match_whole_words, 5, 0, 1, 2)
        self.layout().addWidget(self.checkbox_use_regex, 6, 0, 1, 2)

        self.layout().addLayout(layout_ignore_tags, 7, 0, 1, 2)
        self.layout().addWidget(self.checkbox_match_tags, 8, 0, 1, 2)

        self.layout().addWidget(
            wordless_layout.Wordless_Separator(self, orientation='Vertical'),
            0, 2, 9, 1)

        self.layout().addLayout(layout_buttons_right, 0, 3, 9, 1)

        self.layout().addWidget(wordless_layout.Wordless_Separator(self), 9, 0,
                                1, 4)

        self.layout().addLayout(layout_buttons_bottom, 10, 0, 1, 4)

        self.main.wordless_work_area.currentChanged.connect(self.reject)

        self.load_settings()
Example #10
0
    def __init__(self, main):
        super().__init__(main)

        # Table
        self.table_wordlist = Wordless_Table_Wordlist(self)

        layout_results = wordless_layout.Wordless_Layout()
        layout_results.addWidget(self.table_wordlist.label_number_results, 0,
                                 0)
        layout_results.addWidget(self.table_wordlist.button_results_filter, 0,
                                 2)
        layout_results.addWidget(self.table_wordlist.button_results_search, 0,
                                 3)

        layout_results.setColumnStretch(1, 1)

        self.wrapper_table.layout().addLayout(layout_results, 0, 0, 1, 5)
        self.wrapper_table.layout().addWidget(self.table_wordlist, 1, 0, 1, 5)
        self.wrapper_table.layout().addWidget(
            self.table_wordlist.button_generate_table, 2, 0)
        self.wrapper_table.layout().addWidget(
            self.table_wordlist.button_generate_fig, 2, 1)
        self.wrapper_table.layout().addWidget(
            self.table_wordlist.button_export_selected, 2, 2)
        self.wrapper_table.layout().addWidget(
            self.table_wordlist.button_export_all, 2, 3)
        self.wrapper_table.layout().addWidget(self.table_wordlist.button_clear,
                                              2, 4)

        # 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_tags, self.combo_box_ignore_tags,
         self.combo_box_ignore_tags_tags, self.label_ignore_tags,
         self.checkbox_use_tags
         ) = wordless_widgets.wordless_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 = wordless_layout.Wordless_Layout()
        layout_ignore_tags.addWidget(self.stacked_widget_ignore_tags, 0, 0)
        layout_ignore_tags.addWidget(self.stacked_widget_ignore_tags_tags, 0,
                                     1)
        layout_ignore_tags.addWidget(self.label_ignore_tags, 0, 2)

        layout_ignore_tags.setColumnStretch(3, 1)

        self.group_box_token_settings.setLayout(
            wordless_layout.Wordless_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(
            wordless_layout.Wordless_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(
            wordless_layout.Wordless_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.label_measure_dispersion, self.combo_box_measure_dispersion
         ) = wordless_widgets.wordless_widgets_measure_dispersion(self)
        (self.label_measure_adjusted_freq, self.combo_box_measure_adjusted_freq
         ) = wordless_widgets.wordless_widgets_measure_adjusted_freq(self)

        (self.label_settings_measures, self.button_settings_measures
         ) = wordless_widgets.wordless_widgets_settings_measures(
             self, tab=self.tr('Dispersion'))

        self.combo_box_measure_dispersion.currentTextChanged.connect(
            self.generation_settings_changed)
        self.combo_box_measure_adjusted_freq.currentTextChanged.connect(
            self.generation_settings_changed)

        layout_settings_measures = wordless_layout.Wordless_Layout()
        layout_settings_measures.addWidget(self.label_settings_measures, 0, 0)
        layout_settings_measures.addWidget(self.button_settings_measures, 0, 1)

        layout_settings_measures.setColumnStretch(1, 1)

        self.group_box_generation_settings.setLayout(
            wordless_layout.Wordless_Layout())
        self.group_box_generation_settings.layout().addWidget(
            self.label_measure_dispersion, 0, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.combo_box_measure_dispersion, 1, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.label_measure_adjusted_freq, 2, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.combo_box_measure_adjusted_freq, 3, 0)

        self.group_box_generation_settings.layout().addWidget(
            wordless_layout.Wordless_Separator(self), 4, 0)

        self.group_box_generation_settings.layout().addLayout(
            layout_settings_measures, 5, 0)

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

        (self.checkbox_show_pct, self.checkbox_show_cumulative,
         self.checkbox_show_breakdown
         ) = wordless_widgets.wordless_widgets_table_settings(
             self, table=self.table_wordlist)

        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(
            wordless_layout.Wordless_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)

        # Figure Settings
        self.group_box_fig_settings = QGroupBox(self.tr('Figure Settings'),
                                                self)

        (self.label_graph_type, self.combo_box_graph_type, self.label_use_file,
         self.combo_box_use_file, self.label_use_data, self.combo_box_use_data,
         self.checkbox_use_pct, self.checkbox_use_cumulative
         ) = wordless_widgets.wordless_widgets_fig_settings(self)

        self.label_rank = QLabel(self.tr('Rank:'), self)
        (self.label_rank_min, self.spin_box_rank_min,
         self.checkbox_rank_min_no_limit, self.label_rank_max,
         self.spin_box_rank_max, self.checkbox_rank_max_no_limit
         ) = wordless_widgets.wordless_widgets_filter(self,
                                                      filter_min=1,
                                                      filter_max=100000)

        self.combo_box_graph_type.currentTextChanged.connect(
            self.fig_settings_changed)
        self.combo_box_use_file.currentTextChanged.connect(
            self.fig_settings_changed)
        self.combo_box_use_data.currentTextChanged.connect(
            self.fig_settings_changed)
        self.checkbox_use_pct.stateChanged.connect(self.fig_settings_changed)
        self.checkbox_use_cumulative.stateChanged.connect(
            self.fig_settings_changed)

        self.spin_box_rank_min.valueChanged.connect(self.fig_settings_changed)
        self.checkbox_rank_min_no_limit.stateChanged.connect(
            self.fig_settings_changed)
        self.spin_box_rank_max.valueChanged.connect(self.fig_settings_changed)
        self.checkbox_rank_max_no_limit.stateChanged.connect(
            self.fig_settings_changed)

        layout_fig_settings_combo_boxes = wordless_layout.Wordless_Layout()
        layout_fig_settings_combo_boxes.addWidget(self.label_graph_type, 0, 0)
        layout_fig_settings_combo_boxes.addWidget(self.combo_box_graph_type, 0,
                                                  1)
        layout_fig_settings_combo_boxes.addWidget(self.label_use_file, 1, 0)
        layout_fig_settings_combo_boxes.addWidget(self.combo_box_use_file, 1,
                                                  1)
        layout_fig_settings_combo_boxes.addWidget(self.label_use_data, 2, 0)
        layout_fig_settings_combo_boxes.addWidget(self.combo_box_use_data, 2,
                                                  1)

        layout_fig_settings_combo_boxes.setColumnStretch(1, 1)

        self.group_box_fig_settings.setLayout(
            wordless_layout.Wordless_Layout())
        self.group_box_fig_settings.layout().addLayout(
            layout_fig_settings_combo_boxes, 0, 0, 1, 3)
        self.group_box_fig_settings.layout().addWidget(self.checkbox_use_pct,
                                                       1, 0, 1, 3)
        self.group_box_fig_settings.layout().addWidget(
            self.checkbox_use_cumulative, 2, 0, 1, 3)

        self.group_box_fig_settings.layout().addWidget(
            wordless_layout.Wordless_Separator(self), 3, 0, 1, 3)

        self.group_box_fig_settings.layout().addWidget(self.label_rank, 4, 0,
                                                       1, 3)
        self.group_box_fig_settings.layout().addWidget(self.label_rank_min, 5,
                                                       0)
        self.group_box_fig_settings.layout().addWidget(self.spin_box_rank_min,
                                                       5, 1)
        self.group_box_fig_settings.layout().addWidget(
            self.checkbox_rank_min_no_limit, 5, 2)
        self.group_box_fig_settings.layout().addWidget(self.label_rank_max, 6,
                                                       0)
        self.group_box_fig_settings.layout().addWidget(self.spin_box_rank_max,
                                                       6, 1)
        self.group_box_fig_settings.layout().addWidget(
            self.checkbox_rank_max_no_limit, 6, 2)

        self.group_box_fig_settings.layout().setColumnStretch(1, 1)

        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().addWidget(self.group_box_fig_settings,
                                                 3, 0)

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

        self.load_settings()
    def __init__(self, main):
        super().__init__(main, main.tr('Acknowledgments'), width=580)

        self.ACKS_GENERAL = [
            [
                '<a href="https://www.python.org/">Python</a>', '3.7.2',
                'Guido van Rossum, Python Software Foundation',
                '<a href="https://docs.python.org/3.7/license.html#psf-license-agreement-for-python-release">PSF</a>'
            ],
            [
                '<a href="https://www.riverbankcomputing.com/software/pyqt/intro">PyQt</a>',
                '5.12.1', 'Riverbank Computing Limited',
                '<a href="http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html#license">GPL-3.0</a>'
            ]
        ]

        self.ACKS_NLP = [
            [
                main.tr('<a href="https://github.com/fxsjy/jieba">jieba</a>'),
                '0.39', 'Sun Junyi',
                '<a href="https://github.com/fxsjy/jieba/blob/master/LICENSE">MIT</a>'
            ],
            [
                '<a href="https://github.com/taishi-i/nagisa">nagisa</a>',
                '0.2.1', 'Taishi Ikeda (池田大志)',
                '<a href="https://github.com/taishi-i/nagisa/blob/master/LICENSE.txt">MIT</a>'
            ],
            [
                '<a href="http://www.nltk.org/">NLTK</a>', '3.4',
                'Steven Bird, Liling Tan',
                '<a href="https://github.com/nltk/nltk/blob/develop/LICENSE.txt">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/Esukhia/pybo">pybo</a>', '0.4.2',
                'Hélios Drupchen Hildt',
                '<a href="https://github.com/Esukhia/pybo/blob/master/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/kmike/pymorphy2/">pymorphy2</a>',
                '0.8', 'Mikhail Korobov',
                '<a href="https://github.com/kmike/pymorphy2/#pymorphy2">MIT</a>'
            ],
            [
                '<a href="https://github.com/PyThaiNLP/pythainlp">PyThaiNLP</a>',
                '1.7.4',
                'Wannaphong Phatthiyaphaibun (วรรณพงษ์ ภัททิยไพบูลย์)',
                '<a href="https://github.com/PyThaiNLP/pythainlp/blob/dev/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/alvations/sacremoses">SacreMoses</a>',
                '0.0.13', 'Liling Tan',
                '<a href="https://github.com/alvations/sacremoses#license">LGPL-2.1</a>'
            ],
            [
                '<a href="https://spacy.io/">spaCy</a>', '2.1.3',
                'Matthew Honnibal, Ines Montani',
                '<a href="https://github.com/explosion/spaCy/blob/master/LICENSE">MIT</a>'
            ],
            [
                '<a href="https://github.com/undertheseanlp/underthesea">Underthesea</a>',
                '1.1.15', 'Vu Anh',
                '<a href="https://github.com/undertheseanlp/underthesea/blob/master/LICENSE">GPL-3.0</a>'
            ]
        ]

        self.ACKS_PLOTTING = [
            [
                '<a href="https://matplotlib.org/">Matplotlib</a>', '3.0.3',
                'Matplotlib Development Team',
                '<a href="https://matplotlib.org/users/license.html">Matplotlib</a>'
            ],
            [
                '<a href="https://amueller.github.io/word_cloud/">wordcloud</a>',
                '1.5.0', 'Andreas Christian Mueller',
                '<a href="https://github.com/amueller/word_cloud/blob/master/LICENSE">MIT</a>'
            ]
        ]

        self.ACKS_MISC = [
            [
                '<a href="https://www.crummy.com/software/BeautifulSoup/">Beautiful Soup</a>',
                '4.7.1', 'Leonard Richardson',
                '<a href="https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/LICENSE">MIT</a>'
            ],
            [
                '<a href="https://github.com/PyYoshi/cChardet">cChardet</a>',
                '2.1.4', 'Yoshihiro Misawa',
                '<a href="https://github.com/PyYoshi/cChardet/blob/master/COPYING">MPL-1.0/GPL-2.0/LGPL-2.1</a>'
            ],
            [
                '<a href="https://github.com/chardet/chardet">chardet</a>',
                '3.0.4', 'Daniel Blanchard',
                '<a href="https://github.com/chardet/chardet/blob/master/LICENSE">LGPL-2.1</a>'
            ],
            [
                '<a href="https://github.com/Mimino666/langdetect">langdetect</a>',
                '1.0.7', 'Michal Mimino Danilak',
                '<a href="https://github.com/Mimino666/langdetect/blob/master/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://github.com/saffsd/langid.py">langid.py</a>',
                '1.1.6', 'Marco Lui',
                '<a href="https://github.com/saffsd/langid.py/blob/master/LICENSE">BSD-2-Clause</a>'
            ],
            [
                '<a href="https://lxml.de/">lxml</a>', '4.3.3',
                'Stefan Behnel',
                '<a href="https://github.com/lxml/lxml/blob/master/doc/licenses/BSD.txt">BSD-3-Clause</a>'
            ],
            [
                '<a href="http://www.numpy.org/">NumPy</a>', '1.16.2',
                'NumPy Developers',
                '<a href="http://www.numpy.org/license.html">BSD-3-Clause</a>'
            ],
            [
                '<a href="https://openpyxl.readthedocs.io/en/stable/">openpyxl</a>',
                '2.6.1', 'Eric Gazoni, Charlie Clark',
                '<a href="https://bitbucket.org/openpyxl/openpyxl/src/5983d4ba5c18b85171185e8b1ca136876ec52864/LICENCE.rst">MIT</a>'
            ],
            [
                '<a href="http://www.pyinstaller.org/">PyInstaller</a>',
                '3.5.dev0+cb8d10af6', 'Hartmut Goebel',
                '<a href="https://github.com/pyinstaller/pyinstaller/blob/develop/COPYING.txt">PyInstaller</a>'
            ],
            [
                '<a href="https://github.com/python-openxml/python-docx">python-docx</a>',
                '0.8.10', 'Steve Canny',
                '<a href="https://github.com/python-openxml/python-docx/blob/master/LICENSE">MIT</a>'
            ],
            [
                '<a href="http://python-requests.org">requests</a>', '2.21.0',
                'Kenneth Reitz',
                '<a href="https://github.com/requests/requests/blob/master/LICENSE">Apache-2.0</a>'
            ],
            [
                '<a href="https://www.scipy.org/">SciPy</a>', '1.2.1',
                'SciPy Developers',
                '<a href="https://www.scipy.org/scipylib/license.html">BSD-3-Clause</a>'
            ],
            [
                '<a href="https://github.com/python-excel/xlrd">xlrd</a>',
                '1.2.0', 'Stephen John Machin',
                '<a href="https://github.com/python-excel/xlrd/blob/master/LICENSE">BSD-3-Clause/BSD-4-Clause</a>'
            ]
        ]

        self.ACKS_DATA = [
            [
                '<a href="https://github.com/pharos-alexandria/grk-stoplist">grk-stoplist</a>',
                '/', 'Annette von Stockhausen',
                '<a href="https://github.com/pharos-alexandria/grk-stoplist/blob/master/LICENSE">CC0-1.0</a>'
            ],
            [
                '<a href="https://github.com/stenskjaer/lemmalist-greek">lemmalist-greek</a>',
                '/', 'Michael Stenskjær Christensen',
                '<a href="https://github.com/stenskjaer/lemmalist-greek/blob/master/LICENSE">GPL-3.0</a>'
            ],
            [
                '<a href="https://github.com/michmech/lemmatization-lists">Lemmatization Lists</a>',
                '/', 'Michal Boleslav Měchura',
                '<a href="https://github.com/michmech/lemmatization-lists/blob/master/LICENCE">ODbL</a>'
            ],
            [
                '<a href="https://github.com/stopwords-iso/stopwords-iso">Stopwords ISO</a>',
                '0.4.0', 'Gene Diaz',
                '<a href="https://github.com/stopwords-iso/stopwords-iso/blob/master/LICENSE">MIT</a>'
            ]
        ]

        self.label_acks = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    Wordless stands on the shoulders of giants. Thus, I would like to extend my thanks to the following open-source projects:
                </div>
            '''), self)
        self.label_browse_category = QLabel(self.tr('Browse by Category:'),
                                            self)
        self.combo_box_browse_category = wordless_box.Wordless_Combo_Box(self)

        self.table_acks = wordless_table.Wordless_Table(
            self,
            headers=[
                self.tr('Name'),
                self.tr('Version'),
                self.tr('Author(s)'),
                self.tr('License')
            ])

        self.combo_box_browse_category.addItems([
            self.tr('General'),
            self.tr('Natural Language Processing'),
            self.tr('Plotting'),
            self.tr('Miscellaneous'),
            self.tr('Data')
        ])

        self.table_acks.setFixedHeight(250)

        self.combo_box_browse_category.currentTextChanged.connect(
            self.browse_category_changed)

        layout_browse_category = wordless_layout.Wordless_Layout()
        layout_browse_category.addWidget(self.label_browse_category, 0, 0)
        layout_browse_category.addWidget(self.combo_box_browse_category, 0, 1)

        layout_browse_category.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_acks, 0, 0)
        self.wrapper_info.layout().addLayout(layout_browse_category, 1, 0)
        self.wrapper_info.layout().addWidget(self.table_acks, 2, 0)

        self.load_settings()

        self.set_fixed_height()
Example #12
0
    def __init__(self, main):
        super().__init__(main)

        # Table
        self.table_keywords = Wordless_Table_Keywords(self)

        layout_results = wordless_layout.Wordless_Layout()
        layout_results.addWidget(self.table_keywords.label_number_results, 0,
                                 0)
        layout_results.addWidget(self.table_keywords.button_filter_results, 0,
                                 2)
        layout_results.addWidget(self.table_keywords.button_search_results, 0,
                                 3)

        layout_results.setColumnStretch(1, 1)

        self.wrapper_table.layout().addLayout(layout_results, 0, 0, 1, 5)
        self.wrapper_table.layout().addWidget(self.table_keywords, 1, 0, 1, 5)
        self.wrapper_table.layout().addWidget(
            self.table_keywords.button_generate_table, 2, 0)
        self.wrapper_table.layout().addWidget(
            self.table_keywords.button_generate_fig, 2, 1)
        self.wrapper_table.layout().addWidget(
            self.table_keywords.button_export_selected, 2, 2)
        self.wrapper_table.layout().addWidget(
            self.table_keywords.button_export_all, 2, 3)
        self.wrapper_table.layout().addWidget(self.table_keywords.button_clear,
                                              2, 4)

        # 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
         ) = wordless_widgets.wordless_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 = wordless_layout.Wordless_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(
            wordless_layout.Wordless_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(
            wordless_layout.Wordless_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(
            wordless_layout.Wordless_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.label_ref_file = QLabel(self.tr('Reference File:'), self)
        self.combo_box_ref_file = wordless_box.Wordless_Combo_Box_Ref_File(
            self)
        (self.label_test_significance, self.combo_box_test_significance
         ) = wordless_widgets.wordless_widgets_test_significance(self)
        (self.label_measure_effect_size, self.combo_box_measure_effect_size
         ) = wordless_widgets.wordless_widgets_measure_effect_size(self)

        (self.label_settings_measures, self.button_settings_measures
         ) = wordless_widgets.wordless_widgets_settings_measures(
             self, tab=self.tr('Statistical Significance'))

        self.combo_box_test_significance.addItems(
            list(self.main.settings_global['tests_significance']
                 ['keywords'].keys()))
        self.combo_box_measure_effect_size.addItems(
            list(self.main.settings_global['measures_effect_size']
                 ['keywords'].keys()))

        self.combo_box_ref_file.currentTextChanged.connect(
            self.generation_settings_changed)
        self.combo_box_test_significance.currentTextChanged.connect(
            self.generation_settings_changed)
        self.combo_box_measure_effect_size.currentTextChanged.connect(
            self.generation_settings_changed)

        layout_settings_measures = wordless_layout.Wordless_Layout()
        layout_settings_measures.addWidget(self.label_settings_measures, 0, 0)
        layout_settings_measures.addWidget(self.button_settings_measures, 0, 1)

        layout_settings_measures.setColumnStretch(1, 1)

        self.group_box_generation_settings.setLayout(
            wordless_layout.Wordless_Layout())
        self.group_box_generation_settings.layout().addWidget(
            self.label_ref_file, 0, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.combo_box_ref_file, 1, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.label_test_significance, 3, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.combo_box_test_significance, 4, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.label_measure_effect_size, 5, 0)
        self.group_box_generation_settings.layout().addWidget(
            self.combo_box_measure_effect_size, 6, 0)

        self.group_box_generation_settings.layout().addWidget(
            wordless_layout.Wordless_Separator(self), 7, 0)

        self.group_box_generation_settings.layout().addLayout(
            layout_settings_measures, 8, 0)

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

        (self.checkbox_show_pct, self.checkbox_show_cumulative,
         self.checkbox_show_breakdown
         ) = wordless_widgets.wordless_widgets_table_settings(
             self, table=self.table_keywords)

        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(
            wordless_layout.Wordless_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)

        # Figure Settings
        self.group_box_fig_settings = QGroupBox(self.tr('Figure Settings'),
                                                self)

        (self.label_graph_type, self.combo_box_graph_type, self.label_use_file,
         self.combo_box_use_file, self.label_use_data, self.combo_box_use_data,
         self.checkbox_use_pct, self.checkbox_use_cumulative
         ) = wordless_widgets.wordless_widgets_fig_settings(self)

        self.label_rank = QLabel(self.tr('Rank:'), self)
        (self.label_rank_min, self.spin_box_rank_min,
         self.checkbox_rank_min_no_limit, self.label_rank_max,
         self.spin_box_rank_max, self.checkbox_rank_max_no_limit
         ) = wordless_widgets.wordless_widgets_filter(self,
                                                      filter_min=1,
                                                      filter_max=100000)

        self.combo_box_graph_type.currentTextChanged.connect(
            self.fig_settings_changed)
        self.combo_box_use_file.currentTextChanged.connect(
            self.fig_settings_changed)
        self.combo_box_use_data.currentTextChanged.connect(
            self.fig_settings_changed)
        self.checkbox_use_pct.stateChanged.connect(self.fig_settings_changed)
        self.checkbox_use_cumulative.stateChanged.connect(
            self.fig_settings_changed)

        self.spin_box_rank_min.valueChanged.connect(self.fig_settings_changed)
        self.checkbox_rank_min_no_limit.stateChanged.connect(
            self.fig_settings_changed)
        self.spin_box_rank_max.valueChanged.connect(self.fig_settings_changed)
        self.checkbox_rank_max_no_limit.stateChanged.connect(
            self.fig_settings_changed)

        layout_fig_settings_combo_boxes = wordless_layout.Wordless_Layout()
        layout_fig_settings_combo_boxes.addWidget(self.label_graph_type, 0, 0)
        layout_fig_settings_combo_boxes.addWidget(self.combo_box_graph_type, 0,
                                                  1)
        layout_fig_settings_combo_boxes.addWidget(self.label_use_file, 1, 0)
        layout_fig_settings_combo_boxes.addWidget(self.combo_box_use_file, 1,
                                                  1)
        layout_fig_settings_combo_boxes.addWidget(self.label_use_data, 2, 0)
        layout_fig_settings_combo_boxes.addWidget(self.combo_box_use_data, 2,
                                                  1)

        layout_fig_settings_combo_boxes.setColumnStretch(1, 1)

        self.group_box_fig_settings.setLayout(
            wordless_layout.Wordless_Layout())
        self.group_box_fig_settings.layout().addLayout(
            layout_fig_settings_combo_boxes, 0, 0, 1, 3)
        self.group_box_fig_settings.layout().addWidget(self.checkbox_use_pct,
                                                       1, 0, 1, 3)
        self.group_box_fig_settings.layout().addWidget(
            self.checkbox_use_cumulative, 2, 0, 1, 3)

        self.group_box_fig_settings.layout().addWidget(
            wordless_layout.Wordless_Separator(self), 3, 0, 1, 3)

        self.group_box_fig_settings.layout().addWidget(self.label_rank, 4, 0,
                                                       1, 3)
        self.group_box_fig_settings.layout().addWidget(self.label_rank_min, 5,
                                                       0)
        self.group_box_fig_settings.layout().addWidget(self.spin_box_rank_min,
                                                       5, 1)
        self.group_box_fig_settings.layout().addWidget(
            self.checkbox_rank_min_no_limit, 5, 2)
        self.group_box_fig_settings.layout().addWidget(self.label_rank_max, 6,
                                                       0)
        self.group_box_fig_settings.layout().addWidget(self.spin_box_rank_max,
                                                       6, 1)
        self.group_box_fig_settings.layout().addWidget(
            self.checkbox_rank_max_no_limit, 6, 2)

        self.group_box_fig_settings.layout().setColumnStretch(1, 1)

        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().addWidget(self.group_box_fig_settings,
                                                 3, 0)

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

        self.load_settings()
    def __init__(self, main):
        super().__init__(main)

        # Table
        self.table_files = Wordless_Table_Files(self)

        self.wrapper_table.layout().addWidget(self.table_files, 0, 0, 1, 4)
        self.wrapper_table.layout().addWidget(
            self.table_files.button_open_files, 1, 0)
        self.wrapper_table.layout().addWidget(self.table_files.button_open_dir,
                                              1, 1)
        self.wrapper_table.layout().addWidget(self.table_files.button_reopen,
                                              1, 2)
        self.wrapper_table.layout().addWidget(
            self.table_files.button_select_all, 2, 0)
        self.wrapper_table.layout().addWidget(
            self.table_files.button_invert_selection, 2, 1)
        self.wrapper_table.layout().addWidget(
            self.table_files.button_deselect_all, 2, 2)
        self.wrapper_table.layout().addWidget(
            self.table_files.button_close_selected, 1, 3)
        self.wrapper_table.layout().addWidget(
            self.table_files.button_close_all, 2, 3)

        # Folder Settings
        self.group_box_folder_settings = QGroupBox(self.tr('Folder Settings'),
                                                   self)

        self.checkbox_subfolders = QCheckBox(self.tr('Subfolders'), self)

        self.checkbox_subfolders.stateChanged.connect(
            self.folder_settings_changed)

        self.group_box_folder_settings.setLayout(
            wordless_layout.Wordless_Layout())
        self.group_box_folder_settings.layout().addWidget(
            self.checkbox_subfolders, 0, 0)

        # Auto-detection Settings
        self.group_box_auto_detection_settings = QGroupBox(
            self.tr('Auto-detection Settings'), self)

        self.checkbox_detect_langs = QCheckBox(self.tr('Detect Languages'),
                                               self)
        self.checkbox_detect_text_types = QCheckBox(
            self.tr('Detect Text Types'), self)
        self.checkbox_detect_encodings = QCheckBox(self.tr('Detect Encodings'),
                                                   self)

        self.checkbox_detect_langs.stateChanged.connect(
            self.auto_detection_settings_changed)
        self.checkbox_detect_text_types.stateChanged.connect(
            self.auto_detection_settings_changed)
        self.checkbox_detect_encodings.stateChanged.connect(
            self.auto_detection_settings_changed)

        self.group_box_auto_detection_settings.setLayout(
            wordless_layout.Wordless_Layout())
        self.group_box_auto_detection_settings.layout().addWidget(
            self.checkbox_detect_langs, 0, 0)
        self.group_box_auto_detection_settings.layout().addWidget(
            self.checkbox_detect_text_types, 0, 1)
        self.group_box_auto_detection_settings.layout().addWidget(
            self.checkbox_detect_encodings, 1, 0)

        self.wrapper_settings.layout().addWidget(
            self.group_box_folder_settings, 0, 0)
        self.wrapper_settings.layout().addWidget(
            self.group_box_auto_detection_settings, 1, 0)

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

        self.load_settings()

        # Load files
        self.main.wordless_files = Wordless_Files(self.table_files)
        self.main.wordless_files.update_table()
Example #14
0
    def __init__(self, main):
        super().__init__(main)

        # Table
        self.table_overview = Wordless_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
         ) = wordless_widgets.wordless_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 = wordless_layout.Wordless_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(
            wordless_layout.Wordless_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(
            wordless_layout.Wordless_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(
            wordless_layout.Wordless_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 = wordless_box.Wordless_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(
            wordless_layout.Wordless_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
         ) = wordless_widgets.wordless_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(
            wordless_layout.Wordless_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()
Example #15
0
    def __init__(self, main):
        super().__init__(main, main.tr('Donating'),
                         width = 450)

        self.label_donating = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    If you would like to support the development of Wordless, you may donate via PayPal, Alipay or WeChat.
                </div>
            '''),
            self
        )
        self.label_donating_via = QLabel(self.tr('Donating via:'), self)
        self.combo_box_donating_via = wordless_box.Wordless_Combo_Box(self)
        self.label_donating_via_img = wordless_label.Wordless_Label_Html('', self)
        self.label_donating_note = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    <span style="color: #F00;"><b>Important Note</b></span>: I <b>WILL NOT PROVIDE</b> invoices, receipts, refund services, detailed spending reports, my contact information other than email addresses, my personal social media accounts, private email/phone support, or guarantees on bug fixes, enhancements, new features, or new releases of Wordless for donation.
                </div>
            '''),
            self
        )

        self.combo_box_donating_via.addItems([
            self.tr('PayPal'),
            self.tr('Alipay'),
            self.tr('WeChat')
        ])

        self.combo_box_donating_via.currentTextChanged.connect(self.donating_via_changed)

        layout_donating_via = wordless_layout.Wordless_Layout()
        layout_donating_via.addWidget(self.label_donating_via, 0, 0)
        layout_donating_via.addWidget(self.combo_box_donating_via, 0, 1)

        layout_donating_via.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_donating, 0, 0)
        self.wrapper_info.layout().addLayout(layout_donating_via, 1, 0)
        self.wrapper_info.layout().addWidget(self.label_donating_via_img, 2, 0, Qt.AlignHCenter | Qt.AlignVCenter)
        self.wrapper_info.layout().addWidget(self.label_donating_note, 3, 0)

        # Calculate height
        donating_via_old = self.main.settings_custom['menu']['help']['donating']['donating_via']

        self.combo_box_donating_via.setCurrentText('PayPal')
        self.donating_via_changed()

        height_donating_via_paypal = self.label_donating_via_img.sizeHint().height()
        self.height_paypal = self.heightForWidth(self.width())

        self.combo_box_donating_via.setCurrentText('Alipay')
        self.donating_via_changed()

        height_donating_via_alipay = self.label_donating_via_img.sizeHint().height()
        self.height_alipay = self.heightForWidth(self.width()) + (height_donating_via_alipay - height_donating_via_paypal)

        self.main.settings_custom['menu']['help']['donating']['donating_via'] = donating_via_old

        self.load_settings()
    def __init__(self, main):
        super().__init__(main, main.tr('Acknowledgments'), width=550)

        self.ACKS_GENERAL = [
            # Python
            [
                'Python', 'https://www.python.org', '3.7.5',
                'Guido van Rossum', 'PSF',
                'https://docs.python.org/3.7/license.html#psf-license-agreement-for-python-release'
            ],
            # PyInstaller
            [
                'PyInstaller', 'http://www.pyinstaller.org',
                '4.0.dev0+46286a1f4', 'Hartmut Goebel', 'PyInstaller',
                'https://github.com/pyinstaller/pyinstaller/blob/develop/COPYING.txt'
            ],
            # PyQt
            [
                'PyQt',
                'https://www.riverbankcomputing.com/software/pyqt/intro',
                '5.13.2', 'Riverbank Computing Limited', 'GPL-3.0',
                'http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html#license'
            ],
            # pytest
            [
                'pytest', 'https://pytest.org', '5.3.1', 'Holger Krekel',
                'MIT',
                'https://github.com/pytest-dev/pytest/blob/master/LICENSE'
            ]
        ]

        self.ACKS_NLP = [
            # botok
            [
                'botok', 'https://github.com/Esukhia/botok', '0.6.18',
                'Hélios Drupchen Hildt', 'Apache-2.0',
                'https://github.com/Esukhia/botok/blob/master/LICENSE'
            ],
            # jieba
            [
                'jieba<br>(“结巴”中文分词)', 'https://github.com/fxsjy/jieba',
                '0.39', 'Sun Junyi (孙君意)', 'MIT',
                'https://github.com/fxsjy/jieba/blob/master/LICENSE'
            ],
            # nagisa
            [
                'nagisa', 'https://github.com/taishi-i/nagisa', '0.2.4',
                'Taishi Ikeda (池田大志)', 'MIT',
                'https://github.com/taishi-i/nagisa/blob/master/LICENSE.txt'
            ],
            # NLTK
            [
                'NLTK', 'http://www.nltk.org', '3.4.5',
                'Steven Bird, Liling Tan', 'Apache-2.0',
                'https://github.com/nltk/nltk/blob/develop/LICENSE.txt'
            ],
            # pymorphy2
            [
                'pymorphy2', 'https://github.com/kmike/pymorphy2', '0.8',
                'Mikhail Korobov', 'MIT',
                'https://github.com/kmike/pymorphy2/#pymorphy2'
            ],
            # PyThaiNLP
            [
                'PyThaiNLP', 'https://github.com/PyThaiNLP/pythainlp', '2.0.7',
                'Wannaphong Phatthiyaphaibun<br>(วรรณพงษ์ ภัททิยไพบูลย์)',
                'Apache-2.0',
                'https://github.com/PyThaiNLP/pythainlp/blob/dev/LICENSE'
            ],
            # razdel
            [
                'razdel', 'https://github.com/natasha/razdel', '0.4.0',
                'Alexander Kukushkin', 'MIT',
                'https://github.com/natasha/razdel#%D0%BB%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D1%8F'
            ],
            # Sacremoses
            [
                'Sacremoses', 'https://github.com/alvations/sacremoses',
                '0.0.35', 'Liling Tan', 'LGPL-2.1',
                'https://github.com/alvations/sacremoses#license'
            ],
            # spaCy
            [
                'spaCy', 'https://spacy.io', '2.2.3',
                'Matthew Honnibal, Ines Montani', 'MIT',
                'https://github.com/explosion/spaCy/blob/master/LICENSE'
            ],
            # syntok
            [
                'syntok', 'https://github.com/fnl/syntok', '1.2.2',
                'Florian Leitner', 'MIT',
                'https://github.com/fnl/syntok/blob/master/LICENSE'
            ],
            # Underthesea
            [
                'Underthesea', 'https://github.com/undertheseanlp/underthesea',
                '1.1.17', 'Vu Anh', 'GPL-3.0',
                'https://github.com/undertheseanlp/underthesea/blob/master/LICENSE'
            ]
        ]

        self.ACKS_LANG_DATA = [
            # extra-stopwords
            [
                'extra-stopwords', 'https://github.com/Xangis/extra-stopwords',
                'N/A', 'Jason Champion', 'MIT',
                'https://github.com/Xangis/extra-stopwords/blob/master/LICENSE'
            ],
            # grk-stoplist
            [
                'grk-stoplist',
                'https://github.com/pharos-alexandria/grk-stoplist', 'N/A',
                'Annette von Stockhausen', 'CC0-1.0',
                'https://github.com/pharos-alexandria/grk-stoplist/blob/master/LICENSE'
            ],
            # lemmalist-greek
            [
                'lemmalist-greek',
                'https://github.com/stenskjaer/lemmalist-greek', 'N/A',
                'Michael Stenskjær Christensen', 'GPL-3.0',
                'https://github.com/stenskjaer/lemmalist-greek/blob/master/LICENSE'
            ],
            # Lemmatization Lists
            [
                'Lemmatization Lists',
                'https://github.com/michmech/lemmatization-lists', 'N/A',
                'Michal Boleslav Měchura', 'ODbL',
                'https://github.com/michmech/lemmatization-lists/blob/master/LICENCE'
            ],
            # Stopwords ISO
            [
                'Stopwords ISO',
                'https://github.com/stopwords-iso/stopwords-iso', '0.4.0',
                'Gene Diaz', 'MIT',
                'https://github.com/stopwords-iso/stopwords-iso/blob/master/LICENSE'
            ]
        ]

        self.ACKS_PLOTTING = [
            # Matplotlib
            [
                'Matplotlib', 'https://matplotlib.org', '3.1.2',
                'Matplotlib Development Team', 'Matplotlib',
                'https://matplotlib.org/users/license.html'
            ],
            # NetworkX
            [
                'NetworkX', 'http://networkx.github.io', '2.4',
                'Aric Hagberg, Dan Schult, Pieter Swart', 'BSD-3-Clause',
                'https://github.com/networkx/networkx/blob/master/LICENSE.txt'
            ],
            # WordCloud
            [
                'WordCloud', 'https://amueller.github.io/word_cloud/', '1.6.0',
                'Andreas Christian Mueller', 'MIT',
                'https://github.com/amueller/word_cloud/blob/master/LICENSE'
            ]
        ]

        self.ACKS_MISC = [
            # Beautiful Soup
            [
                'Beautiful Soup',
                'https://www.crummy.com/software/BeautifulSoup/', '4.8.1',
                'Leonard Richardson', 'MIT',
                'https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/view/head:/LICENSE'
            ],
            # cChardet
            [
                'cChardet', 'https://github.com/PyYoshi/cChardet', '2.1.5',
                'Yoshihiro Misawa', 'MPL-1.0/GPL-2.0/LGPL-2.1',
                'https://github.com/PyYoshi/cChardet/blob/master/COPYING'
            ],
            # chardet
            [
                'chardet', 'https://github.com/chardet/chardet', '3.0.4',
                'Daniel Blanchard', 'LGPL-2.1',
                'https://github.com/chardet/chardet/blob/master/LICENSE'
            ],
            # langdetect
            [
                'langdetect', 'https://github.com/Mimino666/langdetect',
                '1.0.7', 'Michal Mimino Danilak', 'Apache-2.0',
                'https://github.com/Mimino666/langdetect/blob/master/LICENSE'
            ],
            # langid.py
            [
                'langid.py', 'https://github.com/saffsd/langid.py', '1.1.6',
                'Marco Lui', 'BSD-2-Clause',
                'https://github.com/saffsd/langid.py/blob/master/LICENSE'
            ],
            # lxml
            [
                'lxml', 'https://lxml.de', '4.4.2', 'Stefan Behnel',
                'BSD-3-Clause',
                'https://github.com/lxml/lxml/blob/master/doc/licenses/BSD.txt'
            ],
            # NumPy
            [
                'NumPy', 'https://numpy.org', '1.17.4', 'NumPy Developers',
                'BSD-3-Clause', 'http://www.numpy.org/license.html'
            ],
            # openpyxl
            [
                'openpyxl', 'https://openpyxl.readthedocs.io/en/stable/',
                '3.0.2', 'Eric Gazoni, Charlie Clark', 'MIT',
                'https://bitbucket.org/openpyxl/openpyxl/src/5983d4ba5c18b85171185e8b1ca136876ec52864/LICENCE.rst'
            ],
            # python-docx
            [
                'python-docx', 'https://github.com/python-openxml/python-docx',
                '0.8.10', 'Steve Canny', 'MIT',
                'https://github.com/python-openxml/python-docx/blob/master/LICENSE'
            ],
            # requests
            [
                'requests', 'https://python-requests.org', '2.22.0',
                'Kenneth Reitz', 'Apache-2.0',
                'https://github.com/requests/requests/blob/master/LICENSE'
            ],
            # SciPy
            [
                'SciPy', 'https://www.scipy.org', '1.3.3', 'SciPy Developers',
                'BSD-3-Clause', 'https://www.scipy.org/scipylib/license.html'
            ],
            # xlrd
            [
                'xlrd', 'https://github.com/python-excel/xlrd', '1.2.0',
                'Stephen John Machin', 'BSD-3-Clause/BSD-4-Clause',
                'https://github.com/python-excel/xlrd/blob/master/LICENSE'
            ]
        ]

        self.label_acks = wordless_label.Wordless_Label_Dialog(
            self.tr('''
                <div>
                    I would like to extend my sincere gratitude to the following open-source projects without which this project would not have been possible:
                </div>
            '''), self)
        self.label_browse_category = QLabel(self.tr('Browse by category:'),
                                            self)
        self.combo_box_browse_category = wordless_box.Wordless_Combo_Box(self)

        self.table_acks = wordless_table.Wordless_Table(
            self,
            headers=[
                self.tr('Name'),
                self.tr('Version'),
                self.tr('Author(s)'),
                self.tr('License')
            ])

        self.combo_box_browse_category.addItems([
            self.tr('General'),
            self.tr('Natural Language Processing'),
            self.tr('Language Data'),
            self.tr('Plotting'),
            self.tr('Miscellaneous')
        ])

        self.table_acks.setFixedHeight(250)

        self.combo_box_browse_category.currentTextChanged.connect(
            self.browse_category_changed)

        layout_browse_category = wordless_layout.Wordless_Layout()
        layout_browse_category.addWidget(self.label_browse_category, 0, 0)
        layout_browse_category.addWidget(self.combo_box_browse_category, 0, 1)

        layout_browse_category.setColumnStretch(2, 1)

        self.wrapper_info.layout().addWidget(self.label_acks, 0, 0)
        self.wrapper_info.layout().addLayout(layout_browse_category, 1, 0)
        self.wrapper_info.layout().addWidget(self.table_acks, 2, 0)

        self.load_settings()

        self.set_fixed_height()