Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #318

Merged
merged 28 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
274180e
Merge pull request #305 from IDEMSInternational/master
MeSophie Jan 31, 2025
2e6dcc3
Change made
MeSophie Jan 31, 2025
c99f8be
Merge pull request #306 from IDEMSInternational/master
MeSophie Jan 31, 2025
ea78aaa
Small change made in the data base
MeSophie Jan 31, 2025
897b88f
Change made
MeSophie Feb 3, 2025
03fed96
Change made
MeSophie Feb 3, 2025
74eb56a
Change made
MeSophie Feb 3, 2025
9ca8b99
Change made
MeSophie Feb 3, 2025
aefc664
Change made
MeSophie Feb 4, 2025
31b94cc
logical symbols changes
Fidel365 Feb 4, 2025
bd73897
Merge pull request #9408 from MeSophie/databasechange
N-thony Feb 5, 2025
1df0b70
minor change
MeSophie Feb 5, 2025
d7780e0
changes
Vitalis95 Feb 5, 2025
67666a5
Merge pull request #9417 from Vitalis95/stack_bug
N-thony Feb 5, 2025
809f2c3
New help file
N-thony Feb 5, 2025
0190d4c
Minor Adjustments to Script Design
derekagorhom Feb 5, 2025
c9973f1
Merge pull request #9421 from derekagorhom/Design_Changes_ScriptsWindow
N-thony Feb 6, 2025
3e5e4f1
Merge pull request #9419 from Fidel365/logicalsymbols
N-thony Feb 6, 2025
9b8051b
Fixed Minor Change in Edit > Find Dialog
derekagorhom Feb 6, 2025
685d670
updated the help file
N-thony Feb 7, 2025
a81f09b
Remove background colors
N-thony Feb 7, 2025
515401d
Merge pull request #89 from N-thony/clear_backgroundColor
derekagorhom Feb 7, 2025
392f536
Blocking Sentinel values from displaying
derekagorhom Feb 7, 2025
738ed21
Merge pull request #9425 from derekagorhom/Design_Changes_ScriptsWindow
N-thony Feb 7, 2025
fa2fcf3
Merge pull request #9407 from MeSophie/NewPicsacrop9384
N-thony Feb 10, 2025
0e1f744
Merge pull request #9418 from N-thony/helpfile
N-thony Feb 10, 2025
08eed9e
Downgrade getPass to ensure compatibility
N-thony Feb 10, 2025
0f53692
Merge pull request #9432 from N-thony/dowgrad_getPAss
N-thony Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions instat/Interface/IDataViewGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ Public Interface IDataViewGrid

Sub Focus()

Sub RemoveAllBackgroundColors()

Function GetSelectedColumns() As List(Of clsColumnHeaderDisplay)

Function GetFirstRowHeader() As String
Expand Down
4 changes: 4 additions & 0 deletions instat/UserControls/DataGrid/Linux/ucrDataViewLinuxGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ Public Class ucrDataViewLinuxGrid
dataGrid.Rows(iRow).Cells(iColumn).Value = GetCurrentDataFrameFocus.DisplayedData(iRow, iColumn)
End Sub

Private Sub RemoveAllBackgroundColors() Implements IDataViewGrid.RemoveAllBackgroundColors

End Sub

Public Sub SearchRowInGrid(rowNumbers As List(Of Integer), strColumn As String, Optional iRow As Integer = 0,
Optional bApplyToRows As Boolean = False) Implements IDataViewGrid.SearchRowInGrid
End Sub
Expand Down
9 changes: 9 additions & 0 deletions instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ Public Class ucrDataViewReoGrid
Next
End Sub

Private Sub RemoveAllBackgroundColors() Implements IDataViewGrid.RemoveAllBackgroundColors
For rowNumber As Integer = 0 To grdData.CurrentWorksheet.RowCount - 1
For colIndex As Integer = 0 To grdData.CurrentWorksheet.ColumnCount - 1
grdData.CurrentWorksheet.Cells(rowNumber, colIndex).Style.BackColor = Color.Transparent
Next
Next
grdData.CurrentWorksheet.RequestInvalidate()
End Sub

Public Sub SearchRowInGrid(rowNumbers As List(Of Integer), strColumn As String, Optional iRow As Integer = 0,
Optional bApplyToRows As Boolean = False) Implements IDataViewGrid.SearchRowInGrid
Dim currSheet = grdData.CurrentWorksheet
Expand Down
7 changes: 7 additions & 0 deletions instat/dlgFindInVariableOrFilter.vb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ Public Class dlgFindInVariableOrFilter
rdoCell.Checked = True
ucrReceiverVariable.Clear()
ucrInputPattern.cboInput.ResetText()
frmMain.ucrDataViewer.RemoveAllBackgroundColors()
End Sub

