[education/rkward] /: Add gitInstall plugin to settings and add-ons page

Thomas Friedrichsmeier null at kde.org
Fri May 6 16:59:42 BST 2022


Git commit 462c2b47d3340380e8ea82de863f8fc02ee08e1a by Thomas Friedrichsmeier.
Committed on 06/05/2022 at 15:59.
Pushed by tfry into branch 'master'.

Add gitInstall plugin to settings and add-ons page

M  +2    -0    ChangeLog
M  +3    -2    rkward/pages/rkward_addons.rkh
M  +3    -0    rkward/plugins/embedded.pluginmap
M  +1    -10   rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
M  +12   -2    rkward/settings/rksettingsmoduler.cpp

https://invent.kde.org/education/rkward/commit/462c2b47d3340380e8ea82de863f8fc02ee08e1a

diff --git a/ChangeLog b/ChangeLog
index 290f858d..6d96d697 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 TODOs:
 	- More tolerant handshake on Windows? Simply a matter of allowing more time?
 
+- Added functionality to install add-on packages directly from git (formerly available as external plugin rk.gitInstall)
 - Fixed: Disabling a <row> element in plugins would not make the sub-elements non-required
 - Add option to show ANOVA table for linear regression
 - Add default preview() function is available to plugins, reducing the code needed to add preview functionality
@@ -8,6 +9,7 @@ TODOs:
 - Better placement of messages in non-plot preview windows
 - Fixed some problems with cancelling running commands
 - Package installation uses inline widget to provide progress feedback, instead of separate dialogs
+	- TODO: Fix crash, if cancelling of operation is confirmed, after operation has finished (guard against deletion, while question sub-dialog is active)
 - Package installation no longer uses an external process, unless required for root permissions
 - Fixed: Package installation as root would fail to find kdesu/kdesudo on recent systems
 - Fixed: R help pages would refuse to open in new tab
diff --git a/rkward/pages/rkward_addons.rkh b/rkward/pages/rkward_addons.rkh
index 930c0aa9..1a87ab13 100644
--- a/rkward/pages/rkward_addons.rkh
+++ b/rkward/pages/rkward_addons.rkh
@@ -33,9 +33,10 @@ Addons shown in bold have been reported to be useful and work well in RKWard, bu
 
 	<section title="RKWard Plugins" id="rkward_plugins">
 RKWard plugins can be installed from a variety of sources, but the usual distribution of add-on packages is via R packages. To look for R packages that provide RKWard graphical dialogs,
-use the regular dialog (Settings->Manage R packages and plugins), and check the option "Show only packages providing RKWard dialogs".
+use the regular dialog (<link href="rkward://actions/rpackage_install">Settings->Manage R packages and plugins</link>), and check the option "Show only packages providing RKWard dialogs".
 
-Not all RKWard plugins packaged this way will be visible in the R package installation dialog, as they are not hosted (yet) in the default repositories, notably, at the time of this writing, the very extensive <link href="https://github.com/rkward-community/rk.Teaching">rk.Teaching</link> set of plugins.
+Not all RKWard plugins packaged this way will be visible in the R package installation dialog, as they are not hosted (yet) in the default repositories, notably, at the time of this writing, the very extensive <link href="https://github.com/rkward-community/rk.Teaching">rk.Teaching</link> set of plugins. Many of these are hosted on platforms such as github.com, and knowing the repository url,
+can be installed with few clicks, using <link href="rkward://runplugin/rkward::install_from_git/fullURL.text=https://github.com/rkward-community/rk.Teaching.git">this dialog</link> (pre-initialized for installation of rk.Teaching).
 	</section>
 
 	<section title="Creating your own RKWard Plugins" id="writing_plugins">
diff --git a/rkward/plugins/embedded.pluginmap b/rkward/plugins/embedded.pluginmap
index 93ab295f..33c3bca2 100644
--- a/rkward/plugins/embedded.pluginmap
+++ b/rkward/plugins/embedded.pluginmap
@@ -31,5 +31,8 @@
 		<!-- This plugin does not really belong, here, but nowhere else, either, since it's only for the purpose of testing some things in the
 				automated tests. It definitely should not be shown in the menu, of course. -->
 		<component type="standard" id="testing_run_code" file="testing/run_code.xml" label="Run Code"/>
+
+		<!-- This plugin does not really belong, here, either, but has no place in the menu, too. -->
+		<component type="standard" id="install_from_git" file="internal/Installfromgit.xml" label="Install from git"/>
 	</components>
 </document>
