Module: Themigrator::UI::LogArea
Defined Under Namespace
Classes: LogWindow
Instance Method Summary collapse
- #initialize_log_area(roles, progress_monitor) ⇒ Object
- #la_append(action, role, msg) ⇒ Object
- #la_initialize? ⇒ Boolean
- #la_npage ⇒ Object
- #la_ppage ⇒ Object
- #la_render ⇒ Object
- #la_switch_action(action) ⇒ Object
Instance Method Details
#initialize_log_area(roles, progress_monitor) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/themigrator/ui/log_area.rb', line 113 def initialize_log_area(roles, progress_monitor) @la_pm = progress_monitor @la_roles = roles @la_scripts = Themigrator::Migration::SCRIPTS @la_actions = Themigrator::Migration::ACTIONS @la_current_action = nil @la_lines = lines @la_cols = cols @la_mutex = Mutex.new # @windows = Hash.new {|h,a| h[a] = {} } # @windows[action][role] @la_windows @la_windows = Hash.new do |h, action| role_windows = {} @la_roles.each_with_index do |role, n| column_height = @la_lines - 4 column_width = @la_cols / @la_roles.size top = 2 left = column_width * n w = LogWindow.new(column_height, column_width - 1, top, left) w.role = role w.action = action w.progress_monitor = @la_pm role_windows[role] = w end h[action] = role_windows end end |
#la_append(action, role, msg) ⇒ Object
162 163 164 165 166 |
# File 'lib/themigrator/ui/log_area.rb', line 162 def la_append(action, role, msg) @la_mutex.synchronize do la_get_window(action, role).append(msg) end end |
#la_initialize? ⇒ Boolean
142 143 144 |
# File 'lib/themigrator/ui/log_area.rb', line 142 def la_initialize? defined?(@la_roles) end |
#la_npage ⇒ Object
146 147 148 |
# File 'lib/themigrator/ui/log_area.rb', line 146 def la_npage la_each_window { |w,_role| w.nextpage } end |
#la_ppage ⇒ Object
150 151 152 |
# File 'lib/themigrator/ui/log_area.rb', line 150 def la_ppage la_each_window { |w,_role| w.prevpage } end |
#la_render ⇒ Object
168 169 170 171 172 |
# File 'lib/themigrator/ui/log_area.rb', line 168 def la_render la_each_window do |w, _role| w.render end end |
#la_switch_action(action) ⇒ Object
154 155 156 157 158 159 160 |
# File 'lib/themigrator/ui/log_area.rb', line 154 def la_switch_action(action) return if @la_current_action == action || @la_roles.empty? @la_current_action = action.to_s @la_roles.each do |role| la_get_window(action, role).redraw end end |