def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.setOpenExternalLinks(True) self.setContentsMargins(3, 3, 3, 3)
def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.setMaxVisibleItems(20) self.setFocusPolicy(Qt.StrongFocus)
def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.setWidgetResizable(True) self.setBackgroundRole(QPalette.Light)
def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.setSelectionMode(QAbstractItemView.ExtendedSelection) self.setEditTriggers(QAbstractItemView.DoubleClicked | QAbstractItemView.SelectedClicked) self.setDragEnabled(True) self.setAcceptDrops(True) self.setDragDropMode(QAbstractItemView.InternalMove) self.itemChanged.connect(self.item_changed) self.itemSelectionChanged.connect(self.selection_changed) self.button_add = QPushButton(self.tr('Add'), self) self.button_remove = QPushButton(self.tr('Remove'), self) self.button_clear = QPushButton(self.tr('Clear'), self) self.button_import = QPushButton(self.tr('Import'), self) self.button_export = QPushButton(self.tr('Export'), self) self.button_add.clicked.connect(self.add_item) self.button_remove.clicked.connect(self.remove_item) self.button_clear.clicked.connect(self.clear_list) self.button_import.clicked.connect(self.import_list) self.button_export.clicked.connect(self.export_list) self.clear_list()
def __init__(self, orientation, parent): super().__init__(orientation, parent) self.main = wl_misc.find_wl_main(parent) self.setHandleWidth(0) self.setChildrenCollapsible(False)
def __init__(self, parent, widget=None, row=None, col=None): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.widget = widget self.row = row self.col = col self.enabled = True
def wl_widgets_settings_measures(parent, tab): main = wl_misc.find_wl_main(parent) label_settings_measures = QLabel(parent.tr('Advanced Settings:'), parent) button_settings_measures = QPushButton(parent.tr('Settings...'), parent) button_settings_measures.clicked.connect(lambda: main.wl_settings.load(tab = tab)) return label_settings_measures, button_settings_measures
def wl_widgets_measure_adjusted_freq(parent): main = wl_misc.find_wl_main(parent) label_measure_adjusted_freq = QLabel(parent.tr('Measure of Adjusted Frequency:'), parent) combo_box_measure_adjusted_freq = wl_box.Wl_Combo_Box(parent) combo_box_measure_adjusted_freq.addItems(list(main.settings_global['measures_adjusted_freq'].keys())) return (label_measure_adjusted_freq, combo_box_measure_adjusted_freq)
def wl_widgets_measure_dispersion(parent): main = wl_misc.find_wl_main(parent) label_measure_dispersion = QLabel(parent.tr('Measure of Dispersion:'), parent) combo_box_measure_dispersion = wl_box.Wl_Combo_Box(parent) combo_box_measure_dispersion.addItems(list(main.settings_global['measures_dispersion'].keys())) return (label_measure_dispersion, combo_box_measure_dispersion)
def __init__(self, parent, orientation = 'hor'): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) if orientation == 'hor': self.setFrameShape(QFrame.HLine) else: self.setFrameShape(QFrame.VLine) self.setStyleSheet('color: #D0D0D0;')
def __init__(self, text, parent): main = wl_misc.find_wl_main(parent) super().__init__( f''' {main.settings_global['styles']['style_dialog']} <body> {text} </body> ''', parent) self.setWordWrap(True)
def wl_widgets_context_settings(parent, tab): main = wl_misc.find_wl_main(parent) label_context_settings = QLabel(parent.tr('Context Settings:'), parent) button_context_settings = QPushButton(parent.tr('Settings...'), parent) dialog_context_settings = wl_dialog_context_settings.Wl_Dialog_Context_Settings(main, tab = tab) main.__dict__[f'wl_context_settings_{tab}'] = dialog_context_settings button_context_settings.clicked.connect(lambda: main.__dict__[f'wl_context_settings_{tab}'].load()) return label_context_settings, button_context_settings
def __init__(self, parent): super().__init__(parent) self.FONT_SIZES = { 'Extra Small': 10, 'Small': 12, 'Medium (Recommended)': 14, 'Large': 16, 'Extra Large': 18 } self.main = wl_misc.find_wl_main(parent) self.addItems(list(self.FONT_SIZES))
def wl_widgets_filter_p_value(parent): def min_changed(): if spin_box_min.value() > spin_box_max.value(): spin_box_max.setValue(spin_box_min.value()) def max_changed(): if spin_box_min.value() > spin_box_max.value(): spin_box_min.setValue(spin_box_max.value()) def precision_changed(): precision = main.settings_custom['data']['precision_p_value'] spin_box_min.setDecimals(precision) spin_box_max.setDecimals(precision) spin_box_min.setSingleStep(0.1 ** precision) spin_box_max.setSingleStep(0.1 ** precision) main = wl_misc.find_wl_main(parent) label_min = QLabel(parent.tr('From'), parent) (spin_box_min, checkbox_min_no_limit) = wl_widgets_no_limit(parent, double = True) label_max = QLabel(parent.tr('To'), parent) (spin_box_max, checkbox_max_no_limit) = wl_widgets_no_limit(parent, double = True) spin_box_min.setRange(0, 1) spin_box_max.setRange(0, 1) spin_box_min.valueChanged.connect(min_changed) spin_box_max.valueChanged.connect(max_changed) main.wl_settings.wl_settings_changed.connect(precision_changed) min_changed() max_changed() precision_changed() return ( label_min, spin_box_min, checkbox_min_no_limit, label_max, spin_box_max, checkbox_max_no_limit )
def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.setObjectName('wl-wrapper') self.setStyleSheet(''' QWidget#wl-wrapper { background-color: #FFF; } ''') self.wrapper_table = QWidget(self) self.wrapper_table.setLayout(Wl_Layout()) self.wrapper_table.layout().setContentsMargins(0, 0, 0, 0) self.scroll_area_settings = Wl_Scroll_Area(self) self.button_restore_default_settings = wl_buttons.Wl_Button_Restore_Default_Settings(self, load_settings = self.load_settings) self.scroll_area_settings.setFixedWidth(400) self.wrapper_settings_outer = QWidget(self) self.wrapper_settings_outer.setLayout(Wl_Layout()) self.wrapper_settings = QWidget(self) self.wrapper_settings.setLayout(Wl_Layout()) self.wrapper_settings.layout().setContentsMargins(0, 0, 0, 0) self.wrapper_settings_outer.layout().addWidget(self.wrapper_settings, 0, 0) self.wrapper_settings_outer.layout().addWidget(self.button_restore_default_settings, 1, 0) self.wrapper_settings_outer.layout().setContentsMargins(8, 6, 8, 6) self.scroll_area_settings.setWidget(self.wrapper_settings_outer) self.setLayout(Wl_Layout()) self.layout().addWidget(self.wrapper_table, 0, 0) self.layout().addWidget(self.scroll_area_settings, 0, 1) self.layout().setContentsMargins(8, 6, 8, 6)
def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.setObjectName('wl-wrapper') self.setStyleSheet(''' QWidget#wl-wrapper { background-color: #FFF; } ''') self.wrapper_table = QWidget(self) self.wrapper_table.setLayout(Wl_Layout()) self.wrapper_table.layout().setContentsMargins(8, 8, 6, 6) self.wrapper_right = QWidget(self) self.wrapper_right.setFixedWidth(340) self.scroll_area_settings = Wl_Scroll_Area(self) self.button_reset_settings = wl_button.Wl_Button_Reset_Settings(self) self.wrapper_settings = QWidget(self) self.wrapper_settings.setLayout(Wl_Layout()) self.wrapper_settings.layout().setContentsMargins(6, 4, 6, 4) self.scroll_area_settings.setWidget(self.wrapper_settings) self.wrapper_right.setLayout(Wl_Layout()) self.wrapper_right.layout().addWidget(self.scroll_area_settings, 0, 0) self.wrapper_right.layout().addWidget(self.button_reset_settings, 1, 0) self.wrapper_right.layout().setContentsMargins(0, 8, 8, 6) self.setLayout(Wl_Layout()) self.layout().addWidget(self.wrapper_table, 0, 0) self.layout().addWidget(self.wrapper_right, 0, 1) self.layout().setContentsMargins(0, 0, 0, 0)
def __init__(self, parent, new_item_text='', editable=True, drag_drop=True): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.new_item_text = new_item_text if new_item_text else _tr( 'Wl_List_Add_Ins_Del_Clr', 'New item') self.items_old = [] if editable: self.setEditTriggers(QAbstractItemView.DoubleClicked | QAbstractItemView.SelectedClicked) else: self.setEditTriggers(QAbstractItemView.NoEditTriggers) if drag_drop: self.setDragDropMode(QAbstractItemView.InternalMove) self.setSelectionMode(QAbstractItemView.ExtendedSelection) self.setModel(QStringListModel(self)) self.model().dataChanged.connect(self.data_changed) self.selectionModel().selectionChanged.connect(self.selection_changed) self.button_add = QPushButton(_tr('Wl_List_Add_Ins_Del_Clr', 'Add'), self) self.button_ins = QPushButton(_tr('Wl_List_Add_Ins_Del_Clr', 'Insert'), self) self.button_del = QPushButton(_tr('Wl_List_Add_Ins_Del_Clr', 'Remove'), self) self.button_clr = QPushButton(_tr('Wl_List_Add_Ins_Del_Clr', 'Clear'), self) self.button_add.clicked.connect(self.add_item) self.button_ins.clicked.connect(self.ins_item) self.button_del.clicked.connect(self.del_item) self.button_clr.clicked.connect(self.clr_list)
def __init__(self, text, parent): super().__init__(text, parent) self.main = wl_misc.find_wl_main(parent)
def wl_widgets_fig_settings(parent, collocation = False): def graph_type_changed(): if combo_box_graph_type.currentText() == parent.tr('Line Chart'): combo_box_use_file.setEnabled(False) use_data_changed() else: combo_box_use_file.setEnabled(True) checkbox_use_pct.setEnabled(False) checkbox_use_cumulative.setEnabled(False) def use_data_changed(): if combo_box_graph_type.currentText() == parent.tr('Line Chart'): if combo_box_use_data.currentText() == parent.tr('Frequency'): checkbox_use_pct.setEnabled(True) checkbox_use_cumulative.setEnabled(True) else: checkbox_use_pct.setEnabled(False) checkbox_use_cumulative.setEnabled(False) def wl_files_changed(): if combo_box_use_file.count() == 1: use_file_old = '' else: use_file_old = combo_box_use_file.currentText() combo_box_use_file.clear() for file in main.wl_files.get_selected_files(): combo_box_use_file.addItem(file['name']) combo_box_use_file.addItem(parent.tr('Total')) if use_file_old and combo_box_use_file.findText(use_file_old) > -1: combo_box_use_file.setCurrentText(use_file_old) main = wl_misc.find_wl_main(parent) label_graph_type = QLabel(parent.tr('Graph Type:'), parent) combo_box_graph_type = wl_box.Wl_Combo_Box(parent) label_use_file = QLabel(parent.tr('Use File:'), parent) combo_box_use_file = wl_box.Wl_Combo_Box(parent) label_use_data = QLabel(parent.tr('Use Data:'), parent) combo_box_use_data = wl_box.Wl_Combo_Box(parent) # Clip long file names combo_box_use_file.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon) checkbox_use_pct = QCheckBox(parent.tr('Use percentage data'), parent) checkbox_use_cumulative = QCheckBox(parent.tr('Use cumulative data'), parent) combo_box_graph_type.addItems([parent.tr('Line Chart'), parent.tr('Word Cloud')]) # Collocation & Colligation if collocation: combo_box_graph_type.addItem(parent.tr('Network Graph')) combo_box_graph_type.currentTextChanged.connect(graph_type_changed) combo_box_use_data.currentTextChanged.connect(use_data_changed) main.wl_files.table.itemChanged.connect(wl_files_changed) combo_box_use_file.wl_files_changed = wl_files_changed graph_type_changed() use_data_changed() wl_files_changed() return ( label_graph_type, combo_box_graph_type, label_use_file, combo_box_use_file, label_use_data, combo_box_use_data, checkbox_use_pct, checkbox_use_cumulative )
def wl_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 token_settings_changed(): token_settings = main.settings_custom[tab]['token_settings'] checkbox_ignore_tags.blockSignals(True) checkbox_match_tags.blockSignals(True) if token_settings['ignore_tags']: checkbox_ignore_tags.setEnabled(False) checkbox_match_tags.setEnabled(False) else: checkbox_ignore_tags.setEnabled(True) checkbox_match_tags.setEnabled(True) if token_settings['use_tags']: checkbox_ignore_tags.setEnabled(False) checkbox_match_tags.setEnabled(False) else: checkbox_ignore_tags.setEnabled(True) checkbox_match_tags.setEnabled(True) checkbox_ignore_tags.blockSignals(False) checkbox_match_tags.blockSignals(False) def ignore_tags_changed(): if checkbox_ignore_tags.isChecked(): checkbox_match_tags.setEnabled(False) checkbox_match_tags.setChecked(False) else: checkbox_match_tags.setEnabled(True) def match_tags_changed(): if checkbox_match_tags.isChecked(): checkbox_match_inflected_forms.setEnabled(False) checkbox_ignore_tags.setEnabled(False) checkbox_ignore_tags.setChecked(False) else: checkbox_match_inflected_forms.setEnabled(True) checkbox_ignore_tags.setEnabled(True) main = wl_misc.find_wl_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 = wl_list.Wl_List_Search_Terms(parent) label_separator = wl_label.Wl_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 tags'), parent) checkbox_match_tags = QCheckBox(parent.tr('Match tags only'), parent) wrapper_search_terms = QWidget(parent) wrapper_search_terms.setLayout(wl_layout.Wl_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 = wl_layout.Wl_Stacked_Widget(parent) stacked_widget_search_term.addWidget(line_edit_search_term) stacked_widget_search_term.addWidget(wrapper_search_terms) checkbox_match_tags.token_settings_changed = token_settings_changed checkbox_multi_search_mode.stateChanged.connect(multi_search_mode_changed) checkbox_ignore_tags.stateChanged.connect(ignore_tags_changed) checkbox_match_tags.stateChanged.connect(match_tags_changed) multi_search_mode_changed() token_settings_changed() ignore_tags_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, checkbox_ignore_tags, checkbox_match_tags )
def __init__(self, parent): super().__init__(parent) self.main = wl_misc.find_wl_main(parent) self.currentChanged.connect(self.current_changed)