Skip to content

Commit

Permalink
Merge pull request #54 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
Vitalis95 authored May 4, 2022
2 parents ee34797 + 8bc9d15 commit ffeb905
Show file tree
Hide file tree
Showing 34 changed files with 1,281 additions and 1,188 deletions.
3 changes: 2 additions & 1 deletion instat/Model/DataFrame/clsDataFramePage.vb
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ Public Class clsDataFramePage
End If
_lstColumns.Clear()


For i = 0 To _clsRDotNetDataFrame.ColumnNames.ToList.Count - 1
columnHeader = GetColumnDispayDetails(_clsRDotNetDataFrame.ColumnNames.ToList(i), vecColumnDataTypes(i))
If bApplyBackGroundColumnColours AndAlso vecColumnColours IsNot Nothing Then
If bApplyBackGroundColumnColours AndAlso Not Double.IsNaN(vecColumnColours(i)) Then
columnHeader.clsBackGroundColour = GetColumnBackGroundColor(i, vecColumnColours(i).ToString())
End If
_lstColumns.Add(columnHeader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Public Class ucrDataframeMetadataReoGrid
grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False)
grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False)
grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToFillSerial, False)
grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.View_AllowCellTextOverflow, False)
grdData.Worksheets(0).SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down
grdData.SheetTabNewButtonVisible = False
AttachEventsToWorksheet(grdData.Worksheets(0))
Expand Down
13 changes: 11 additions & 2 deletions instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,24 @@ Public MustInherit Class ucrReoGrid
End Function

Private Sub UpdateWorksheetStyle(workSheet As Worksheet)
'issue with reo grid that means if RangePosition.EntireRange is used then the back color
'changes. This would then override the back color set in R
If frmMain.clsInstatOptions IsNot Nothing Then
workSheet.SetRangeStyles(RangePosition.EntireRange, New WorksheetRangeStyle() With {
'Set enitre range apart from top row
workSheet.SetRangeStyles(New RangePosition(1, 0, workSheet.RowCount, workSheet.ColumnCount), New WorksheetRangeStyle() With {
.Flag = PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize Or PlainStyleFlag.FontName,
.TextColor = frmMain.clsInstatOptions.clrEditor,
.FontSize = frmMain.clsInstatOptions.fntEditor.Size,
.FontName = frmMain.clsInstatOptions.fntEditor.Name
})
'Set top row
workSheet.SetRangeStyles(New RangePosition(0, 0, 1, workSheet.ColumnCount), New WorksheetRangeStyle() With {
.Flag = PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize Or PlainStyleFlag.FontName,
.TextColor = frmMain.clsInstatOptions.clrEditor,
.FontSize = frmMain.clsInstatOptions.fntEditor.Size,
.FontName = frmMain.clsInstatOptions.fntEditor.Name
})
End If

End Sub

Private Sub ucrReoGrid_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Expand Down
6 changes: 3 additions & 3 deletions instat/dlgColourbyProperty.Designer.vb

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

38 changes: 34 additions & 4 deletions instat/dlgColourbyProperty.vb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
' along with this program. If not, see <http://www.gnu.org/licenses/>.

Imports instat.Translations
Imports RDotNet
Public Class dlgColourbyProperty
Public bFirstLoad As Boolean = True
Private clsColourByMetadata As New RFunction
Private clsRemoveColour As New RFunction
Private bReset As Boolean = True
Private bApplyColumnColours As Boolean

Private Sub dlgColourbyProperty_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
Expand All @@ -32,6 +34,8 @@ Public Class dlgColourbyProperty
SetRCodeForControls(bReset)
bReset = False
TestOKEnabled()
AutoFill()
SetBaseFunction()
autoTranslate(Me)
End Sub

Expand Down Expand Up @@ -61,7 +65,6 @@ Public Class dlgColourbyProperty

clsColourByMetadata.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_column_colours_by_metadata")
clsRemoveColour.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$remove_column_colours")

ucrBase.clsRsyntax.SetBaseRFunction(clsColourByMetadata)
End Sub

Expand All @@ -73,7 +76,7 @@ Public Class dlgColourbyProperty
End Sub

Private Sub TestOKEnabled()
If Not ucrReceiverMetadataProperty.IsEmpty Then
If Not ucrReceiverMetadataProperty.IsEmpty OrElse ucrChkRemoveColours.Checked Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
Expand All @@ -86,14 +89,41 @@ Public Class dlgColourbyProperty
TestOKEnabled()
End Sub

Private Sub ucrChkRemoveColours_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkRemoveColours.ControlValueChanged
If ucrChkRemoveColours.Checked Then

Private Sub AutoFill()
If ucrSelectorColourByMetadata.lstAvailableVariable.Items.Count > 0 Then
Dim clsHasColoursFunc As New RFunction
clsHasColoursFunc.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$has_colours")
clsHasColoursFunc.AddParameter("data_name", Chr(34) & ucrSelectorColourByMetadata.ucrAvailableDataFrames.strCurrDataFrame & Chr(34))
bApplyColumnColours = frmMain.clsRLink.RunInternalScriptGetValue(clsHasColoursFunc.ToScript()).AsLogical(0)
If Not bApplyColumnColours Then
For Each lviItem As ListViewItem In ucrSelectorColourByMetadata.lstAvailableVariable.Items
If lviItem.Text = "class" Then
ucrReceiverMetadataProperty.Add(lviItem.Text, ucrSelectorColourByMetadata.ucrAvailableDataFrames.strCurrDataFrame)
Exit For
End If
Next
End If
ucrChkRemoveColours.Visible = bApplyColumnColours
End If
End Sub

Private Sub SetBaseFunction()
If ucrChkRemoveColours.Checked AndAlso bApplyColumnColours Then
ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColour)
Else
ucrBase.clsRsyntax.SetBaseRFunction(clsColourByMetadata)
End If
End Sub

Private Sub ucrChkRemoveColours_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkRemoveColours.ControlValueChanged
SetBaseFunction()
End Sub

Private Sub ucrSelectorColourByMetadata_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColourByMetadata.ControlValueChanged
AutoFill()
End Sub

Private Sub Controls_ControContententsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColourByMetadata.ControlContentsChanged, ucrReceiverMetadataProperty.ControlContentsChanged, ucrChkRemoveColours.ControlContentsChanged
TestOKEnabled()
End Sub
Expand Down
Loading

0 comments on commit ffeb905

Please sign in to comment.