Class: ArcadiaProblemsShower
- Inherits:
-
Object
- Object
- ArcadiaProblemsShower
- Defined in:
- lib/a-core.rb
Instance Method Summary collapse
- #append_problem(e) ⇒ Object
- #button_text ⇒ Object
-
#initialize(_arcadia) ⇒ ArcadiaProblemsShower
constructor
A new instance of ArcadiaProblemsShower.
- #initialize_gui ⇒ Object
- #new_sequence_value ⇒ Object
- #on_after_initialize(_event) ⇒ Object
- #on_arcadia_problem(_event) ⇒ Object
- #show_problems ⇒ Object
Constructor Details
#initialize(_arcadia) ⇒ ArcadiaProblemsShower
Returns a new instance of ArcadiaProblemsShower.
1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 |
# File 'lib/a-core.rb', line 1983 def initialize(_arcadia) @arcadia = _arcadia @showed = false @initialized = false #@visible = false @problems = Array.new @seq = 0 @dmc=0 @rec=0 Arcadia.attach_listener(self, ArcadiaProblemEvent) Arcadia.attach_listener(self, InitializeEvent) end |
Instance Method Details
#append_problem(e) ⇒ Object
2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 |
# File 'lib/a-core.rb', line 2120 def append_problem(e) # parent_node='root' case e.type when ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE # parent_node='dependences_missing_node' text = Arcadia.text("main.ps.dependences_missing") # if [email protected]?(parent_node) # @tree.insert('end', 'root' ,parent_node, { # 'text' => text , # 'helptext' => text, # 'drawcross'=>'auto', # 'deltax'=>-1, # 'image'=> Arcadia.image_res(BROKEN_GIF) # }.update(Arcadia.style('treeitem')) # ) # # end # @dmc+=1 # @tree.itemconfigure('dependences_missing_node','text'=>"#{text} (#{@dmc})" ) when ArcadiaProblemEvent::RUNTIME_ERROR_TYPE # parent_node='runtime_error_node' text = Arcadia.text("main.ps.runtime_errors") # if [email protected]?(parent_node) # @tree.insert('end', 'root' ,parent_node, { # 'text' => text , # 'helptext' => text, # 'drawcross'=>'auto', # 'deltax'=>-1, # 'image'=> Arcadia.image_res(ERROR_GIF) # }.update(Arcadia.style('treeitem')) #.update({'fill'=>Arcadia.conf('inactiveforeground')})) # ) # end # @rec+=1 # @tree.itemconfigure('runtime_error_node','text'=>"#{text} (#{@rec})" ) end output_mark = Arcadia.console(self,'msg'=>"#{text} : ", 'level'=>'system_error', 'mark'=>output_mark) title_node="node_#{new_sequence_value}" detail_node="detail_of_#{title_node}" # @tree.insert('end', parent_node ,title_node, { # 'text' => e.title , # 'helptext' => e.title, # 'drawcross'=>'auto', # 'deltax'=>-1, # 'image'=> Arcadia.image_res(ITEM_GIF) # }.update(Arcadia.style('treeitem')) # ) if e.detail.kind_of?(Array) # e.detail.each_with_index{|line,i| # @tree.insert('end', title_node , "#{detail_node}_#{i}" , { # 'text' => line , # 'helptext' => i.to_s, # 'drawcross'=>'auto', # 'deltax'=>-1, # 'image'=> Arcadia.image_res(ITEM_DETAIL_GIF) # }.update(Arcadia.style('treeitem')) # ) # } else # @tree.insert('end', title_node , detail_node , { # 'text' => e.detail , # 'helptext' => e.title, # 'drawcross'=>'auto', # 'deltax'=>-1, # 'image'=> Arcadia.image_res(ITEM_DETAIL_GIF) # }.update(Arcadia.style('treeitem')) # ) end output_mark = Arcadia.console(self,'msg'=>"#{e.title}\n> #{e.detail}", 'level'=>'system_error', 'mark'=>output_mark, 'append'=>true) end |
#button_text ⇒ Object
2045 2046 2047 |
# File 'lib/a-core.rb', line 2045 def @problems.count > 1 ? Arcadia.text("main.ps.problems", [@problems.count]) : Arcadia.text("main.ps.problem", [@problems.count]) end |
#initialize_gui ⇒ Object
2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 |
# File 'lib/a-core.rb', line 2050 def initialize_gui # float_frame # args = {'width'=>600, 'height'=>300, 'x'=>400, 'y'=>100} # @ff = @arcadia.layout.add_float_frame(args).hide # @ff.title(Arcadia.text("main.ps.title")) # # #tree # @tree = BWidgetTreePatched.new(@ff.frame, Arcadia.style('treepanel')){ # showlines false # deltay 22 # } # @tree.extend(TkScrollableWidget).show(0,0) # # do_double_click = proc{ # _selected = @tree.selected # _selected_text = @tree.itemcget(_selected, 'text') # if _selected_text # _file, _row, _other = _selected_text.split(':') # if File.exist?(_file) # begin # r = _row.strip.to_i # integer = true # rescue Exception => e # integer = false # end # if integer # OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>r).go! # end # end # end # } # @tree.textbind_append('Double-1',do_double_click) # # # # call button # command = proc{ # if @ff.visible? # @ff.hide # #@visible = false # else # @ff.show # #@visible = true # end # } # # b_style = Arcadia.style('toolbarbutton') # b_style["relief"]='groove' # # b_style["borderwidth"]=2 # b_style["highlightbackground"]='red' # # b_text = button_text # # @b_err = Tk::BWidget::Button.new(@arcadia['toolbar'].frame, b_style){ # image Arcadia.image_res(ALERT_GIF) # compound 'left' # padx 2 # command command if command # #width 100 # #height 20 # #helptext _hint if _hint # text b_text # }.pack('side' =>'left','before'=>@arcadia['toolbar'].items.values[0].item_obj, :padx=>2, :pady=>0) end |
#new_sequence_value ⇒ Object
2116 2117 2118 |
# File 'lib/a-core.rb', line 2116 def new_sequence_value @seq+=1 end |
#on_after_initialize(_event) ⇒ Object
2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
# File 'lib/a-core.rb', line 2008 def on_after_initialize(_event) @initialized = true if @problems.count > 0 show_problems Thread.new do num_sleep = 0 while TkWinfo.viewable(Arcadia.layout.root) == false && num_sleep < 20 sleep(1) num_sleep += 1 end @ff.show end # p TkWinfo.viewable(Arcadia.layout.root) # Tk.after(1000, proc{@ff.show; p TkWinfo.viewable(Arcadia.layout.root)}) end end |
#on_arcadia_problem(_event) ⇒ Object
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 |
# File 'lib/a-core.rb', line 1996 def on_arcadia_problem(_event) @problems << _event if @initialized if !@showed show_problems else append_problem(_event) #@b_err.configure('text'=> button_text) end end end |
#show_problems ⇒ Object
2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 |
# File 'lib/a-core.rb', line 2026 def show_problems begin initialize_gui @problems.each{|e| append_problem(e) } # if @tree.exist?('dependences_missing_node') # @tree.open_tree('dependences_missing_node', true) # end # if @tree.exist?('runtime_error_node') # @tree.open_tree('runtime_error_node', true) # end @showed=true rescue RuntimeError => e Arcadia.detach_listener(self, ArcadiaProblemEvent) Arcadia.detach_listener(self, InitializeEvent) end end |