diff --git a/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R b/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
index 516eacfe..c30e9c8f 100644
--- a/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
+++ b/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.gitInstall_plugin_script.R
@@ -12,8 +12,6 @@ guess.getter <- TRUE
 rk.set.indent(by="  ")
 # should empty "else" clauses be kept in the JavaScript code?
 rk.set.empty.e(TRUE)
-# make your plugin translatable by setting this to TRUE
-update.translations <- TRUE
 
 aboutPlugin <- rk.XML.about(
   name="rk.gitInstall",
@@ -224,7 +222,7 @@ plugin.dir <- rk.plugin.skeleton(
     #related=,
     #technical=
   ),
-  create=c("pmap", "xml", "js", "desc", "rkh"),
+  create=c("xml", "js", "rkh"),
   overwrite=overwrite,
   #components=list(),, 
   #provides=c("logic", "dialog"), 
@@ -233,13 +231,6 @@ plugin.dir <- rk.plugin.skeleton(
   edit=FALSE, 
   load=TRUE, 
   show=TRUE,
-  gen.info="$SRC/inst/rkward/rkwarddev_rk.gitInstall_plugin_script.R",
   hints=FALSE
 )
-
-  # you can make your plugin translatable, see top of script
-  if(isTRUE(update.translations)){
-    rk.updatePluginMessages(file.path(output.dir,"rk.gitInstall","inst","rkward","rk.gitInstall.pluginmap"))
-  } else {}
-
 })
diff --git a/rkward/settings/rksettingsmoduler.cpp b/rkward/settings/rksettingsmoduler.cpp
index 80e0894f..233656c3 100755
--- a/rkward/settings/rksettingsmoduler.cpp
+++ b/rkward/settings/rksettingsmoduler.cpp
@@ -33,6 +33,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include "../misc/rkstandardicons.h"
 #include "../rbackend/rkrinterface.h"
 #include "../rbackend/rksessionvars.h"
+#include "../plugin/rkcomponentmap.h"
 #include "../misc/rkstyle.h"
 
 #include "../debug.h"
@@ -341,9 +342,18 @@ RKSettingsModuleRPackages::RKSettingsModuleRPackages (RKSettings *gui, QWidget *
 	source_packages_box->setChecked (true);
 	source_packages_box->setEnabled (false);
 #endif
-	RKCommonFunctions::setTips (QString ("<p>%1</p>").arg (i18n ("Installing packages from pre-compiled binaries (if available) is generally faster, and does not require an installation of development tools and libraries. On the other hand, building packages from source provides best compatibility. On Mac OS X and Linux, building packages from source is currently recommended.")), source_packages_box);
+	RKCommonFunctions::setTips (QString ("<p>%1</p>").arg (i18n ("Installing packages from pre-compiled binaries (if available) is generally faster, and does not require an installation of development tools and libraries. On the other hand, building packages from source provides best compatibility.")), source_packages_box);
 	main_vbox->addWidget (source_packages_box);
 
+	hbox = new QHBoxLayout();
+	main_vbox->addLayout(hbox);
+	auto button = new QPushButton(i18n("Install from git"));
+	auto label = RKCommonFunctions::wordWrappedLabel(i18n("Some add-on packages are not available in the CRAN repository, but can be installed from development repositories. Use the button \"%1\", to install such pacakges, comfortably.", button->text()));
+	hbox->addWidget(label);
+	hbox->setStretchFactor(label, 2);
+	connect(button, &QPushButton::clicked, this, []() { RKComponentMap::getMap()->invokeComponent("rkward::install_from_git", QStringList()); });
+	hbox->addWidget(button);
+
 	main_vbox->addStretch ();
 
 	libloc_selector = new MultiStringSelector (i18n ("R Library locations (where libraries get installed to, locally)"), this);
@@ -351,7 +361,7 @@ RKSettingsModuleRPackages::RKSettingsModuleRPackages (RKSettings *gui, QWidget *
 	connect (libloc_selector, &MultiStringSelector::listChanged, this, &RKSettingsModuleRPackages::settingChanged);
 	connect (libloc_selector, &MultiStringSelector::getNewStrings, this, &RKSettingsModuleRPackages::addLibLoc);
 	main_vbox->addWidget (libloc_selector);
-	QLabel *label = new QLabel (i18n ("Note: The startup defaults will always be used in addition to the locations you specify in this list"), this);
+	label = new QLabel (i18n ("Note: The startup defaults will always be used in addition to the locations you specify in this list"), this);
 	main_vbox->addWidget (label);
 
 	main_vbox->addStretch ();



More information about the rkward-tracker mailing list