Private Sub cmdFind_Click(sender As Object, e As EventArgs) Handles cmdFind.Click
Expand Down Expand Up @@ -216,10 +217,16 @@ Public Class dlgFindInVariableOrFilter
Dim bApplyToRows As Boolean = (rdoVariable.Checked AndAlso rdoRow.Checked) OrElse rdoInFilter.Checked
frmMain.ucrDataViewer.SearchRowInGrid(rowNumbers:=lstRowNumbers, strColumn:=strColumn,
iRow:=iRow, bApplyToRows:=bApplyToRows)
lblFoundRow.Visible = True
lblFoundRow.Text = "Found Row: " & iRow
lblFoundRow.Visible = True
iCountRowClick += 1
SetControlsVisible(False)
If iRow = -2147483648 Then
lblFoundRow.Text = "No cell rows found"
Else
lblFoundRow.Text = "Found Row: " & iRow
End If
Else
Dim lstColumnNames As New List(Of String)
lstColumnNames = frmMain.clsRLink.RunInternalScriptGetValue(clsGetRowsFunction.ToScript()).AsCharacter.ToList
Expand Down
594 changes: 298 additions & 296 deletions instat/dlgPICSACrops.Designer.vb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions instat/dlgPICSACrops.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ttPlanting.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
113 changes: 101 additions & 12 deletions instat/dlgPICSACrops.vb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
' along with this program. If not, see <http://www.gnu.org/licenses/>.

Imports instat.Translations
Imports System.Text.RegularExpressions


Public Class dlgPICSACrops
Private clsCropsFunction As New RFunction
Expand All @@ -23,6 +25,11 @@ Public Class dlgPICSACrops
Public bFirstLoad As Boolean = True
Private bReset As Boolean = True
Private strCurrDataName As String = ""
Private lstEndReceivers As New List(Of ucrReceiverSingle)
Private lstStartReceivers As New List(Of ucrReceiverSingle)
Private bisFilling As Boolean = False

Dim lstRecognisedTypes As New List(Of KeyValuePair(Of String, List(Of String)))

Private Sub dlgPICSACrops_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
Expand All @@ -36,16 +43,32 @@ Public Class dlgPICSACrops
bReset = False
TestOkEnabled()
autoTranslate(Me)
AutoFillReceivers(lstEndReceivers)
AutoFillReceivers(lstStartReceivers)
End Sub

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 480
' Sub dialog not yet created.
cmdOptions.Visible = False

Dim kvpEnd As KeyValuePair(Of String, List(Of String)) = New KeyValuePair(Of String, List(Of String))("end_season", {"end_season", "end_rains", "end_rain_filled", "end_season_filled"}.ToList())
Dim kvpStart As KeyValuePair(Of String, List(Of String)) = New KeyValuePair(Of String, List(Of String))("start_rain", {"start_rain"}.ToList())

lstRecognisedTypes.AddRange({kvpEnd, kvpStart})

lstEndReceivers.AddRange({ucrReceiverEnd})

lstStartReceivers.AddRange({ucrReceiverStart})

ucrSelectorForCrops.SetLabelText("Data Frame (Daily):")
ucrSelectorForCrops.SetParameter(New RParameter("data_name", 0))
ucrSelectorForCrops.SetParameterIsString()

ucrSelectorSummary.SetLabelText("Data Frame (Summary):")
ucrSelectorSummary.SetParameter(New RParameter("season_data_name", 8))
ucrSelectorSummary.SetParameterIsString()

'Year Receiver
ucrReceiverYear.Selector = ucrSelectorForCrops
ucrReceiverYear.SetParameter(New RParameter("year", 1))
Expand Down Expand Up @@ -75,18 +98,18 @@ Public Class dlgPICSACrops
ucrReceiverDay.bAutoFill = True

'Start Receiver
ucrReceiverStart.Selector = ucrSelectorSummary
ucrReceiverStart.SetParameter(New RParameter("start_day", 8))
ucrReceiverStart.SetParameterIsString()
ucrReceiverStart.SetDataType("numeric")
ucrReceiverStart.Selector = ucrSelectorForCrops
ucrReceiverStart.bAttachedToPrimaryDataFrame = False
ucrReceiverStart.Tag = "start_rain"

