File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed
Plugins/Flow.Launcher.Plugin.Calculator Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1515 <system : String x : Key =" flowlauncher_plugin_calculator_decimal_separator_dot" >Dot (.)</system : String >
1616 <system : String x : Key =" flowlauncher_plugin_calculator_max_decimal_places" >Max. decimal places</system : String >
1717 <system : String x : Key =" flowlauncher_plugin_calculator_failed_to_copy" >Copy failed, please try later</system : String >
18+ <system : String x : Key =" flowlauncher_plugin_calculator_show_error_message" >Show error message when calculation fails</system : String >
1819</ResourceDictionary >
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ public List<Result> Query(Query query)
7979
8080 if ( result == null || string . IsNullOrEmpty ( result . ToString ( ) ) )
8181 {
82+ if ( ! _settings . ShowErrorMessage ) return EmptyResults ;
8283 return new List < Result >
8384 {
8485 new Result
@@ -90,10 +91,14 @@ public List<Result> Query(Query query)
9091 }
9192
9293 if ( result . ToString ( ) == "NaN" )
94+ {
9395 result = Localize . flowlauncher_plugin_calculator_not_a_number ( ) ;
96+ }
9497
9598 if ( result is Function )
99+ {
96100 result = Localize . flowlauncher_plugin_calculator_expression_not_complete ( ) ;
101+ }
97102
98103 if ( ! string . IsNullOrEmpty ( result . ToString ( ) ) )
99104 {
@@ -129,6 +134,7 @@ public List<Result> Query(Query query)
129134 catch ( Exception )
130135 {
131136 // Mages engine can throw various exceptions, for simplicity we catch them all and show a generic message.
137+ if ( ! _settings . ShowErrorMessage ) return EmptyResults ;
132138 return new List < Result >
133139 {
134140 new Result
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ namespace Flow.Launcher.Plugin.Calculator
44 public class Settings
55 {
66 public DecimalSeparator DecimalSeparator { get ; set ; } = DecimalSeparator . UseSystemLocale ;
7- public int MaxDecimalPlaces { get ; set ; } = 10 ;
7+
8+ public int MaxDecimalPlaces { get ; set ; } = 10 ;
9+
10+ public bool ShowErrorMessage { get ; set ; } = false ;
811 }
912}
Original file line number Diff line number Diff line change 1515 <Grid .RowDefinitions>
1616 <RowDefinition Height =" auto" />
1717 <RowDefinition Height =" auto" />
18+ <RowDefinition Height =" auto" />
1819 </Grid .RowDefinitions>
1920 <Grid .ColumnDefinitions>
2021 <ColumnDefinition Width =" Auto" />
5859 ItemsSource =" {Binding MaxDecimalPlacesRange}"
5960 SelectedItem =" {Binding Settings.MaxDecimalPlaces}" />
6061
62+ <CheckBox
63+ Grid.Row=" 2"
64+ Grid.Column=" 0"
65+ Grid.ColumnSpan=" 2"
66+ Margin =" {StaticResource SettingPanelItemTopBottomMargin}"
67+ HorizontalAlignment =" Left"
68+ VerticalAlignment =" Center"
69+ Content =" {DynamicResource flowlauncher_plugin_calculator_show_error_message}"
70+ IsChecked =" {Binding Settings.ShowErrorMessage, Mode=TwoWay}" />
6171 </Grid >
6272</UserControl >
You can’t perform that action at this time.
0 commit comments