chemistry_paradise 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +657 -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 +595 -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/constants_for_chemical_formulas.rb +16 -0
  18. data/lib/chemistry_paradise/constants/file_constants.rb +33 -0
  19. data/lib/chemistry_paradise/constants/german_names_of_elements_to_element_symbol.rb +157 -0
  20. data/lib/chemistry_paradise/converters/celsius_to_fahrenheit.rb +143 -0
  21. data/lib/chemistry_paradise/converters/celsius_to_kelvin.rb +125 -0
  22. data/lib/chemistry_paradise/converters/fahrenheit_to_celsius.rb +132 -0
  23. data/lib/chemistry_paradise/converters/shared.rb +21 -0
  24. data/lib/chemistry_paradise/gui/gtk3/calculate_molecular_weight/calculate_molecular_weight.rb +34 -0
  25. data/lib/chemistry_paradise/gui/gtk3/show_periodic_table/show_periodic_table.rb +34 -0
  26. data/lib/chemistry_paradise/gui/gtk3/temperature_converter/temperature_converter.rb +112 -0
  27. data/lib/chemistry_paradise/gui/gtk3/wetter/wetter.rb +119 -0
  28. data/lib/chemistry_paradise/gui/libui/temperature_converter/temperature_converter.rb +100 -0
  29. data/lib/chemistry_paradise/gui/libui/wetter/wetter.rb +47 -0
  30. data/lib/chemistry_paradise/gui/shared_code/calculate_molecular_weight/calculate_molecular_weight_module.rb +171 -0
  31. data/lib/chemistry_paradise/gui/shared_code/show_periodic_table/show_periodic_table_module.rb +318 -0
  32. data/lib/chemistry_paradise/gui/shared_code/temperature_converter/temperature_converter_module.rb +192 -0
  33. data/lib/chemistry_paradise/gui/shared_code/wetter/wetter_module.rb +349 -0
  34. data/lib/chemistry_paradise/gui/swing/TemperatureConverter$1.class +0 -0
  35. data/lib/chemistry_paradise/gui/swing/TemperatureConverter.class +0 -0
  36. data/lib/chemistry_paradise/gui/swing/TemperatureConverter.java +133 -0
  37. data/lib/chemistry_paradise/gui/unified_widgets/wetter/wetter.rb +62 -0
  38. data/lib/chemistry_paradise/images/show_periodic_table.png +0 -0
  39. data/lib/chemistry_paradise/images/vienna_map.png +0 -0
  40. data/lib/chemistry_paradise/interactive_chemistry_shell.rb +246 -0
  41. data/lib/chemistry_paradise/project/project.rb +24 -0
  42. data/lib/chemistry_paradise/requires/common_external_requires.rb +17 -0
  43. data/lib/chemistry_paradise/requires/require_the_project.rb +21 -0
  44. data/lib/chemistry_paradise/requires/require_the_project_including_the_graphical_user_interface.rb +7 -0
  45. data/lib/chemistry_paradise/requires/require_the_project_including_the_web_interface.rb +4 -0
  46. data/lib/chemistry_paradise/shared.rb +130 -0
  47. data/lib/chemistry_paradise/show_electron_configuration.rb +250 -0
  48. data/lib/chemistry_paradise/show_element.rb +145 -0
  49. data/lib/chemistry_paradise/sinatra/sinatra.rb +131 -0
  50. data/lib/chemistry_paradise/sinatra/wetter/app.rb +68 -0
  51. data/lib/chemistry_paradise/sinatra/wetter/start_sinatra_interface.rb +31 -0
  52. data/lib/chemistry_paradise/split_molecule_names.rb +228 -0
  53. data/lib/chemistry_paradise/toplevel_methods/atomgewichte.rb +31 -0
  54. data/lib/chemistry_paradise/toplevel_methods/convert_parens.rb +64 -0
  55. data/lib/chemistry_paradise/toplevel_methods/display_where_the_molmasses_are_kept.rb +24 -0
  56. data/lib/chemistry_paradise/toplevel_methods/e.rb +16 -0
  57. data/lib/chemistry_paradise/toplevel_methods/kelvin.rb +34 -0
  58. data/lib/chemistry_paradise/toplevel_methods/language.rb +50 -0
  59. data/lib/chemistry_paradise/toplevel_methods/misc.rb +228 -0
  60. data/lib/chemistry_paradise/toplevel_methods/periodic_table.rb +16 -0
  61. data/lib/chemistry_paradise/toplevel_methods/remove_this_molecule_from.rb +63 -0
  62. data/lib/chemistry_paradise/toplevel_methods/roebe.rb +16 -0
  63. data/lib/chemistry_paradise/toplevel_methods/show_electron_negativity_chart.rb +26 -0
  64. data/lib/chemistry_paradise/utility_scripts/calculate_atomic_mass.rb +559 -0
  65. data/lib/chemistry_paradise/utility_scripts/combustion_analysis.rb +207 -0
  66. data/lib/chemistry_paradise/utility_scripts/electron_negativity_chart.rb +78 -0
  67. data/lib/chemistry_paradise/utility_scripts/equalize_chemical_formula.rb +84 -0
  68. data/lib/chemistry_paradise/utility_scripts/equation_solver.rb +130 -0
  69. data/lib/chemistry_paradise/utility_scripts/orbitals.rb +70 -0
  70. data/lib/chemistry_paradise/utility_scripts/show_electron_negativity_of_this_element.rb +103 -0
  71. data/lib/chemistry_paradise/utility_scripts/show_periodic_table.rb +996 -0
  72. data/lib/chemistry_paradise/verbose_chemical_calculation.rb +21 -0
  73. data/lib/chemistry_paradise/version/version.rb +19 -0
  74. data/lib/chemistry_paradise/wetter/wetter.rb +539 -0
  75. data/lib/chemistry_paradise/www/wetter/embeddable_interface.rb +78 -0
  76. data/lib/chemistry_paradise/www/wetter/wetter.cgi +28 -0
  77. data/lib/chemistry_paradise/yaml/atomgewichte.yml +139 -0
  78. data/lib/chemistry_paradise/yaml/colours_for_the_elements.yml +13 -0
  79. data/lib/chemistry_paradise/yaml/dichte.yml +21 -0
  80. data/lib/chemistry_paradise/yaml/electron_negativity_chart.yml +111 -0
  81. data/lib/chemistry_paradise/yaml/molecular_formula_of_different_molecules.yml +13 -0
  82. data/lib/chemistry_paradise/yaml/periodic_table_of_the_elements.yml +125 -0
  83. data/lib/chemistry_paradise.rb +1 -0
  84. data/test/testing_chemistry_paradise.rb +49 -0
  85. metadata +175 -0
