statstudio 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- statstudio/__init__.py +9 -0
- statstudio/__main__.py +3 -0
- statstudio/app.py +83 -0
- statstudio/cli.py +116 -0
- statstudio/core/__init__.py +3 -0
- statstudio/core/archive.py +27 -0
- statstudio/core/commands.py +67 -0
- statstudio/core/formula_catalog.py +74 -0
- statstudio/core/formulas.py +605 -0
- statstudio/core/joins.py +123 -0
- statstudio/core/project.py +358 -0
- statstudio/core/runtime.py +321 -0
- statstudio/core/scripting.py +594 -0
- statstudio/core/table.py +796 -0
- statstudio/core/transform.py +450 -0
- statstudio/feature_help.py +595 -0
- statstudio/io/__init__.py +3 -0
- statstudio/io/docx.py +201 -0
- statstudio/io/export.py +99 -0
- statstudio/io/file_import.py +199 -0
- statstudio/io/odbc.py +334 -0
- statstudio/io/sample_data.py +164 -0
- statstudio/io/table_io.py +118 -0
- statstudio/plots/__init__.py +19 -0
- statstudio/plots/advanced.py +651 -0
- statstudio/plots/basic.py +957 -0
- statstudio/plots/bayesian_plots.py +94 -0
- statstudio/plots/common.py +334 -0
- statstudio/plots/diagnostics.py +214 -0
- statstudio/plots/doe_plots.py +235 -0
- statstudio/plots/plotly_builders.py +719 -0
- statstudio/plots/predictive_plots.py +72 -0
- statstudio/plots/registry.py +251 -0
- statstudio/plugins.py +111 -0
- statstudio/resources/help_topics.json +13195 -0
- statstudio/resources/logo.ico +0 -0
- statstudio/resources/logo.png +0 -0
- statstudio/resources/statstudio.svg +8 -0
- statstudio/stats/__init__.py +42 -0
- statstudio/stats/bayesian.py +1094 -0
- statstudio/stats/bayesian_optimization.py +590 -0
- statstudio/stats/common.py +140 -0
- statstudio/stats/correlation.py +135 -0
- statstudio/stats/custom_doe.py +1714 -0
- statstudio/stats/descriptive.py +200 -0
- statstudio/stats/desirability.py +132 -0
- statstudio/stats/distributions.py +331 -0
- statstudio/stats/doe.py +1070 -0
- statstudio/stats/hypothesis.py +1305 -0
- statstudio/stats/multivariate.py +307 -0
- statstudio/stats/optimal_doe.py +264 -0
- statstudio/stats/power.py +194 -0
- statstudio/stats/predictive.py +605 -0
- statstudio/stats/profiler.py +379 -0
- statstudio/stats/quality.py +1218 -0
- statstudio/stats/regression.py +1600 -0
- statstudio/stats/results.py +235 -0
- statstudio/stats/simulator.py +95 -0
- statstudio/stats/survival.py +637 -0
- statstudio/stats/timeseries.py +643 -0
- statstudio/stats/tolerance.py +154 -0
- statstudio/ui/__init__.py +0 -0
- statstudio/ui/analysis_hub.py +271 -0
- statstudio/ui/command_catalog.py +460 -0
- statstudio/ui/command_palette.py +55 -0
- statstudio/ui/console.py +239 -0
- statstudio/ui/dialogs/__init__.py +0 -0
- statstudio/ui/dialogs/advanced_dialogs.py +392 -0
- statstudio/ui/dialogs/base.py +537 -0
- statstudio/ui/dialogs/bayesian_dialogs.py +488 -0
- statstudio/ui/dialogs/bayesian_optimization_dialog.py +299 -0
- statstudio/ui/dialogs/custom_doe_dialog.py +467 -0
- statstudio/ui/dialogs/doe_dialogs.py +220 -0
- statstudio/ui/dialogs/extended_dialogs.py +665 -0
- statstudio/ui/dialogs/graph_builder.py +139 -0
- statstudio/ui/dialogs/help_dialog.py +207 -0
- statstudio/ui/dialogs/help_topics.py +280 -0
- statstudio/ui/dialogs/lazy.py +184 -0
- statstudio/ui/dialogs/odbc_dialog.py +311 -0
- statstudio/ui/dialogs/plot_dialog.py +1385 -0
- statstudio/ui/dialogs/report_composer.py +218 -0
- statstudio/ui/dialogs/script_dialogs.py +267 -0
- statstudio/ui/dialogs/stats_dialogs.py +1688 -0
- statstudio/ui/dialogs/table_dialogs.py +997 -0
- statstudio/ui/dialogs/window.py +58 -0
- statstudio/ui/docks/__init__.py +0 -0
- statstudio/ui/formula_editor.py +121 -0
- statstudio/ui/icons.py +257 -0
- statstudio/ui/jobs.py +179 -0
- statstudio/ui/main_window.py +3934 -0
- statstudio/ui/plot_interaction.py +178 -0
- statstudio/ui/profiler_widget.py +437 -0
- statstudio/ui/recent.py +82 -0
- statstudio/ui/reports/__init__.py +0 -0
- statstudio/ui/reports/report_view.py +1632 -0
- statstudio/ui/script_jobs.py +35 -0
- statstudio/ui/scripts_panel.py +271 -0
- statstudio/ui/table_document.py +233 -0
- statstudio/ui/table_model.py +285 -0
- statstudio/ui/table_view.py +285 -0
- statstudio/ui/theme.py +645 -0
- statstudio/ui/welcome.py +453 -0
- statstudio/ui/window_controls.py +53 -0
- statstudio/ui/workers.py +53 -0
- statstudio-0.1.0.dist-info/METADATA +261 -0
- statstudio-0.1.0.dist-info/RECORD +110 -0
- statstudio-0.1.0.dist-info/WHEEL +5 -0
- statstudio-0.1.0.dist-info/entry_points.txt +5 -0
- statstudio-0.1.0.dist-info/licenses/LICENSE +674 -0
- statstudio-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
|
|
4
|
+
from matplotlib.figure import Figure
|
|
5
|
+
from PySide6.QtCore import Qt, Signal
|
|
6
|
+
from PySide6.QtWidgets import QGridLayout, QLabel, QVBoxLayout, QWidget
|
|
7
|
+
|
|
8
|
+
from statstudio.ui.dialogs.base import ColumnDropZone
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class GraphBuilderCanvas(QWidget):
|
|
12
|
+
"""Live graph preview with drag targets arranged around the axes."""
|
|
13
|
+
|
|
14
|
+
roles_changed = Signal()
|
|
15
|
+
|
|
16
|
+
def __init__(self, parent: QWidget | None = None) -> None:
|
|
17
|
+
super().__init__(parent)
|
|
18
|
+
self.setMinimumSize(460, 380)
|
|
19
|
+
self._host = QWidget(self)
|
|
20
|
+
self._host_layout = QVBoxLayout(self._host)
|
|
21
|
+
self._host_layout.setContentsMargins(0, 0, 0, 0)
|
|
22
|
+
self._host_layout.setSpacing(0)
|
|
23
|
+
self.x_zone = ColumnDropZone("X", multi=True, parent=self)
|
|
24
|
+
self.y_zone = ColumnDropZone("Y", multi=True, parent=self)
|
|
25
|
+
self.y2_zone = ColumnDropZone("Y2", parent=self)
|
|
26
|
+
self.group_zone = ColumnDropZone("Color", parent=self)
|
|
27
|
+
self.size_zone = ColumnDropZone("Size", parent=self)
|
|
28
|
+
self.shape_zone = ColumnDropZone("Shape", parent=self)
|
|
29
|
+
self._zones = {
|
|
30
|
+
"x": self.x_zone,
|
|
31
|
+
"y": self.y_zone,
|
|
32
|
+
"y2": self.y2_zone,
|
|
33
|
+
"group": self.group_zone,
|
|
34
|
+
"size": self.size_zone,
|
|
35
|
+
"shape": self.shape_zone,
|
|
36
|
+
}
|
|
37
|
+
for zone in self._zones.values():
|
|
38
|
+
zone.columns_changed.connect(self._zones_changed)
|
|
39
|
+
self.status_label = QLabel(self)
|
|
40
|
+
self.status_label.setStyleSheet(
|
|
41
|
+
"QLabel { color: #a33; background: rgba(255, 255, 255, 220); padding: 3px 6px; border-radius: 4px; }"
|
|
42
|
+
)
|
|
43
|
+
self.status_label.setWordWrap(True)
|
|
44
|
+
self.status_label.hide()
|
|
45
|
+
layout = QGridLayout(self)
|
|
46
|
+
layout.setContentsMargins(4, 4, 4, 4)
|
|
47
|
+
layout.setHorizontalSpacing(6)
|
|
48
|
+
layout.setVerticalSpacing(4)
|
|
49
|
+
layout.addWidget(self.group_zone, 0, 0)
|
|
50
|
+
layout.addWidget(self.size_zone, 0, 1, Qt.AlignmentFlag.AlignHCenter)
|
|
51
|
+
layout.addWidget(self.shape_zone, 0, 2)
|
|
52
|
+
layout.addWidget(self.y_zone, 1, 0, Qt.AlignmentFlag.AlignVCenter)
|
|
53
|
+
layout.addWidget(self._host, 1, 1)
|
|
54
|
+
layout.addWidget(self.y2_zone, 1, 2, Qt.AlignmentFlag.AlignVCenter)
|
|
55
|
+
layout.addWidget(self.x_zone, 2, 1, Qt.AlignmentFlag.AlignHCenter)
|
|
56
|
+
layout.addWidget(self.status_label, 3, 0, 1, 3)
|
|
57
|
+
layout.setColumnStretch(1, 1)
|
|
58
|
+
layout.setRowStretch(1, 1)
|
|
59
|
+
self.y_zone.setFixedWidth(170)
|
|
60
|
+
self.y2_zone.setFixedWidth(170)
|
|
61
|
+
self.x_zone.setMinimumWidth(240)
|
|
62
|
+
self.x_zone.setMaximumWidth(520)
|
|
63
|
+
self.group_zone.setMinimumWidth(120)
|
|
64
|
+
self.group_zone.setMaximumWidth(200)
|
|
65
|
+
self.size_zone.setMinimumWidth(90)
|
|
66
|
+
self.size_zone.setMaximumWidth(160)
|
|
67
|
+
self.shape_zone.setMinimumWidth(90)
|
|
68
|
+
self.shape_zone.setMaximumWidth(160)
|
|
69
|
+
self._canvas: FigureCanvasQTAgg | None = None
|
|
70
|
+
self.set_figure(self._placeholder_figure())
|
|
71
|
+
|
|
72
|
+
def _placeholder_figure(self) -> Figure:
|
|
73
|
+
figure = Figure(figsize=(5.2, 3.8))
|
|
74
|
+
axis = figure.add_subplot(111)
|
|
75
|
+
axis.axis("off")
|
|
76
|
+
axis.text(
|
|
77
|
+
0.5,
|
|
78
|
+
0.5,
|
|
79
|
+
"Drag columns onto X, Y, Color, Size or Shape",
|
|
80
|
+
ha="center",
|
|
81
|
+
va="center",
|
|
82
|
+
color="#7b8594",
|
|
83
|
+
fontsize=11,
|
|
84
|
+
)
|
|
85
|
+
return figure
|
|
86
|
+
|
|
87
|
+
def set_figure(self, figure: Figure) -> FigureCanvasQTAgg:
|
|
88
|
+
if self._canvas is not None:
|
|
89
|
+
old_figure = self._canvas.figure
|
|
90
|
+
self._host_layout.removeWidget(self._canvas)
|
|
91
|
+
self._canvas.setParent(None)
|
|
92
|
+
self._canvas.deleteLater()
|
|
93
|
+
if old_figure is not figure:
|
|
94
|
+
try:
|
|
95
|
+
import matplotlib.pyplot as plt
|
|
96
|
+
|
|
97
|
+
plt.close(old_figure)
|
|
98
|
+
except Exception:
|
|
99
|
+
pass
|
|
100
|
+
canvas = FigureCanvasQTAgg(figure)
|
|
101
|
+
canvas.setMinimumHeight(280)
|
|
102
|
+
self._host_layout.addWidget(canvas)
|
|
103
|
+
canvas.show()
|
|
104
|
+
self._canvas = canvas
|
|
105
|
+
canvas.draw_idle()
|
|
106
|
+
return canvas
|
|
107
|
+
|
|
108
|
+
def show_placeholder(self) -> None:
|
|
109
|
+
self.set_figure(self._placeholder_figure())
|
|
110
|
+
|
|
111
|
+
def set_status(self, message: str = "") -> None:
|
|
112
|
+
self.status_label.setText(message)
|
|
113
|
+
self.status_label.setVisible(bool(message))
|
|
114
|
+
|
|
115
|
+
def set_role_visible(self, role: str, visible: bool) -> None:
|
|
116
|
+
zone = self._zones.get(role)
|
|
117
|
+
if zone is not None:
|
|
118
|
+
zone.setVisible(visible)
|
|
119
|
+
|
|
120
|
+
def role_columns(self, role: str) -> list[str]:
|
|
121
|
+
zone = self._zones.get(role)
|
|
122
|
+
return zone.columns() if zone is not None else []
|
|
123
|
+
|
|
124
|
+
def role_column(self, role: str) -> str | None:
|
|
125
|
+
zone = self._zones.get(role)
|
|
126
|
+
return zone.column() if zone is not None else None
|
|
127
|
+
|
|
128
|
+
def set_role_columns(self, role: str, columns) -> None:
|
|
129
|
+
zone = self._zones.get(role)
|
|
130
|
+
if zone is not None:
|
|
131
|
+
zone.set_columns(columns)
|
|
132
|
+
|
|
133
|
+
def set_allowed_columns(self, columns) -> None:
|
|
134
|
+
allowed = {str(column) for column in columns}
|
|
135
|
+
for zone in self._zones.values():
|
|
136
|
+
zone.allowed_columns = allowed
|
|
137
|
+
|
|
138
|
+
def _zones_changed(self, *_args) -> None:
|
|
139
|
+
self.roles_changed.emit()
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from PySide6.QtCore import Qt, QUrl
|
|
4
|
+
from PySide6.QtWidgets import (
|
|
5
|
+
QApplication,
|
|
6
|
+
QComboBox,
|
|
7
|
+
QDialogButtonBox,
|
|
8
|
+
QHBoxLayout,
|
|
9
|
+
QLabel,
|
|
10
|
+
QLineEdit,
|
|
11
|
+
QListWidget,
|
|
12
|
+
QListWidgetItem,
|
|
13
|
+
QPushButton,
|
|
14
|
+
QSplitter,
|
|
15
|
+
QTextBrowser,
|
|
16
|
+
QVBoxLayout,
|
|
17
|
+
QWidget,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from statstudio.feature_help import (
|
|
21
|
+
HelpCatalog,
|
|
22
|
+
HelpTopic,
|
|
23
|
+
load_help_catalog,
|
|
24
|
+
render_topic,
|
|
25
|
+
search_topics,
|
|
26
|
+
)
|
|
27
|
+
from statstudio.ui.dialogs.window import IndependentDialog
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class FeatureHelpDialog(IndependentDialog):
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
catalog: HelpCatalog | None = None,
|
|
34
|
+
parent: QWidget | None = None,
|
|
35
|
+
*,
|
|
36
|
+
topic_id: str | None = None,
|
|
37
|
+
) -> None:
|
|
38
|
+
super().__init__(parent, window_type=Qt.WindowType.Window)
|
|
39
|
+
self.catalog = catalog or load_help_catalog()
|
|
40
|
+
self.current_topic: HelpTopic | None = None
|
|
41
|
+
self.setWindowTitle("StatStudio Help")
|
|
42
|
+
self.setWindowModality(Qt.WindowModality.NonModal)
|
|
43
|
+
self.setWindowFlag(Qt.WindowType.WindowMinimizeButtonHint, True)
|
|
44
|
+
self.setWindowFlag(Qt.WindowType.WindowMaximizeButtonHint, True)
|
|
45
|
+
self.setMinimumSize(780, 520)
|
|
46
|
+
self.resize(980, 680)
|
|
47
|
+
|
|
48
|
+
layout = QVBoxLayout(self)
|
|
49
|
+
layout.setContentsMargins(12, 12, 12, 10)
|
|
50
|
+
layout.setSpacing(8)
|
|
51
|
+
|
|
52
|
+
heading = QLabel("Help and feature reference")
|
|
53
|
+
heading.setStyleSheet("font-size:16px; font-weight:600; color:#24364b;")
|
|
54
|
+
layout.addWidget(heading)
|
|
55
|
+
|
|
56
|
+
filters = QHBoxLayout()
|
|
57
|
+
self.search = QLineEdit()
|
|
58
|
+
self.search.setClearButtonEnabled(True)
|
|
59
|
+
self.search.setPlaceholderText("Search features, methods, menu commands, or Python libraries…")
|
|
60
|
+
self.search.textChanged.connect(self._refresh_results)
|
|
61
|
+
self.search.returnPressed.connect(self._select_first)
|
|
62
|
+
filters.addWidget(self.search, 1)
|
|
63
|
+
self.category = QComboBox()
|
|
64
|
+
self.category.addItem("All categories")
|
|
65
|
+
self.category.addItems(self.catalog.category_titles)
|
|
66
|
+
self.category.currentIndexChanged.connect(self._refresh_results)
|
|
67
|
+
filters.addWidget(self.category)
|
|
68
|
+
layout.addLayout(filters)
|
|
69
|
+
|
|
70
|
+
splitter = QSplitter(Qt.Orientation.Horizontal)
|
|
71
|
+
self.results = QListWidget()
|
|
72
|
+
self.results.setMinimumWidth(270)
|
|
73
|
+
self.results.setAlternatingRowColors(False)
|
|
74
|
+
self.results.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
|
75
|
+
self.results.currentItemChanged.connect(self._show_current)
|
|
76
|
+
splitter.addWidget(self.results)
|
|
77
|
+
|
|
78
|
+
self.content = QTextBrowser()
|
|
79
|
+
self.content.setOpenLinks(False)
|
|
80
|
+
self.content.setOpenExternalLinks(False)
|
|
81
|
+
self.content.anchorClicked.connect(self._anchor_clicked)
|
|
82
|
+
splitter.addWidget(self.content)
|
|
83
|
+
splitter.setStretchFactor(0, 0)
|
|
84
|
+
splitter.setStretchFactor(1, 1)
|
|
85
|
+
splitter.setSizes([320, 640])
|
|
86
|
+
layout.addWidget(splitter, 1)
|
|
87
|
+
|
|
88
|
+
footer = QHBoxLayout()
|
|
89
|
+
self.count_label = QLabel()
|
|
90
|
+
self.count_label.setStyleSheet("color:#657386;")
|
|
91
|
+
footer.addWidget(self.count_label)
|
|
92
|
+
footer.addStretch(1)
|
|
93
|
+
self.quick_button = QPushButton("Quick start")
|
|
94
|
+
self.quick_button.clicked.connect(lambda: self.show_topic("quick-start"))
|
|
95
|
+
footer.addWidget(self.quick_button)
|
|
96
|
+
self.copy_button = QPushButton("Copy automation example")
|
|
97
|
+
self.copy_button.clicked.connect(self._copy_scripting)
|
|
98
|
+
footer.addWidget(self.copy_button)
|
|
99
|
+
self.minimize_button = QPushButton("Minimize")
|
|
100
|
+
self.minimize_button.setToolTip("Minimize Help so you can work in the main window while keeping help open.")
|
|
101
|
+
self.minimize_button.clicked.connect(self.showMinimized)
|
|
102
|
+
footer.addWidget(self.minimize_button)
|
|
103
|
+
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
|
|
104
|
+
buttons.rejected.connect(self.reject)
|
|
105
|
+
footer.addWidget(buttons)
|
|
106
|
+
layout.addLayout(footer)
|
|
107
|
+
|
|
108
|
+
self._refresh_results()
|
|
109
|
+
if topic_id:
|
|
110
|
+
self.show_topic(topic_id)
|
|
111
|
+
self.search.setFocus()
|
|
112
|
+
|
|
113
|
+
def _category_title(self) -> str:
|
|
114
|
+
index = self.category.currentIndex()
|
|
115
|
+
return self.category.currentText() if index > 0 else ""
|
|
116
|
+
|
|
117
|
+
def _refresh_results(self) -> None:
|
|
118
|
+
previous = self.current_topic.id if self.current_topic else ""
|
|
119
|
+
self.results.clear()
|
|
120
|
+
topics = search_topics(self.catalog, self.search.text(), self._category_title())
|
|
121
|
+
for topic in topics:
|
|
122
|
+
item = QListWidgetItem(topic.title)
|
|
123
|
+
item.setData(Qt.ItemDataRole.UserRole, topic.id)
|
|
124
|
+
item.setToolTip(f"{topic.category}\n{topic.summary}")
|
|
125
|
+
self.results.addItem(item)
|
|
126
|
+
count = len(topics)
|
|
127
|
+
self.count_label.setText(f"{count} topic" + ("" if count == 1 else "s"))
|
|
128
|
+
if not topics:
|
|
129
|
+
self.current_topic = None
|
|
130
|
+
self.content.setHtml(self._empty_html())
|
|
131
|
+
self.copy_button.setEnabled(False)
|
|
132
|
+
return
|
|
133
|
+
if previous:
|
|
134
|
+
for row in range(self.results.count()):
|
|
135
|
+
item = self.results.item(row)
|
|
136
|
+
if item.data(Qt.ItemDataRole.UserRole) == previous:
|
|
137
|
+
self.results.setCurrentRow(row)
|
|
138
|
+
break
|
|
139
|
+
if self.current_topic is None or self._current_id() != previous:
|
|
140
|
+
self._select_first()
|
|
141
|
+
|
|
142
|
+
def _current_id(self) -> str:
|
|
143
|
+
item = self.results.currentItem()
|
|
144
|
+
return str(item.data(Qt.ItemDataRole.UserRole)) if item is not None else ""
|
|
145
|
+
|
|
146
|
+
def _select_first(self) -> None:
|
|
147
|
+
if self.results.count():
|
|
148
|
+
self.results.setCurrentRow(0)
|
|
149
|
+
|
|
150
|
+
def _show_current(self, current: QListWidgetItem | None, _previous: QListWidgetItem | None) -> None:
|
|
151
|
+
if current is None:
|
|
152
|
+
self.current_topic = None
|
|
153
|
+
self.content.clear()
|
|
154
|
+
self.copy_button.setEnabled(False)
|
|
155
|
+
return
|
|
156
|
+
topic_id = str(current.data(Qt.ItemDataRole.UserRole))
|
|
157
|
+
topic = self.catalog.topic(topic_id)
|
|
158
|
+
if topic is None:
|
|
159
|
+
return
|
|
160
|
+
self.current_topic = topic
|
|
161
|
+
self.content.setHtml(render_topic(topic, self.catalog))
|
|
162
|
+
self.content.verticalScrollBar().setValue(0)
|
|
163
|
+
self.copy_button.setEnabled(bool(topic.scripting))
|
|
164
|
+
|
|
165
|
+
def show_topic(self, topic_id: str) -> bool:
|
|
166
|
+
for row in range(self.results.count()):
|
|
167
|
+
item = self.results.item(row)
|
|
168
|
+
if item.data(Qt.ItemDataRole.UserRole) == topic_id:
|
|
169
|
+
self.results.setCurrentRow(row)
|
|
170
|
+
return True
|
|
171
|
+
topic = self.catalog.topic(topic_id)
|
|
172
|
+
if topic is None:
|
|
173
|
+
return False
|
|
174
|
+
self.search.blockSignals(True)
|
|
175
|
+
self.category.blockSignals(True)
|
|
176
|
+
self.search.clear()
|
|
177
|
+
self.category.setCurrentIndex(0)
|
|
178
|
+
self.search.blockSignals(False)
|
|
179
|
+
self.category.blockSignals(False)
|
|
180
|
+
self._refresh_results()
|
|
181
|
+
for row in range(self.results.count()):
|
|
182
|
+
item = self.results.item(row)
|
|
183
|
+
if item.data(Qt.ItemDataRole.UserRole) == topic_id:
|
|
184
|
+
self.results.setCurrentRow(row)
|
|
185
|
+
return True
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
def _anchor_clicked(self, url: QUrl) -> None:
|
|
189
|
+
target = url.toString()
|
|
190
|
+
if target.startswith("topic:"):
|
|
191
|
+
self.show_topic(target[len("topic:") :])
|
|
192
|
+
|
|
193
|
+
def _copy_scripting(self) -> None:
|
|
194
|
+
if self.current_topic is None or not self.current_topic.scripting:
|
|
195
|
+
return
|
|
196
|
+
QApplication.clipboard().setText(self.current_topic.scripting)
|
|
197
|
+
self.count_label.setText("Automation example copied")
|
|
198
|
+
|
|
199
|
+
def _empty_html(self) -> str:
|
|
200
|
+
return (
|
|
201
|
+
"<html><body style='font-family:sans-serif;color:#405064;padding:18px;'>"
|
|
202
|
+
"<h2>No matching help topics</h2>"
|
|
203
|
+
"<p>Try a method name such as <b>regression</b>, <b>Cpk</b>, or <b>Box-Cox</b>; "
|
|
204
|
+
"a menu label such as <b>Join</b>; or a library such as <b>statsmodels</b>.</p>"
|
|
205
|
+
"<p>Clear the search box or choose <b>All categories</b> to browse every topic.</p>"
|
|
206
|
+
"</body></html>"
|
|
207
|
+
)
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from PySide6.QtCore import Qt
|
|
6
|
+
from PySide6.QtGui import QKeySequence, QShortcut
|
|
7
|
+
from PySide6.QtWidgets import QApplication, QDialogButtonBox, QWidget
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
_DIALOG_TOPICS: dict[str, str] = {
|
|
11
|
+
"DistributionIDDialog": "distribution-identification",
|
|
12
|
+
"ToleranceDialog": "tolerance-interval",
|
|
13
|
+
"SimulationDialog": "response-simulation",
|
|
14
|
+
"EquivalentTestDialog": "equivalence",
|
|
15
|
+
"SignTestDialog": "nonparametric-tests",
|
|
16
|
+
"WilcoxonOneDialog": "nonparametric-tests",
|
|
17
|
+
"MoodMedianDialog": "nonparametric-tests",
|
|
18
|
+
"FriedmanDialog": "nonparametric-tests",
|
|
19
|
+
"RunsTestDialog": "nonparametric-tests",
|
|
20
|
+
"ProcessScreeningDialog": "process-screening",
|
|
21
|
+
"ProfilerDialog": "prediction-profiler",
|
|
22
|
+
"MultiResponseDialog": "multi-response-optimization",
|
|
23
|
+
"BayesianLinearRegressionDialog": "bayesian-models",
|
|
24
|
+
"BayesianLogisticRegressionDialog": "bayesian-models",
|
|
25
|
+
"BayesianTwoSampleDialog": "bayesian-models",
|
|
26
|
+
"BayesianANOVADialog": "bayesian-models",
|
|
27
|
+
"BayesianOptimizationDialog": "bayesian-optimization",
|
|
28
|
+
"CustomDesignDialog": "custom-doe",
|
|
29
|
+
"DOEDesignDialog": "factorial-designs",
|
|
30
|
+
"FitYByXDialog": "fit-y-by-x",
|
|
31
|
+
"TwoWayANOVADialog": "two-way-anova",
|
|
32
|
+
"ContingencyDialog": "contingency",
|
|
33
|
+
"PostHocDialog": "posthoc",
|
|
34
|
+
"DistributionSummaryDialog": "distribution-summary",
|
|
35
|
+
"PredictiveDialog": "predictive-modeling",
|
|
36
|
+
"GageRRDialog": "measurement-systems",
|
|
37
|
+
"CompetingRiskDialog": "competing-risks",
|
|
38
|
+
"ReliabilityDialog": "reliability",
|
|
39
|
+
"ZeroFailureReliabilityDialog": "reliability",
|
|
40
|
+
"ForecastDialog": "forecast",
|
|
41
|
+
"STLDialog": "stl",
|
|
42
|
+
"DescriptiveDialog": "descriptive-statistics",
|
|
43
|
+
"DistributionDialog": "distribution-fit",
|
|
44
|
+
"FrequencyDialog": "frequency",
|
|
45
|
+
"GroupSummaryDialog": "grouped-summary",
|
|
46
|
+
"TTestDialog": "t-test",
|
|
47
|
+
"ANOVADialog": "anova",
|
|
48
|
+
"MannWhitneyDialog": "nonparametric-tests",
|
|
49
|
+
"WilcoxonDialog": "nonparametric-tests",
|
|
50
|
+
"ChiSquareDialog": "chi-square",
|
|
51
|
+
"ProportionDialog": "proportion",
|
|
52
|
+
"NormalityDialog": "normality",
|
|
53
|
+
"CorrelationDialog": "correlation",
|
|
54
|
+
"CovarianceDialog": "correlation",
|
|
55
|
+
"RegressionDialog": "regression",
|
|
56
|
+
"RegressionProfilerDialog": "prediction-profiler",
|
|
57
|
+
"RegressionMultiResponseDialog": "multi-response-optimization",
|
|
58
|
+
"MultivariateDialog": "multivariate",
|
|
59
|
+
"TimeSeriesDialog": "time-series",
|
|
60
|
+
"SurvivalDialog": "survival",
|
|
61
|
+
"QualityDialog": "quality-spc",
|
|
62
|
+
"PowerDialog": "power-sample-size",
|
|
63
|
+
"DOEAnalysisDialog": "analyze-design",
|
|
64
|
+
"JoinDialog": "join-tables",
|
|
65
|
+
"AppendDialog": "append-tables",
|
|
66
|
+
"FormulaDialog": "formulas",
|
|
67
|
+
"FilterDialog": "row-states",
|
|
68
|
+
"SplitDialog": "reshape-tables",
|
|
69
|
+
"StackDialog": "reshape-tables",
|
|
70
|
+
"UnstackDialog": "reshape-tables",
|
|
71
|
+
"SubsetColumnsDialog": "reshape-tables",
|
|
72
|
+
"RecodeDialog": "recode-column",
|
|
73
|
+
"MissingDialog": "missing-values",
|
|
74
|
+
"NewTableDialog": "new-table",
|
|
75
|
+
"NewColumnDialog": "table-editing",
|
|
76
|
+
"ColumnPropertiesDialog": "column-properties",
|
|
77
|
+
"ImportPreviewDialog": "import-data",
|
|
78
|
+
"PasteDialog": "paste-data",
|
|
79
|
+
"CSVOptionsDialog": "import-data",
|
|
80
|
+
"RenameTableDialog": "manage-tables",
|
|
81
|
+
"DuplicateTableDialog": "manage-tables",
|
|
82
|
+
"StandardizeDialog": "standardize-columns",
|
|
83
|
+
"FindReplaceDialog": "find-replace",
|
|
84
|
+
"SimpleRecodeDialog": "recode-column",
|
|
85
|
+
"ColumnManagerDialog": "column-manager",
|
|
86
|
+
"SortDialog": "sort-table",
|
|
87
|
+
"PlotDialog": "graph-builder",
|
|
88
|
+
"PlotEditDialog": "graph-builder",
|
|
89
|
+
"ColumnSwitcherDialog": "column-switcher",
|
|
90
|
+
"ReportComposerDialog": "report-composer",
|
|
91
|
+
"ODBCDialog": "odbc-connections",
|
|
92
|
+
"TableScriptsDialog": "linked-scripts",
|
|
93
|
+
"JournalDialog": "journal",
|
|
94
|
+
"FeatureHelpDialog": "",
|
|
95
|
+
"BaseDialog": "overview",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_ANALYSIS_TOPICS: dict[str, str] = {
|
|
99
|
+
"analysis": "linear-regression",
|
|
100
|
+
"linear_regression": "regression",
|
|
101
|
+
"polynomial_regression": "regression",
|
|
102
|
+
"logistic_regression": "regression",
|
|
103
|
+
"glm": "regression",
|
|
104
|
+
"mixed_model": "regression",
|
|
105
|
+
"gee": "regression",
|
|
106
|
+
"stepwise_regression": "regression",
|
|
107
|
+
"fit_y_by_x": "fit-y-by-x",
|
|
108
|
+
"regression_prediction_profiler": "prediction-profiler",
|
|
109
|
+
"regression_multi_response_optimization": "multi-response-optimization",
|
|
110
|
+
"multi_response_optimization": "multi-response-optimization",
|
|
111
|
+
"prediction_profiler": "prediction-profiler",
|
|
112
|
+
"descriptive": "descriptive-statistics",
|
|
113
|
+
"frequency": "frequency",
|
|
114
|
+
"grouped_summary": "grouped-summary",
|
|
115
|
+
"distribution_fit": "distribution-fit",
|
|
116
|
+
"distribution_id": "distribution-identification",
|
|
117
|
+
"distribution_summary": "distribution-summary",
|
|
118
|
+
"tolerance_interval": "tolerance-interval",
|
|
119
|
+
"tolerance_sample_size": "tolerance-interval",
|
|
120
|
+
"normality": "normality",
|
|
121
|
+
"correlation": "correlation",
|
|
122
|
+
"covariance": "correlation",
|
|
123
|
+
"t_test_one": "t-test",
|
|
124
|
+
"t_test_two": "t-test",
|
|
125
|
+
"t_test_paired": "t-test",
|
|
126
|
+
"anova": "anova",
|
|
127
|
+
"repeated_measures_anova": "anova",
|
|
128
|
+
"kruskal": "anova",
|
|
129
|
+
"two_way_anova": "two-way-anova",
|
|
130
|
+
"posthoc": "posthoc",
|
|
131
|
+
"mann_whitney": "nonparametric-tests",
|
|
132
|
+
"wilcoxon": "nonparametric-tests",
|
|
133
|
+
"one_sample_wilcoxon": "nonparametric-tests",
|
|
134
|
+
"sign_test": "nonparametric-tests",
|
|
135
|
+
"mood_median": "nonparametric-tests",
|
|
136
|
+
"friedman": "nonparametric-tests",
|
|
137
|
+
"runs_test": "nonparametric-tests",
|
|
138
|
+
"levene": "normality",
|
|
139
|
+
"equivalence": "equivalence",
|
|
140
|
+
"contingency": "contingency",
|
|
141
|
+
"chi_square": "chi-square",
|
|
142
|
+
"proportion": "proportion",
|
|
143
|
+
"pca": "multivariate",
|
|
144
|
+
"factor_analysis": "multivariate",
|
|
145
|
+
"kmeans": "multivariate",
|
|
146
|
+
"hierarchical_clustering": "multivariate",
|
|
147
|
+
"discriminant": "multivariate",
|
|
148
|
+
"canonical_correlation": "multivariate",
|
|
149
|
+
"manova": "multivariate",
|
|
150
|
+
"bayesian_linear_regression": "bayesian-models",
|
|
151
|
+
"bayesian_logistic_regression": "bayesian-models",
|
|
152
|
+
"bayesian_two_sample": "bayesian-models",
|
|
153
|
+
"bayesian_anova": "bayesian-models",
|
|
154
|
+
"bayesian_optimization": "bayesian-optimization",
|
|
155
|
+
"ts_summary": "time-series",
|
|
156
|
+
"stationarity": "time-series",
|
|
157
|
+
"acf_pacf": "time-series",
|
|
158
|
+
"decomposition": "time-series",
|
|
159
|
+
"arima": "forecast",
|
|
160
|
+
"exponential_smoothing": "forecast",
|
|
161
|
+
"forecast": "forecast",
|
|
162
|
+
"stl": "stl",
|
|
163
|
+
"kaplan_meier": "survival",
|
|
164
|
+
"logrank": "survival",
|
|
165
|
+
"cox_regression": "survival",
|
|
166
|
+
"cause_specific_logrank": "competing-risks",
|
|
167
|
+
"cumulative_incidence": "competing-risks",
|
|
168
|
+
"weibull_aft": "reliability",
|
|
169
|
+
"interval_censored_weibull": "reliability",
|
|
170
|
+
"reliability_zero_failures": "reliability",
|
|
171
|
+
"control_chart": "quality-spc",
|
|
172
|
+
"capability": "quality-spc",
|
|
173
|
+
"pareto": "quality-spc",
|
|
174
|
+
"gage_rr": "measurement-systems",
|
|
175
|
+
"attribute_agreement": "measurement-systems",
|
|
176
|
+
"process_screening": "process-screening",
|
|
177
|
+
"power_anova": "power-sample-size",
|
|
178
|
+
"power_curve": "power-sample-size",
|
|
179
|
+
"power_equivalence": "power-sample-size",
|
|
180
|
+
"power_paired_t": "power-sample-size",
|
|
181
|
+
"power_proportion": "power-sample-size",
|
|
182
|
+
"power_t": "power-sample-size",
|
|
183
|
+
"power_t_sample_size": "power-sample-size",
|
|
184
|
+
"power_variance": "power-sample-size",
|
|
185
|
+
"doe_analysis": "analyze-design",
|
|
186
|
+
"custom_doe_analysis": "analyze-design",
|
|
187
|
+
"doe_diagnostics": "design-diagnostics",
|
|
188
|
+
"mixture_analysis": "response-surface-designs",
|
|
189
|
+
"response_simulation": "response-simulation",
|
|
190
|
+
"custom_response_simulation": "response-simulation",
|
|
191
|
+
"custom_prediction_profiler": "prediction-profiler",
|
|
192
|
+
"cart": "predictive-modeling",
|
|
193
|
+
"random_forest": "predictive-modeling",
|
|
194
|
+
"neural_network": "predictive-modeling",
|
|
195
|
+
"svm": "predictive-modeling",
|
|
196
|
+
"naive_bayes": "predictive-modeling",
|
|
197
|
+
"xgboost": "predictive-modeling",
|
|
198
|
+
"automl": "predictive-modeling",
|
|
199
|
+
"plot": "graph-builder",
|
|
200
|
+
"plot_page": "graph-builder",
|
|
201
|
+
"profiler": "prediction-profiler",
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def dialog_help_topic(dialog: Any) -> str:
|
|
206
|
+
override = getattr(dialog, "help_topic", "")
|
|
207
|
+
if callable(override):
|
|
208
|
+
override = override()
|
|
209
|
+
if isinstance(override, str) and override:
|
|
210
|
+
return override
|
|
211
|
+
for cls in type(dialog).__mro__:
|
|
212
|
+
topic = _DIALOG_TOPICS.get(cls.__name__)
|
|
213
|
+
if topic:
|
|
214
|
+
return topic
|
|
215
|
+
return "overview"
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def analysis_help_topic(result_or_type: Any) -> str:
|
|
219
|
+
analysis_type = result_or_type if isinstance(result_or_type, str) else getattr(result_or_type, "analysis_type", "")
|
|
220
|
+
return _ANALYSIS_TOPICS.get(str(analysis_type), "reports")
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
_STANDALONE_HELP: list[QWidget] = []
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _forget_standalone_help(dialog: QWidget) -> None:
|
|
227
|
+
try:
|
|
228
|
+
_STANDALONE_HELP.remove(dialog)
|
|
229
|
+
except ValueError:
|
|
230
|
+
pass
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def _main_window_for(widget: QWidget | None) -> QWidget | None:
|
|
234
|
+
candidate = widget
|
|
235
|
+
seen: set[int] = set()
|
|
236
|
+
while candidate is not None and id(candidate) not in seen:
|
|
237
|
+
seen.add(id(candidate))
|
|
238
|
+
if callable(getattr(candidate, "_statstudio_help", None)):
|
|
239
|
+
return candidate
|
|
240
|
+
owner = getattr(candidate, "_owner_widget", None)
|
|
241
|
+
candidate = owner if owner is not None else candidate.parentWidget()
|
|
242
|
+
return None
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def open_help(parent: QWidget | None, topic_id: str) -> None:
|
|
246
|
+
from statstudio.ui.dialogs.help_dialog import FeatureHelpDialog
|
|
247
|
+
|
|
248
|
+
modal = QApplication.activeModalWidget()
|
|
249
|
+
if modal is not None and parent is not None:
|
|
250
|
+
if parent.window() is modal or modal.isAncestorOf(parent):
|
|
251
|
+
FeatureHelpDialog(parent=parent, topic_id=topic_id).exec()
|
|
252
|
+
return
|
|
253
|
+
|
|
254
|
+
main_window = _main_window_for(parent)
|
|
255
|
+
if main_window is not None:
|
|
256
|
+
main_window._statstudio_help(topic_id)
|
|
257
|
+
return
|
|
258
|
+
|
|
259
|
+
dialog = FeatureHelpDialog(parent=parent, topic_id=topic_id)
|
|
260
|
+
dialog.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
|
|
261
|
+
_STANDALONE_HELP.append(dialog)
|
|
262
|
+
dialog.destroyed.connect(lambda *_, d=dialog: _forget_standalone_help(d))
|
|
263
|
+
dialog.show()
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def add_help_button(button_box: QDialogButtonBox, widget: QWidget) -> Any:
|
|
267
|
+
button = button_box.addButton("Help", QDialogButtonBox.ButtonRole.ActionRole)
|
|
268
|
+
button.clicked.connect(lambda: open_help(widget, dialog_help_topic(widget)))
|
|
269
|
+
return button
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def install_context_help(widget: QWidget, topic_id: str | None = None) -> QShortcut:
|
|
273
|
+
if topic_id:
|
|
274
|
+
widget.setProperty("help_topic", topic_id)
|
|
275
|
+
setattr(widget, "help_topic", topic_id)
|
|
276
|
+
shortcut = QShortcut(QKeySequence(Qt.Key.Key_F1), widget)
|
|
277
|
+
shortcut.setContext(Qt.ShortcutContext.WidgetWithChildrenShortcut)
|
|
278
|
+
shortcut.activated.connect(lambda: open_help(widget, dialog_help_topic(widget)))
|
|
279
|
+
setattr(widget, "_help_shortcut", shortcut)
|
|
280
|
+
return shortcut
|