'End Receiver
ucrReceiverEnd.Selector = ucrSelectorForCrops
ucrReceiverEnd.Selector = ucrSelectorSummary
ucrReceiverEnd.SetParameter(New RParameter("end_day", 9))
ucrReceiverEnd.SetParameterIsString()
ucrReceiverEnd.SetDataType("numeric")
ucrReceiverEnd.bAttachedToPrimaryDataFrame = False
ucrReceiverEnd.Tag = "end_season"

ucrPnlStartCheck.AddRadioButton(rdoYes)
ucrPnlStartCheck.AddRadioButton(rdoNo)
Expand All @@ -97,23 +120,27 @@ Public Class dlgPICSACrops

ucrInputPlantingDates.SetParameter(New RParameter("plant_days", 5))
ucrInputPlantingDates.SetValidationTypeAsNumericList()
ucrInputPlantingDates.SetItems({"160", "80, 90, 100, 110, 120", "92, 122, 153", "124, 184, 10", "92, 152, 15"})
ucrInputPlantingDates.SetItems({"160", "92, 122, 153", "124, 184, 10", "92, 152, 15"})
ucrInputPlantingDates.AddQuotesIfUnrecognised = False
ucrInputPlantingDates.bAllowNonConditionValues = True
ttPlanting.SetToolTip(ucrInputPlantingDates.cboInput, " The day number for planting. Starting from January, April 1st is day 92. Starting from July, November 1st is day 124. ")


'Planting Length
ucrInputCropLengths.SetParameter(New RParameter("plant_lengths", 6))
ucrInputCropLengths.SetValidationTypeAsNumericList()
ucrInputCropLengths.SetItems({"120", "100, 110, 120, 130, 140", "80, 90, 100, 110", "120, 150, 180", "60, 120, 10"})
ucrInputCropLengths.SetItems({"120", "100, 140, 10", "120, 150, 180", "60, 120, 10"})
ucrInputCropLengths.AddQuotesIfUnrecognised = False
ucrInputCropLengths.bAllowNonConditionValues = True
ttPlanting.SetToolTip(ucrInputCropLengths.cboInput, " The crop duration, in days. Often between 60 days (2 months) and 150 days (5 months). ")

'Water amount
ucrInputWaterAmounts.SetParameter(New RParameter("rain_totals", 7))
ucrInputWaterAmounts.SetValidationTypeAsNumericList()
ucrInputWaterAmounts.SetItems({"600", "300, 400, 500, 600, 700", "300, 500, 700", "200, 600, 50", "500, 700, 25"})
ucrInputWaterAmounts.SetItems({"600", "300, 500, 700", "200, 600, 50", "500, 700, 25"})
ucrInputWaterAmounts.AddQuotesIfUnrecognised = False
ucrInputWaterAmounts.bAllowNonConditionValues = True
ttPlanting.SetToolTip(ucrInputWaterAmounts.cboInput, " The amount of water (rainfall) needed for the crop. Usually between 250mm and 1000mm. ")

'Planting Date Panel
'ucrPnlPlantingDate.SetParameter(New RParameter("planting_days", clsCropsFunction, 5))
Expand Down Expand Up @@ -179,6 +206,8 @@ Public Class dlgPICSACrops

'Linking of controls
ucrChkDataProp.AddToLinkedControls(ucrChkDataCrops, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedDisabledIfParameterMissing:=True)
AutoFillReceivers(lstEndReceivers)
AutoFillReceivers(lstStartReceivers)
End Sub

Private Sub SetDefaults()
Expand All @@ -190,7 +219,9 @@ Public Class dlgPICSACrops
'Currently this must come before reset to ensure autofilling is done correctly
'Once autofilling is being triggered correctly this can go after Reset.
ucrSelectorForCrops.Reset()
ucrSelectorSummary.Reset()
ucrReceiverRainfall.SetMeAsReceiver()
ucrReceiverStart.SetMeAsReceiver()

clsDummyFunction.AddParameter("check", "both", iPosition:=0)

