Exemple #1
0
    def __init__(self, main):
        super().__init__(main, main.tr('Need Help?'),
                         width = 550,
                         height = 500)

        self.label_need_help = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    If you encounter a problem, find a bug, or require any further information, feel free to ask questions, submit bug reports, or provide feedback by <a href="https://github.com/BLKSerene/Wordless/issues/new">creating an issue</a> on Github if you fail to find the answer by searching <a href="https://github.com/BLKSerene/Wordless/issues">existing issues</a> first.
                </div>

                <div>
                    If you need to post sample texts or other information that cannot be shared or you do not want to share publicly, you may send me an email.
                </div>
            '''),
            self
        )

        self.table_need_help = wl_table.Wl_Table(
            self,
            headers = [
                self.tr('Channel'),
                self.tr('Contact Information')
            ],
            cols_stretch = [
                self.tr('Contact Information')
            ]
        )

        self.table_need_help.setFixedHeight(300)
        self.table_need_help.setRowCount(4)
        self.table_need_help.verticalHeader().setHidden(True)

        self.table_need_help.setCellWidget(0, 0, wl_label.Wl_Label_Html_Centered(self.tr('Documentation'), self))
        self.table_need_help.setCellWidget(0, 1, wl_label.Wl_Label_Html('<a href="https://github.com/BLKSerene/Wordless#documentation">https://github.com/BLKSerene/Wordless#documentation</a>', self))
        self.table_need_help.setCellWidget(1, 0, wl_label.Wl_Label_Html_Centered(self.tr('Email'), self))
        self.table_need_help.setCellWidget(1, 1, wl_label.Wl_Label_Html('<a href="mailto:[email protected]">[email protected]</a>', self))
        self.table_need_help.setCellWidget(2, 0, wl_label.Wl_Label_Html_Centered(self.tr('<a href="https://www.wechat.com/en/">WeChat</a><br>Official Account'), self))
        self.table_need_help.setCellWidget(2, 1, wl_label.Wl_Label_Html_Centered('<img src="imgs/wechat_official_account.jpg">', self))

        self.label_need_help_note = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    <span style="color: #F00;"><b>Important Note</b></span>: I <b>CANNOT GUARANTEE</b> that all emails will always be checked or replied in time. I <b>WILL NOT REPLY</b> to irrelevant emails and I reserve the right to <b>BLOCK AND/OR REPORT</b> people who send me spam emails.
                </div>
            '''),
            self
        )

        self.wrapper_info.layout().addWidget(self.label_need_help, 0, 0)
        self.wrapper_info.layout().addWidget(self.table_need_help, 1, 0)
        self.wrapper_info.layout().addWidget(self.label_need_help_note, 2, 0)
Exemple #2
0
    def __init__(self, main):
        super().__init__(main, main.tr('Exit'), width=420, no_button=True)

        self.label_confirm_exit = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    Restart is required for font settings to take effect. Do you want to restart Wordless now?
                </div>

                <div style="font-weight: bold;">
                    Note: All unsaved data and figures will be lost.
                </div>
            '''), self)

        self.button_restart = QPushButton(self.tr('Restart'), self)
        self.button_cancel = QPushButton(self.tr('Cancel'), self)

        self.button_restart.clicked.connect(self.accept)
        self.button_cancel.clicked.connect(self.reject)

        self.wrapper_info.layout().addWidget(self.label_confirm_exit, 0, 0)

        self.wrapper_buttons.layout().addWidget(self.button_restart, 0, 1)
        self.wrapper_buttons.layout().addWidget(self.button_cancel, 0, 2)

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

        self.set_fixed_height()
Exemple #3
0
    def __init__(self, main, on_startup=False):
        super().__init__(main,
                         main.tr('Check for Updates'),
                         width=420,
                         no_button=True)

        self.on_startup = on_startup

        self.label_check_updates = wl_label.Wl_Label_Dialog('', self)
        self.checkbox_check_updates_on_startup = QCheckBox(
            self.tr('Check for updates on startup'), self)

        self.button_try_again = QPushButton(self.tr('Try Again'), self)
        self.button_cancel = QPushButton(self.tr('Cancel'), self)

        self.checkbox_check_updates_on_startup.stateChanged.connect(
            self.check_updates_on_startup_changed)

        self.button_try_again.clicked.connect(self.check_updates)

        self.wrapper_info.layout().addWidget(self.label_check_updates, 0, 0)

        self.wrapper_buttons.layout().addWidget(
            self.checkbox_check_updates_on_startup, 0, 0)
        self.wrapper_buttons.layout().addWidget(self.button_try_again, 0, 2)
        self.wrapper_buttons.layout().addWidget(self.button_cancel, 0, 3)

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

        self.load_settings()

        self.set_fixed_height()
Exemple #4
0
    def __init__(self, main, files_detection_error_encoding,
                 files_detection_error_text_type, files_detection_error_lang):
        super().__init__(main,
                         main.tr('Detection Error'),
                         width=DIALOG_ERROR_WIDTH,
                         height=DIALOG_ERROR_HEIGHT)

        self.label_error = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    An error occurred during auto-detection. Please set the settings of the following files manually.
                </div>
            '''), self)

        self.table_error_files = wl_table.Wl_Table_Error(
            self, headers=[self.tr('Error Types'),
                           self.tr('Files')])

        self.table_error_files.setFixedHeight(TABLE_ERROR_FILES_HEIGHT)
        self.table_error_files.setRowCount(0)

        self.button_export.clicked.connect(self.table_error_files.export_all)

        for file in files_detection_error_encoding:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Encoding Detection')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_detection_error_text_type:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Text Type Detection')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_detection_error_lang:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Language Detection')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        self.wrapper_info.layout().addWidget(self.label_error, 0, 0)
        self.wrapper_info.layout().addWidget(self.table_error_files, 1, 0)
