Commit e1582ddb authored by Meade's avatar Meade

Minor fixes/improvements. See README.md or CHANGELOG.md for the full list.

parent 50ca9afe
## New In 6.0.1
* Moved `startGTK()` into its own module so the `mod.rs` is just modules.
* Properly configured the tests module in `main.rs` with the `#[cfg(test)]` flag and removed unused imports in some tests.
* Updated `gtkCSS()` to the latest `get_default_screen()` arguments.
* Moved the `clone!()` macro into `macroDefinitions.rs` so the `mod.rs` is just modules.
## New In 6.0.0
* Changed from switches to dropdowns for units.
* Added Imperial (British) units.
......@@ -5,7 +11,7 @@
* Under the bonnet, complete rewrite/cleanup.
* Broke apart large functions.
* Wrote tests for all of the Maths, Formatting, Implementations, and Common Functions.
## New In 5.3.1
* Fixed the percentage display for Real Attenuation.
......
This diff is collapsed.
[package]
name = "BrewStillery"
version = "6.0.0"
version = "6.0.1"
authors = ["Meade <thedarkula2049@gmail.com>", "Emily <marleybrush5@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
......@@ -11,19 +11,18 @@ readme = "README.md"
keywords = ["beer", "wine", "champagne", "distilling", "calculator"]
categories = ["science", "gui"]
license = "AGPL-3.0"
exclude = ["Arch/*"]
[badges]
maintenance = { status = "actively-developed" }
[dependencies.gtk]
version = "0.3.0"
version = "0.4.0"
features = ["v3_22"]
[dependencies]
gdk = "0.7.0"
gio = "0.3.0"
# clippy = {version = "*", optional = true}
gdk = "0.8.0"
gio = "0.4.0"
clippy = {version = "0.0.189", optional = true}
[features]
default = []
......
......@@ -4,13 +4,11 @@ It has a multitude of great functions, such as calculating ABV, determining carb
Written in Rust, using GTK3
## New In 6.0.0
* Changed from switches to dropdowns for units.
* Added Imperial (British) units.
* In Total IBU, changed Boil Time to per hop.
* Under the bonnet, complete rewrite/cleanup.
* Broke apart large functions.
* Wrote tests for all of the Maths, Formatting, Implementations, and Common Functions.
## New In 6.0.1
* Moved `startGTK()` into its own module so the `mod.rs` is just modules.
* Properly configured the tests module in `main.rs` with the `#[cfg(test)]` flag and removed unused imports in some tests.
* Updated `gtkCSS()` to the latest `get_default_screen()` arguments.
* Moved the `clone!()` macro into `macroDefinitions.rs` so the `mod.rs` is just modules.
## Full Changelog
* [Available Here](CHANGELOG.md)
......@@ -66,5 +64,5 @@ Written in Rust, using GTK3
* ["Calculating Gravity, Bitterness, And Color: Techniques"](https://byo.com/bock/item/409-calculating-gravity-bitterness-and-color-techniques) - Chris Colby, 2000
* ["Formulas And C Source Code"](https://web.archive.org/web/20090807084643/http://www.primetab.com:80/formulas) - PrimeTab, Modified: March 25, 2002
* ["Estimating Color"](http://brewwiki.com/index.php/Estimating_Color) - BrewWiki.com, Modified: May, 17 2008
* ["Technical Information for Brewers"](http://wetnewf.org/pdfs/Brewing_articles/MOAWorkbook.xls) - A.J. deLange, 2013
* ["Technical Information for Brewers"](http://wetnewf.org/pdfs/Brewing_articles/MOAWorkbook.xls) - A.J. DeLange, 2013
* ["Color math and programming code examples"](https://www.easyrgb.com/en/math.php) - IRO Group Limited, 2018
\ No newline at end of file
......@@ -62,8 +62,7 @@ pub trait inputMatching {
impl inputMatching for str {
fn validInput(&self) -> f64 {
let stringInput = self.parse::<f64>();
match stringInput {
match self.parse::<f64>() {
Ok(number) => number,
Err(_) => 0.0,
}
......
......@@ -2657,7 +2657,7 @@
<property name="can_focus">False</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="label" translatable="yes">Version 6.0.0</property>
<property name="label" translatable="yes">Version 6.0.1</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -2740,7 +2740,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title">BrewStillery</property>
<property name="subtitle">6.0.0</property>
<property name="subtitle">6.0.1</property>
<property name="show_close_button">True</property>
<child>
<placeholder/>
......
......@@ -6,6 +6,6 @@ pub fn gtkCSS(mainWindow: &gtk::ApplicationWindow) {
let css = gtk::CssProvider::new();
let cssFile = include_bytes!("BrewStillery.css");
css.load_from_data(cssFile).expect("gtkCSS(), .load_from_data()");
let screen = mainWindow.get_display().expect("gtkCSS(), screen").get_screen(0);
let screen = mainWindow.get_display().expect("gtkCSS(), screen").get_default_screen();
gtk::StyleContext::add_provider_for_screen(&screen, &css, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
}
\ No newline at end of file
pub mod startGTK;
mod gtkCSS;
mod guestimateABVGUI;
mod increaseABVGUI;
......@@ -6,79 +7,4 @@ mod realABVGUI;
mod waterSpargeGUI;
mod guestimateIBUGUI;
mod gyleCarbonationGUI;
mod champagneCarbonationGUI;
use gtk;
use gtk::prelude::*;
use gui::gtkCSS::gtkCSS;
use gui::guestimateABVGUI::guestimateABVGUI;
use gui::increaseABVGUI::increaseABVGUI;
use gui::grainToABVGUI::grainToABVGUI;
use gui::realABVGUI::realABVGUI;
use gui::waterSpargeGUI::waterSpargeGUI;
use gui::guestimateIBUGUI::guestimateIBUGUI;
use gui::gyleCarbonationGUI::gyleCarbonationGUI;
use gui::champagneCarbonationGUI::champagneCarbonationGUI;
pub fn startGTK(application: &gtk::Application) {
let builder = gtk::Builder::new_from_string(include_str!("BrewStillery.glade"));
let mainWindow: gtk::ApplicationWindow = builder.get_object("mainWindow").expect("startGTK(), mainWindow");
mainWindow.set_application(application);
mainWindow.connect_delete_event(clone!(mainWindow => move |_, _| {
mainWindow.destroy();
Inhibit(false)
}));
// css section
gtkCSS(&mainWindow);
// guestimateABV Section
guestimateABVGUI(&builder);
// increaseABV Section
increaseABVGUI(&builder);
// realABV Section
realABVGUI(&builder);
// grainABV Section
grainToABVGUI(&builder);
// waterSparge Section
waterSpargeGUI(&builder);
// guestimateIBU Section
guestimateIBUGUI(&builder);
// gyleCarbonation Section
gyleCarbonationGUI(&builder);
// champagneCarbonation Section
champagneCarbonationGUI(&builder);
mainWindow.show_all();
}
\ No newline at end of file
mod champagneCarbonationGUI;
\ No newline at end of file
use gtk;
use gtk::prelude::*;
use gui::gtkCSS;
use gui::guestimateABVGUI;
use gui::increaseABVGUI;
use gui::grainToABVGUI;
use gui::realABVGUI;
use gui::waterSpargeGUI;
use gui::guestimateIBUGUI;
use gui::gyleCarbonationGUI;
use gui::champagneCarbonationGUI;
pub fn startGTK(application: &gtk::Application) {
let builder = gtk::Builder::new_from_string(include_str!("BrewStillery.glade"));
let mainWindow: gtk::ApplicationWindow = builder.get_object("mainWindow").expect("startGTK(), mainWindow");
mainWindow.set_application(application);
mainWindow.connect_delete_event(clone!(mainWindow => move |_, _| {
mainWindow.destroy();
Inhibit(false)
}));
// css section
gtkCSS::gtkCSS(&mainWindow);
// guestimateABV Section
guestimateABVGUI::guestimateABVGUI(&builder);
// increaseABV Section
increaseABVGUI::increaseABVGUI(&builder);
// realABV Section
realABVGUI::realABVGUI(&builder);
// grainABV Section
grainToABVGUI::grainToABVGUI(&builder);
// waterSparge Section
waterSpargeGUI::waterSpargeGUI(&builder);
// guestimateIBU Section
guestimateIBUGUI::guestimateIBUGUI(&builder);
// gyleCarbonation Section
gyleCarbonationGUI::gyleCarbonationGUI(&builder);
// champagneCarbonation Section
champagneCarbonationGUI::champagneCarbonationGUI(&builder);
mainWindow.show_all();
}
\ No newline at end of file
macro_rules! clone {
(@param _) => ( _ );
(@param $x:ident) => ( $x );
($($n:ident),+ => move || $body:expr) => (
{
$( let $n = $n.clone(); )+
move || $body
}
);
($($n:ident),+ => move |$($p:tt),+| $body:expr) => (
{
$( let $n = $n.clone(); )+
move |$(clone!(@param $p),)+| $body
}
);
}
\ No newline at end of file
macro_rules! clone {
(@param _) => ( _ );
(@param $x:ident) => ( $x );
($($n:ident),+ => move || $body:expr) => (
{
$( let $n = $n.clone(); )+
move || $body
}
);
($($n:ident),+ => move |$($p:tt),+| $body:expr) => (
{
$( let $n = $n.clone(); )+
move |$(clone!(@param $p),)+| $body
}
);
}
\ No newline at end of file
#[macro_use]
mod macroDefinitions;
\ No newline at end of file
......@@ -16,6 +16,7 @@ mod macros;
mod gui;
mod functions;
mod light;
#[cfg(test)]
mod tests;
fn main() {
......@@ -24,7 +25,7 @@ fn main() {
.expect("Initialisation failed");
application.connect_startup(move |app| {
gui::startGTK(app);
gui::startGTK::startGTK(app);
});
application.connect_activate(|_| {});
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::champagneCarbonation::*;
#[test]
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::grainToABV::*;
#[allow(unused_imports)]
use gdk::RGBA;
#[test]
fn grainToABVMathsImperialGBTest() {
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[test]
......@@ -6,6 +5,6 @@ fn grainToGravityTest() {
let volumeInGallonsUS = 20.0;
let weightInPounds = 60.0;
let grainGravity = 1.037;
assert_eq!(grainToGravity(volumeInGallonsUS, weightInPounds, grainGravity), 1.06327);
}
\ No newline at end of file
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::guestimateABV::guestimateABVFormatting;
#[test]
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::guestimateIBU::*;
#[test]
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::gyleCarbonation::*;
#[test]
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[test]
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::increaseABV::*;
#[allow(unused_imports)]
#[test]
fn increaseABVMathsImperialGBTest() {
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use light::lightFunctions::*;
#[test]
......@@ -66,6 +64,6 @@ fn grainToGravityTest() {
let weightInPounds = 30.0;
let grainGravity = 1.037;
let output = grainToGravity(volumeInGallons, weightInPounds, grainGravity);
assert_eq!(output, 1.0316349999999999)
}
\ No newline at end of file
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::realABV::realABVFormatting;
#[test]
......@@ -10,7 +8,7 @@ fn realABVMathsTest() {
let output = realABV(startingBrix, finalBrix);
let abv = output.0;
let attenuation = output.1;
assert_eq!(abv, 4.973244658620157);
assert_eq!(attenuation, 37.349534965963777);
}
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[test]
......@@ -9,6 +8,6 @@ fn realIBUTest() {
let hopAmount = 3.0;
let boilTime = 60.0;
let output = realIBU(brix, wortVolume, alphaAcid, hopAmount, boilTime);
assert_eq!(output, 13.486826596469873);
}
\ No newline at end of file
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use functions::waterSparge::*;
#[test]
......
#[allow(unused_imports)]
use functions::commonFunctions::*;
#[allow(unused_imports)]
use gdk::RGBA;
#[test]
fn zeroRGBATest() {
......
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