Expand Down Expand Up @@ -218,15 +249,14 @@ Public Class dlgPICSACrops
'TODO This should be done further done.
' This ensures the correct data frame is set before attempting to fill the receiver
'ucrReceiverYear.SetMeAsReceiver()
ucrSelectorForCrops.SetDataframe(ucrReceiverYear.GetDataName())
'Disabled as selector cannot yet auto set when multiple data frame are selected.
'ucrSelectorForCrops.SetRCode(clsCropsFunction, bReset)
ucrSelectorForCrops.SetRCode(clsCropsFunction, bReset)
ucrSelectorSummary.SetRCode(clsCropsFunction, bReset)
ucrReceiverYear.SetRCode(clsCropsFunction, bReset)
ucrReceiverStation.SetRCode(clsCropsFunction, bReset)
ucrReceiverRainfall.SetRCode(clsCropsFunction, bReset)
ucrReceiverDay.SetRCode(clsCropsFunction, bReset)
'ucrReceiverStart.SetMeAsReceiver()
ucrSelectorForCrops.SetDataframe(ucrReceiverStart.GetDataName())
ucrReceiverStart.SetRCode(clsCropsFunction, bReset)
ucrReceiverEnd.SetRCode(clsCropsFunction, bReset)

Expand All @@ -237,6 +267,8 @@ Public Class dlgPICSACrops
ucrPnlStartCheck.SetRCode(clsDummyFunction, bReset)
End If
AddingStartCheckParm()
AutoFillReceivers(lstEndReceivers)
AutoFillReceivers(lstStartReceivers)
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
Expand All @@ -258,12 +290,14 @@ Public Class dlgPICSACrops
TestOkEnabled()
End Sub

Private Sub ucrSelectorForCrops_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForCrops.ControlValueChanged
Private Sub ucrSelectorForCrops_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForCrops.ControlValueChanged, ucrSelectorSummary.ControlValueChanged
If ucrSelectorForCrops.CurrentReceiver Is Nothing OrElse ucrSelectorForCrops.CurrentReceiver.bAttachedToPrimaryDataFrame Then
clsCropsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForCrops.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0)
Else
clsCropsFunction.AddParameter("season_data_name", Chr(34) & ucrSelectorForCrops.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=8)
clsCropsFunction.AddParameter("season_data_name", Chr(34) & ucrSelectorSummary.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=8)
End If
AutoFillReceivers(lstEndReceivers)
AutoFillReceivers(lstStartReceivers)
End Sub

Private Sub PlantingDaysParam()
Expand Down Expand Up @@ -371,4 +405,59 @@ Public Class dlgPICSACrops
End If
End Sub

Private Sub AutoFillReceivers(lstReceivers As List(Of ucrReceiverSingle))
If bisFilling OrElse lstReceivers Is Nothing Then
Exit Sub
End If

bisFilling = True

Dim lstRecognisedValues As List(Of String)
Dim ucrCurrentReceiver As ucrReceiver = ucrSelectorSummary.CurrentReceiver
Dim strSelectedValue As String
Dim bFound As Boolean = False

For Each ucrTempReceiver As ucrReceiver In lstReceivers
ucrTempReceiver.SetMeAsReceiver()
lstRecognisedValues = GetRecognisedValues(ucrTempReceiver.Tag)

If lstRecognisedValues.Count > 0 Then
Dim lstAvailable As List(Of String) = ucrSelectorSummary.lstAvailableVariable.Items.Cast(Of ListViewItem) _
.Select(Function(item) Regex.Replace(item.Text.ToLower(), "[^\w]", String.Empty)).ToList()

If lstRecognisedValues.Contains("end_season") AndAlso lstAvailable.Contains("end_season") Then
strSelectedValue = "end_season"
Else
strSelectedValue = lstRecognisedValues.FirstOrDefault(Function(val) lstAvailable.Contains(val))
End If

If Not String.IsNullOrEmpty(strSelectedValue) Then
Dim matchingItem As ListViewItem = ucrSelectorSummary.lstAvailableVariable.Items.Cast(Of ListViewItem) _
.FirstOrDefault(Function(item) Regex.Replace(item.Text.ToLower(), "[^\w]", String.Empty) = strSelectedValue)

If matchingItem IsNot Nothing Then
ucrTempReceiver.Add(matchingItem.Text, ucrSelectorSummary.ucrAvailableDataFrames.cboAvailableDataFrames.Text)
End If
End If
End If
Next

If ucrCurrentReceiver IsNot Nothing Then
ucrCurrentReceiver.SetMeAsReceiver()
End If

bisFilling = False
End Sub

Private Function GetRecognisedValues(strVariable As String) As List(Of String)
Dim lstValues As New List(Of String)

For Each kvpTemp As KeyValuePair(Of String, List(Of String)) In lstRecognisedTypes
If kvpTemp.Key = strVariable Then
lstValues = kvpTemp.Value
Exit For
End If
Next
Return lstValues
End Function
End Class
7 changes: 4 additions & 3 deletions instat/dlgStack.vb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ Public Class dlgStack

