basic status view (without updates)

This commit is contained in:
Torsten Ruger 2015-08-20 20:03:00 +02:00
parent 0e430e8b00
commit 287277ef59
3 changed files with 24 additions and 8 deletions

View File

@ -5,6 +5,7 @@ require "salama"
require "interpreter/interpreter"
require "list_view"
require_relative "class_view"
require_relative "status_view"
#require_relative "registers_view"
#require_relative "object_view"
#require_relative "space_view"
@ -26,7 +27,7 @@ class MainView < ListView
machine.run_before "Register::CallImplementation"
@interpreter = Interpreter::Interpreter.new
super( [ClassView.new(@interpreter)] )
super( [ClassView.new(@interpreter) , StatusView.new(@interpreter)] )
end
def draww

View File

@ -1,7 +0,0 @@
class Point
def initialize x = 0 , y = 0
@x = x
@y = y
end
attr_accessor :x , :y
end

22
lib/status_view.rb Normal file
View File

@ -0,0 +1,22 @@
class StatusView < ElementView
def initialize interpreter
@interpreter = interpreter
end
def draw
DOM do |dom|
dom.div.status_view do
dom.h4 {"Interpreter"}
dom.span "Instruction #{@interpreter.clock}"
dom.button { "Next"}
dom.span "State #{@interpreter.state}"
dom.br{""}
dom.span{ "Link #{@interpreter.link}"}
dom.br{"Stdout"}
dom.span { @interpreter.stdout}
end
end
end
end