Class: AimsProject::CalculationTree
- Inherits:
-
Wx::ScrolledWindow
- Object
- Wx::ScrolledWindow
- AimsProject::CalculationTree
- Includes:
- Wx
- Defined in:
- lib/aims_project/calculation_tree.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#treeControl ⇒ Object
Returns the value of attribute treeControl.
Instance Method Summary collapse
- #init_tree ⇒ Object
-
#initialize(app, window) ⇒ CalculationTree
constructor
A new instance of CalculationTree.
- #show_calculation(calc) ⇒ Object
Constructor Details
#initialize(app, window) ⇒ CalculationTree
Returns a new instance of CalculationTree.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/aims_project/calculation_tree.rb', line 9 def initialize(app, window) super(window) self.app = app init_tree sizer = BoxSizer.new(VERTICAL) sizer.add(self.treeControl, 1, EXPAND | ALL, 5) set_auto_layout(true) set_sizer(sizer) end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
7 8 9 |
# File 'lib/aims_project/calculation_tree.rb', line 7 def app @app end |
#treeControl ⇒ Object
Returns the value of attribute treeControl.
7 8 9 |
# File 'lib/aims_project/calculation_tree.rb', line 7 def treeControl @treeControl end |
Instance Method Details
#init_tree ⇒ Object
22 23 24 25 |
# File 'lib/aims_project/calculation_tree.rb', line 22 def init_tree @treeControl = Wx::TreeCtrl.new(self) root = self.treeControl.add_root("-") end |
#show_calculation(calc) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/aims_project/calculation_tree.rb', line 27 def show_calculation(calc) @tree_map = {} @treeControl.delete_all_items root = self.treeControl.add_root(calc.name) input_geom = @treeControl.append_item(root, calc.geometry) @tree_map[input_geom] = calc.input_geometry @treeControl.append_item(root, calc.control) @treeControl.append_item(root, calc.status) @treeControl.append_item(root, "CONVERGED: #{calc.converged?}") # @treeControl.append_item(root, calc.output.total_wall_time) if calc.output calc.output.geometry_steps.each{|step| step_id = @treeControl.append_item(root, "Step %i" % step.step_num) @tree_map[step_id] = step @treeControl.append_item(step_id, "Total Energy: %f" % step.total_energy) @treeControl.append_item(step_id, "SC Iters: %i" % step.sc_iterations.size) @treeControl.append_item(step_id, "Wall Time: %f" % step.total_wall_time.to_s) } end @treeControl.(root) # self.app.project.calculations.each{|calc| # calcid = self.treeControl.append_item(root, calc.name) # @tree_map[calcid] = calc # } evt_tree_sel_changed(self.treeControl) {|evt| item = @tree_map[evt.get_item] if item.is_a? Aims::GeometryStep self.app.show_geometry(item.geometry) end if item.is_a? Aims::Geometry self.app.show_geometry(item) end } end |