~sporiff/soap-calculator

97bfc58faa8813f679dc50d357f6eb35a48d3d32 — Ciarán Ainsworth 4 months ago fb6a387 master
Ingest dictionary at init
3 files changed, 42 insertions(+), 191 deletions(-)

M screenshot.png
M src/__main__.py
M src/soap-calculator.glade
M screenshot.png => screenshot.png +0 -0

M src/__main__.py => src/__main__.py +12 -0
@@ 1,11 1,23 @@
import gi
from calc import calculation
from dict import saponification_values

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

class Handler:

    def __init__(self):
        oil1Tree = builder.get_object("oil1Picker")
        oil2Tree = builder.get_object("oil2Picker")
        oil_store = Gtk.ListStore(str)
        for key in saponification_values:
            oil_store.append([key])
        oil1Tree.set_model(oil_store)
        oil1Tree.set_active(15)
        oil2Tree.set_model(oil_store)
        oil2Tree.set_active(43)

    # Allow the x button to destroy the window

    def onDestroy(self, *args):

M src/soap-calculator.glade => src/soap-calculator.glade +30 -191
@@ 62,200 62,10 @@ Author: Ciarán Ainsworth
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="hexpand">True</property>
            <property name="row_spacing">10</property>
            <property name="row_homogeneous">True</property>
            <property name="column_homogeneous">True</property>
            <child>
              <object class="GtkComboBoxText" id="oil1Picker">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">center</property>
                <property name="margin_bottom">10</property>
                <property name="hexpand">True</property>
                <property name="active">16</property>
                <property name="has_entry">True</property>
                <property name="active_id">16</property>
                <items>
                  <item id="1" translatable="yes">Almond Oil</item>
                  <item id="2" translatable="yes">Aloe Vera Butter</item>
                  <item id="3" translatable="yes">Aloe Vera Oil</item>
                  <item id="4" translatable="yes">Apricot Kernel Oil</item>
                  <item id="5" translatable="yes">Avocado Butter</item>
                  <item id="6" translatable="yes">Babassu Nut Oil</item>
                  <item id="7" translatable="yes">Beeswax</item>
                  <item id="8" translatable="yes">Borage Oil</item>
                  <item id="9" translatable="yes">Candelilla Wax</item>
                  <item id="10" translatable="yes">Canola Oil</item>
                  <item id="11" translatable="yes">Canola Oil, High Oleic Acid</item>
                  <item id="12" translatable="yes">Castor Bean Oil</item>
                  <item id="13" translatable="yes">Cherry Kernel Oil</item>
                  <item id="14" translatable="yes">Chicken Fat</item>
                  <item id="15" translatable="yes">Cocoa Butter</item>
                  <item id="16" translatable="yes">Coconut Oil, Refined 76°</item>
                  <item id="17" translatable="yes">Coconut Oil, Hydrogenated 92°</item>
                  <item id="18" translatable="yes">Coconut Oil, Fractioned/Saturated</item>
                  <item id="19" translatable="yes">Copha Vegetable Shortening</item>
                  <item id="20" translatable="yes">Corn Oil</item>
                  <item id="21" translatable="yes">Cottonseed Oil</item>
                  <item id="22" translatable="yes">Crisco Vegetable Shortening</item>
                  <item id="22" translatable="yes">Emu Oil</item>
                  <item id="23" translatable="yes">Evening Primrose Oil</item>
                  <item id="24" translatable="yes">Flaxseed Oil</item>
                  <item id="25" translatable="yes">Goat Fat</item>
                  <item id="26" translatable="yes">Goose Fat</item>
                  <item id="27" translatable="yes">Grapeseed Oil</item>
                  <item id="28" translatable="yes">Hazelnut Oil</item>
                  <item id="29" translatable="yes">Hempseed Oil</item>
                  <item id="30" translatable="yes">Jojoba Seed Oil</item>
                  <item id="31" translatable="yes">Jojoba Seed Liquid Wax</item>
                  <item id="32" translatable="yes">Karite Butter</item>
                  <item id="33" translatable="yes">Kremelta Vegetable Shortening</item>
                  <item id="34" translatable="yes">Kukui Nut Oil</item>
                  <item id="35" translatable="yes">Lanolin</item>
                  <item id="36" translatable="yes">Lard</item>
                  <item id="37" translatable="yes">Linseed Oil</item>
                  <item id="38" translatable="yes">Macadamia Nut Oil</item>
                  <item id="39" translatable="yes">Milk Fat</item>
                  <item id="40" translatable="yes">Mink Oil</item>
                  <item id="41" translatable="yes">Monoï de Tahiti Oil</item>
                  <item id="42" translatable="yes">Neem Tree Oil</item>
                  <item id="43" translatable="yes">Olive Oil</item>
                  <item id="44" translatable="yes">Ostrich Oil</item>
                  <item id="45" translatable="yes">Palm Kernel Oil</item>
                  <item id="46" translatable="yes">Palm Oil</item>
                  <item id="47" translatable="yes">Peach Kernel Oil</item>
                  <item id="48" translatable="yes">Peanut Oil</item>
                  <item id="49" translatable="yes">Pumpkin Seed Oil</item>
                  <item id="50" translatable="yes">Rapeseed Oil</item>
                  <item id="51" translatable="yes">Rice Bran Oil</item>
                  <item id="52" translatable="yes">Safflower Oil, High Linoleic Acid</item>
                  <item id="53" translatable="yes">Safflower Oil, High Oleic Acid</item>
                  <item id="54" translatable="yes">Sesame Seed Oil</item>
                  <item id="55" translatable="yes">Shea Butter</item>
                  <item id="56" translatable="yes">Soybean Oil</item>
                  <item id="57" translatable="yes">Soybean Oil, 27.5% Hydrogenated</item>
                  <item id="58" translatable="yes">Stearic Acid, Animal-Source</item>
                  <item id="59" translatable="yes">Stearic Acid, Vegetable-Source</item>
                  <item id="60" translatable="yes">Sunflower Seed Oil</item>
                  <item id="61" translatable="yes">Sunflower Seed Oil, High Oleic Acid</item>
                  <item id="62" translatable="yes">Tallow, Beef</item>
                  <item id="63" translatable="yes">Tallow, Deer</item>
                  <item id="64" translatable="yes">Tallow, Sheep</item>
                  <item id="65" translatable="yes">Tamanu Seed Oil</item>
                  <item id="66" translatable="yes">Tiaré Flower Oil</item>
                  <item id="67" translatable="yes">Walnut Oil</item>
                </items>
                <signal name="changed" handler="calculate" swapped="no"/>
                <child internal-child="entry">
                  <object class="GtkEntry">
                    <property name="can_focus">False</property>
                    <property name="halign">center</property>
                    <property name="hexpand">True</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="oil2Picker">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">center</property>
                <property name="margin_top">10</property>
                <property name="hexpand">True</property>
                <property name="active">43</property>
                <property name="has_entry">True</property>
                <property name="active_id">43</property>
                <items>
                  <item id="1" translatable="yes">Almond Oil</item>
                  <item id="2" translatable="yes">Aloe Vera Butter</item>
                  <item id="3" translatable="yes">Aloe Vera Oil</item>
                  <item id="4" translatable="yes">Apricot Kernel Oil</item>
                  <item id="5" translatable="yes">Avocado Butter</item>
                  <item id="6" translatable="yes">Babassu Nut Oil</item>
                  <item id="7" translatable="yes">Beeswax</item>
                  <item id="8" translatable="yes">Borage Oil</item>
                  <item id="9" translatable="yes">Candelilla Wax</item>
                  <item id="10" translatable="yes">Canola Oil</item>
                  <item id="11" translatable="yes">Canola Oil, High Oleic Acid</item>
                  <item id="12" translatable="yes">Castor Bean Oil</item>
                  <item id="13" translatable="yes">Cherry Kernel Oil</item>
                  <item id="14" translatable="yes">Chicken Fat</item>
                  <item id="15" translatable="yes">Cocoa Butter</item>
                  <item id="16" translatable="yes">Coconut Oil, Refined 76°</item>
                  <item id="17" translatable="yes">Coconut Oil, Hydrogenated 92°</item>
                  <item id="18" translatable="yes">Coconut Oil, Fractioned/Saturated</item>
                  <item id="19" translatable="yes">Copha Vegetable Shortening</item>
                  <item id="20" translatable="yes">Corn Oil</item>
                  <item id="21" translatable="yes">Cottonseed Oil</item>
                  <item id="22" translatable="yes">Crisco Vegetable Shortening</item>
                  <item id="22" translatable="yes">Emu Oil</item>
                  <item id="23" translatable="yes">Evening Primrose Oil</item>
                  <item id="24" translatable="yes">Flaxseed Oil</item>
                  <item id="25" translatable="yes">Goat Fat</item>
                  <item id="26" translatable="yes">Goose Fat</item>
                  <item id="27" translatable="yes">Grapeseed Oil</item>
                  <item id="28" translatable="yes">Hazelnut Oil</item>
                  <item id="29" translatable="yes">Hempseed Oil</item>
                  <item id="30" translatable="yes">Jojoba Seed Oil</item>
                  <item id="31" translatable="yes">Jojoba Seed Liquid Wax</item>
                  <item id="32" translatable="yes">Karite Butter</item>
                  <item id="33" translatable="yes">Kremelta Vegetable Shortening</item>
                  <item id="34" translatable="yes">Kukui Nut Oil</item>
                  <item id="35" translatable="yes">Lanolin</item>
                  <item id="36" translatable="yes">Lard</item>
                  <item id="37" translatable="yes">Linseed Oil</item>
                  <item id="38" translatable="yes">Macadamia Nut Oil</item>
                  <item id="39" translatable="yes">Milk Fat</item>
                  <item id="40" translatable="yes">Mink Oil</item>
                  <item id="41" translatable="yes">Monoï de Tahiti Oil</item>
                  <item id="42" translatable="yes">Neem Tree Oil</item>
                  <item id="43" translatable="yes">Olive Oil</item>
                  <item id="44" translatable="yes">Ostrich Oil</item>
                  <item id="45" translatable="yes">Palm Kernel Oil</item>
                  <item id="46" translatable="yes">Palm Oil</item>
                  <item id="47" translatable="yes">Peach Kernel Oil</item>
                  <item id="48" translatable="yes">Peanut Oil</item>
                  <item id="49" translatable="yes">Pumpkin Seed Oil</item>
                  <item id="50" translatable="yes">Rapeseed Oil</item>
                  <item id="51" translatable="yes">Rice Bran Oil</item>
                  <item id="52" translatable="yes">Safflower Oil, High Linoleic Acid</item>
                  <item id="53" translatable="yes">Safflower Oil, High Oleic Acid</item>
                  <item id="54" translatable="yes">Sesame Seed Oil</item>
                  <item id="55" translatable="yes">Shea Butter</item>
                  <item id="56" translatable="yes">Soybean Oil</item>
                  <item id="57" translatable="yes">Soybean Oil, 27.5% Hydrogenated</item>
                  <item id="58" translatable="yes">Stearic Acid, Animal-Source</item>
                  <item id="59" translatable="yes">Stearic Acid, Vegetable-Source</item>
                  <item id="60" translatable="yes">Sunflower Seed Oil</item>
                  <item id="61" translatable="yes">Sunflower Seed Oil, High Oleic Acid</item>
                  <item id="62" translatable="yes">Tallow, Beef</item>
                  <item id="63" translatable="yes">Tallow, Deer</item>
                  <item id="64" translatable="yes">Tallow, Sheep</item>
                  <item id="65" translatable="yes">Tamanu Seed Oil</item>
                  <item id="66" translatable="yes">Tiaré Flower Oil</item>
                  <item id="67" translatable="yes">Walnut Oil</item>
                </items>
                <signal name="changed" handler="calculate" swapped="no"/>
                <child internal-child="entry">
                  <object class="GtkEntry">
                    <property name="can_focus">True</property>
                    <property name="halign">center</property>
                    <property name="hexpand">True</property>
                    <property name="editable">False</property>
                    <property name="text" translatable="yes">Walnut Oil</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkSpinButton" id="oil1">
                <property name="visible">True</property>
                <property name="can_focus">True</property>


@@ 291,6 101,35 @@ Author: Ciarán Ainsworth
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="oil1Picker">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">center</property>
                <property name="hexpand">True</property>
                <property name="active">16</property>
                <property name="active_id">16</property>
                <signal name="changed" handler="calculate" swapped="no"/>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="oil2Picker">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="halign">center</property>
                <property name="hexpand">True</property>
                <property name="active_id">16</property>
                <signal name="changed" handler="calculate" swapped="no"/>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>