@@ -0,0 +1,349 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::GUI::WetterModule
6
+ # =========================================================================== #
7
+ # require 'chemistry_paradise/gui/shared_code/wetter/wetter_module.rb'
8
+ # include ChemistryParadise::GUI::WetterModule
9
+ # =========================================================================== #
10
+ module ChemistryParadise
11
+
12
+ module GUI
13
+
14
+ module WetterModule
15
+
16
+ require 'chemistry_paradise/project/project.rb'
17
+ require 'chemistry_paradise/wetter/wetter.rb'
18
+
19
+ # ========================================================================= #
20
+ # === TITLE
21
+ # ========================================================================= #
22
+ TITLE = 'Wetter-Application'
23
+
24
+ # ========================================================================= #
25
+ # === WIDTH
26
+ # ========================================================================= #
27
+ WIDTH = '40% or minimum 260px'
28
+
29
+ # ========================================================================= #
30
+ # === HEIGHT
31
+ # ========================================================================= #
32
+ HEIGHT = '30% or minimum 220px'
33
+
34
+ # ========================================================================= #
35
+ # === USE_THIS_FONT
36
+ # ========================================================================= #
37
+ USE_THIS_FONT = 'Hack 18'
38
+
39
+ # ========================================================================= #
40
+ # === SMALLER_FONT
41
+ # ========================================================================= #
42
+ SMALLER_FONT = 'Hack 16'
43
+
44
+ # ========================================================================= #
45
+ # === SMALLEST_FONT
46
+ # ========================================================================= #
47
+ SMALLEST_FONT = 'Hack 12'
48
+
49
+ # ========================================================================= #
50
+ # === smaller_font?
51
+ # ========================================================================= #
52
+ def smaller_font?
53
+ SMALLER_FONT
54
+ end
55
+
56
+ # ========================================================================= #
57
+ # === smallest_font?
58
+ # ========================================================================= #
59
+ def smallest_font?
60
+ SMALLEST_FONT
61
+ end
62
+
63
+ # ========================================================================= #
64
+ # === reset_the_shared_module
65
+ # ========================================================================= #
66
+ def reset_the_shared_module
67
+ # ======================================================================= #
68
+ # === Set title, width height and font in one go
69
+ # ======================================================================= #
70
+ title_width_height_font(TITLE, WIDTH, HEIGHT, USE_THIS_FONT)
71
+ # ======================================================================= #
72
+ # === @favicon
73
+ # ======================================================================= #
74
+ @favicon = :tabble
75
+ # ======================================================================= #
76
+ # === @temperature
77
+ #
78
+ # Grab the current temperature next. Note that this can take a while
79
+ # since a remote website is queried for the information.
80
+ # ======================================================================= #
81
+ @temperature = nil
82
+ end
83
+
84
+ # ========================================================================= #
85
+ # === padding?
86
+ # ========================================================================= #
87
+ def padding?
88
+ 4
89
+ end
90
+
91
+ # ========================================================================= #
92
+ # === border_size?
93
+ # ========================================================================= #
94
+ def border_size?
95
+ 2
96
+ end
97
+
98
+ # ========================================================================= #
99
+ # === create_the_labels
100
+ # ========================================================================= #
101
+ def create_the_labels
102
+ # ======================================================================= #
103
+ # === @label_showing_the_temperature
104
+ # ======================================================================= #
105
+ @label_showing_the_temperature = bold_label
106
+ # ======================================================================= #
107
+ # === @label_current_temperature_in_vienna
108
+ # ======================================================================= #
109
+ @label_current_temperature_in_vienna = bold_label('Current temperature in Vienna:')
110
+ # ======================================================================= #
111
+ # === @small_label_showing_an_emoji
112
+ # ======================================================================= #
113
+ @small_label_showing_an_emoji = label
114
+ if use_gtk?
115
+ @small_label_showing_an_emoji.set_text(::Gtk::Emojis::SMILEY_6)
116
+ @small_label_showing_an_emoji.use_this_font = smallest_font?
117
+ end
118
+ end
119
+
120
+ # ========================================================================= #
121
+ # === determine_which_smiley_should_be_used
122
+ #
123
+ # This method is used to determine which smiley should be used.
124
+ # ========================================================================= #
125
+ def determine_which_smiley_should_be_used(
126
+ i = :infer
127
+ )
128
+ if use_gtk?
129
+ case i
130
+ when :infer
131
+ if @temperature.to_i < 8 # Below 8°C it is quite cold.
132
+ i = :cold
133
+ else # This is the default. Apply it above 8°C.
134
+ i = :warm
135
+ end
136
+ end
137
+ case i
138
+ # ======================================================================= #
139
+ # === :warm
140
+ # ======================================================================= #
141
+ when :warm
142
+ @small_label_showing_an_emoji.set_text(::Gtk::Emojis::SMILEY_6)
143
+ # ======================================================================= #
144
+ # === :cold
145
+ # ======================================================================= #
146
+ when :cold
147
+ @small_label_showing_an_emoji.set_text(::Gtk::Emojis::SMILEY_15)
148
+ end
149
+ end
150
+ end
151
+
152
+ # ========================================================================= #
153
+ # === create_the_main_window
154
+ # ========================================================================= #
155
+ def create_the_main_window
156
+ @main_window = window_or_vbox(
157
+ @title,
158
+ @width,
159
+ @height,
160
+ margin: true
161
+ )
162
+ end
163
+
164
+ # ========================================================================= #
165
+ # === main_window?
166
+ # ========================================================================= #
167
+ def main_window?
168
+ @main_window
169
+ end
170
+
171
+ # ========================================================================= #
172
+ # === connect_skeleton (connect tag)
173
+ # ========================================================================= #
174
+ def connect_skeleton
175
+ if use_gtk?
176
+ abort_on_exception
177
+ @main_window.add(@scrolled_window)
178
+ @main_window.show_all
179
+ minimal(@main_window)
180
+ end
181
+ end
182
+
183
+ # ========================================================================= #
184
+ # === return_the_temperature_string
185
+ # ========================================================================= #
186
+ def return_the_temperature_string(
187
+ i = @temperature
188
+ )
189
+ case i
190
+ when nil
191
+ result = ' [querying the temperature ... wait a moment]'
192
+ else
193
+ result = @temperature.to_s.dup
194
+ result << ' °C'
195
+ end
196
+ return result
197
+ end
198
+
199
+ # ========================================================================= #
200
+ # === create_the_buttons (buttons tag)
201
+ # ========================================================================= #
202
+ def create_the_buttons
203
+ # ======================================================================= #
204
+ # === @button_update (update tag)
205
+ # ======================================================================= #
206
+ @button_update = bold_button('_Update')
207
+ @button_update.clear_background
208
+ @button_update.use_this_font = smaller_font?
209
+ @button_update.bblack3
210
+ @button_update.pad8px
211
+ @button_update.on_hover(:lightblue)
212
+ @button_update.width_height(150, 40)
213
+ @button_update.hint = '<b>Clicking</b> on this button will '\
214
+ '<b>update the temperature display value</b> '\
215
+ 'shown above.'
216
+ @button_update.on_click_event {
217
+ do_the_actions_associated_with_the_update_button
218
+ }
219
+ end
220
+
221
+ # ========================================================================= #
222
+ # === create_skeleton (create tag)
223
+ #
224
+ # For libui to call this method, the main-window must have been
225
+ # defined already.
226
+ # ========================================================================= #
227
+ def create_skeleton
228
+ create_the_labels
229
+ create_the_buttons
230
+ create_the_main_window
231
+ a_hbox = padded_hbox
232
+ if use_gtk?
233
+ # ===================================================================== #
234
+ # Add a cute little weather-icon next, for ruby-gtk3.
235
+ # ===================================================================== #
236
+ weather_icon = ::Gtk.image(:weather_icon)
237
+ event_box = ::Gtk.eventbox(weather_icon)
238
+ event_box.signal_connect(:event) { |widget, event|
239
+ if button_press_event?(event)
240
+ attach_temperature_value_to_the_main_label
241
+ end
242
+ }
243
+ a_hbox.minimal(event_box, 4)
244
+ end
245
+ a_hbox.minimal(@label_current_temperature_in_vienna, 4)
246
+ a_hbox.minimal(@label_showing_the_temperature, 4)
247
+ a_hbox.minimal(@small_label_showing_an_emoji, 4)
248
+ outer_vbox = padded_vbox
249
+ outer_vbox.minimal(a_hbox)
250
+ tiny_hbox = hbox
251
+ tiny_hbox.minimal(@button_update)
252
+ tiny_hbox.horizontal_center
253
+ tiny_hbox.width_height(200, 45)
254
+ tiny_hbox.set_size_request(220, 50)
255
+ outer_vbox.minimal(tiny_hbox, 4)
256
+ if use_gtk?
257
+ this_file = ::ChemistryParadise.project_base_dir?+
258
+ 'images/vienna_map.png'
259
+ if File.exist? this_file
260
+ image_of_vienna = gtk_image(this_file)
261
+ image_of_vienna.pad8px
262
+ image_of_vienna.horizontal_center
263
+ outer_vbox.minimal(image_of_vienna, 8)
264
+ end
265
+ end
266
+ # ========================================================================= #
267
+ # Put it into a scrolled-window next.
268
+ # ========================================================================= #
269
+ @main_window.enable_free_form_css
270
+ @main_window.try_to_use_this_font(USE_THIS_FONT)
271
+ @main_window.set_border_width(8)
272
+ if use_gtk?
273
+ @main_window.signal_connect(:destroy) { ::Gtk.main_quit }
274
+ end
275
+ if use_gtk?
276
+ @scrolled_window = ::Gtk.scrolled_window(outer_vbox) { :always_scrollbars }
277
+ @scrolled_window.set_size_request(560, 280)
278
+ @scrolled_window.show_all
279
+ elsif use_libui?
280
+ outer_vbox.add_hsep
281
+ outer_vbox.minimal(quit_button)
282
+ @main_window.minimal(outer_vbox)
283
+ end
284
+ @main_window.try_to_add_default_CSS_rules
285
+ @main_window.show_all
286
+ end
287
+
288
+ # ========================================================================= #
289
+ # === do_the_actions_associated_with_the_update_button
290
+ # ========================================================================= #
291
+ def do_the_actions_associated_with_the_update_button
292
+ update_the_temperature_listing
293
+ end
294
+
295
+ # ========================================================================= #
296
+ # === attach_temperature_value_to_the_main_label
297
+ #
298
+ # Note that this has to be called once upon start-up.
299
+ # ========================================================================= #
300
+ def attach_temperature_value_to_the_main_label
301
+ update_the_temperature_listing
302
+ @label_showing_the_temperature.make_bold
303
+ end
304
+
305
+ # ========================================================================= #
306
+ # === update_the_temperature_listing
307
+ # ========================================================================= #
308
+ def update_the_temperature_listing
309
+ @temperature = nil # Reset it here.
310
+ _ = return_the_temperature_string
311
+ @label_showing_the_temperature.set_text(_)
312
+ @label_showing_the_temperature.set_colour(:royalblue)
313
+ @label_showing_the_temperature.make_bold
314
+ # ======================================================================= #
315
+ # We need to use a thread here so it does not block the main application.
316
+ # ======================================================================= #
317
+ Thread.new {
318
+ @temperature = ::ChemistryParadise::Wetter.return_temperature
319
+ @label_showing_the_temperature.set_text(return_the_temperature_string)
320
+ @label_showing_the_temperature.set_colour(:royalblue)
321
+ @label_showing_the_temperature.make_bold
322
+ # ===================================================================== #
323
+ # We will also updated the smiley.
324
+ # ===================================================================== #
325
+ determine_which_smiley_should_be_used
326
+ }
327
+ end; alias update_the_temperature update_the_temperature_listing # === update_the_temperature
328
+
329
+ # ========================================================================= #
330
+ # === run (run tag)
331
+ # ========================================================================= #
332
+ def run
333
+ if defined?(super)
334
+ super()
335
+ else # else we have to call the required methods on our own here.
336
+ create_skeleton
337
+ end
338
+ attach_temperature_value_to_the_main_label
339
+ @main_window.intelligent_exit
340
+ if use_libui?
341
+ run_main
342
+ end
343
+ end
344
+
345
+ end; end; end
346
+
347
+ if __FILE__ == $PROGRAM_NAME
348
+ ChemistryParadise::GUI::WetterModule
349
+ end # wetter.rb
@@ -0,0 +1,133 @@
1
+ /* package TemperatureConverter; */
2
+ import javax.swing.*;
3
+ import java.awt.*;
4
+ import java.awt.event.*;
5
+ import java.awt.Dimension;
6
+ import java.awt.event.KeyAdapter;
7
+ import java.awt.event.KeyEvent;
8
+
9
+ import java.util.Random;
10
+ import javax.swing.border.EmptyBorder;
11
+
12
+ public class TemperatureConverter {
13
+
14
+ private static final String TITLE = "Temperature Converter";
15
+ JTextField entry1,
16
+ entry2,
17
+ entry3;
18
+ /*
19
+ * Main constructor (def initialize)
20
+ */
21
+ public TemperatureConverter() {
22
+ run();
23
+ }
24
+ /*
25
+ * run()
26
+ */
27
+ void run() {
28
+ JFrame frame = new JFrame(TITLE);
29
+
30
+ frame.setLayout(new GridLayout(4, 3));
31
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
32
+
33
+ JLabel label_title = new JLabel(TITLE);
34
+ label_title.setFont(new Font("Serif", Font.PLAIN, 30)); /* Set a new font size */
35
+
36
+ frame.add(label_title);
37
+ frame.add(new JLabel(""));
38
+ frame.add(new JLabel(""));
39
+
40
+ /* Celsius */
41
+ JLabel label1 = new JLabel("Celsius:");
42
+ label1.setFont(new Font("Serif", Font.PLAIN, 20));
43
+ frame.add(label1);
44
+ JTextField entry1 = new JTextField(30);
45
+ entry1.setFont(new Font("Serif", Font.PLAIN, 20));
46
+ entry1.setMargin(new Insets(4, 4, 4, 4));
47
+ entry1.setHorizontalAlignment(JTextField.CENTER);
48
+ entry1.setFocusable(true);
49
+ frame.add(entry1);
50
+ frame.add(new JLabel(""));
51
+
52
+ /* Fahrenheit */
53
+ JLabel label2 = new JLabel("Fahrenheit:");
54
+ label2.setFont(new Font("Serif", Font.PLAIN, 20));
55
+ frame.add(label2);
56
+ JTextField entry2 = new JTextField(30);
57
+ entry2.setFont(new Font("Serif", Font.PLAIN, 20));
58
+ entry2.setMargin(new Insets(4, 4, 4, 4));
59
+ entry2.setHorizontalAlignment(JTextField.CENTER);
60
+ entry2.setFocusable(true);
61
+ frame.add(entry2);
62
+ frame.add(new JLabel(""));
63
+
64
+ /* Kelvin */
65
+ JLabel label3 = new JLabel("Kelvin:");
66
+ label3.setFont(new Font("Serif", Font.PLAIN, 20));
67
+ frame.add(label3);
68
+ JTextField entry3 = new JTextField(30);
69
+ entry3.setFont(new Font("Serif", Font.PLAIN, 20));
70
+ entry3.setMargin(new Insets(4, 4, 4, 4));
71
+ entry3.setHorizontalAlignment(JTextField.CENTER);
72
+ entry3.setFocusable(true);
73
+ frame.add(entry3);
74
+
75
+ // Listen to every key event on the label
76
+ entry1.addKeyListener(new KeyAdapter() {
77
+ @Override
78
+ public void keyReleased(KeyEvent e){
79
+ /* Set the text with the key typed */
80
+ String x = entry1.getText();
81
+
82
+ int work_with_this_value = Integer.parseInt(x);
83
+
84
+ String new_value_to_set_for_fahrenheit = String.valueOf(
85
+ convert_celsius_to_fahrenheit(work_with_this_value)
86
+ );
87
+ entry2.setText(new_value_to_set_for_fahrenheit);
88
+
89
+ /* DEBUGGING:
90
+ en(KeyEvent.getKeyText(e.getKeyCode()));
91
+ */
92
+ String new_value_to_set_for_kelvin = String.valueOf(
93
+ convert_celsius_to_kelvin(work_with_this_value)
94
+ );
95
+ entry3.setText(new_value_to_set_for_kelvin);
96
+ }
97
+ });
98
+
99
+ frame.setSize(1200, 500);
100
+ frame.setVisible(true);
101
+
102
+ }
103
+ /*
104
+ * To convert temperatures in degrees Celsius to
105
+ * Fahrenheit, multiply by 1.8 (or 9/5) and add 32.
106
+ *
107
+ *
108
+ * Example: (30°C x 1.8) + 32 = 86°F
109
+ */
110
+
111
+ double convert_celsius_to_fahrenheit(int n_celsius) {
112
+ return (n_celsius * 1.8) + 32;
113
+ }
114
+ /*
115
+ * T (K) = T (°C) + 273.15
116
+ */
117
+ double convert_celsius_to_kelvin(int n_celsius) {
118
+ return n_celsius + 273.15;
119
+ }
120
+
121
+ public static void e(String i) {
122
+ System.out.print(i);
123
+ }
124
+
125
+ public static void en(String i) {
126
+ System.out.println(i);
127
+ }
128
+
129
+ public static void main(String[] args) {
130
+ TemperatureConverter x = new TemperatureConverter();
131
+ }
132
+
133
+ }
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === ChemistryParadise::Gui::UnifiedWidgets::WheatherApp
6
+ #
7
+ # Usage example:
8
+ #
9
+ # ChemistryParadise::Gui::UnifiedWidgets::WheatherApp.new(ARGV)
10
+ #
11
+ # =========================================================================== #
12
+ # require 'chemistry_paradise/gui/unified_widgets/wetter/wetter.rb'
13
+ # Wetter::GUI::WheatherApp.new
14
+ # =========================================================================== #
15
+ module ChemistryParadise
16
+
17
+ module GUI
18
+
19
+ module UnifiedWidgets
20
+
21
+ class WheatherApp # === Wetter::Gui::UnifiedWidgets::WheatherApp
22
+
23
+ require 'chemistry_paradise/gui/shared_code/wetter/wetter_module.rb'
24
+ include ChemistryParadise::GUI::WetterModule
25
+
26
+ begin
27
+ require 'simple_widgets'
28
+ include SimpleWidgets
29
+ extend SimpleWidgets
30
+ rescue LoadError; end
31
+
32
+ # ========================================================================= #
33
+ # Toggle the GUI in use here after setting a default:
34
+ # ========================================================================= #
35
+ use :libui # :gtk3
36
+
37
+ # ========================================================================= #
38
+ # === initialize
39
+ # ========================================================================= #
40
+ def initialize(
41
+ i = ARGV,
42
+ run_already = true
43
+ )
44
+ reset
45
+ parse_this_input_for_proper_widget_support(i)
46
+ run if run_already
47
+ end
48
+
49
+ # ========================================================================= #
50
+ # === reset
51
+ # ========================================================================= #
52
+ def reset
53
+ reset_the_shared_module
54
+ reset_the_internal_variables
55
+ infer_the_size_automatically
56
+ end
57
+
58
+ end; end; end; end
59
+
60
+ if __FILE__ == $PROGRAM_NAME
61
+ ChemistryParadise::GUI::UnifiedWidgets::WheatherApp.new(ARGV)
62
+ end # wetter_app