Skip to content

Commit

Permalink
Merge pull request #244 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Updating Branch
  • Loading branch information
Muthenya authored Feb 20, 2019
2 parents 95dc0e1 + 0d2bade commit 8959d1f
Show file tree
Hide file tree
Showing 406 changed files with 3,587 additions and 1,607 deletions.
23 changes: 19 additions & 4 deletions instat/clsRCodeStructure.vb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Public Class RCodeStructure
Public strAssignToGraph As String
Public strAssignToSurv As String
Public strAssignToTable As String
' If true then a list of data frames is being assigned, otherwise a single data frame
Public bDataFrameList As Boolean = False
' Optional R character vector to give names of new data frames if data frame list is not named
Public strDataFrameNames As String
'These AssingTo's are only relevant in the string case, as RFunction and ROperator have internal equivalents.
'If they are empty, the output Of the command Is Not linked To an R-instat object.
'If they are non-empty, that gives the name of the R-instat Object fields it needs to be linked with.
Expand Down Expand Up @@ -78,7 +82,7 @@ Public Class RCodeStructure
End Sub

'Most methods from RFunction/ROperator have been moved here
Public Sub SetAssignTo(strTemp As String, Optional strTempDataframe As String = "", Optional strTempColumn As String = "", Optional strTempModel As String = "", Optional strTempGraph As String = "", Optional strTempSurv As String = "", Optional strTempTable As String = "", Optional bAssignToIsPrefix As Boolean = False, Optional bAssignToColumnWithoutNames As Boolean = False, Optional bInsertColumnBefore As Boolean = False, Optional bRequireCorrectLength As Boolean = True)
Public Sub SetAssignTo(strTemp As String, Optional strTempDataframe As String = "", Optional strTempColumn As String = "", Optional strTempModel As String = "", Optional strTempGraph As String = "", Optional strTempSurv As String = "", Optional strTempTable As String = "", Optional bAssignToIsPrefix As Boolean = False, Optional bAssignToColumnWithoutNames As Boolean = False, Optional bInsertColumnBefore As Boolean = False, Optional bRequireCorrectLength As Boolean = True, Optional bDataFrameList As Boolean = False, Optional strDataFrameNames As String = "")
strAssignTo = strTemp
If Not strTempDataframe = "" Then
strAssignToDataFrame = strTempDataframe
Expand All @@ -104,6 +108,8 @@ Public Class RCodeStructure
Me.bAssignToColumnWithoutNames = bAssignToColumnWithoutNames
Me.bInsertColumnBefore = bInsertColumnBefore
Me.bRequireCorrectLength = bRequireCorrectLength
Me.bDataFrameList = bDataFrameList
Me.strDataFrameNames = strDataFrameNames
End Sub

Public Sub RemoveAssignTo()
Expand Down Expand Up @@ -229,9 +235,16 @@ Public Class RCodeStructure
strAssignTo = clsGetTables.ToScript()
ElseIf Not strAssignToDataFrame = "" Then
clsAddData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$import_data")
clsDataList.SetRCommand("list")
clsDataList.AddParameter(strAssignToDataFrame, strAssignTo)
clsAddData.AddParameter("data_tables", clsRFunctionParameter:=clsDataList)
If bDataFrameList Then
clsAddData.AddParameter("data_tables", strAssignTo, iPosition:=0)
If strDataFrameNames <> "" Then
clsAddData.AddParameter("data_names", strDataFrameNames, iPosition:=5)
End If
Else
clsDataList.SetRCommand("list")
clsDataList.AddParameter(strAssignToDataFrame, strAssignTo)
clsAddData.AddParameter("data_tables", clsRFunctionParameter:=clsDataList, iPosition:=0)
End If
strScript = strScript & clsAddData.ToScript() & Environment.NewLine

