Skip to content

Commit 63c6e12

Browse files
PabRodrecapvandenmanFBartos
authored
Merge eScience Center and JASP versions (#12)
* Add minimal example * Use examples instead of dummyanalysis * Add renv.lock to repo * More dummy functionality * Create manual input * Finally some interactivity * Update lock file * Improve AddOne example * Remove text examples They were too simplistic * Problematic snippet regarding plots * Firt example with data * adding github workflow for merging jaspModules * adding github workflow for merging jaspModules * new jaspmodule * Revert "Merge pull request #1 from recap/dev/template" This reverts commit 420c7c5, reversing changes made to aa2f5a2. * update workflow * new myJaspModule module * Revert "Merge pull request #2 from recap/dev/template" This reverts commit e5495e0, reversing changes made to b51cf34. * update README * adding PR open check for DESCRIPTION file * creating faulty module * adding myAwsomeModule * Revert "Merge pull request #3 from recap/dev/template" This reverts commit e213321, reversing changes made to 9c186f6. * Update DESCRIPTION * Revert "Merge pull request #4 from PabRod/dev/template" This reverts commit 7deb734, reversing changes made to f9b48f9. * new workflow to create repo * new workflow to create repo * new workflow to create repo * new workflow to create repo * new module myJaspModule * Revert "Merge pull request #5 from recap/dev/template" This reverts commit cfbef07, reversing changes made to e2fb568. * new workflow to create repo * new module myJaspModule * Revert "Merge pull request #6 from recap/dev/template" This reverts commit 7d7f8be, reversing changes made to cbb676d. * update workflow using PAT * new module myJaspModule * Revert "Merge pull request #7 from recap/dev/template" This reverts commit 62c20d5, reversing changes made to 826e654. * update workflow using PAT * update workflow using PAT * new module myJaspModule * Revert "Merge pull request #8 from recap/dev/template" This reverts commit 7f315d7, reversing changes made to d554001. * new workflow to create repo * update README * Revert "Merge pull request #9 from jasp-escience/dev/template" This reverts commit e847d4f, reversing changes made to e04cc19. * adding workflows to main branch * new module myJaspModule * Revert "Merge pull request #10 from recap/main" This reverts commit 622abb0, reversing changes made to a3ea110. * only run template workflows when PR is from forked repos * updating workflow to add submodule to modules repo * new module * Revert "Merge pull request #11 from recap/main" This reverts commit dd35463, reversing changes made to 1ec524b. * updating workflow to add submodule to modules repo * new module * Revert "Merge pull request #12 from recap/main" This reverts commit 82d384d, reversing changes made to 7e6250a. * updating workflow to add submodule to modules repo * new module * updating workflow to add submodule to modules repo * new module * updating workflow to add submodule to modules repo * updating workflow to add submodule to modules repo * new module * Revert "Merge pull request #15 from recap/main" This reverts commit 29ae05b, reversing changes made to 8e10709. * updating workflow to add submodule to modules repo * new module * Revert "Merge pull request #16 from recap/main" This reverts commit 4ece16a, reversing changes made to e3c182f. * updating workflow to add submodule to modules repo * new module * Revert "Merge pull request #17 from recap/main" This reverts commit 163a8c0, reversing changes made to 6d9d5a9. * updating workflow to add submodule to modules repo * new module * updating workflow to add submodule to modules repo * new module * Revert "Merge pull request #19 from recap/main" This reverts commit 9d48366, reversing changes made to 1ff369f. * updating workflow to add submodule to modules repo * increase security in PR workflow. * new module * increase security in PR workflow. * increase security in PR workflow. * increase security in PR workflow. * Revert "Merge pull request #22 from recap/main" This reverts commit bfd3ec0, reversing changes made to cb754d2. * increase security in PR workflow. * new module * Revert "Merge pull request #23 from recap/main" This reverts commit da3bdfc, reversing changes made to f00d0c1. * increase security in PR workflow. * increase security in PR workflow. * new module * increase security in PR workflow. * increase security in PR workflow. * new module * test modify workflow * Revert "Merge pull request #25 from recap/main" This reverts commit e4d8b3c, reversing changes made to 10d67e3. * increase security in PR workflow. * increase security in PR workflow. * adding check for changes in .github/workflows * adding check for changes in .github/workflows * adding check for changes in .github/workflows * new module * new module * manual revert * break if revert fails * new module * Revert "Merge pull request #28 from recap/main" This reverts commit 7a5e4d8, reversing changes made to dfad630. * add new steps to check if module exists on PR creation * new module * add new steps to check if module exists on PR creation * add new steps to check if module exists on PR creation * Update ProcessData * Revert "Merge pull request #30 from jasp-escience/dummy" This reverts commit 5bb176d, reversing changes made to 6928dc8. * updating workflow * test branch * update workflow * update workflow * update workflow * Add example icon * update workflow to not trigger when org is jasp-escience * test file * remove file * Revert "Revert "Merge pull request #30 from jasp-escience/dummy"" This reverts commit e2e5e55. * Revert "Merge pull request #35 from recap/main" This reverts commit 1fb37e0, reversing changes made to 0c583bb. * new module * update workflow to delte workflows when creating new repo * Revert "Merge pull request #36 from recap/main" This reverts commit 7e679b7, reversing changes made to 4cbe29f. * update workflow to delte workflows when creating new repo * new module (#37) * Revert "new module (#37)" This reverts commit 0547c18. * update workflow to delte workflows when creating new repo * new module (#38) * Revert "new module (#38)" This reverts commit da261a3. * Remove line invoking Travis * Edit DESCRIPTION and update dependencies * Fix wrong package name * Add tables example * Add renv initializer * disable workflows on pull_request * Temporarily remove actions * Revert "Temporarily remove actions" This reverts commit 874e01a. * Update R/examples.R Co-authored-by: Don van den Bergh <[email protected]> * Update R/examples.R Co-authored-by: Don van den Bergh <[email protected]> * Update inst/Description.qml Co-authored-by: Don van den Bergh <[email protected]> * Revert "Remove line invoking Travis" This reverts commit eed5432. * revert workflows * Apply proper dataset subsetting See https://github.com/jasp-stats/jaspModuleTemplate/pull/12\#discussion_r2003575807 * Apply suggestions to parabolaPlot Co-authored-by: František Bartoš <[email protected]> * Use camelCase for functions * Add qsTr wrapper to all text, title and menu fields in the qml files * Add documentation to inputs, and improve readability See #12 (comment) * Capitalize first letter of all qml files See https://github.com/jasp-stats/jaspModuleTemplate/pull/12\#issuecomment-2736932619 * Remove (temporarily) translations.yml At least until we figure out why it is failing and email bombing everybody. Sorry for that * Revert "Remove (temporarily) translations.yml" This reverts commit bfb36a0. * Recover and deactivate translations.yml As suggested by Bruno * Add info fields to all forms Suggested by Bruno * Properly deactivate translation GitHub action * Properly deactivate translations GitHub action * Remove (temporarily) translations.yml Suggested by Bruno * Be explicit about requiresData * Simplify Data.qml * Edit README --------- Co-authored-by: Reggie Cushing <[email protected]> Co-authored-by: R. Cushing <[email protected]> Co-authored-by: Don van den Bergh <[email protected]> Co-authored-by: František Bartoš <[email protected]>
1 parent e04cc19 commit 63c6e12

20 files changed

+3202
-38
lines changed

.Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
^renv$
2+
^renv\.lock$
13
^.*\.Rproj$
24
^\.Rproj\.user$
35
^\.travis\.yml$

.Rprofile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source("renv/activate.R")

.github/workflows/i18nCheck.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
on:
1+
on:
22
push:
3-
paths: ['**.R', '**.qml', '**.po', '**.yml']
4-
3+
paths: ["**.R", "**.qml", "**.po", "**.yml"]
4+
55
pull_request:
6-
paths: ['**.R', '**.qml', '**.po', '**.yml']
7-
6+
paths: ["**.R", "**.qml", "**.po", "**.yml"]
7+
88
workflow_dispatch:
99

1010
name: i18n-check

.github/workflows/translations.yml

-21
This file was deleted.

.github/workflows/unittests.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
on:
2-
push:
3-
paths: ['**.R', 'tests/**', '**.Rd', '**.c', '**.cpp', '**.h', '**.hpp', 'DESCRIPTION', 'NAMESPACE', 'MAKEVARS', 'MAKEVARS.win', '**.yml']
4-
pull_request:
5-
paths: ['**.R', 'tests/**', '**.Rd', '**.c', '**.cpp', '**.h', '**.hpp', 'DESCRIPTION', 'NAMESPACE', 'MAKEVARS', 'MAKEVARS.win']
6-
schedule:
7-
- cron: '13 12 * * 1-5'
2+
workflow_dispatch:
3+
4+
# on:
5+
# push:
6+
# paths: ['**.R', 'tests/**', '**.Rd', '**.c', '**.cpp', '**.h', '**.hpp', 'DESCRIPTION', 'NAMESPACE', 'MAKEVARS', 'MAKEVARS.win', '**.yml']
7+
# pull_request:
8+
# paths: ['**.R', 'tests/**', '**.Rd', '**.c', '**.cpp', '**.h', '**.hpp', 'DESCRIPTION', 'NAMESPACE', 'MAKEVARS', 'MAKEVARS.win']
9+
# schedule:
10+
# - cron: '13 12 * * 1-5'
811

912
name: unit-tests
1013

1114
jobs:
12-
1315
unit-tests:
14-
1516
uses: jasp-stats/jasp-actions/.github/workflows/unittests.yml@master
1617
with:
17-
needs_JAGS: false
18+
needs_JAGS: false
1819
needs_igraph: false

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Date: 2020-10-15
66
Author: JASP Team
77
Website: jasp-stats.org
88
Maintainer: JASP Team <[email protected]>
9-
Description: This module offers analyses.
9+
Description: Example module showing basic functionality. Use it for inspiration when creating your own module.
1010
License: GPL (>= 2)
1111
Encoding: UTF-8
1212
Imports:

NAMESPACE

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
import(jaspBase)
2+
export(addOne)
3+
export(processData)
4+
export(processTable)
5+
export(parabola)

R/examples.R

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
addOne <- function(jaspResults, dataset, options) {
2+
result <- as.character(options$my_number + 1) # options$my_number comes from the menu created by inst/qml/integer.qml
3+
4+
jaspResults[["result"]] <- createJaspHtml(text = result,
5+
title = "This is your result:")
6+
7+
return()
8+
}
9+
10+
processData <- function(jaspResults, dataset, options) {
11+
# Dataset access
12+
# options$ts --maps to--> 't'
13+
# dataset[[options$ts]] --maps to--> dataset$t
14+
result <- paste(dataset[[options$ts]], collapse = "")
15+
jaspResults[["result"]] <- createJaspHtml(text = result,
16+
title = "This is your result:")
17+
18+
return()
19+
}
20+
21+
processTable <- function(jaspResults, dataset, options) {
22+
# Prints the inputs as a table
23+
stats <- createJaspTable(gettext("Some descriptives"))
24+
25+
stats$addColumnInfo(name = gettext("times"))
26+
stats$addColumnInfo(name = gettext("xs"))
27+
28+
stats[["times"]] <- dataset[[options$ts]]
29+
stats[["xs"]] <- dataset[[options$xs]]
30+
31+
jaspResults[["stats"]] <- stats
32+
33+
return()
34+
}
35+
36+
parabola <- function(jaspResults, dataset, options) {
37+
# Analysis
38+
f <- function(x) { options$a * x^2 } # Function to be plotted
39+
p <- ggplot2::ggplot() + # Plotting command
40+
ggplot2::xlim(-3, 3) +
41+
ggplot2::ylim(0, 10) +
42+
ggplot2::geom_function(fun = f)
43+
# add jasp theme
44+
p <- jaspGraphs::geom_rangeframe() +
45+
jaspGraphs::themeJaspRaw()
46+
# Aesthetics
47+
parabolaPlot <- createJaspPlot(title = gettext("Parabola"),
48+
width = 160,
49+
height = 320)
50+
parabolaPlot$dependOn(c("a")) # Refresh view whenever a changes
51+
parabolaPlot$info <- gettext("This figure displays a parabola specified via the `a` option.")
52+
jaspResults[["parabolaPlot"]] <- parabolaPlot
53+
parabolaPlot$plotObject <- p
54+
55+
return()
56+
}

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
# jaspModuleTemplate
1+
# jaspModuleTemplate
2+
3+
This template repository is a starting point for developing a new module for JASP.
4+
It contains the necessary files and structure, plus a numbers of examples to get started.
5+
6+
## How to use this repository
7+
8+
Fork this template repository to your own GitHub account to start developing your module.
9+
You can then clone the repository to your local machine and start developing your module.
10+
11+
The repository contains example functionality.
12+
Feel free to reuse and adapt the examples to your needs.
13+
Feel also free to remove the ones you don't need.
14+
15+
## Contributing back new module to JASP
16+
17+
Once you have developed your module, you can contribute it back to JASP by creating a pull request.
18+
The JASP team will review your module and provide feedback.
19+
Once your module is accepted, a new repo is created in the JASP organization and your module is added to the JASP module repository.
20+
21+
## Reference
22+
[Adding your own modules to JASP](https://github.com/jasp-stats/jasp-desktop/blob/development/Docs/development/jasp-adding-module.md)

inst/Description.qml

+48-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,57 @@ Description
55
{
66
name : "jaspModule"
77
title : qsTr("Jasp Module")
8-
description : qsTr("This module offers analyses.")
8+
description : qsTr("Examples for module builders")
99
version : "0.1"
1010
author : "JASP Team"
1111
maintainer : "JASP Team <[email protected]>"
1212
website : "https://jasp-stats.org"
1313
license : "GPL (>= 2)"
14+
icon : "exampleIcon.png" // Located in /inst/icons/
15+
preloadData: true
16+
requiresData: true
17+
18+
19+
GroupTitle
20+
{
21+
title: qsTr("Basic functions")
22+
}
23+
24+
Analysis
25+
{
26+
title: qsTr("Add one") // Title for window
27+
menu: qsTr("Add one") // Title for ribbon
28+
func: "addOne" // Function to be called
29+
qml: "Integer.qml" // Design input window
30+
requiresData: false // Allow to run even without data
31+
}
32+
33+
Analysis
34+
{
35+
title: qsTr("Load data")
36+
menu: qsTr("Load data")
37+
func: "processData"
38+
qml: "Data.qml"
39+
}
40+
41+
Analysis
42+
{
43+
title: qsTr("Tabular results")
44+
menu: qsTr("Tabular results")
45+
func: "processTable"
46+
qml: "Table.qml"
47+
}
48+
49+
GroupTitle
50+
{
51+
title: qsTr("Plotting")
52+
}
53+
54+
Analysis
55+
{
56+
title: qsTr("Plot a parabola")
57+
func: "parabola"
58+
qml: "Parabola.qml"
59+
requiresData: false
60+
}
1461
}

inst/icons/exampleIcon.png

1.78 KB
Loading

inst/icons/exampleIcon.svg

+83
Loading

inst/qml/Data.qml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// Copyright (C) 2013-2018 University of Amsterdam
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Affero General Public License as
6+
// published by the Free Software Foundation, either version 3 of the
7+
// License, or (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Affero General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Affero General Public
15+
// License along with this program. If not, see
16+
// <http://www.gnu.org/licenses/>.
17+
//
18+
import QtQuick 2.8
19+
import QtQuick.Layouts 1.3
20+
import JASP.Controls 1.0
21+
import JASP.Widgets 1.0
22+
import JASP 1.0
23+
24+
Form
25+
{
26+
27+
info: qsTr("This example shows how to load a dataset and perform a simple operation on it. \
28+
Specifically, it concatenates the values of a column. \n
29+
e.g.: [1, 2, 3] -> '123'") // Used for populating the info tab
30+
31+
Text
32+
{
33+
text: qsTr("This example shows how to load a dataset and perform a simple operation on it.")
34+
}
35+
36+
VariablesForm
37+
{
38+
AvailableVariablesList { name: "allVariables" }
39+
40+
AssignedVariablesList {
41+
name: "ts"
42+
label: qsTr("Times (t)")
43+
info: qsTr("Vector representing times")
44+
singleVariable: true
45+
allowedColumns: ["scale"]
46+
}
47+
}
48+
49+
}

0 commit comments

Comments
 (0)