Commit 24ea9d3a authored by Meade's avatar Meade

Variable name changes, small changes.

parent c2f321ff
[root]
name = "BrewStillery"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
......
[package]
name = "BrewStillery"
version = "1.0.0"
version = "1.0.1"
authors = ["Emily And Meade <thedarkula2049@gmail.com>"]
description = "BrewStillery is a brewer's, vintner's, and distiller's calculator. It has a multitude of great functions, such as calculating ABV, determining carbonation, and total sparge water needed."
# documentation to come
......
......@@ -48,7 +48,7 @@ pub fn guestiMaths(buffer: String, guestimatorOutput: String, ref guestimatorBui
let estimatedABW = (originalExtract - realExtract) / ( 2.0665 - (0.010665 * originalExtract));
let estimatedABV = estimatedABW * (finalGravity / 0.794);
let abv = format!("{:.2}", estimatedABV);
let abv = format!("{:.2}%", estimatedABV);
let ref output: &gtk::Entry = &guestimatorBuilderClone.get_object(&guestimatorOutput).unwrap();
output.set_text(&abv.to_string());
}
\ No newline at end of file
......@@ -12,8 +12,8 @@ pub fn gyleCarbonationPrep(ref gyleBuilderClone: &gtk::Builder) {
let gyleCO2Input: &gtk::Entry = &gyleBuilderClone.get_object("gyleCO2Input").unwrap();
let gyleCO2InputBuffer = gyleCO2Input.get_text().expect("No input");
let gyleFinalVolumeInput: &gtk::Entry = &gyleBuilderClone.get_object("gyleFinalVolumeInput").unwrap();
let gyleFinalVolumeInputBuffer = gyleFinalVolumeInput.get_text().expect("No input");
let gyleWortVolumeInput: &gtk::Entry = &gyleBuilderClone.get_object("gyleWortVolumeInput").unwrap();
let gyleWortVolumeInputBuffer = gyleWortVolumeInput.get_text().expect("No input");
......@@ -28,24 +28,24 @@ pub fn gyleCarbonationPrep(ref gyleBuilderClone: &gtk::Builder) {
} else if gyleCO2InputBuffer == "" || isNumerical.is_match(&gyleCO2InputBuffer) == false || isCharacter.is_match(&gyleCO2InputBuffer) == true || isMismatched.is_match(&gyleCO2InputBuffer) == true {
let output: gtk::Entry = gyleBuilderClone.get_object(&spargeMashWaterOutput).unwrap();
output.set_text("Enter a number");
} else if gyleFinalVolumeInputBuffer == "" || isNumerical.is_match(&gyleFinalVolumeInputBuffer) == false || isCharacter.is_match(&gyleFinalVolumeInputBuffer) == true || isMismatched.is_match(&gyleFinalVolumeInputBuffer) == true {
} else if gyleWortVolumeInputBuffer == "" || isNumerical.is_match(&gyleWortVolumeInputBuffer) == false || isCharacter.is_match(&gyleWortVolumeInputBuffer) == true || isMismatched.is_match(&gyleWortVolumeInputBuffer) == true {
let output: gtk::Entry = gyleBuilderClone.get_object(&spargeMashWaterOutput).unwrap();
output.set_text("Enter a number");
} else {
let gyleBrixInputBufferFloat: f32 = gyleBrixInputBuffer.parse().unwrap();
let gyleCO2InputBufferFloat: f32 = gyleCO2InputBuffer.parse().unwrap();
let gyleFinalVolumeInputBufferFloat: f32 = gyleFinalVolumeInputBuffer.parse().unwrap();
let gyleWortVolumeInputBufferFloat: f32 = gyleWortVolumeInputBuffer.parse().unwrap();
if gyleBrixInputBufferFloat <= 0.0 {
let output: gtk::Entry = gyleBuilderClone.get_object(&spargeMashWaterOutput).unwrap();
output.set_text("Enter a positive number");
} else if gyleCO2InputBufferFloat <= 0.0 {
let output: gtk::Entry = gyleBuilderClone.get_object(&spargeMashWaterOutput).unwrap();
output.set_text("Enter a positive number");
} else if gyleFinalVolumeInputBufferFloat <= 0.0 {
} else if gyleWortVolumeInputBufferFloat <= 0.0 {
let output: gtk::Entry = gyleBuilderClone.get_object(&spargeMashWaterOutput).unwrap();
output.set_text("Enter a positive number");
} else {
onGyleActivate(gyleBrixInputBuffer, gyleCO2InputBuffer, gyleFinalVolumeInputBuffer, &gyleBuilderClone);
onGyleActivate(gyleBrixInputBuffer, gyleCO2InputBuffer, gyleWortVolumeInputBuffer, &gyleBuilderClone);
}
}
}
......
......@@ -54,7 +54,7 @@
<property name="margin_left">13</property>
<property name="margin_right">13</property>
<property name="xalign">0.5</property>
<property name="placeholder_text" translatable="yes">Enter your starting brix</property>
<property name="placeholder_text" translatable="yes">Starting Brix</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -83,7 +83,7 @@
<object class="GtkEntry" id="guestimatorOutput">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Guestimated ABV</property>
<property name="tooltip_text" translatable="yes">Estimated ABV</property>
<property name="margin_left">13</property>
<property name="margin_right">13</property>
<property name="editable">False</property>
......@@ -945,7 +945,7 @@
<object class="GtkEntry" id="gyleCO2Input">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Desired ABV</property>
<property name="tooltip_text" translatable="yes">Desired CO2 Level</property>
<property name="margin_left">3</property>
<property name="margin_right">3</property>
<property name="xalign">0.5</property>
......@@ -958,13 +958,13 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="gyleFinalVolumeInput">
<object class="GtkEntry" id="gyleWortVolumeInput">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Desired Wort Volume</property>
<property name="tooltip_text" translatable="yes">Wort Volume</property>
<property name="margin_right">13</property>
<property name="xalign">0.5</property>
<property name="placeholder_text" translatable="yes">Final Volume</property>
<property name="placeholder_text" translatable="yes">Wort Volume</property>
</object>
<packing>
<property name="expand">True</property>
......@@ -1000,7 +1000,7 @@
<object class="GtkEntry" id="gyleOutput">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Guestimated ABV</property>
<property name="tooltip_text" translatable="yes">Gyle To Reserve</property>
<property name="margin_left">13</property>
<property name="margin_right">13</property>
<property name="editable">False</property>
......@@ -1116,7 +1116,7 @@
<object class="GtkEntry" id="champagneCarbonationInput">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Starting brix</property>
<property name="tooltip_text" translatable="yes">Volume To Carbonate</property>
<property name="margin_left">13</property>
<property name="margin_right">13</property>
<property name="xalign">0.5</property>
......
......@@ -136,10 +136,10 @@ pub fn startGTK() {
gyleCarbonationPrep(&gyleCO2InputBuilderClone);
});
let gyleFinalVolumeInput: gtk::Entry = builder.get_object("gyleFinalVolumeInput").unwrap();
let gyleFinalVolumeInputBuilderClone = builder.clone();
gyleFinalVolumeInput.connect_activate(move |_| {
gyleCarbonationPrep(&gyleFinalVolumeInputBuilderClone);
let gyleWortVolumeInput: gtk::Entry = builder.get_object("gyleWortVolumeInput").unwrap();
let gyleWortVolumeInputBuilderClone = builder.clone();
gyleWortVolumeInput.connect_activate(move |_| {
gyleCarbonationPrep(&gyleWortVolumeInputBuilderClone);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment