Class: MetaRuby::GUI::ExceptionView Deprecated

Inherits:
Qt::WebView
  • Object
show all
Defined in:
lib/metaruby/gui/exception_view.rb

Overview

Deprecated.

Widget that allows to display a list of exceptions

instead

Constant Summary collapse

TEMPLATE =
<<-EOD
<head>
<%= exception_rendering.head %>
</head>
<%= exception_rendering.scripts %>
<body>
<table class="exception_list">
<%= each_exception.each_with_index.map do |(e, reason), idx|
        exception_rendering.render(e, reason, idx)
    end.join("\\n") %>
</table>
</body>
EOD

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ ExceptionView

Returns a new instance of ExceptionView.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/metaruby/gui/exception_view.rb', line 20

def initialize(parent = nil)
    super

    @displayed_exceptions = []
    self.focus_policy = Qt::NoFocus

    @metaruby_page = HTML::Page.new(self.page)
    connect(@metaruby_page, SIGNAL('fileOpenClicked(const QUrl&)'),
            self, SLOT('fileOpenClicked(const QUrl&)'))
    @exception_rendering = ExceptionRendering.new(metaruby_page)

    if ENV['METARUBY_GUI_DEBUG_HTML']
        page.settings.setAttribute(Qt::WebSettings::DeveloperExtrasEnabled, true)
        @inspector = Qt::WebInspector.new
        @inspector.page = page
        @inspector.show
    end
end

Instance Attribute Details

#displayed_exceptionsObject (readonly)

Returns the value of attribute displayed_exceptions.



11
12
13
# File 'lib/metaruby/gui/exception_view.rb', line 11

def displayed_exceptions
  @displayed_exceptions
end

#exception_rendering#head, ... (readonly)

Returns an object that allows to render exceptions in HTML.

Returns:

  • (#head, #scripts, #render)

    an object that allows to render exceptions in HTML



18
19
20
# File 'lib/metaruby/gui/exception_view.rb', line 18

def exception_rendering
  @exception_rendering
end

#metaruby_pageHTML::Page (readonly)

Returns the page object that allows to infer.

Returns:

  • (HTML::Page)

    the page object that allows to infer



14
15
16
# File 'lib/metaruby/gui/exception_view.rb', line 14

def metaruby_page
  @metaruby_page
end

Instance Method Details

#clearObject



48
49
50
51
# File 'lib/metaruby/gui/exception_view.rb', line 48

def clear
    @displayed_exceptions.clear
    update_html
end

#contents_heightObject



80
81
82
# File 'lib/metaruby/gui/exception_view.rb', line 80

def contents_height
    self.page.main_frame.contents_size.height
end

#each_exception(&block) ⇒ Object



53
54
55
# File 'lib/metaruby/gui/exception_view.rb', line 53

def each_exception(&block)
    @displayed_exceptions.each(&block)
end

#exceptions=(list) ⇒ Object



75
76
77
78
# File 'lib/metaruby/gui/exception_view.rb', line 75

def exceptions=(list)
    @displayed_exceptions = list.dup
    update_html
end

#push(exception, reason = nil) ⇒ Object



43
44
45
46
# File 'lib/metaruby/gui/exception_view.rb', line 43

def push(exception, reason = nil)
    @displayed_exceptions << [exception, reason]
    update_html
end

#update_htmlObject



71
72
73
# File 'lib/metaruby/gui/exception_view.rb', line 71

def update_html
    self.html = ERB.new(TEMPLATE).result(binding)
end

#user_file_filter=(filter) ⇒ Object



39
40
41
# File 'lib/metaruby/gui/exception_view.rb', line 39

def user_file_filter=(filter)
    exception_rendering.user_file_filter = filter
end