[education/labplot] src/frontend: [scripting] added an option to create a python script on default on application start.

Alexander Semke <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 5c6d891c8cd16a579826c1365d9bd41e808e59ee by Alexander Semke.
Committed on 06/08/2026 at 18:05.
Pushed by asemke into branch 'master'.

[scripting] added an option to create a python script on default on application start.

M  +6    -0    src/frontend/MainWin.cpp
M  +1    -1    src/frontend/MainWin.h
M  +3    -0    src/frontend/SettingsGeneralPage.cpp

https://invent.kde.org/education/labplot/-/commit/5c6d891c8cd16a579826c1365d9bd41e808e59ee

diff --git a/src/frontend/MainWin.cpp b/src/frontend/MainWin.cpp
index 6991fcd96b..12b85ea396 100644
--- a/src/frontend/MainWin.cpp
+++ b/src/frontend/MainWin.cpp
@@ -575,6 +575,12 @@ bool MainWin::newProject(bool createInitialContent) {
 			const auto& backend = group.readEntry(QLatin1String("LoadOnStartNotebook"), QString());
 			if (Cantor::Backend::listAvailableBackends().indexOf(backend) != -1)
 				addAspectToProject(new Notebook(backend));
+#endif
+			break;
+		}
+		case NewProject::WithScript: {
+#ifdef HAVE_SCRIPTING
+			addAspectToProject(new Script(i18n("Script"), QStringLiteral("Python")));
 #endif
 			break;
 		}
diff --git a/src/frontend/MainWin.h b/src/frontend/MainWin.h
index 5c0f150931..8231a0d498 100644
--- a/src/frontend/MainWin.h
+++ b/src/frontend/MainWin.h
@@ -63,7 +63,7 @@ public:
 	void addAspectToProject(AbstractAspect*);
 
 	enum class LoadOnStart { NewProject, LastProject, WelcomeScreen };
-	enum class NewProject { WithSpreadsheet, WithWorksheet, WithSpreadsheetWorksheet, WithNotebook };
+	enum class NewProject { WithSpreadsheet, WithWorksheet, WithSpreadsheetWorksheet, WithNotebook, WithScript };
 	enum class TitleBarMode { ShowFilePath, ShowFileName, ShowProjectName };
 
 #ifdef HAVE_KUSERFEEDBACK
diff --git a/src/frontend/SettingsGeneralPage.cpp b/src/frontend/SettingsGeneralPage.cpp
index 81f0848779..c7b5b13e1d 100644
--- a/src/frontend/SettingsGeneralPage.cpp
+++ b/src/frontend/SettingsGeneralPage.cpp
@@ -224,6 +224,9 @@ void SettingsGeneralPage::retranslateUi() {
 #ifdef HAVE_CANTOR_LIBS
 	ui.cbNewProject->addItem(i18n("With Notebook"), static_cast<int>(MainWin::NewProject::WithNotebook));
 #endif
+#ifdef HAVE_SCRIPTING
+	ui.cbNewProject->addItem(i18n("With Python Script"), static_cast<int>(MainWin::NewProject::WithScript));
+#endif
 
 	QString msg = i18n("Notebook type to create automatically on startup");
 	ui.lNewProjectNotebook->setToolTip(msg);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.