Exemple #5
0
    def __init__(self, main, files_missing, files_empty, files_decoding_error):
        super().__init__(main,
                         main.tr('Error Loading File'),
                         width=DIALOG_ERROR_WIDTH,
                         height=DIALOG_ERROR_HEIGHT)

        self.label_error = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    An error occurred while loading the following files. Please check the files and/or your settings and try again.
                </div>
            '''), self)

        self.table_error_files = wl_table.Wl_Table_Error(
            self, headers=[self.tr('Error Types'),
                           self.tr('Files')])

        self.table_error_files.setFixedHeight(TABLE_ERROR_FILES_HEIGHT)
        self.table_error_files.setRowCount(0)

        self.button_export.clicked.connect(self.table_error_files.export_all)

        for file in files_missing:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Missing File')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_empty:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Empty File')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_decoding_error:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Decoding Error')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        self.wrapper_info.layout().addWidget(self.label_error, 0, 0)
        self.wrapper_info.layout().addWidget(self.table_error_files, 1, 0)
Exemple #6
0
    def __init__(self, main):
        super().__init__(main, main.tr('Citing'),
                         width = 450,
                         no_button = True)

        self.label_citing = wl_label.Wl_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 = wl_box.Wl_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('APA (7th Edition)'),
            self.tr('MLA (8th Edition)')
        ])
    
        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 = wl_layout.Wl_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()

        self.set_fixed_height()
Exemple #7
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 = wl_label.Wl_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(wl_layout.Wl_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)
Exemple #8
0
    def __init__(self, main):
        super().__init__(main, main.tr('Exit'), width=420, no_button=True)

        self.label_confirm_exit = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    Are you sure you want to exit Wordless?
                </div>

                <div style="font-weight: bold;">
                    Note: All unsaved data and figures will be lost.
                </div>
            '''), self)

        self.checkbox_confirm_on_exit = QCheckBox(
            self.tr('Always confirm on exit'), self)
        self.button_exit = QPushButton(self.tr('Exit'), self)
        self.button_cancel = QPushButton(self.tr('Cancel'), self)

        self.checkbox_confirm_on_exit.stateChanged.connect(
            self.confirm_on_exit_changed)
        self.button_exit.clicked.connect(self.accept)
        self.button_cancel.clicked.connect(self.reject)

        self.wrapper_info.layout().addWidget(self.label_confirm_exit, 0, 0)

        self.wrapper_buttons.layout().addWidget(self.checkbox_confirm_on_exit,
                                                0, 0)
        self.wrapper_buttons.layout().addWidget(self.button_exit, 0, 2)
        self.wrapper_buttons.layout().addWidget(self.button_cancel, 0, 3)

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

        self.load_settings()

        self.set_fixed_height()
