chemistry_paradise 1.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chemistry_paradise might be problematic. Click here for more details.

Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +522 -0
  3. data/bin/chemistry_paradise +7 -0
  4. data/bin/wetter +7 -0
  5. data/chemistry_paradise.gemspec +46 -0
  6. data/doc/README.gen +518 -0
  7. data/doc/bugs/BUGS.md +16 -0
  8. data/doc/formulas/biochemical_calculations.md +5 -0
  9. data/doc/todo/todo_for_the_chemistry_paradise_project.md +33 -0
  10. data/doc/todo/todo_for_the_wetter_project.md +7 -0
  11. data/lib/chemistry_paradise/base/base.rb +215 -0
  12. data/lib/chemistry_paradise/base/colours.rb +93 -0
  13. data/lib/chemistry_paradise/commandline/help.rb +40 -0
  14. data/lib/chemistry_paradise/commandline/menu.rb +88 -0
  15. data/lib/chemistry_paradise/commandline/parse_commandline.rb +94 -0
  16. data/lib/chemistry_paradise/constants/constants.rb +77 -0
  17. data/lib/chemistry_paradise/constants/file_constants.rb +33 -0
  18. data/lib/chemistry_paradise/constants/german_names_of_elements_to_element_symbol.rb +157 -0
  19. data/lib/chemistry_paradise/converters/celsius_to_fahrenheit.rb +143 -0
  20. data/lib/chemistry_paradise/converters/celsius_to_kelvin.rb +125 -0
  21. data/lib/chemistry_paradise/converters/fahrenheit_to_celsius.rb +132 -0
  22. data/lib/chemistry_paradise/converters/shared.rb +21 -0
  23. data/lib/chemistry_paradise/gui/gtk3/calculate_molecular_weight/calculate_molecular_weight.rb +34 -0
  24. data/lib/chemistry_paradise/gui/gtk3/show_periodic_table/show_periodic_table.rb +34 -0
  25. data/lib/chemistry_paradise/gui/gtk3/temperature_converter/temperature_converter.rb +112 -0
  26. data/lib/chemistry_paradise/gui/gtk3/wetter/wetter.rb +119 -0
  27. data/lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb +100 -0
  28. data/lib/chemistry_paradise/gui/libui/wetter/wetter.rb +47 -0
  29. data/lib/chemistry_paradise/gui/shared_code/calculate_molecular_weight/calculate_molecular_weight_module.rb +171 -0
  30. data/lib/chemistry_paradise/gui/shared_code/show_periodic_table/show_periodic_table_module.rb +318 -0
  31. data/lib/chemistry_paradise/gui/shared_code/temperature_converter/temperature_converter_module.rb +192 -0
  32. data/lib/chemistry_paradise/gui/shared_code/wetter/wetter_module.rb +349 -0
  33. data/lib/chemistry_paradise/gui/swing/TemperatureConverter$1.class +0 -0
  34. data/lib/chemistry_paradise/gui/swing/TemperatureConverter.class +0 -0
  35. data/lib/chemistry_paradise/gui/swing/TemperatureConverter.java +133 -0
  36. data/lib/chemistry_paradise/gui/unified_widgets/wetter/wetter.rb +62 -0
  37. data/lib/chemistry_paradise/images/show_periodic_table.png +0 -0
  38. data/lib/chemistry_paradise/images/vienna_map.png +0 -0
  39. data/lib/chemistry_paradise/interactive_chemistry_shell.rb +246 -0
  40. data/lib/chemistry_paradise/project/project.rb +24 -0
  41. data/lib/chemistry_paradise/requires/common_external_requires.rb +17 -0
  42. data/lib/chemistry_paradise/requires/require_the_project.rb +21 -0
  43. data/lib/chemistry_paradise/requires/require_the_project_including_the_graphical_user_interface.rb +7 -0
  44. data/lib/chemistry_paradise/requires/require_the_project_including_the_web_interface.rb +4 -0
  45. data/lib/chemistry_paradise/shared.rb +130 -0
  46. data/lib/chemistry_paradise/show_electron_configuration.rb +250 -0
  47. data/lib/chemistry_paradise/show_element.rb +145 -0
  48. data/lib/chemistry_paradise/sinatra/sinatra.rb +131 -0
  49. data/lib/chemistry_paradise/sinatra/wetter/app.rb +68 -0
  50. data/lib/chemistry_paradise/sinatra/wetter/start_sinatra_interface.rb +31 -0
  51. data/lib/chemistry_paradise/split_molecule_names.rb +228 -0
  52. data/lib/chemistry_paradise/toplevel_methods/atomgewichte.rb +31 -0
  53. data/lib/chemistry_paradise/toplevel_methods/convert_parens.rb +64 -0
  54. data/lib/chemistry_paradise/toplevel_methods/display_where_the_molmasses_are_kept.rb +24 -0
  55. data/lib/chemistry_paradise/toplevel_methods/e.rb +16 -0
  56. data/lib/chemistry_paradise/toplevel_methods/kelvin.rb +34 -0
  57. data/lib/chemistry_paradise/toplevel_methods/language.rb +50 -0
  58. data/lib/chemistry_paradise/toplevel_methods/misc.rb +147 -0
  59. data/lib/chemistry_paradise/toplevel_methods/periodic_table.rb +16 -0
  60. data/lib/chemistry_paradise/toplevel_methods/remove_this_molecule_from.rb +63 -0
  61. data/lib/chemistry_paradise/toplevel_methods/roebe.rb +16 -0
  62. data/lib/chemistry_paradise/toplevel_methods/show_electron_negativity_chart.rb +26 -0
  63. data/lib/chemistry_paradise/utility_scripts/calculate_atomic_mass.rb +559 -0
  64. data/lib/chemistry_paradise/utility_scripts/combustion_analysis.rb +207 -0
  65. data/lib/chemistry_paradise/utility_scripts/electron_negativity_chart.rb +78 -0
  66. data/lib/chemistry_paradise/utility_scripts/equalize_chemical_formula.rb +84 -0
  67. data/lib/chemistry_paradise/utility_scripts/equation_solver.rb +130 -0
  68. data/lib/chemistry_paradise/utility_scripts/orbitals.rb +70 -0
  69. data/lib/chemistry_paradise/utility_scripts/show_electron_negativity_of_this_element.rb +103 -0
  70. data/lib/chemistry_paradise/verbose_chemical_calculation.rb +21 -0
  71. data/lib/chemistry_paradise/version/version.rb +19 -0
  72. data/lib/chemistry_paradise/wetter/wetter.rb +539 -0
  73. data/lib/chemistry_paradise/www/wetter/embeddable_interface.rb +78 -0
  74. data/lib/chemistry_paradise/www/wetter/wetter.cgi +28 -0
  75. data/lib/chemistry_paradise/yaml/atomgewichte.yml +113 -0
  76. data/lib/chemistry_paradise/yaml/colours_for_the_elements.yml +13 -0
  77. data/lib/chemistry_paradise/yaml/dichte.yml +21 -0
  78. data/lib/chemistry_paradise/yaml/electron_negativity_chart.yml +111 -0
  79. data/lib/chemistry_paradise/yaml/molecular_formula_of_different_molecules.yml +13 -0
  80. data/lib/chemistry_paradise/yaml/periodic_table_of_the_elements.yml +125 -0
  81. data/lib/chemistry_paradise.rb +1 -0
  82. data/test/testing_chemistry_paradise.rb +49 -0
  83. metadata +173 -0
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::GUI::Gtk::TemperatureConverter
6
+ # =========================================================================== #
7
+ # require 'chemistry_paradise/gui/gtk3/temperature_converter/temperature_converter.rb'
8
+ # ChemistryParadise::GUI::Gtk::TemperatureConverter.run
9
+ # =========================================================================== #
10
+ require 'gtk_paradise/require_gtk3'
11
+
12
+ module ChemistryParadise
13
+
14
+ module GUI
15
+
16
+ module Gtk
17
+
18
+ class TemperatureConverter < ::Gtk::Box # === ChemistryParadise::GUI::Gtk::TemperatureConverter
19
+
20
+ require 'gtk_paradise/requires/require_the_base_module.rb'
21
+ include ::Gtk::BaseModule
22
+
23
+ require 'chemistry_paradise/gui/shared_code/temperature_converter/temperature_converter_module.rb'
24
+ include ChemistryParadise::GUI::TemperatureConverterModule
25
+
26
+ # ========================================================================= #
27
+ # === initialize
28
+ # ========================================================================= #
29
+ def initialize(
30
+ commandline_arguments = ARGV,
31
+ run_already = true
32
+ )
33
+ super(:vertical)
34
+ reset
35
+ set_commandline_arguments(
36
+ commandline_arguments
37
+ )
38
+ run if run_already
39
+ end
40
+
41
+ # ========================================================================= #
42
+ # === reset (reset tag)
43
+ # ========================================================================= #
44
+ def reset
45
+ reset_the_internal_variables
46
+ # ======================================================================= #
47
+ # === @configuration
48
+ # ======================================================================= #
49
+ @configuration = [true, __dir__, NAMESPACE]
50
+ use_gtk_paradise_project_css_file
51
+ infer_the_size_automatically
52
+ reset_the_shared_module
53
+ end
54
+
55
+ # ========================================================================= #
56
+ # === create_skeleton (create tag)
57
+ # ========================================================================= #
58
+ def create_skeleton
59
+ create_the_entries
60
+ create_the_grid
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === connect_skeleton (connect tag)
65
+ # ========================================================================= #
66
+ def connect_skeleton
67
+ abort_on_exception
68
+ populate_the_grid
69
+ minimal(return_the_title_as_label, 6)
70
+ minimal(@grid, 25)
71
+ end
72
+
73
+ # ========================================================================= #
74
+ # === populate_the_grid
75
+ # ========================================================================= #
76
+ def populate_the_grid
77
+ @grid.left(bold_text('Celsius:'))
78
+ @grid.right(@entry_celsius)
79
+ @grid.new_row
80
+ @grid.left(bold_text('Fahrenheit:'))
81
+ @grid.right(@entry_fahrenheit)
82
+ @grid.new_row
83
+ @grid.left(bold_text('Kelvin:'))
84
+ @grid.right(@entry_kelvin)
85
+ end
86
+
87
+ # ========================================================================= #
88
+ # === run (run tag)
89
+ # ========================================================================= #
90
+ def run
91
+ super()
92
+ end
93
+
94
+ # ========================================================================= #
95
+ # === ChemistryParadise::GUI::Gtk::TemperatureConverter.run
96
+ # ========================================================================= #
97
+ def self.run(
98
+ i = ARGV
99
+ )
100
+ require 'gtk_paradise/run'
101
+ _ = ::ChemistryParadise::GUI::Gtk::TemperatureConverter.new(i)
102
+ r = ::Gtk.run
103
+ r << _
104
+ r.automatic_size_then_automatic_title
105
+ r.top_left_then_run
106
+ end
107
+
108
+ end; end; end; end
109
+
110
+ if __FILE__ == $PROGRAM_NAME
111
+ ChemistryParadise::GUI::Gtk::TemperatureConverter.run
112
+ end
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::GUI::Gtk::Wetter
6
+ #
7
+ # This is a tiny "weather-application", written in ruby-gtk3. Do not
8
+ # expect this to be too sophisticated - it is mostly meant as a
9
+ # prototype for a weather-app.
10
+ # =========================================================================== #
11
+ # require 'chemistry_paradise/gui/gtk3/wetter/wetter.rb'
12
+ # ChemistryParadise::GUI::Gtk::Wetter.run
13
+ # =========================================================================== #
14
+ require 'gtk_paradise/require_gtk3'
15
+
16
+ module ChemistryParadise
17
+
18
+ module GUI
19
+
20
+ module Gtk
21
+
22
+ class Wetter < ::Gtk::Box # === ChemistryParadise::GUI::Gtk::Wetter
23
+
24
+ include ::Gtk::BaseModule
25
+
26
+ require 'chemistry_paradise/gui/shared_code/wetter/wetter_module.rb'
27
+ include ChemistryParadise::GUI::WetterModule
28
+
29
+ # ========================================================================= #
30
+ # === initialize
31
+ # ========================================================================= #
32
+ def initialize(
33
+ commandline_arguments = ARGV,
34
+ run_already = true
35
+ )
36
+ super(:vertical)
37
+ reset
38
+ set_commandline_arguments(
39
+ commandline_arguments
40
+ )
41
+ run if run_already
42
+ end
43
+
44
+ # ========================================================================= #
45
+ # === reset (reset tag)
46
+ # ========================================================================= #
47
+ def reset
48
+ reset_the_internal_variables
49
+ infer_the_namespace
50
+ # ======================================================================= #
51
+ # === @configuration
52
+ # ======================================================================= #
53
+ @configuration = [true, __dir__, namespace?]
54
+ # ======================================================================= #
55
+ # === Set the title, width, height and the font in use.
56
+ # ======================================================================= #
57
+ title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
58
+ use_gtk_paradise_project_css_file
59
+ infer_the_size_automatically
60
+ end
61
+
62
+ # ========================================================================= #
63
+ # === padding?
64
+ # ========================================================================= #
65
+ def padding?
66
+ 4
67
+ end
68
+
69
+ # ========================================================================= #
70
+ # === border_size?
71
+ # ========================================================================= #
72
+ def border_size?
73
+ 2
74
+ end
75
+
76
+ # ========================================================================= #
77
+ # === run (run tag)
78
+ # ========================================================================= #
79
+ def run
80
+ super()
81
+ end
82
+
83
+ # ========================================================================= #
84
+ # === ChemistryParadise::GUI::Gtk::Wetter.gtk3_widget
85
+ #
86
+ # This variant is guaranteed to return the gtk3 variant.
87
+ # ========================================================================= #
88
+ def self.gtk3_widget
89
+ new('gtk3')
90
+ end
91
+
92
+ # ========================================================================= #
93
+ # === ChemistryParadise::GUI::Gtk::Wetter.run_gtk3_widget
94
+ # ========================================================================= #
95
+ def self.run_gtk3_widget
96
+ gtk3_widget
97
+ ::Gtk.enable_default_css
98
+ ::Gtk.main
99
+ end
100
+
101
+ # ========================================================================= #
102
+ # === ChemistryParadise::GUI::Gtk::Wetter.run
103
+ # ========================================================================= #
104
+ def self.run(
105
+ i = ARGV # or 'gtk3' as argument here.
106
+ )
107
+ require 'gtk_paradise/app/app.rb'
108
+ _ = ::ChemistryParadise::GUI::Gtk::Wetter.new(i)
109
+ r = ::Gtk.run
110
+ r << _
111
+ r.enable_quick_exit
112
+ r.automatic_top_left_then_run
113
+ end
114
+
115
+ end; end; end; end
116
+
117
+ if __FILE__ == $PROGRAM_NAME
118
+ ChemistryParadise::GUI::Gtk::Wetter.run
119
+ end # wetter_app_gtk3
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::GUI::LibUI::TemperatureConverter
6
+ # =========================================================================== #
7
+ module ChemistryParadise
8
+
9
+ module GUI
10
+
11
+ module LibUI
12
+
13
+ class TemperatureConverter # === ChemistryParadise::GUI::LibUI::TemperatureConverter
14
+
15
+ alias e puts
16
+
17
+ require 'libui_paradise'
18
+ include LibuiParadise::Extensions
19
+
20
+ require 'chemistry_paradise/gui/shared_code/temperature_converter/temperature_converter_module.rb'
21
+ include ChemistryParadise::GUI::TemperatureConverterModule
22
+
23
+ # ========================================================================= #
24
+ # === initialize
25
+ # ========================================================================= #
26
+ def initialize(
27
+ run_already = true
28
+ )
29
+ reset
30
+ run if run_already
31
+ end
32
+
33
+ # ========================================================================= #
34
+ # === reset (reset tag)
35
+ # ========================================================================= #
36
+ def reset
37
+ title_width_height(TITLE, WIDTH, HEIGHT)
38
+ end
39
+
40
+ # ========================================================================= #
41
+ # === create_skeleton (create tag, skeleton tag)
42
+ # ========================================================================= #
43
+ def create_skeleton
44
+ abort_on_exception
45
+ # ======================================================================= #
46
+ # === @window
47
+ # ======================================================================= #
48
+ @window = ui_padded_main_window(title?, width?, height?, 0)
49
+ create_the_entries
50
+ create_the_grid
51
+ end
52
+
53
+ # ========================================================================= #
54
+ # === return_all_entries
55
+ # ========================================================================= #
56
+ def return_all_entries
57
+ []
58
+ end
59
+
60
+ # ========================================================================= #
61
+ # === run
62
+ # ========================================================================= #
63
+ def run
64
+ create_skeleton_then_connect_skeleton
65
+ outer_vbox = padded_vbox
66
+ outer_vbox.minimal(return_the_title_as_label, 0)
67
+ @grid.hash_grid(
68
+ bold_text('Celsius:'), left: 0, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
69
+ )
70
+ @grid.hash_grid(
71
+ @entry_celsius, left: 1, top: 0, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
72
+ )
73
+
74
+ @grid.hash_grid(
75
+ bold_text('Fahrenheit:'), left: 0, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
76
+ )
77
+ @grid.hash_grid(
78
+ @entry_fahrenheit, left: 1, top: 1, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
79
+ )
80
+
81
+ @grid.hash_grid(
82
+ bold_text('Kelvin:'), left: 0, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
83
+ )
84
+ @grid.hash_grid(
85
+ @entry_kelvin, left: 1, top: 2, xspan: 1, yspan: 1, hexpand: 0, halign: 0.5, vexpand: 1, valign: 0
86
+ )
87
+
88
+ outer_vbox.minimal(@grid, 12)
89
+ outer_vbox.add_hsep
90
+ outer_vbox.minimal(quit_button)
91
+ outer_vbox.add_hsep
92
+ @window.add(outer_vbox)
93
+ @window.intelligent_exit
94
+ end
95
+
96
+ end; end; end; end
97
+
98
+ if __FILE__ == $PROGRAM_NAME
99
+ ChemistryParadise::GUI::LibUI::TemperatureConverter.new
100
+ end
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::GUI::LibUI::Wetter
6
+ # =========================================================================== #
7
+ # require 'chemistry_paradise/gui/libui/wetter/wetter.rb'
8
+ # ChemistryParadise::GUI::LibUI::Wetter.new
9
+ # =========================================================================== #
10
+ module ChemistryParadise
11
+
12
+ module GUI
13
+
14
+ module LibUI
15
+
16
+ class Wetter # === Wetter::GUI::LibUI::Wetter
17
+
18
+ require 'libui_paradise'
19
+ include LibuiParadise::Extensions
20
+
21
+ require 'chemistry_paradise/gui/shared_code/wetter/wetter_module.rb'
22
+ include ChemistryParadise::GUI::WetterModule
23
+
24
+ alias e puts
25
+
26
+ # ========================================================================= #
27
+ # === initialize
28
+ # ========================================================================= #
29
+ def initialize(
30
+ run_already = true
31
+ )
32
+ reset
33
+ run if run_already
34
+ end
35
+
36
+ # ========================================================================= #
37
+ # === reset (reset tag)
38
+ # ========================================================================= #
39
+ def reset
40
+ reset_the_shared_module
41
+ end
42
+
43
+ end; end; end; end
44
+
45
+ if __FILE__ == $PROGRAM_NAME
46
+ ChemistryParadise::GUI::LibUI::Wetter.new
47
+ end
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::GUI::Gtk::CalculateMolecularWeightModule
6
+ # =========================================================================== #
7
+ # require 'chemistry_paradise/gui/shared_code/calculate_molecular_weight/calculate_molecular_weight_module.rb'
8
+ # include ::ChemistryParadise::GUI::Gtk::CalculateMolecularWeightModule
9
+ # =========================================================================== #
10
+ module ChemistryParadise
11
+
12
+ module GUI
13
+
14
+ module Gtk
15
+
16
+ module CalculateMolecularWeightModule
17
+
18
+ require 'chemistry_paradise/utility_scripts/calculate_atomic_mass.rb'
19
+
20
+ require 'gtk_paradise/requires/require_the_base_module.rb'
21
+ include ::Gtk::BaseModule
22
+
23
+ # ========================================================================= #
24
+ # === NAMESPACE
25
+ # ========================================================================= #
26
+ NAMESPACE = inspect
27
+
28
+ # ========================================================================= #
29
+ # === TITLE
30
+ # ========================================================================= #
31
+ TITLE = 'Calculate the molecular weight of a compound'
32
+
33
+ # ========================================================================= #
34
+ # === WIDTH
35
+ # ========================================================================= #
36
+ WIDTH = 1200
37
+
38
+ # ========================================================================= #
39
+ # === HEIGHT
40
+ # ========================================================================= #
41
+ HEIGHT = 500
42
+
43
+ # ========================================================================= #
44
+ # === USE_THIS_FONT
45
+ # ========================================================================= #
46
+ USE_THIS_FONT = :dejavu_condensed_21
47
+
48
+ # ========================================================================= #
49
+ # === initialize
50
+ # ========================================================================= #
51
+ def initialize(
52
+ commandline_arguments = ARGV,
53
+ run_already = true
54
+ )
55
+ super(:vertical)
56
+ reset
57
+ set_commandline_arguments(
58
+ commandline_arguments
59
+ )
60
+ run if run_already
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === reset (reset tag)
65
+ # ========================================================================= #
66
+ def reset
67
+ reset_the_internal_variables
68
+ # ======================================================================= #
69
+ # === @configuration
70
+ # ======================================================================= #
71
+ @configuration = [true, __dir__, NAMESPACE]
72
+ # ======================================================================= #
73
+ # === @title
74
+ # ======================================================================= #
75
+ @title = TITLE
76
+ # ======================================================================= #
77
+ # === @width
78
+ # ======================================================================= #
79
+ set_width(WIDTH)
80
+ # ======================================================================= #
81
+ # === @height
82
+ # ======================================================================= #
83
+ set_height(HEIGHT)
84
+ set_use_this_font(USE_THIS_FONT)
85
+ use_gtk_paradise_project_css_file
86
+ infer_the_size_automatically
87
+ end
88
+
89
+ # ========================================================================= #
90
+ # === padding?
91
+ # ========================================================================= #
92
+ def padding?
93
+ 2
94
+ end
95
+
96
+ # ========================================================================= #
97
+ # === border_size?
98
+ # ========================================================================= #
99
+ def border_size?
100
+ 0
101
+ end
102
+
103
+ # ========================================================================= #
104
+ # === create_the_entry
105
+ # ========================================================================= #
106
+ def create_the_entry
107
+ # ======================================================================= #
108
+ # === @entry_for_the_chemical_formula
109
+ # ======================================================================= #
110
+ @entry_for_the_chemical_formula = gtk_entry
111
+ @entry_for_the_chemical_formula.bblack1
112
+ @entry_for_the_chemical_formula.yellow_background
113
+ @entry_for_the_chemical_formula.center
114
+ @entry_for_the_chemical_formula.hint = 'Input the chemical formula here, '\
115
+ 'then press enter. The atomic mass will be shown.'
116
+ @entry_for_the_chemical_formula.shadow_text =
117
+ 'Input a chemical formula here.'
118
+ @entry_for_the_chemical_formula.on_enter_key {
119
+ _ = @entry_for_the_chemical_formula.text?
120
+ result = ChemistryParadise::CalculateAtomicMass.new(_) {{
121
+ verbosity: :be_quiet,
122
+ may_we_exit: false
123
+ }}.result?
124
+ @text_result.set_text(
125
+ result.to_f.round(3).to_s+' ame'
126
+ )
127
+ @text_result.make_bold
128
+ }
129
+ end
130
+
131
+ # ========================================================================= #
132
+ # === create_skeleton (create tag)
133
+ # ========================================================================= #
134
+ def create_skeleton
135
+ create_the_entry
136
+ end
137
+
138
+ # ========================================================================= #
139
+ # === connect_skeleton (connect tag)
140
+ # ========================================================================= #
141
+ def connect_skeleton
142
+ abort_on_exception
143
+ @text_result = gtk_text
144
+ minimal bold_text('Chemical formula:'), 3
145
+ minimal @entry_for_the_chemical_formula, 3
146
+ minimal @text_result, 3
147
+ end
148
+
149
+ # ========================================================================= #
150
+ # === run (run tag)
151
+ # ========================================================================= #
152
+ def run
153
+ create_skeleton_then_connect_skeleton
154
+ end
155
+
156
+ # ========================================================================= #
157
+ # === ChemistryParadise::GUI::Gtk::CalculateMolecularWeightModule.run
158
+ # ========================================================================= #
159
+ def self.run(
160
+ i = ARGV
161
+ )
162
+ require 'gtk_paradise/run'
163
+ _ = ::ChemistryParadise::GUI::Gtk::CalculateMolecularWeight.new(i)
164
+ r = ::Gtk.run
165
+ r << _
166
+ r.set_size_request(_.width?, _.height?)
167
+ r.automatic_title
168
+ r.top_left_then_run
169
+ end
170
+
171
+ end; end; end; end