Skip to content

Commit

Permalink
Small Bug fixes.
Browse files Browse the repository at this point in the history
> Made a check prior to adding a trigger to the remove/add list to make
sure it isn't there prior.
> GUI have been update.
> Output has been formatted such that things line out nicely! ;)
  • Loading branch information
Chris van Run authored and Chris van Run committed Feb 18, 2015
1 parent d2786a9 commit 394f6ff
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 34 deletions.
14 changes: 9 additions & 5 deletions EDFPlusCheckerEngine/Engine/Actions/ActionCompareTriggers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override string Act()
// same triggernumber, unequal timing.
else
{
if(this.EqNumberUneqTiming_RemoveRec)
if (this.EqNumberUneqTiming_RemoveRec && !RemoveList.Contains(EDFPlusTriggers[j]))
RemoveList.Add(EDFPlusTriggers[j]);
}
}
Expand All @@ -63,7 +63,7 @@ public override string Act()
// different triggernumber, equal timing.
if (Map[i].SameTiming(EDFPlusTriggers[j], ErrorMargin))
{
if (this.UneqNumberEqTiming_RemoveRec)
if (this.UneqNumberEqTiming_RemoveRec && !RemoveList.Contains(EDFPlusTriggers[j]))
RemoveList.Add(EDFPlusTriggers[j]);
}
// different triggernumber, different timing.
Expand All @@ -77,7 +77,11 @@ public override string Act()
if (!Found) //it's nowhere to be found, oh no!
{
if (this.UneqNumberUneqTiming_AddLog)
AddList.Add(new Trigger[] { Map[i], ClosestTrigger(Map[i].OnsetInSeconds, EDFPlusTriggers) });
{
Trigger[] Addition = new Trigger[] { Map[i], ClosestTrigger(Map[i].OnsetInSeconds, EDFPlusTriggers) };
if (!AddList.Contains(Addition))
AddList.Add(Addition);
}
}
}

Expand Down Expand Up @@ -114,13 +118,13 @@ public override string Act()
if (AddList.Count == 0)
Control.Log("None", PrintInConsole);
for (int i = 0; i < AddList.Count; i++)
Control.Log(i+1 + ": Log. " + AddList[i][0].ToString() + Environment.NewLine + "\t closest trigger in recording: [Rec. " + AddList[i][1].ToString() + "]\tdiff: " + String.Format("{0:0.000}", Math.Round(Math.Abs(AddList[i][1].ApproximateOnsetInSeconds - AddList[i][0].ApproximateOnsetInSeconds), 3)) + "s", PrintInConsole);
Control.Log(i+1 + ":\t Log. " + AddList[i][0].ToString() + "\t closest trigger in recording: [Rec. " + AddList[i][1].ToString() + "]\tdiff: " + String.Format("{0:0.000}", Math.Round(Math.Abs(AddList[i][1].ApproximateOnsetInSeconds - AddList[i][0].ApproximateOnsetInSeconds), 3)) + "s", PrintInConsole);

Control.Log(Environment.NewLine + "Rec. Triggers to be Removed: ", PrintInConsole);
if (RemoveList.Count == 0)
Control.Log("None", PrintInConsole);
for (int i = 0; i < RemoveList.Count; i++)
Control.Log(i+1 + ": Rec. " + RemoveList[i].ToString());
Control.Log(i+1 + ":\t Rec. " + RemoveList[i].ToString());

Control.Log(Environment.NewLine, PrintInConsole);

Expand Down
6 changes: 3 additions & 3 deletions EDFPlusCheckerEngine/Engine/FileHandles/IFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public bool SameTiming(Trigger reference, double errorMargin)

public override string ToString()
{
string Description = "Onset: " + OnsetInSeconds + "s";
Description += UncertaintyInSeconds <= 0.0 ? "" : " ~+ " + Math.Round( (UncertaintyInSeconds * 1000),1) + "ms";
Description += " Trigger: " + TriggerNumber;
string Description = "Onset: " + new String(' ', 5 - (int)Math.Floor(Math.Log10((int)OnsetInSeconds) + 1)) + String.Format("{0:0.000}",OnsetInSeconds) + "s";
Description += UncertaintyInSeconds <= 0.0 ? "" : " ~+ " + String.Format("{0:0.0}", (UncertaintyInSeconds * 1000)) + "ms";
Description += " Trigger: " + new String(' ', 3 - (int)Math.Floor(Math.Log10(TriggerNumber) + 1)) + TriggerNumber;
return Description;
}
}
Expand Down
8 changes: 8 additions & 0 deletions EDFPlusCheckerGUI/ConfigurationWindow/OpenFilesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,21 @@ private void RecordingFilesButton_Click(object sender, RoutedEventArgs e)
RecordingFilesDialog.ShowDialog();
string[] FileList = RecordingFilesDialog.FileNames;
RecordingFilesTextBox.Text = String.Join(Environment.NewLine, FileList);

