Skip to content

Commit

Permalink
use jaspColumn (#125)
Browse files Browse the repository at this point in the history
* use jaspColumn

Uses jasp and jaspBase with changes from
jasp-stats/jaspBase#138
jasp-stats/jasp-desktop#5302

.setColumnDataAsScale etc shouldnt be used by analyses (anymore)

* move focus to sample button onclick
  • Loading branch information
JorisGoosen authored Nov 9, 2023
1 parent 244407a commit dcd004c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
24 changes: 11 additions & 13 deletions R/commonDiscoverDistributions.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

# This is a temporary fix
# TODO: remove it when R will solve this problem!
gettextf <- function(fmt, ..., domain = NULL) {
return(sprintf(gettext(fmt, domain = domain), ...))
}

### Summary stats for distributions module ----
.simulateData <- function(jaspResults, options, as = "scale", sampleSizeName = "n"){
if(is.null(jaspResults[['simdata']])){
Expand All @@ -31,14 +25,18 @@ gettextf <- function(fmt, ..., domain = NULL) {
jaspResults[['simdata']] <- createJaspState(sample)
jaspResults[['simdata']]$dependOn(c("newVariableName", "simulateNow"))

if(as == "scale"){
.setColumnDataAsScale (options[["newVariableName"]], sample)
} else if(as == "ordinal"){
.setColumnDataAsOrdinal(options[["newVariableName"]], sample)
} else{
.setColumnDataAsNominal(options[["newVariableName"]], sample)
if(options[["newVariableName"]] != "")
{
jaspResults[['sampleColumn']] <- createJaspColumn(options[["newVariableName"]])

didItWork <- switch(as,
scale= jaspResults[['sampleColumn']]$setScale( sample),
ordinal=jaspResults[['sampleColumn']]$setOrdinal(sample),
jaspResults[['sampleColumn']]$setNominal(sample))

if(!didItWork)
jaspResults[['sampleColumnError']] <- createJaspHtml(text=gettextf("Could not write to column '%s', probably because it wasn't created by this analysis", options[["newVariableName"]]), elementType="errorMsg", dependencies="newVariableName")
}

}

return()
Expand Down
7 changes: 6 additions & 1 deletion inst/qml/common/LDGenerateDisplayData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ Section
id: simulateNowButton
name: "simulateNowButton"
label: qsTr("Draw samples")
onClicked: if (simulateNow.checked) simulateNow.checked = false; else simulateNow.checked = true
onClicked:
{
simulateNowButton.forceActiveFocus();
simulateNow.checked = !simulateNow.checked

}
}
CheckBox { name: "simulateNow"; visible: false; id: simulateNow }
}
Expand Down

0 comments on commit dcd004c

Please sign in to comment.