clsGetData.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_data_frame")
Expand Down Expand Up @@ -460,6 +473,8 @@ Public Class RCodeStructure
clsTempCode.strAssignToGraph = strAssignToGraph
clsTempCode.strAssignToSurv = strAssignToSurv
clsTempCode.strAssignToTable = strAssignToTable
clsTempCode.bDataFrameList = bDataFrameList
clsTempCode.strDataFrameNames = strDataFrameNames
clsTempCode.bToBeAssigned = bToBeAssigned
clsTempCode.bIsAssigned = bIsAssigned
clsTempCode.bAssignToIsPrefix = bAssignToIsPrefix
Expand Down
23 changes: 15 additions & 8 deletions instat/dlgDeleteRowsOrColums.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Public Class dlgDeleteRowsOrColums
Private bReset As Boolean = True
Private clsOperatorRowNames As New ROperator
Private clsDeleteRows, clsDeleteColumns As RFunction
Private Sub dlgDeleteRows_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Private Sub dlgDeleteRows_Load(sender As Object, e As EventArgs) Handles Me.Load
autoTranslate(Me)
If bFirstLoad Then
InitialiseDialog()
Expand All @@ -44,8 +44,8 @@ Public Class dlgDeleteRowsOrColums
ucrPnlColumnsOrRows.AddFunctionNamesCondition(rdoRows, frmMain.clsRLink.strInstatDataObject & "$remove_rows_in_data")

ucrPnlColumnsOrRows.AddToLinkedControls(ucrReceiverForColumnsToDelete, {rdoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlColumnsOrRows.AddToLinkedControls(ucrNudFrom, {rdoRows}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlColumnsOrRows.AddToLinkedControls(ucrNudTo, {rdoRows}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlColumnsOrRows.AddToLinkedControls(ucrNudFrom, {rdoRows}, bNewLinkedHideIfParameterMissing:=True)
ucrPnlColumnsOrRows.AddToLinkedControls(ucrNudTo, {rdoRows}, bNewLinkedHideIfParameterMissing:=True)
ucrPnlColumnsOrRows.AddToLinkedControls(ucrDataFrameLengthForDeleteRows, {rdoRows}, bNewLinkedHideIfParameterMissing:=True)

ucrSelectorForDeleteColumns.SetParameter(New RParameter("data_name", 0))
Expand All @@ -58,11 +58,9 @@ Public Class dlgDeleteRowsOrColums
ucrReceiverForColumnsToDelete.SetLinkedDisplayControl(lblColumnsToDelete)

ucrNudFrom.SetParameter(New RParameter("From", 0))
ucrNudFrom.SetMinMax(1, ucrSelectorForDeleteColumns.ucrAvailableDataFrames.iDataFrameLength)
ucrNudFrom.SetLinkedDisplayControl(lblFrom)

ucrNudTo.SetParameter(New RParameter("To", 2))
ucrNudTo.SetMinMax(1, ucrSelectorForDeleteColumns.ucrAvailableDataFrames.iDataFrameLength)
ucrNudTo.SetParameter(New RParameter("To", 1))
ucrNudTo.SetLinkedDisplayControl(lblTo)

ucrDataFrameLengthForDeleteRows.SetLinkedDisplayControl(lblNumberofRows)
Expand Down Expand Up @@ -117,6 +115,7 @@ Public Class dlgDeleteRowsOrColums
Private Sub ReopenDialog()
'temp fix to receiver containing deleted column on reopen
ucrReceiverForColumnsToDelete.Clear()
SetMaxMin()
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
Expand All @@ -136,11 +135,19 @@ Public Class dlgDeleteRowsOrColums
End Sub

Private Sub ucrSelectorForDeleteColumns_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForDeleteColumns.ControlValueChanged
ucrNudFrom.SetMinMax(1, ucrSelectorForDeleteColumns.ucrAvailableDataFrames.iDataFrameLength)
ucrNudTo.SetMinMax(1, ucrSelectorForDeleteColumns.ucrAvailableDataFrames.iDataFrameLength)
SetMaxMin()
End Sub

Private Sub CoreControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForColumnsToDelete.ControlContentsChanged, ucrNudFrom.ControlContentsChanged, ucrPnlColumnsOrRows.ControlContentsChanged, ucrNudFrom.ControlContentsChanged
TestOKEnabled()
End Sub

Private Sub SetMaxMin()
If ucrSelectorForDeleteColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" Then
ucrNudFrom.SetMinMax(1, ucrSelectorForDeleteColumns.ucrAvailableDataFrames.iDataFrameLength)
' Should use ucrSelectorForDeleteColumns.ucrAvailableDataFrames.iDataFrameLength but doesn't update before dialog loads
ucrNudTo.SetMinMax(1, frmMain.clsRLink.GetDataFrameLength(ucrSelectorForDeleteColumns.ucrAvailableDataFrames.cboAvailableDataFrames.Text))
End If
End Sub

End Class
120 changes: 69 additions & 51 deletions instat/dlgImportDataset.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8959d1f

Please sign in to comment.