this.RecordingFilesTextBox.Focus();
this.RecordingFilesTextBox.CaretIndex = this.RecordingFilesTextBox.Text.Length;
this.RecordingFilesTextBox.ScrollToEnd();
}

private void LogFilesButton_Click(object sender, RoutedEventArgs e)
{
LogFilesDialog.ShowDialog();
string[] FileList = LogFilesDialog.FileNames;
LogFilesTextBox.Text = String.Join(Environment.NewLine, FileList);

this.LogFilesTextBox.Focus();
this.LogFilesTextBox.CaretIndex = this.RecordingFilesTextBox.Text.Length;
this.LogFilesTextBox.ScrollToEnd();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<Label Content="Specific integers to ignore (delimitor = ';'):" HorizontalAlignment="Left" Grid.Column="5"/>
<Button Content="?" Width="25" VerticalAlignment="Top" Click="LogFileTriggerRangeInformationButton_Click" Height="25" Grid.Column="5" HorizontalAlignment="Right"/>
<TextBox x:Name="TriggersToIgnoreTextBox" HorizontalAlignment="Stretch" TextWrapping="Wrap" Margin="10,0,30,0" Grid.Row="1" Grid.Column="5"/>
<TextBox VerticalContentAlignment="Center" x:Name="TriggersToIgnoreTextBox" HorizontalAlignment="Stretch" TextWrapping="Wrap" Margin="10,0,30,0" Grid.Row="1" Grid.Column="5"/>
</Grid>
</GroupBox>

Expand Down
6 changes: 4 additions & 2 deletions EDFPlusCheckerGUI/ConfigurationWindow/SaveFilesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public SaveFilesPage(Controller engine)
ApplicationLogPathDialog.Filter = "Log files (*.log)|*.log|All files (*.*)|*.*";

OutputDirectoryPathDialog = new FolderBrowserDialog();

SaveModifiedFilesCheckbox.IsChecked = false;
}

public override bool ConfigureEngine(out string possibleErrorMessage)
Expand All @@ -52,6 +54,8 @@ public override bool ConfigureEngine(out string possibleErrorMessage)
{
Engine.AddAction(new ActionResolveTriggerDifferences(Engine, Engine.ErrorMargin, true, true));
string SavePath = OutputDirectoryTextBox.Text;
SavePath = (SavePath == "") ? Directory.GetCurrentDirectory() : SavePath;

string Prefix = NewFilesPrefixTextBox.Text;
Engine.AddAction(new ActionSaveEDFFile(Engine, SavePath, Prefix));
}
Expand Down Expand Up @@ -81,8 +85,6 @@ private void SelectOutputFileButton_Click(object sender, RoutedEventArgs e)

private void SaveFilesPage_Loaded(object sender, RoutedEventArgs e)
{
SaveModifiedFilesCheckbox.IsChecked = false;

OutputDirectoryTextBox.Text = OutputDirectoryPathDialog.SelectedPath;
}

Expand Down
3 changes: 3 additions & 0 deletions EDFPlusCheckerGUI/GraphicalUserInterface.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<PropertyGroup>
<ApplicationIcon>EDFPlusCheckerIcon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand Down
38 changes: 19 additions & 19 deletions EDFPlusCheckerGUI/MainEDFPlusCheckerWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,58 +27,58 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<Button Margin="5" Padding="5" x:Name="ConfigureButton" Click="ConfigureButton_Click">
<Button Padding="5,0" x:Name="ConfigureButton" Click="ConfigureButton_Click">
<StackPanel Orientation="Horizontal">
<Image Source="ConfigurationIcon.png" Width="24" Height="24" />
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center">Configure</TextBlock>
<Image Source="ConfigurationIcon.png" Width="48" Height="48" />
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5">Configure</TextBlock>
</StackPanel>
</Button>
<Button Margin="5" Padding="5" x:Name="StartButton" IsEnabled="False" Click="StartButton_Click" Grid.Column="1">

