Пример #1
0
    def browse_category_changed(self):
        settings = self.main.settings_custom['menu']['help']['acks']

        settings[
            'browse_category'] = self.combo_box_browse_category.currentText()

        if settings['browse_category'] == self.tr('General'):
            acks = self.ACKS_GENERAL
        elif settings['browse_category'] == self.tr(
                'Natural Language Processing'):
            acks = self.ACKS_NLP
        elif settings['browse_category'] == self.tr('Language Data'):
            acks = self.ACKS_LANG_DATA
        elif settings['browse_category'] == self.tr('Plotting'):
            acks = self.ACKS_PLOTTING
        elif settings['browse_category'] == self.tr('Miscellaneous'):
            acks = self.ACKS_MISC

        self.table_acks.clear_table()

        self.table_acks.blockSignals(True)
        self.table_acks.setUpdatesEnabled(False)

        self.table_acks.setRowCount(len(acks))

        for i, (project_name, project_url, ver, authors, license_name,
                licence_url) in enumerate(acks):
            project = f'<a href="{project_url}">{project_name}</a>'
            license = f'<a href="{licence_url}">{license_name}</a>'

            # Pad cells with whitespace
            project = project.replace('<br>', '&nbsp;<br>&nbsp;')
            ver = ver.replace('<br>', '&nbsp;<br>&nbsp;')
            authors = authors.replace('<br>', '&nbsp;<br>&nbsp;')
            license = license.replace('<br>', '&nbsp;<br>&nbsp;')

            project = f'&nbsp;{project}&nbsp;'
            ver = f'&nbsp;{ver}&nbsp;'
            authors = f'&nbsp;{authors}&nbsp;'
            license = f'&nbsp;{license}&nbsp;'

            self.table_acks.setCellWidget(
                i, 0, wordless_label.Wordless_Label_Html(project, self))
            self.table_acks.setCellWidget(
                i, 1, wordless_label.Wordless_Label_Html(ver, self))
            self.table_acks.setCellWidget(
                i, 2, wordless_label.Wordless_Label_Html(authors, self))
            self.table_acks.setCellWidget(
                i, 3, wordless_label.Wordless_Label_Html(license, self))

        self.table_acks.blockSignals(False)
        self.table_acks.setUpdatesEnabled(True)

        self.table_acks.itemChanged.emit(self.table_acks.item(0, 0))
Пример #2
0
def wordless_widgets_pick_color(parent):
    def get_color():
        return re.search(r'#[0-9a-zA-Z]{6}', label_pick_color.text()).group()

    def set_color(color):
        label_pick_color.setText(
            f'<span style="margin-right: 3px; background-color: {color}; color: {color}">00</span> <span>{color.upper()}</span>'
        )

    def pick_color():
        color_picked = QColorDialog.getColor(QColor(get_color()), parent,
                                             parent.tr('Pick Color'))

        if color_picked.isValid():
            label_pick_color.set_color(color_picked.name())

    label_pick_color = wordless_label.Wordless_Label_Html('', parent)
    button_pick_color = QPushButton(parent.tr('Pick Color...'), parent)

    label_pick_color.get_color = get_color
    label_pick_color.set_color = set_color

    button_pick_color.clicked.connect(pick_color)

    return label_pick_color, button_pick_color
Пример #3
0
    def browse_category_changed(self):
        settings = self.main.settings_custom['menu']['help']['acks']

        settings[
            'browse_category'] = self.combo_box_browse_category.currentText()

        if settings['browse_category'] == self.tr('General'):
            acks = self.ACKS_GENERAL
        elif settings['browse_category'] == self.tr(
                'Natural Language Processing'):
            acks = self.ACKS_NLP
        elif settings['browse_category'] == self.tr('Plotting'):
            acks = self.ACKS_PLOTTING
        elif settings['browse_category'] == self.tr('Miscellaneous'):
            acks = self.ACKS_MISC
        elif settings['browse_category'] == self.tr('Data'):
            acks = self.ACKS_DATA

        self.table_acks.clear_table()

        self.table_acks.blockSignals(True)
        self.table_acks.setSortingEnabled(False)
        self.table_acks.setUpdatesEnabled(False)

        self.table_acks.setRowCount(len(acks))

        for i, (name, ver, authors, license) in enumerate(acks):
            self.table_acks.setCellWidget(
                i, 0, wordless_label.Wordless_Label_Html(name, self))
            self.table_acks.setCellWidget(
                i, 1, wordless_label.Wordless_Label_Html(ver, self))
            self.table_acks.setCellWidget(
                i, 2, wordless_label.Wordless_Label_Html(authors, self))
            self.table_acks.setCellWidget(
                i, 3, wordless_label.Wordless_Label_Html(license, self))

            self.table_acks.cellWidget(i, 1).setAlignment(Qt.AlignHCenter
                                                          | Qt.AlignVCenter)
            self.table_acks.cellWidget(i, 3).setAlignment(Qt.AlignHCenter
                                                          | Qt.AlignVCenter)

        self.table_acks.blockSignals(False)
        self.table_acks.setSortingEnabled(True)
        self.table_acks.setUpdatesEnabled(True)

        self.table_acks.itemChanged.emit(self.table_acks.item(0, 0))
Пример #4
0
    def __init__(self, main):
        super().__init__(main, main.tr('Need Help?'),
                         width = 500,
                         height = 460)

        self.label_need_help = wordless_label.Wordless_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 = wordless_table.Wordless_Table(self,
                                                             headers = [
                                                                 self.tr('Platforms'),
                                                                 self.tr('Contact Information')
                                                             ],
                                                             cols_stretch = [
                                                                 self.tr('Contact Information')
                                                             ])

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

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

        self.label_need_help_note = wordless_label.Wordless_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)
Пример #5
0
    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()
Пример #6
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()