diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0cc37f115..cc7d85fad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
## [3.6.0](https://github.com/BLKSerene/Wordless/releases/tag/3.6.0) - ??/??/2025
### 🎉 New Features
- Measures: Add effect size - conditional probability / ΔP / mutual information (normalized) / μ-value / pointwise mutual information (squared) / pointwise mutual information (normalized) / relative risk
+- Menu: Add Edit
- Settings: Add Settings - Measures - Effect Size - Mutual Information / Pointwise Mutual Information / Pointwise Mutual Information (Cubic) / Pointwise Mutual Information (Squared)
- Utils: Add Stanza's Sindhi dependency parser
diff --git a/utils/wl_downloader_ci.py b/utils/wl_downloader_ci.py
index 249e14038..536c63233 100644
--- a/utils/wl_downloader_ci.py
+++ b/utils/wl_downloader_ci.py
@@ -34,7 +34,7 @@ def run_cli(commands):
if platform_os == 'Darwin':
subprocess.run(['python3', '-m'] + commands, check = True)
elif platform_os == 'Linux':
- subprocess.run(['python3.10', '-m'] + commands, check = True)
+ subprocess.run(['python3.11', '-m'] + commands, check = True)
except subprocess.CalledProcessError:
subprocess.run(['python', '-m'] + commands, check = True)
diff --git a/wordless/wl_colligation_extractor.py b/wordless/wl_colligation_extractor.py
index b7fbf2406..ef22b1347 100644
--- a/wordless/wl_colligation_extractor.py
+++ b/wordless/wl_colligation_extractor.py
@@ -52,6 +52,8 @@ class Wrapper_Colligation_Extractor(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'colligation_extractor'
+
# Table
self.table_colligation_extractor = Wl_Table_Colligation_Extractor(self)
@@ -143,18 +145,12 @@ def __init__(self, main):
self.checkbox_use_regex,
self.checkbox_match_without_tags,
self.checkbox_match_tags
- ) = wl_widgets.wl_widgets_search_settings(
- self,
- tab = 'colligation_extractor'
- )
+ ) = wl_widgets.wl_widgets_search_settings(self, tab = self.tab)
(
self.label_context_settings,
self.button_context_settings
- ) = wl_widgets.wl_widgets_context_settings(
- self,
- tab = 'colligation_extractor'
- )
+ ) = wl_widgets.wl_widgets_context_settings(self, tab = self.tab)
self.checkbox_multi_search_mode.stateChanged.connect(self.search_settings_changed)
self.line_edit_search_term.textChanged.connect(self.search_settings_changed)
@@ -299,7 +295,7 @@ def __init__(self, main):
self.combo_box_use_data,
self.checkbox_use_pct,
self.checkbox_use_cumulative
- ) = wl_widgets.wl_widgets_fig_settings(self, tab = 'colligation_extractor')
+ ) = wl_widgets.wl_widgets_fig_settings(self, tab = self.tab)
self.label_rank = QLabel(self.tr('Rank:'), self)
(
diff --git a/wordless/wl_collocation_extractor.py b/wordless/wl_collocation_extractor.py
index b761d815f..fbe6c84d0 100644
--- a/wordless/wl_collocation_extractor.py
+++ b/wordless/wl_collocation_extractor.py
@@ -52,6 +52,8 @@ class Wrapper_Collocation_Extractor(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'collocation_extractor'
+
# Table
self.table_collocation_extractor = Wl_Table_Collocation_Extractor(self)
@@ -143,18 +145,12 @@ def __init__(self, main):
self.checkbox_use_regex,
self.checkbox_match_without_tags,
self.checkbox_match_tags
- ) = wl_widgets.wl_widgets_search_settings(
- self,
- tab = 'collocation_extractor'
- )
+ ) = wl_widgets.wl_widgets_search_settings(self, tab = self.tab)
(
self.label_context_settings,
self.button_context_settings
- ) = wl_widgets.wl_widgets_context_settings(
- self,
- tab = 'collocation_extractor'
- )
+ ) = wl_widgets.wl_widgets_context_settings(self, tab = self.tab)
self.checkbox_multi_search_mode.stateChanged.connect(self.search_settings_changed)
self.line_edit_search_term.textChanged.connect(self.search_settings_changed)
@@ -298,7 +294,7 @@ def __init__(self, main):
self.combo_box_use_data,
self.checkbox_use_pct,
self.checkbox_use_cumulative
- ) = wl_widgets.wl_widgets_fig_settings(self, tab = 'collocation_extractor')
+ ) = wl_widgets.wl_widgets_fig_settings(self, tab = self.tab)
self.label_rank = QLabel(self.tr('Rank:'), self)
(
diff --git a/wordless/wl_concordancer.py b/wordless/wl_concordancer.py
index ed375579e..e9b2ed985 100644
--- a/wordless/wl_concordancer.py
+++ b/wordless/wl_concordancer.py
@@ -59,6 +59,7 @@ class Wrapper_Concordancer(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'concordancer'
self.table_concordancer = Wl_Table_Concordancer(self)
layout_results = wl_layouts.Wl_Layout()
@@ -120,18 +121,12 @@ def __init__(self, main):
self.checkbox_use_regex,
self.checkbox_match_without_tags,
self.checkbox_match_tags
- ) = wl_widgets.wl_widgets_search_settings(
- self,
- tab = 'concordancer'
- )
+ ) = wl_widgets.wl_widgets_search_settings(self, tab = self.tab)
(
self.label_context_settings,
self.button_context_settings
- ) = wl_widgets.wl_widgets_context_settings(
- self,
- tab = 'concordancer'
- )
+ ) = wl_widgets.wl_widgets_context_settings(self, tab = self.tab)
self.checkbox_multi_search_mode.stateChanged.connect(self.search_settings_changed)
self.line_edit_search_term.textChanged.connect(self.search_settings_changed)
diff --git a/wordless/wl_concordancer_parallel.py b/wordless/wl_concordancer_parallel.py
index 52103ee5f..19ddbbe0b 100644
--- a/wordless/wl_concordancer_parallel.py
+++ b/wordless/wl_concordancer_parallel.py
@@ -47,6 +47,9 @@ class Wrapper_Concordancer_Parallel(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'concordancer_parallel'
+
+ # Table
self.table_concordancer_parallel = Wl_Table_Concordancer_Parallel(self)
layout_results = wl_layouts.Wl_Layout()
@@ -106,18 +109,12 @@ def __init__(self, main):
self.checkbox_use_regex,
self.checkbox_match_without_tags,
self.checkbox_match_tags
- ) = wl_widgets.wl_widgets_search_settings(
- self,
- tab = 'concordancer_parallel'
- )
+ ) = wl_widgets.wl_widgets_search_settings(self, tab = self.tab)
(
self.label_context_settings,
self.button_context_settings
- ) = wl_widgets.wl_widgets_context_settings(
- self,
- tab = 'concordancer_parallel'
- )
+ ) = wl_widgets.wl_widgets_context_settings(self, tab = self.tab)
self.checkbox_multi_search_mode.stateChanged.connect(self.search_settings_changed)
self.line_edit_search_term.textChanged.connect(self.search_settings_changed)
diff --git a/wordless/wl_dependency_parser.py b/wordless/wl_dependency_parser.py
index 302e7a4c3..5f1b075af 100644
--- a/wordless/wl_dependency_parser.py
+++ b/wordless/wl_dependency_parser.py
@@ -50,6 +50,9 @@ class Wrapper_Dependency_Parser(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'dependency_parser'
+
+ # Table
self.table_dependency_parser = Wl_Table_Dependency_Parser(self)
layout_results = wl_layouts.Wl_Layout()
@@ -111,19 +114,13 @@ def __init__(self, main):
self.checkbox_use_regex,
self.checkbox_match_without_tags,
self.checkbox_match_tags
- ) = wl_widgets.wl_widgets_search_settings_tokens(
- self,
- tab = 'dependency_parser'
- )
+ ) = wl_widgets.wl_widgets_search_settings_tokens(self, tab = self.tab)
self.checkbox_match_dependency_relations = QCheckBox(self.tr('Match dependency relations'), self)
(
self.label_context_settings,
self.button_context_settings
- ) = wl_widgets.wl_widgets_context_settings(
- self,
- tab = 'dependency_parser'
- )
+ ) = wl_widgets.wl_widgets_context_settings(self, tab = self.tab)
self.checkbox_multi_search_mode.stateChanged.connect(self.search_settings_changed)
self.line_edit_search_term.textChanged.connect(self.search_settings_changed)
diff --git a/wordless/wl_keyword_extractor.py b/wordless/wl_keyword_extractor.py
index e9765a10d..2aa79989b 100644
--- a/wordless/wl_keyword_extractor.py
+++ b/wordless/wl_keyword_extractor.py
@@ -45,6 +45,8 @@ class Wrapper_Keyword_Extractor(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'keyword_extractor'
+
# Table
self.table_keyword_extractor = Wl_Table_Keyword_Extractor(self)
@@ -178,7 +180,7 @@ def __init__(self, main):
self.combo_box_use_data,
self.checkbox_use_pct,
self.checkbox_use_cumulative
- ) = wl_widgets.wl_widgets_fig_settings(self, tab = 'keyword_extractor')
+ ) = wl_widgets.wl_widgets_fig_settings(self, tab = self.tab)
self.label_rank = QLabel(self.tr('Rank:'), self)
(
diff --git a/wordless/wl_main.py b/wordless/wl_main.py
index 15e2a3638..719388279 100644
--- a/wordless/wl_main.py
+++ b/wordless/wl_main.py
@@ -285,14 +285,6 @@ def __init__(self, loading_window):
self.load_settings()
- def fix_macos_layout(self, parent):
- for widget in parent.children():
- if widget.children():
- self.fix_macos_layout(widget)
- else:
- if isinstance(widget, QWidget) and not isinstance(widget, QPushButton):
- widget.setAttribute(Qt.WA_LayoutUsesWidgetRect)
-
def closeEvent(self, event):
if self.settings_custom['general']['misc_settings']['always_confirm_on_exit']:
result = Wl_Dialog_Confirm_Exit(self).exec_()
@@ -310,6 +302,7 @@ def closeEvent(self, event):
def init_menu(self):
self.menu_file = self.menuBar().addMenu(self.tr('&File'))
+ self.menu_edit = self.menuBar().addMenu(self.tr('&Edit'))
self.menu_prefs = self.menuBar().addMenu(self.tr('&Preferences'))
self.menu_help = self.menuBar().addMenu(self.tr('&Help'))
@@ -348,6 +341,19 @@ def init_menu(self):
self.action_file_exit.setStatusTip(self.tr('Exit the program'))
self.action_file_exit.triggered.connect(self.close)
+ # Edit
+ self.action_edit_results_search = self.menu_edit.addAction(self.tr('&Search in Results...'))
+ self.action_edit_results_search.setShortcut(QKeySequence('Ctrl+F'))
+ self.action_edit_results_search.setStatusTip(self.tr('Search in results displayed in the table'))
+ self.action_edit_results_search.triggered.connect(self.edit_results_search)
+ self.action_edit_results_filter = self.menu_edit.addAction(self.tr('&Filter Results...'))
+ self.action_edit_results_filter.setShortcut(QKeySequence('Ctrl+Shift+L'))
+ self.action_edit_results_filter.setStatusTip(self.tr('Filter results displayed in the table'))
+ self.action_edit_results_filter.triggered.connect(self.edit_results_filter)
+ self.action_edit_results_sort = self.menu_edit.addAction(self.tr('S&ort Results...'))
+ self.action_edit_results_sort.setStatusTip(self.tr('Sort results displayed in the table'))
+ self.action_edit_results_sort.triggered.connect(self.edit_results_sort)
+
# Preferences
self.action_prefs_settings = self.menu_prefs.addAction(self.tr('&Settings'))
self.action_prefs_settings.setStatusTip(self.tr('Change settings'))
@@ -413,82 +419,6 @@ def init_menu(self):
self.action_help_about.setStatusTip(self.tr('Show information about Wordless'))
self.action_help_about.triggered.connect(self.help_about)
- # Preferences - Display Language
- def prefs_display_lang(self):
- for action in self.action_group_prefs_display_lang.actions():
- if action.isChecked():
- if action.lang != self.settings_custom['menu']['prefs']['display_lang']:
- if wl_dialogs_misc.Wl_Dialog_Restart_Required(self).exec_() == QDialog.Accepted:
- with open(file_settings_display_lang, 'wb') as f:
- pickle.dump(action.lang, f)
-
- # Remove settings file
- if os.path.exists(file_settings):
- os.remove(file_settings)
-
- # Remove file caches
- for file in glob.glob(os.path.join(
- self.settings_custom['general']['imp']['temp_files']['default_path'], '*.*'
- )):
- os.remove(file)
-
- self.restart(save_settings = False)
- else:
- self.__dict__[f"action_prefs_display_lang_{self.settings_custom['menu']['prefs']['display_lang']}"].setChecked(True)
-
- break
-
- # Preferences - Reset Layouts
- def prefs_reset_layouts(self):
- if wl_msg_boxes.wl_msg_box_question(
- main = self,
- title = self.tr('Reset Layouts'),
- text = self.tr('''
-
Do you want to reset all layouts to their default settings?
- ''')
- ):
- self.centralWidget().setSizes(self.settings_default['menu']['prefs']['layouts']['central_widget'])
-
- # Preferences - Show Status Bar
- def prefs_show_status_bar(self):
- self.settings_custom['menu']['prefs']['show_status_bar'] = self.action_prefs_show_status_bar.isChecked()
-
- if self.settings_custom['menu']['prefs']['show_status_bar']:
- self.statusBar().show()
- else:
- self.statusBar().hide()
-
- # Help - Need Help?
- def help_need_help(self):
- Wl_Dialog_Need_Help(self).exec_()
-
- # Help - Citing
- def help_citing(self):
- Wl_Dialog_Citing(self).exec_()
-
- # Help - Donating
- def help_donating(self):
- Wl_Dialog_Donating(self).exec_()
-
- # Help - Acknowledgments
- def help_acks(self):
- Wl_Dialog_Acks(self).exec_()
-
- # Help - Check for Updates
- def help_check_updates(self, on_startup = False):
- dialog_check_updates = Wl_Dialog_Check_Updates(self, on_startup = on_startup)
-
- if not on_startup:
- dialog_check_updates.exec_()
-
- # Help - Changelog
- def help_changelog(self):
- Wl_Dialog_Changelog(self).exec_()
-
- # Help - About Wordless
- def help_about(self):
- Wl_Dialog_About(self).exec_()
-
def init_central_widget(self):
self.tabs_file_area = wl_layouts.Wl_Tab_Widget(self)
@@ -567,23 +497,13 @@ def init_work_area(self):
self.wl_work_area.currentChanged.connect(self.work_area_changed)
- def file_area_changed(self):
- # Current tab
- self.settings_custom['file_area_cur'] = self.tabs_file_area.tabText(self.tabs_file_area.currentIndex())
-
- def work_area_changed(self):
- # Current tab
- self.settings_custom['work_area_cur'] = self.wl_work_area.tabText(self.wl_work_area.currentIndex())
-
- # File area
- if self.settings_custom['work_area_cur'] != self.tr('Keyword Extractor'):
- self.tabs_file_area.setCurrentIndex(0)
-
- # Hide single tab
- self.tabs_file_area.tabBar().hide()
- # Keyword Extractor
- else:
- self.tabs_file_area.tabBar().show()
+ def fix_macos_layout(self, parent):
+ for widget in parent.children():
+ if widget.children():
+ self.fix_macos_layout(widget)
+ else:
+ if isinstance(widget, QWidget) and not isinstance(widget, QPushButton):
+ widget.setAttribute(Qt.WA_LayoutUsesWidgetRect)
def load_settings(self):
settings = self.settings_custom
@@ -609,13 +529,174 @@ def load_settings(self):
# Work area
for i in range(self.wl_work_area.count()):
- if self.wl_work_area.tabText(i) == self.settings_custom['work_area_cur']:
+ if self.wl_work_area.widget(i).tab == self.settings_custom['work_area_cur']:
self.wl_work_area.setCurrentIndex(i)
break
self.work_area_changed()
+ def file_area_changed(self):
+ # Current tab
+ self.settings_custom['file_area_cur'] = self.tabs_file_area.tabText(self.tabs_file_area.currentIndex())
+
+ def work_area_changed(self):
+ # Current tab
+ self.settings_custom['work_area_cur'] = self.wl_work_area.currentWidget().tab
+
+ # File Area
+ if self.settings_custom['work_area_cur'] == 'keyword_extractor':
+ self.tabs_file_area.tabBar().show()
+ else:
+ self.tabs_file_area.setCurrentIndex(0)
+
+ # Hide single tab
+ self.tabs_file_area.tabBar().hide()
+
+ # Menu - Edit
+ match self.wl_work_area.currentWidget().tab:
+ case 'concordancer':
+ table = self.wl_work_area.currentWidget().table_concordancer
+ case 'concordancer_parallel':
+ table = self.wl_work_area.currentWidget().table_concordancer_parallel
+ case 'dependency_parser':
+ table = self.wl_work_area.currentWidget().table_dependency_parser
+ case 'wordlist_generator':
+ table = self.wl_work_area.currentWidget().table_wordlist_generator
+ case 'ngram_generator':
+ table = self.wl_work_area.currentWidget().table_ngram_generator
+ case 'collocation_extractor':
+ table = self.wl_work_area.currentWidget().table_collocation_extractor
+ case 'colligation_extractor':
+ table = self.wl_work_area.currentWidget().table_colligation_extractor
+ case 'keyword_extractor':
+ table = self.wl_work_area.currentWidget().table_keyword_extractor
+ case _:
+ table = None
+
+ if table:
+ table.results_changed_menu_edit()
+
+ def edit_results_search(self):
+ match self.wl_work_area.currentWidget().tab:
+ case 'concordancer':
+ button_results_search = self.wl_work_area.currentWidget().table_concordancer.button_results_search
+ case 'concordancer_parallel':
+ button_results_search = self.wl_work_area.currentWidget().table_concordancer_parallel.button_results_search
+ case 'dependency_parser':
+ button_results_search = self.wl_work_area.currentWidget().table_dependency_parser.button_results_search
+ case 'wordlist_generator':
+ button_results_search = self.wl_work_area.currentWidget().table_wordlist_generator.button_results_search
+ case 'ngram_generator':
+ button_results_search = self.wl_work_area.currentWidget().table_ngram_generator.button_results_search
+ case 'collocation_extractor':
+ button_results_search = self.wl_work_area.currentWidget().table_collocation_extractor.button_results_search
+ case 'colligation_extractor':
+ button_results_search = self.wl_work_area.currentWidget().table_colligation_extractor.button_results_search
+ case 'keyword_extractor':
+ button_results_search = self.wl_work_area.currentWidget().table_keyword_extractor.button_results_search
+ case _:
+ button_results_search = None
+
+ if button_results_search and button_results_search.isEnabled():
+ button_results_search.click()
+
+ def edit_results_filter(self):
+ match self.wl_work_area.currentWidget().tab:
+ case 'dependency_parser':
+ button_results_filter = self.wl_work_area.currentWidget().table_dependency_parser.button_results_filter
+ case 'wordlist_generator':
+ button_results_filter = self.wl_work_area.currentWidget().table_wordlist_generator.button_results_filter
+ case 'ngram_generator':
+ button_results_filter = self.wl_work_area.currentWidget().table_ngram_generator.button_results_filter
+ case 'collocation_extractor':
+ button_results_filter = self.wl_work_area.currentWidget().table_collocation_extractor.button_results_filter
+ case 'colligation_extractor':
+ button_results_filter = self.wl_work_area.currentWidget().table_colligation_extractor.button_results_filter
+ case 'keyword_extractor':
+ button_results_filter = self.wl_work_area.currentWidget().table_keyword_extractor.button_results_filter
+ case _:
+ button_results_filter = None
+
+ if button_results_filter and button_results_filter.isEnabled():
+ button_results_filter.click()
+
+ def edit_results_sort(self):
+ match self.wl_work_area.currentWidget().tab:
+ case 'concordancer':
+ button_results_sort = self.wl_work_area.currentWidget().table_concordancer.button_results_sort
+ case _:
+ button_results_sort = None
+
+ if button_results_sort and button_results_sort.isEnabled():
+ button_results_sort.click()
+
+ def prefs_display_lang(self):
+ for action in self.action_group_prefs_display_lang.actions():
+ if action.isChecked():
+ if action.lang != self.settings_custom['menu']['prefs']['display_lang']:
+ if wl_dialogs_misc.Wl_Dialog_Restart_Required(self).exec_() == QDialog.Accepted:
+ with open(file_settings_display_lang, 'wb') as f:
+ pickle.dump(action.lang, f)
+
+ # Remove settings file
+ if os.path.exists(file_settings):
+ os.remove(file_settings)
+
+ # Remove file caches
+ for file in glob.glob(os.path.join(
+ self.settings_custom['general']['imp']['temp_files']['default_path'], '*.*'
+ )):
+ os.remove(file)
+
+ self.restart(save_settings = False)
+ else:
+ self.__dict__[f"action_prefs_display_lang_{self.settings_custom['menu']['prefs']['display_lang']}"].setChecked(True)
+
+ break
+
+ def prefs_reset_layouts(self):
+ if wl_msg_boxes.wl_msg_box_question(
+ main = self,
+ title = self.tr('Reset Layouts'),
+ text = self.tr('''
+ Do you want to reset all layouts to their default settings?
+ ''')
+ ):
+ self.centralWidget().setSizes(self.settings_default['menu']['prefs']['layouts']['central_widget'])
+
+ def prefs_show_status_bar(self):
+ self.settings_custom['menu']['prefs']['show_status_bar'] = self.action_prefs_show_status_bar.isChecked()
+
+ if self.settings_custom['menu']['prefs']['show_status_bar']:
+ self.statusBar().show()
+ else:
+ self.statusBar().hide()
+
+ def help_need_help(self):
+ Wl_Dialog_Need_Help(self).exec_()
+
+ def help_citing(self):
+ Wl_Dialog_Citing(self).exec_()
+
+ def help_donating(self):
+ Wl_Dialog_Donating(self).exec_()
+
+ def help_acks(self):
+ Wl_Dialog_Acks(self).exec_()
+
+ def help_check_updates(self, on_startup = False):
+ dialog_check_updates = Wl_Dialog_Check_Updates(self, on_startup = on_startup)
+
+ if not on_startup:
+ dialog_check_updates.exec_()
+
+ def help_changelog(self):
+ Wl_Dialog_Changelog(self).exec_()
+
+ def help_about(self):
+ Wl_Dialog_About(self).exec_()
+
def save_settings(self):
# Clear history of closed files
self.settings_custom['file_area']['files_closed'].clear()
@@ -628,7 +709,6 @@ def save_settings(self):
pickle.dump(self.settings_custom, f)
def restart(self, save_settings = True):
- # pylint: disable=consider-using-with
# Save settings before restarting
if save_settings:
self.save_settings()
@@ -644,7 +724,7 @@ def restart(self, save_settings = True):
elif is_macos:
subprocess.Popen(['python3', '-m', 'wordless.wl_main'])
elif is_linux:
- subprocess.Popen(['python3.10', '-m', 'wordless.wl_main'])
+ subprocess.Popen(['python3.11', '-m', 'wordless.wl_main'])
sys.exit(0)
diff --git a/wordless/wl_ngram_generator.py b/wordless/wl_ngram_generator.py
index da5a48270..5e068516a 100644
--- a/wordless/wl_ngram_generator.py
+++ b/wordless/wl_ngram_generator.py
@@ -50,6 +50,8 @@ class Wrapper_Ngram_Generator(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'ngram_generator'
+
# Table
self.table_ngram_generator = Wl_Table_Ngram_Generator(self)
@@ -141,10 +143,7 @@ def __init__(self, main):
self.checkbox_use_regex,
self.checkbox_match_without_tags,
self.checkbox_match_tags
- ) = wl_widgets.wl_widgets_search_settings(
- main,
- tab = 'ngram_generator'
- )
+ ) = wl_widgets.wl_widgets_search_settings(main, tab = self.tab)
self.label_search_term_position = QLabel(self.tr('Search term position:'), self)
(
@@ -164,10 +163,7 @@ def __init__(self, main):
(
self.label_context_settings,
self.button_context_settings
- ) = wl_widgets.wl_widgets_context_settings(
- self,
- tab = 'ngram_generator'
- )
+ ) = wl_widgets.wl_widgets_context_settings(self, tab = self.tab)
self.checkbox_multi_search_mode.stateChanged.connect(self.search_settings_changed)
self.line_edit_search_term.textChanged.connect(self.search_settings_changed)
@@ -315,7 +311,7 @@ def __init__(self, main):
self.combo_box_use_data,
self.checkbox_use_pct,
self.checkbox_use_cumulative
- ) = wl_widgets.wl_widgets_fig_settings(self, tab = 'ngram_generator')
+ ) = wl_widgets.wl_widgets_fig_settings(self, tab = self.tab)
self.label_rank = QLabel(self.tr('Rank:'), self)
(
diff --git a/wordless/wl_nlp/wl_dependency_parsing.py b/wordless/wl_nlp/wl_dependency_parsing.py
index 6f99d1a23..c5e245ccf 100644
--- a/wordless/wl_nlp/wl_dependency_parsing.py
+++ b/wordless/wl_nlp/wl_dependency_parsing.py
@@ -520,6 +520,8 @@ def wl_dependency_parse_fig_tokens(
return htmls
def wl_show_dependency_graphs(main, htmls, show_in_separate_tab):
+ # pylint: disable=consider-using-with
+
DIR_PATH = os.path.join(wl_settings_default.DEFAULT_DIR_EXPS, '_dependency_parsing_figs')
# Clean cache
@@ -556,7 +558,7 @@ def wl_show_dependency_graphs(main, htmls, show_in_separate_tab):
elif is_linux:
wl_misc.change_file_owner_to_user(fig_path)
- subprocess.Popen(['xdg-open', f'file://{fig_path}']) # pylint: disable=consider-using-with
+ subprocess.Popen(['xdg-open', f'file://{fig_path}'])
else:
fig_path = wl_checks_misc.check_new_path(os.path.join(fig_dir, 'fig.html'))
fig_path = wl_paths.get_normalized_path(fig_path)
@@ -569,4 +571,4 @@ def wl_show_dependency_graphs(main, htmls, show_in_separate_tab):
elif is_linux:
wl_misc.change_file_owner_to_user(fig_path)
- subprocess.Popen(['xdg-open', f'file://{fig_path}']) # pylint: disable=consider-using-with
+ subprocess.Popen(['xdg-open', f'file://{fig_path}'])
diff --git a/wordless/wl_profiler.py b/wordless/wl_profiler.py
index 1c6237eaf..f9ad52939 100644
--- a/wordless/wl_profiler.py
+++ b/wordless/wl_profiler.py
@@ -44,7 +44,9 @@ class Wrapper_Profiler(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
- # Table
+ self.tab = 'profiler'
+
+ # Tables
self.table_profiler_readability = Wl_Table_Profiler_Readability(self)
self.table_profiler_counts = Wl_Table_Profiler_Counts(self)
self.table_profiler_lexical_density_diversity = Wl_Table_Profiler_Lexical_Density_Diversity(self)
@@ -195,7 +197,7 @@ def load_settings(self, defaults = False):
# Tab
for i in range(self.tabs_profiler.count()):
- if self.tabs_profiler.tabText(i) == settings['tab']:
+ if self.tabs_profiler.widget(i).tab == settings['tab']:
self.tabs_profiler.setCurrentIndex(i)
# Token Settings
@@ -225,14 +227,14 @@ def load_settings(self, defaults = False):
self.table_settings_changed()
def tabs_changed(self):
- i_tabs = self.tabs_profiler.currentIndex()
+ self.main.settings_custom['profiler']['tab'] = self.tabs_profiler.currentWidget().tab
- self.main.settings_custom['profiler']['tab'] = self.tabs_profiler.tabText(i_tabs)
+ i_tab = self.tabs_profiler.currentIndex()
- self.stacked_widget_button_generate_table.setCurrentIndex(i_tabs)
- self.stacked_widget_button_exp_selected_cells.setCurrentIndex(i_tabs)
- self.stacked_widget_button_exp_all_cells.setCurrentIndex(i_tabs)
- self.stacked_widget_button_clr_table.setCurrentIndex(i_tabs)
+ self.stacked_widget_button_generate_table.setCurrentIndex(i_tab)
+ self.stacked_widget_button_exp_selected_cells.setCurrentIndex(i_tab)
+ self.stacked_widget_button_exp_all_cells.setCurrentIndex(i_tab)
+ self.stacked_widget_button_clr_table.setCurrentIndex(i_tab)
def item_changed(self):
if any((not table.is_empty() for table in self.tables)):
@@ -283,7 +285,7 @@ def generate_all_tables(self):
self.main,
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress_Process_Data(self.main),
update_gui = self.update_gui_table,
- profiler_tab = 'all'
+ tab = 'all'
)
wl_threading.Wl_Thread(worker_profiler_table).start_worker()
@@ -323,7 +325,7 @@ class Wl_Table_Profiler(wl_tables.Wl_Table_Data):
def __init__(
self, parent, headers,
headers_int = None, headers_float = None, headers_pct = None, headers_cum = None,
- profiler_tab = 'all'
+ tab = 'all'
):
super().__init__(
parent,
@@ -337,7 +339,7 @@ def __init__(
generate_fig = False
)
- self.profiler_tab = profiler_tab
+ self.tab = tab
def clr_table(self, confirm = False): # pylint: disable=arguments-differ
if super().clr_table(num_headers = 0, confirm = confirm):
@@ -355,7 +357,7 @@ def generate_table(self):
self.main,
dialog_progress = wl_dialogs_misc.Wl_Dialog_Progress_Process_Data(self.main),
update_gui = self.update_gui_table,
- profiler_tab = self.profiler_tab
+ tab = self.tab
)
wl_threading.Wl_Thread(worker_profiler_table).start_worker()
@@ -411,7 +413,7 @@ def __init__(self, parent):
parent,
headers = HEADERS_READABILITY,
headers_float = HEADERS_READABILITY,
- profiler_tab = 'readability'
+ tab = 'readability'
)
def update_gui_table(self, err_msg, text_stats_files):
@@ -487,7 +489,7 @@ def __init__(self, parent):
],
# Excluding count of types
headers_cum = HEADERS_COUNTS[:8] + HEADERS_COUNTS[10:],
- profiler_tab = 'counts'
+ tab = 'counts'
)
def update_gui_table(self, err_msg, text_stats_files):
@@ -620,7 +622,7 @@ def __init__(self, parent):
parent,
headers = HEADERS_LEXICAL_DENSITY_DIVERSITY,
headers_float = HEADERS_LEXICAL_DENSITY_DIVERSITY,
- profiler_tab = 'lexical_density_diversity'
+ tab = 'lexical_density_diversity'
)
def update_gui_table(self, err_msg, text_stats_files):
@@ -826,7 +828,7 @@ def __init__(self, parent):
[*HEADERS[0:3], *HEADERS[4:7], HEADERS[9]]
for HEADERS in HEADERS_LENS
), start = []),
- profiler_tab = 'lens'
+ tab = 'lens'
)
def update_gui_table(self, err_msg, text_stats_files):
@@ -947,7 +949,7 @@ def __init__(self, parent):
super().__init__(
parent,
headers = [],
- profiler_tab = 'len_breakdown'
+ tab = 'len_breakdown'
)
def update_gui_table(self, err_msg, text_stats_files):
@@ -1146,8 +1148,8 @@ def update_gui_table(self, err_msg, text_stats_files):
class Wl_Worker_Profiler(wl_threading.Wl_Worker):
worker_done = pyqtSignal(str, list)
- def __init__(self, main, dialog_progress, update_gui, profiler_tab):
- super().__init__(main, dialog_progress, update_gui, profiler_tab = profiler_tab)
+ def __init__(self, main, dialog_progress, update_gui, tab):
+ super().__init__(main, dialog_progress, update_gui, tab = tab)
self.err_msg = ''
self.text_stats_files = []
@@ -1163,7 +1165,7 @@ def run(self):
text = wl_token_processing.wl_process_tokens_profiler(
self.main, file['text'],
token_settings = settings['token_settings'],
- profiler_tab = self.profiler_tab
+ tab = self.tab
)
texts.append(text)
@@ -1176,7 +1178,7 @@ def run(self):
tokens = text.get_tokens_flat()
# Readability
- if self.profiler_tab in ['readability', 'all']:
+ if self.tab in ['readability', 'all']:
stats_readability = [
wl_measures_readability.rd(self.main, text),
wl_measures_readability.aari(self.main, text),
@@ -1221,7 +1223,7 @@ def run(self):
else:
stats_readability = None
- if self.profiler_tab in ['lexical_density_diversity', 'counts', 'lens', 'len_breakdown', 'all']:
+ if self.tab in ['lexical_density_diversity', 'counts', 'lens', 'len_breakdown', 'all']:
# Paragraph length
len_paras_sentences = [
len(para)
@@ -1284,7 +1286,7 @@ def run(self):
len_syls = None
# Lexical Density/Diversity
- if self.profiler_tab in ['lexical_density_diversity', 'all']:
+ if self.tab in ['lexical_density_diversity', 'all']:
if tokens:
stats_lexical_density_diversity = [
wl_measures_lexical_density_diversity.brunets_index(self.main, text),
diff --git a/wordless/wl_settings/wl_settings_default.py b/wordless/wl_settings/wl_settings_default.py
index d1e8582a7..3ced157fd 100644
--- a/wordless/wl_settings/wl_settings_default.py
+++ b/wordless/wl_settings/wl_settings_default.py
@@ -96,7 +96,7 @@ def init_settings_default(main):
settings_default = {
'1st_startup': True,
'file_area_cur': _tr('wl_settings_default', 'Observed Files'),
- 'work_area_cur': _tr('wl_settings_default', 'Profiler'),
+ 'work_area_cur': 'profiler',
'menu': {
'prefs': {
@@ -133,7 +133,7 @@ def init_settings_default(main):
},
'profiler': {
- 'tab': _tr('wl_settings_default', 'Counts'),
+ 'tab': 'counts',
'token_settings': {
'words': True,
diff --git a/wordless/wl_widgets/wl_tables.py b/wordless/wl_widgets/wl_tables.py
index 0d8258b41..a00e0afa0 100644
--- a/wordless/wl_widgets/wl_tables.py
+++ b/wordless/wl_widgets/wl_tables.py
@@ -31,7 +31,11 @@
QItemSelection,
Qt
)
-from PyQt5.QtGui import QFont, QStandardItem, QStandardItemModel
+from PyQt5.QtGui import (
+ QFont,
+ QStandardItem,
+ QStandardItemModel
+)
from PyQt5.QtWidgets import (
QAbstractItemView,
QApplication,
@@ -1856,6 +1860,17 @@ def results_changed(self):
self.button_results_search.setEnabled(False)
+ self.results_changed_menu_edit()
+
+ def results_changed_menu_edit(self):
+ if self.button_results_search.isEnabled():
+ self.main.action_edit_results_search.setEnabled(True)
+ else:
+ self.main.action_edit_results_search.setEnabled(False)
+
+ self.main.action_edit_results_filter.setEnabled(False)
+ self.main.action_edit_results_sort.setEnabled(False)
+
class Wl_Table_Data_Sort_Search(Wl_Table_Data):
def __init__(
self, main, tab,
@@ -1906,6 +1921,21 @@ def results_changed(self):
self.button_results_sort.setEnabled(False)
self.button_results_search.setEnabled(False)
+ self.results_changed_menu_edit()
+
+ def results_changed_menu_edit(self):
+ if self.button_results_search.isEnabled():
+ self.main.action_edit_results_search.setEnabled(True)
+ else:
+ self.main.action_edit_results_search.setEnabled(False)
+
+ if self.button_results_sort.isEnabled():
+ self.main.action_edit_results_sort.setEnabled(True)
+ else:
+ self.main.action_edit_results_sort.setEnabled(False)
+
+ self.main.action_edit_results_filter.setEnabled(False)
+
class Wl_Table_Data_Filter_Search(Wl_Table_Data):
def __init__(
self, main, tab,
@@ -1958,6 +1988,21 @@ def results_changed(self):
else:
self.button_results_search.setEnabled(False)
+ self.results_changed_menu_edit()
+
+ def results_changed_menu_edit(self):
+ if self.button_results_search.isEnabled():
+ self.main.action_edit_results_search.setEnabled(True)
+ else:
+ self.main.action_edit_results_search.setEnabled(False)
+
+ if self.button_results_filter.isEnabled():
+ self.main.action_edit_results_filter.setEnabled(True)
+ else:
+ self.main.action_edit_results_filter.setEnabled(False)
+
+ self.main.action_edit_results_sort.setEnabled(False)
+
def results_filter_clicked(self):
match self.tab:
case 'dependency_parser':
diff --git a/wordless/wl_wordlist_generator.py b/wordless/wl_wordlist_generator.py
index 17d4c5544..aa332f3f4 100644
--- a/wordless/wl_wordlist_generator.py
+++ b/wordless/wl_wordlist_generator.py
@@ -50,6 +50,8 @@ class Wrapper_Wordlist_Generator(wl_layouts.Wl_Wrapper):
def __init__(self, main):
super().__init__(main)
+ self.tab = 'wordlist_generator'
+
# Table
self.table_wordlist_generator = Wl_Table_Wordlist_Generator(self)
@@ -178,7 +180,7 @@ def __init__(self, main):
self.combo_box_use_data,
self.checkbox_use_pct,
self.checkbox_use_cumulative
- ) = wl_widgets.wl_widgets_fig_settings(self, tab = 'wordlist_generator')
+ ) = wl_widgets.wl_widgets_fig_settings(self, tab = self.tab)
self.label_rank = QLabel(self.tr('Rank:'), self)
(