<Button Padding="5,0" x:Name="StartButton" IsEnabled="False" Click="StartButton_Click" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<Image Source="StartIcon.png" Width="24" Height="24"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right">Start</TextBlock>
<Image Source="StartIcon.png" Width="48" Height="48"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">Start</TextBlock>

</StackPanel>
</Button>
<Button Margin="5" Padding="5" x:Name="AboutButton" Click="AboutButton_Click" Grid.Column="2">
<Button Padding="5,0" x:Name="AboutButton" Click="AboutButton_Click" Grid.Column="2" SnapsToDevicePixels="True">
<StackPanel Orientation="Horizontal">
<Image Source="InfoIcon.png" Width="24" Height="24"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right">About</TextBlock>
<Image Source="InfoIcon.png" Width="48" Height="48"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">About</TextBlock>
</StackPanel>
</Button>
<Button Margin="5" Padding="5" x:Name="ExitButton" IsCancel="True" Click="ExitButton_Click" Grid.Column="3">
<Button Padding="5,0" x:Name="ExitButton" IsCancel="True" Click="ExitButton_Click" Grid.Column="3">
<StackPanel Orientation="Horizontal">
<Image Source="CancelIcon.png" Width="24" Height="24"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right">Exit</TextBlock>
<Image Source="CancelIcon.png" Width="48" Height="48"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">Exit</TextBlock>
</StackPanel>
</Button>
<Button Margin="5" Padding="5" x:Name="CancelButton" IsCancel="True" Click="CancelButton_Click" Visibility="Hidden" Grid.Column="3">
<Button Padding="5,0" x:Name="CancelButton" IsCancel="True" Click="CancelButton_Click" Visibility="Hidden" Grid.Column="3">
<StackPanel Orientation="Horizontal">
<Image Source="CancelIcon.png" Width="24" Height="24"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right">Cancel</TextBlock>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">Cancel</TextBlock>
</StackPanel>
</Button>
<Button Margin="5" Padding="5" x:Name="LogButton" IsEnabled="False" Click="LogButton_Click" Grid.Column="4">
<Button Padding="5,0" x:Name="LogButton" IsEnabled="False" Click="LogButton_Click" Grid.Column="4">
<StackPanel Orientation="Horizontal">
<Image Source="OpenLogIcon.png" Width="24" Height="24"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right">Open Log</TextBlock>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5">Open Log</TextBlock>
</StackPanel>
</Button>
</Grid>

<Grid HorizontalAlignment="Stretch" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<Label VerticalAlignment="Center" Content="Status:"/>
<TextBox VerticalAlignment="Center" x:Name="StatusTextBox" HorizontalAlignment="Stretch" Background="{DynamicResource {x:Static SystemColors.GradientInactiveCaptionBrushKey}}" IsReadOnly="True" Text="Waiting for configuration..." Grid.Column="1"/>
<ProgressBar Margin="5,0" VerticalAlignment="Center" x:Name="ProgressBar" Width="200" Height="20" Foreground="#FF0A6A3E" Grid.Column="3"/>
<Label VerticalAlignment="Center" HorizontalContentAlignment="Left" x:Name="PercentageLabel" Content="100%" Grid.Column="2"/>
<Label VerticalAlignment="Center" HorizontalContentAlignment="Right" x:Name="PercentageLabel" Content="0%" Grid.Column="2"/>
</Grid>
</Grid>
</Window>
5 changes: 4 additions & 1 deletion EDFPlusCheckerGUI/MainEDFPlusCheckerWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ protected void MyBackGroundWorker_RunWorkerCompleted(object sender, RunWorkerCom
StartButton.IsEnabled = false;
LogButton.IsEnabled = true;
CancelButton.Visibility = System.Windows.Visibility.Hidden;
Mouse.OverrideCursor = null;

//RunningIconRotate.Stop();
}

Expand Down Expand Up @@ -125,8 +127,9 @@ private void StartButton_Click(object sender, RoutedEventArgs e)
CancelButton.Visibility = System.Windows.Visibility.Visible;

StatusTextBox.Text = "Running...";

PercentageLabel.Content = "0%";

Mouse.OverrideCursor = Cursors.Wait;
//RunningIconRotate.Begin();
MyBackGroundWorker.RunWorkerAsync();
}
Expand Down
6 changes: 3 additions & 3 deletions EDFPlusCheckerGUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: NeutralResourcesLanguageAttribute("")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

0 comments on commit 394f6ff

Please sign in to comment.