[education/rkward] rkward/plugins: updated DownloadAppImage plugin to support official stable and development releases and custom sources

m.eik michalke null at kde.org
Tue Oct 22 20:21:14 BST 2024


Git commit 0b622ad7ca2b23a33b57eb6d47b0429dd54e5997 by m.eik michalke.
Committed on 22/10/2024 at 19:19.
Pushed by meikm into branch 'master'.

updated DownloadAppImage plugin to support official stable and development releases and custom sources

M  +9    -1    rkward/plugins/00saveload/DownloadAppImage.js
M  +4    -0    rkward/plugins/00saveload/DownloadAppImage.rkh
M  +22   -12   rkward/plugins/00saveload/DownloadAppImage.xml
M  +56   -14   rkward/plugins/rkwarddev_scripts/rkwarddev_rk.download_appimage_plugin_script.R

https://invent.kde.org/education/rkward/-/commit/0b622ad7ca2b23a33b57eb6d47b0429dd54e5997

diff --git a/rkward/plugins/00saveload/DownloadAppImage.js b/rkward/plugins/00saveload/DownloadAppImage.js
index d2da80813..5f6f467bb 100644
--- a/rkward/plugins/00saveload/DownloadAppImage.js
+++ b/rkward/plugins/00saveload/DownloadAppImage.js
@@ -23,6 +23,7 @@ function preprocess(is_preview){
 function calculate(is_preview){
   // read in variables from dialog
   var aiuFile = getString("aiu_file");
+  var aiuBranch = getString("aiu_branch");
   var aiuUrl = getString("aiu_url");
   var aiuPattern = getString("aiu_pattern");
   var aiuMethod = getString("aiu_method");
@@ -39,7 +40,14 @@ function calculate(is_preview){
   } else {
     echo(",\n    overwrite = FALSE");  
   }
-  echo(",\n    url = \"" + aiuUrl + "\"" + ",\n    pattern = \"" + aiuPattern + "\"" + ",\n    method = \"" + aiuMethod + "\"");
+  if(aiuBranch == "stable") {
+    echo(",\n    url = \"https://download.kde.org/stable/rkward/0.8.0\"" + ",\n    pattern = \"rkward.*x86_64\\\\.AppImage\"");  
+  } else if(aiuBranch == "develop") {
+    echo(",\n    url = \"https://cdn.kde.org/ci-builds/education/rkward/master/linux\"" + ",\n    pattern = \"rkward-master.*linux-gcc-x86_64\\\\.AppImage\"");  
+  } else {
+    echo(",\n    url = \"" + aiuUrl + "\"" + ",\n    pattern = \"" + aiuPattern + "\"");  
+  }
+  echo(",\n    method = \"" + aiuMethod + "\"");
   if(aiuCacheok) {
     echo(",\n      cacheOK=TRUE");
   } else {}
diff --git a/rkward/plugins/00saveload/DownloadAppImage.rkh b/rkward/plugins/00saveload/DownloadAppImage.rkh
index bdedd973d..de0b7fc29 100644
--- a/rkward/plugins/00saveload/DownloadAppImage.rkh
+++ b/rkward/plugins/00saveload/DownloadAppImage.rkh
@@ -26,12 +26,16 @@ SPDX-License-Identifier: GPL-2.0-or-later
   -->
   <settings>
     <caption id="tab_File" />
+    <caption id="frm_brwsrlbSAI" />
     <setting id="aiu_file">
       Select a target file to save the AppImage to.
     </setting>
     <setting id="noLoadMsg">
     </setting>
     <caption id="tab_Source" />
+    <setting id="aiu_branch">
+      Define which branch of RKWard you want to download: The latest stable release, the latest development build (used for testing and probably buggy/unstable) or an AppImage from a custom source.
+    </setting>
     <setting id="aiu_url">
       URL to look for the AppImage files.
     </setting>
diff --git a/rkward/plugins/00saveload/DownloadAppImage.xml b/rkward/plugins/00saveload/DownloadAppImage.xml
index 6d205d57e..0b218a359 100644
--- a/rkward/plugins/00saveload/DownloadAppImage.xml
+++ b/rkward/plugins/00saveload/DownloadAppImage.xml
@@ -21,20 +21,25 @@ SPDX-License-Identifier: GPL-2.0-or-later
     <script>
       <![CDATA[
         doRCommand('Sys.getenv("APPIMAGE")', "commandFinished");
-        commandFinished = function (result, id) {
-          if (result != "") {
-            gui.setValue("aiu_file.selection", result);
-            return;
-          }
-        }
+            commandFinished = function (result, id) {
+              if (result != "") {
+                gui.setValue("aiu_file.selection", result);
+                return;
+              }
+            }
       ]]>
     </script>
+    <convert id="aiu_lgc_branch_stable" sources="aiu_branch.string" mode="equals" standard="stable" />
+    <convert id="aiu_lgc_branch_develop" sources="aiu_branch.string" mode="equals" standard="develop" />
+    <convert id="aiu_lgc_branch_custom" sources="aiu_branch.string" mode="equals" standard="custom" />
+    <connect governor="aiu_lgc_branch_custom" client="aiu_url.enabled" />
+    <connect governor="aiu_lgc_branch_custom" client="aiu_pattern.enabled" />
   </logic>
   <dialog label="Download AppImage">
     <tabbook id="tbbk_AppImage" label="AppImage">
       <tab label="File" id="tab_File">
-        <row id="row_cPAIYRFRPA">
-          <column id="clm_fPAIYRFRPA">
+        <row id="row_cSAISAILMS">
+          <column id="clm_fSAISAILMS">
             <frame id="frm_brwsrlbSAI">
               <browser label="Save to" type="savefile" id="aiu_file" filter="*.AppImage" />
             </frame>
@@ -44,10 +49,15 @@ SPDX-License-Identifier: GPL-2.0-or-later
         </row>
       </tab>
       <tab label="Source" id="tab_Source">
-        <row id="row_cURLP8664A">
-          <column id="clm_iURLP8664A">
-            <input label="URL" id="aiu_url" initial="https://cdn.kde.org/ci-builds/education/rkward/master/linux" required="true" />
-            <input label="Pattern" id="aiu_pattern" initial="rkward-master.*linux-gcc-x86_64\\.AppImage" required="true" />
+        <row id="row_cRKWLCCURL">
+          <column id="clm_dRKWLCCURL">
+            <dropdown id="aiu_branch" label="RKWard release branch">
+              <option label="Latest stable release" value="stable" checked="true" />
+              <option label="Current development build (untested!)" value="develop" />
+              <option label="Custom" value="custom" />
+            </dropdown>
+            <input label="URL" id="aiu_url" initial="https://..." required="true" />
+            <input label="Pattern" id="aiu_pattern" initial="rkward.*x86_64\\.AppImage" required="true" />
             <stretch />
           </column>
         </row>
diff --git a/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.download_appimage_plugin_script.R b/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.download_appimage_plugin_script.R
index 749265be4..617d0f6f4 100644
--- a/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.download_appimage_plugin_script.R
+++ b/rkward/plugins/rkwarddev_scripts/rkwarddev_rk.download_appimage_plugin_script.R
@@ -32,7 +32,7 @@ aboutPlugin <- rk.XML.about(
   ),
   about=list(
     desc="Adds a dialog to install or update an AppImage of RKWard",
-    version="0.01-0",
+    version="0.02-0",
     url="https://rkward.kde.org",
     license="GPL (>= 3)"
   )
@@ -80,9 +80,27 @@ tab_file <- rk.XML.row(
   )
 )
 
+aiu_branch <- rk.XML.dropdown(
+  label = "RKWard release branch",
+  options = list(
+    "Latest stable release"=c(
+      val = "stable",
+      chk = TRUE
+    ),
+    "Current development build (untested!)"=c(
+      val = "develop"
+    ),
+    "Custom"=c(
+      val = "custom"
+    )
+  ),
+  id.name = "aiu_branch",
+  help = "Define which branch of RKWard you want to download: The latest stable release, the latest development build (used for testing and probably buggy/unstable) or an AppImage from a custom source."
+)
+
 aiu_url <- rk.XML.input(
   label = "URL",
-  initial = "https://cdn.kde.org/ci-builds/education/rkward/master/linux",
+  initial = "https://...",
   size = "medium",
   required = TRUE,
   id.name = "aiu_url",
@@ -91,7 +109,7 @@ aiu_url <- rk.XML.input(
 
 aiu_pattern <- rk.XML.input(
   label = "Pattern",
-  initial = "rkward-master.*linux-gcc-x86_64\\\\.AppImage",
+  initial = "rkward.*x86_64\\\\.AppImage",
   size = "medium",
   required = TRUE,
   id.name = "aiu_pattern",
@@ -100,6 +118,7 @@ aiu_pattern <- rk.XML.input(
 
 tab_source <- rk.XML.row(
   rk.XML.col(
+    aiu_branch,
     aiu_url,
     aiu_pattern,
     rk.XML.stretch()
@@ -174,15 +193,24 @@ pluginDialog <- rk.XML.dialog(
 ################
 ## logic section
 
-aiu_logic <- rk.XML.logic(rk.comment(id("
-  doRCommand('Sys.getenv(\"APPIMAGE\")', \"commandFinished\");
-        commandFinished = function (result, id) {
-          if (result != \"\") {
-            gui.setValue(\"", aiu_file, ".selection\", result);
-            return;
-          }
-        }
-", js=FALSE)))
+aiu_logic <- rk.XML.logic(
+  rk.comment(
+    id("
+      doRCommand('Sys.getenv(\"APPIMAGE\")', \"commandFinished\");
+            commandFinished = function (result, id) {
+              if (result != \"\") {
+                gui.setValue(\"", aiu_file, ".selection\", result);
+                return;
+              }
+            }
+    ", js=FALSE)
+  ),
+  aiu_gov_branch_stable <- rk.XML.convert(sources=list(string=aiu_branch), mode=c(equals="stable"), id.name="aiu_lgc_branch_stable"),
+  aiu_gov_branch_develop <- rk.XML.convert(sources=list(string=aiu_branch), mode=c(equals="develop"), id.name="aiu_lgc_branch_develop"),
+  aiu_gov_branch_custom <- rk.XML.convert(sources=list(string=aiu_branch), mode=c(equals="custom"), id.name="aiu_lgc_branch_custom"),
+  rk.XML.connect(governor=aiu_gov_branch_custom, client=aiu_url, set="enabled"),
+  rk.XML.connect(governor=aiu_gov_branch_custom, client=aiu_pattern, set="enabled")
+)
 
 
 #############
@@ -212,11 +240,25 @@ aiu_js_calc <- rk.paste.JS(
       echo(",\n    overwrite = TRUE")
     } else {
       echo(",\n    overwrite = FALSE")
+    },
+    if(aiu_branch == "stable"){
+      echo(
+        ",\n    url = \"https://download.kde.org/stable/rkward/0.8.0\"",
+        ",\n    pattern = \"rkward.*x86_64\\\\.AppImage\""
+      )
+    } else if(aiu_branch == "develop"){
+      echo(
+        ",\n    url = \"https://cdn.kde.org/ci-builds/education/rkward/master/linux\"",
+        ",\n    pattern = \"rkward-master.*linux-gcc-x86_64\\\\.AppImage\""
+      )
+    } else {
+      echo(
+        ",\n    url = \"", aiu_url, "\"",
+        ",\n    pattern = \"", aiu_pattern, "\""
+      )
     }
   ),
   echo(
-    ",\n    url = \"", aiu_url, "\"",                # url = "https://cdn.kde.org/ci-builds/education/rkward/master/linux"
-    ",\n    pattern = \"", aiu_pattern, "\"",        # pattern = "rkward-master.*linux-gcc-x86_64\\.AppImage"
     ",\n    method = \"", aiu_method, "\""           # method = "auto"
   ),
   tf(


More information about the rkward-tracker mailing list