Exemple #9
0
    def __init__(self, main):
        super().__init__(main, main.tr('Donating'), width=450)

        self.label_donating = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    If you would like to support the development of Wordless, you may donate via <a href="https://www.paypal.com/">PayPal</a>, <a href="https://global.alipay.com/">Alipay</a>, or <a href="https://pay.weixin.qq.com/index.php/public/wechatpay_en">WeChat Pay</a>.
                </div>
            '''), self)
        self.label_donating_via = QLabel(self.tr('Donating via:'), self)
        self.combo_box_donating_via = wl_box.Wl_Combo_Box(self)
        self.label_donating_via_img = wl_label.Wl_Label_Html('', self)
        self.label_donating_note = wl_label.Wl_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 Pay')])

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

        layout_donating_via = wl_layout.Wl_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()
Exemple #10
0
    def __init__(self, main):
        super().__init__(main, main.tr('Acknowledgments'), width=550)

        with open('wl_acks/wl_acks_general.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_GENERAL = [row for row in csv_reader]

        with open('wl_acks/wl_acks_nlp.csv', 'r', encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_NLP = [row for row in csv_reader]

        with open('wl_acks/wl_acks_lang_data.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_LANG_DATA = [row for row in csv_reader]

        with open('wl_acks/wl_acks_plotting.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_PLOTTING = [row for row in csv_reader]

        with open('wl_acks/wl_acks_misc.csv',
                  'r',
                  encoding='utf_8',
                  newline='') as f:
            csv_reader = csv.reader(f, delimiter='|')

            self.ACKS_MISC = [row for row in csv_reader]

        self.label_acks = wl_label.Wl_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 = wl_box.Wl_Combo_Box(self)

        self.table_acks = wl_table.Wl_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 = wl_layout.Wl_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()
Exemple #11
0
    def __init__(self, main, files_duplicate, files_empty, files_unsupported,
                 files_parsing_error):
        super().__init__(main,
                         main.tr('Error Opening File'),
                         width=DIALOG_ERROR_WIDTH)

        self.label_error = wl_label.Wl_Label_Dialog(
            self.tr('''
                <div>
                    An error occurred while opening the files, so the following files are skipped and will not be added to the file area.
                </div>
            '''), self)

        self.table_error_files = wl_table.Wl_Table_Error(
            self, headers=[self.tr('Error Types'),
                           self.tr('Files')])

        self.table_error_files.setFixedHeight(TABLE_ERROR_FILES_HEIGHT)
        self.table_error_files.setRowCount(0)

        self.button_export.clicked.connect(self.table_error_files.export_all)

        for file in files_duplicate:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Duplicate File')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_empty:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Empty File')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_unsupported:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Unsupported File Type')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_parsing_error:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Parsing Error')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        self.wrapper_info.layout().addWidget(self.label_error, 0, 0)
        self.wrapper_info.layout().addWidget(self.table_error_files, 1, 0)
Exemple #12
0
    def __init__(self, main, files_missing, files_empty, files_decoding_error,
                 files_pos_tagging_not_supported):
        if files_pos_tagging_not_supported:
            super().__init__(main,
                             main.tr('Error Loading Files'),
                             width=DIALOG_ERROR_WIDTH,
                             height=DIALOG_ERROR_HEIGHT_COLLIGATION)
        else:
            super().__init__(main,
                             main.tr('Error Loading Files'),
                             width=DIALOG_ERROR_WIDTH,
                             height=DIALOG_ERROR_HEIGHT)

        if files_pos_tagging_not_supported:
            self.label_error = wl_label.Wl_Label_Dialog(
                self.tr('''
                    <div>
                        An error occurred while loading the following files. Please check the files and/or your settings and try again.
                    </div>
                    <div>
                        The built-in POS taggers currently have no support for some of the following files, please check your language settings or provide files that have already been POS-tagged.
                    </div>
                '''), self)
        else:
            self.label_error = wl_label.Wl_Label_Dialog(
                self.tr('''
                    <div>
                        An error occurred while loading the following files. Please check the files and/or your settings and try again.
                    </div>
                '''), self)

        self.table_error_files = wl_table.Wl_Table_Error(
            self, headers=[self.tr('Error Types'),
                           self.tr('Files')])

        self.table_error_files.setFixedHeight(TABLE_ERROR_FILES_HEIGHT)
        self.table_error_files.setRowCount(0)

        self.button_export.clicked.connect(self.table_error_files.export_all)

        for file in files_missing:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Missing File')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_empty:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Empty File')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_decoding_error:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('Decoding Error')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        for file in files_pos_tagging_not_supported:
            self.table_error_files.setRowCount(
                self.table_error_files.rowCount() + 1)

            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 0,
                QTableWidgetItem(self.tr('POS Tagging Not Supported')))
            self.table_error_files.setItem(
                self.table_error_files.rowCount() - 1, 1,
                QTableWidgetItem(file))

        self.wrapper_info.layout().addWidget(self.label_error, 0, 0)
        self.wrapper_info.layout().addWidget(self.table_error_files, 1, 0)