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.
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 |
# File 'lib/a-core.rb', line 1890 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
2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 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 |
# File 'lib/a-core.rb', line 2022 def append_problem(e) parent_node='root' case e.type when ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE parent_node='dependences_missing_node' text = "Dependences missings" if !@tree.exist?(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')) #.update({'fill'=>Arcadia.conf('inactiveforeground')})) ) end @dmc+=1 @tree.itemconfigure('dependences_missing_node','text'=>"#{text} (#{@dmc})" ) when ArcadiaProblemEvent::RUNTIME_ERROR_TYPE parent_node='runtime_error_node' text = "Runtime errors" if !@tree.exist?(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 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')) #.update({'fill'=>Arcadia.conf('inactiveforeground')})) ) 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')) #.update({'fill'=>Arcadia.conf('inactiveforeground')})) ) } 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')) #.update({'fill'=>Arcadia.conf('inactiveforeground')})) ) end end |
#button_text ⇒ Object
1942 1943 1944 |
# File 'lib/a-core.rb', line 1942 def @problems.count > 1 ? "#{@problems.count} problems" : "#{@problems.count} problem" end |
#initialize_gui ⇒ Object
1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 |
# File 'lib/a-core.rb', line 1947 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 problems") #tree @tree = BWidgetTreePatched.new(@ff.frame, Arcadia.style('treepanel')){ showlines false deltay 22 # opencmd do_open_folder_cmd # closecmd do_close_folder_cmd # selectcommand do_select_item # crosscloseimage TkPhotoImage.new('dat' => PLUS_GIF) # crossopenimage TkPhotoImage.new('dat' => MINUS_GIF) } @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 = @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
2018 2019 2020 |
# File 'lib/a-core.rb', line 2018 def new_sequence_value @seq+=1 end |
#on_after_initialize(_event) ⇒ Object
1915 1916 1917 1918 1919 1920 1921 |
# File 'lib/a-core.rb', line 1915 def on_after_initialize(_event) @initialized = true if @problems.count > 0 show_problems @ff.show end end |
#on_arcadia_problem(_event) ⇒ Object
1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 |
# File 'lib/a-core.rb', line 1903 def on_arcadia_problem(_event) @problems << _event if @initialized if !@showed show_problems else append_problem(_event) @b_err.configure('text'=> ) end end end |
#show_problems ⇒ Object
1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 |
# File 'lib/a-core.rb', line 1923 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 |