ucrPnlCarryColumns.AddRadioButton(rdoCarryAllColumns)
ucrPnlCarryColumns.AddRadioButton(rdoCarryColumns)
ucrPnlCarryColumns.AddParameterIsRFunctionCondition(rdoCarryAllColumns, "data")
ucrPnlCarryColumns.AddParameterIsROperatorCondition(rdoCarryColumns, "%>%")
ucrPnlCarryColumns.AddParameterValuesCondition(rdoCarryAllColumns, "checked", "all_columns")
ucrPnlCarryColumns.AddParameterValuesCondition(rdoCarryColumns, "checked", "columns")

ucrInputValuesTo.SetParameter(New RParameter(" values_to", 4))
ucrInputValuesTo.SetRDefault(Chr(34) & "value" & Chr(34))
Expand Down Expand Up @@ -237,6 +237,7 @@ Public Class dlgStack
ucrReceiverColumnsToBeStack.SetMeAsReceiver()

clsDummyFunction.AddParameter("drop", "False", iPosition:=0)
clsDummyFunction.AddParameter("checked", "all_columns", iPosition:=1)

clsPivotLongerFunction.SetRCommand("pivot_longer")
clsPivotLongerFunction.SetPackageName("tidyr")
Expand Down Expand Up @@ -300,7 +301,6 @@ Public Class dlgStack
ucrChkDropMissingValues.SetRCode(clsPivotLongerFunction, bReset)
ucrInputValuesTo.SetRCode(clsPivotLongerFunction, bReset)
ucrPnlStack.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset)
ucrPnlCarryColumns.SetRCode(clsPivotLongerFunction, bReset)
ucrInputDropPrefix.SetRCode(clsPivotLongerFunction, bReset)
ucrChkDropPrefix.SetRCode(clsPivotLongerFunction, bReset)
ucrFactorInto.SetRCode(clsReshapeFunction, bReset)
Expand All @@ -309,6 +309,7 @@ Public Class dlgStack
ucrReceiverDropValues.SetRCode(clsReshapeFunction, bReset)
ucrChkDropVariables.SetRCode(clsDummyFunction, bReset)
ucrReceiverColumnsToBeStack.SetRCode(clsPivotLongerFunction, bReset)
ucrPnlCarryColumns.SetRCode(clsDummyFunction, bReset)
End If
End Sub

Expand Down
Binary file modified instat/static/Help/R-Instat.chm
Binary file not shown.
2 changes: 1 addition & 1 deletion instat/static/InstatObject/R/Rsetup.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ versions <- c("1.4-8", "1.3-7", "1.23", "0.1.5", "1.2.1.1", "2.8.0",
"0.6.2", "1.01-2", "1.1.4.1", "0.5.2", "1.0.0", "1.5.2", "8.23.0",
"0.8-87", "0.2.1", "1.7.1", "1.2-5", "1.5-3", "1.6.4", "1.11.2",
"1.34.0", "1.0.0", "1.3.2", "2.0", "0.1.3", "1.1.14.1", "0.1.4",
"1.5-20", "2.1.4", "0.2-4", "2.2.1", "0.4.0", "1.7.2", "0.10.2",
"1.5-20", "2.1.4", "0.2-2", "2.2.1", "0.4.0", "1.7.2", "0.10.2",
"0.12.0", "0.4.17", "0.3.3", "3.5.1", "0.1.2", "0.6.0", "0.5.8-1",
"0.6.0", "0.9.6", "0.5.6", "3.2.0", "0.3.1", "0.6.4", "0.7.0",
"0.1.2", "5.1.0", "0.6.2", "1.4.1", "0.1.2", "2.6.6", "4.1-8",
Expand Down
2 changes: 1 addition & 1 deletion instat/static/InstatObject/R/stand_alone_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -2989,7 +2989,7 @@ getRowHeadersWithText <- function(data, column, searchText, ignore_case, use_reg
searchText <- paste0("^", searchText, "$")
}
# Find the rows that match the search text
matchingRows <- grepl(searchText, data[[column]], ignore.case = ignore_case, perl = TRUE)
matchingRows <- grepl(searchText, data[[column]], ignore.case = ignore_case, fixed = TRUE)
}
# Get the row headers where the search text is found
rowHeaders <- rownames(data)[matchingRows]
Expand Down
Binary file modified instat/translations/rInstatTranslations.db
Binary file not shown.
Loading
Loading