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>', ' <br> ') ver = ver.replace('<br>', ' <br> ') authors = authors.replace('<br>', ' <br> ') license = license.replace('<br>', ' <br> ') project = f' {project} ' ver = f' {ver} ' authors = f' {authors} ' license = f' {license} ' self.table_acks.setCellWidget( i, 0, wl_label.Wl_Label_Html(project, self)) self.table_acks.setCellWidget( i, 1, wl_label.Wl_Label_Html_Centered(ver, self)) self.table_acks.setCellWidget( i, 2, wl_label.Wl_Label_Html(authors, self)) self.table_acks.setCellWidget( i, 3, wl_label.Wl_Label_Html_Centered(license, self)) self.table_acks.blockSignals(False) self.table_acks.setUpdatesEnabled(True) self.table_acks.itemChanged.emit(self.table_acks.item(0, 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)
def wl_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 = wl_label.Wl_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
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()