Skip to content

Commit

Permalink
Update Numerical Inputs (#2433)
Browse files Browse the repository at this point in the history
* Updated to MzLib 1.0.548 and fixed custom ions in search tasks

* reverted calibration task change

* merged in master bbbyy

* Spectral Library from Command Line (#2386)

* Updated to MzLib 1.0.548 and fixed custom ions in search tasks

* reverted calibration task change

* merged in master bbbyy

* Enabled Library Loading from command line

* Add alignment properties and key handling to TextBoxControls

- Added `HorizontalContentAlignment` and `VerticalContentAlignment` properties to center content in `DoubleTextBoxControl` and `IntegerTextBoxControl`.
- Introduced constructors to set alignment properties.
- Overrode `OnKeyDown` to clear focus on Return key press.
- Included `System.Windows` namespace in both control files.

* Replace TextBox with custom numeric controls in XAML

Replaced standard TextBox controls with custom IntegerTexBoxControl and DoubleTextBoxControl in various XAML files to improve input validation and user experience. Removed the CheckIfNumber event handler and method from code-behind files as the new custom controls handle validation internally. Updated tooltips and adjusted layout properties for consistency.

---------

Co-authored-by: Nic Bollis <[email protected]>
Co-authored-by: Edwin Laboy <[email protected]>
  • Loading branch information
3 people authored Nov 4, 2024
1 parent 7dafd00 commit b98cfad
Show file tree
Hide file tree
Showing 14 changed files with 156 additions and 146 deletions.
36 changes: 18 additions & 18 deletions MetaMorpheus/GUI/TaskWindows/CalibrateTaskWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="maxMissedCleavageLabel" Content="Max Missed Cleavages" />
<TextBox x:Name="MissedCleavagesTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" TextChanged="ProteaseSpecificUpdate">
<local:IntegerTexBoxControl x:Name="MissedCleavagesTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" TextChanged="ProteaseSpecificUpdate">
<TextBox.ToolTip>
<TextBlock>
Maximum number of missed proteolytic cleavages allowed.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="proteaseLabel" Content="Protease" />
Expand All @@ -114,55 +114,55 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="lblMinPeptideLength" Content="Min Peptide Len" />
<TextBox x:Name="MinPeptideLengthTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MinPeptideLengthTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The minimum allowed peptide length. Must be a positive, non-zero integer.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="lblMaxPeptideLength" Content="Max Peptide Len" />
<TextBox x:Name="MaxPeptideLengthTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" TextChanged="ProteaseSpecificUpdate">
<local:IntegerTexBoxControl x:Name="MaxPeptideLengthTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500" TextChanged="ProteaseSpecificUpdate">
<TextBox.ToolTip>
<TextBlock>
The maximum allowed peptide length. Leave empty for no limitation.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="LbMinVariantDepth" Content="Min read depth for variants" />
<TextBox x:Name="MinVariantDepthTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MinVariantDepthTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The minimum number of reads to consider a nucleic acid sequence variant.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="LbMaxHeterozygousVariants" Content="Max heterozygous variants for combinitorics" />
<TextBox x:Name="MaxHeterozygousVariantsTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MaxHeterozygousVariantsTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The maximum number of heterozygous variants for combinitorics.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="MinimumScoreLabel" Content="Minimum score allowed:" />
<TextBox x:Name="MinScoreAllowed" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MinScoreAllowed" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The minimum MetaMorpheus score allowed for a PSM to be reportable.
<LineBreak/>
Decreasing this number increases search time.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1">
Expand All @@ -188,25 +188,25 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="MaxModsPerPeptideLabel" Content="Max Mods Per Peptide" />
<TextBox x:Name="MaxModsPerPeptideTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MaxModsPerPeptideTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The maximum number of modifications allowed on a single isoform.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="MaxModificationIsoformsLabel" Content="Max Modification Isoforms" />
<TextBox x:Name="MaxModificationIsoformsTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MaxModificationIsoformsTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
The maximum number of isoforms (sequences with modifications) allowed from a given unmodified "base-sequence".
<LineBreak/>
This prevents highly ambiguous regions from greatly expanding the search space.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label x:Name="ionsToSearchLabel" Content="Dissociation Type" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
Expand All @@ -220,15 +220,15 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<Label Content="Max Threads" />
<TextBox x:Name="MaxThreadsTextBox" PreviewTextInput="CheckIfNumber" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<local:IntegerTexBoxControl x:Name="MaxThreadsTextBox" Width="45" ToolTipService.ShowDuration="999999" ToolTipService.InitialShowDelay="500">
<TextBox.ToolTip>
<TextBlock>
By default, MetaMorpheus uses this machine's number of threads minus one to maximize search speed while letting you use your computer for other purposes.
<LineBreak/>
Enter a lower number to limit CPU usage.
</TextBlock>
</TextBox.ToolTip>
</TextBox>
</local:IntegerTexBoxControl>
</StackPanel>
</StackPanel>
</Grid>
Expand Down
5 changes: 0 additions & 5 deletions MetaMorpheus/GUI/TaskWindows/CalibrateTaskWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,6 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
DialogResult = true;
}

private void CheckIfNumber(object sender, TextCompositionEventArgs e)
{
e.Handled = GlobalGuiSettings.CheckIsPositiveInteger(e.Text);
}

private void KeyPressed(object sender, KeyEventArgs e)
{
if (e.Key == Key.Return)
Expand Down
Loading

0 comments on commit b98cfad

Please sign in to comment.