Skip to content

Commit

Permalink
Merge pull request #21 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Pulling changes from the main
  • Loading branch information
deaspo committed Jan 26, 2016
2 parents 8ab1967 + 169f2d5 commit 64706fb
Show file tree
Hide file tree
Showing 24 changed files with 1,615 additions and 802 deletions.
108 changes: 108 additions & 0 deletions instat/My Project/Resources.Designer.vb

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

36 changes: 36 additions & 0 deletions instat/My Project/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -898,4 +898,40 @@
<data name="Probability" xml:space="preserve">
<value>Probability</value>
</data>
<data name="Comment" xml:space="preserve">
<value>Comment</value>
</data>
<data name="Data_Frame" xml:space="preserve">
<value>Data Frame</value>
</data>
<data name="Encoding" xml:space="preserve">
<value>Encoding</value>
</data>
<data name="Heading" xml:space="preserve">
<value>Heading</value>
</data>
<data name="Import" xml:space="preserve">
<value>Import</value>
</data>
<data name="Input_File" xml:space="preserve">
<value>Input File</value>
</data>
<data name="No" xml:space="preserve">
<value>No</value>
</data>
<data name="Quote" xml:space="preserve">
<value>Quote</value>
</data>
<data name="Row_names" xml:space="preserve">
<value>Row names</value>
</data>
<data name="Separator" xml:space="preserve">
<value>Separator</value>
</data>
<data name="Strings_as_factors" xml:space="preserve">
<value>Strings as factors</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
</root>
15 changes: 12 additions & 3 deletions instat/clsGridLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Imports RDotNet
Imports unvell.ReoGrid

Public Class clsGridLink
Public grdData As ReoGridControl
Public grdMetadata As ReoGridControl
Public grdVariablesMetadata As ReoGridControl
Public grdData As New ReoGridControl
Public grdMetadata As New ReoGridControl
Public grdVariablesMetadata As New ReoGridControl
Public bGrdDataExists As Boolean = False
Public bGrdMetadataExists As Boolean = False
Public bGrdVariablesMetadataExists As Boolean = False
Expand Down Expand Up @@ -110,6 +110,15 @@ Public Class clsGridLink
FillSheet(dfTemp, "metadata", grdMetadata)
End If

If grdData.Worksheets.Count = 0 Then
grdData.Visible = False
grdVariablesMetadata.Visible = False
grdMetadata.Visible = False
Else
grdData.Visible = True
grdVariablesMetadata.Visible = True
grdMetadata.Visible = True
End If
End Sub

Public Sub SetData(grdTemp As ReoGridControl)
Expand Down
27 changes: 19 additions & 8 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,26 @@ Public Class RLink
bInstatObjectExists = True
End Sub

Public Sub LoadData(strDataName As String, strFile As String)
Public Sub LoadData(strDataName As String, strFile As String, strFileExt As String)
Dim clsRSyntax As New RSyntax
If Not bInstatObjectExists Then
CreateNewInstatObject()
End If
clsRSyntax.SetFunction("read.csv")
clsRSyntax.AddParameter("file", strFile)
clsRSyntax.SetAssignTo(strDataName, strTempDataframe:=strDataName)
RunScript(clsRSyntax.GetScript())
Select Case strFileExt
Case ".RDS"
If Not bInstatObjectExists Then
clsRSyntax.SetAssignTo(frmMain.clsRLink.strInstatDataObject)
clsRSyntax.SetFunction("readRDS")
clsRSyntax.AddParameter("file", Chr(34) & strFile & Chr(34))
RunScript(clsRSyntax.GetScript())
frmMain.clsRLink.bInstatObjectExists = True
End If
Case ".csv"
If Not bInstatObjectExists Then
CreateNewInstatObject()
End If
clsRSyntax.SetFunction("read.csv")
clsRSyntax.AddParameter("file", Chr(34) & strFile & Chr(34))
clsRSyntax.SetAssignTo(strDataName, strTempDataframe:=strDataName)
RunScript(clsRSyntax.GetScript())
End Select
frmMain.clsGrids.UpdateGrids()
End Sub

Expand Down
10 changes: 6 additions & 4 deletions instat/dlgFileNew.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ Public Class dlgFileNew

Private Sub dlgFileNew_Load(sender As Object, e As EventArgs) Handles MyBase.Load
autoTranslate(Me)
'TODO What should these defaults be?
' Defaults should be stored in Options dialog
txtRows.Text = 10
txtColumns.Text = 2
'TODO add this line back in with correct method name when Steve has written method
'frmMain.clsRLink.clsEngine.Evaluate(frmMain.clsRLink.strInstatDataObject & "$get_next_default_object_name(" & Chr(34) & "Sheet" & Chr(34) & ")")
'TODO remove line below when above is fixed
txtName.Text = "Sheet1"
ucrBase.clsRsyntax.SetFunction("matrix", clsMatrix)
ucrBase.clsRsyntax.AddParameter("data", "NA", clsRFunction:=clsMatrix)
ucrBase.clsRsyntax.AddParameter("nrow", txtRows.Text, clsRFunction:=clsMatrix)
Expand All @@ -43,8 +49,4 @@ Public Class dlgFileNew
ucrBase.clsRsyntax.AddParameter("nrow", txtRows.Text, clsRFunction:=clsMatrix)
End Sub

Private Sub ucrBase_Load(sender As Object, e As EventArgs) Handles ucrBase.ClickOk
frmMain.clsGrids.UpdateGrids()
frmEditor.Show()
End Sub
End Class
Loading

0 comments on commit 64706fb

Please sign in to comment.