Class: ArcadiaAboutSplash

Inherits:
TkToplevel
  • Object
show all
Defined in:
lib/a-core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArcadiaAboutSplash

Returns a new instance of ArcadiaAboutSplash.



1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
# File 'lib/a-core.rb', line 1794

def initialize
  #_bgcolor = '#B83333'
  _bgcolor = '#000000'
  super()
  relief 'groove'
  #relief 'flat'
  background  _bgcolor
  highlightbackground  _bgcolor
  highlightthickness  1
  borderwidth 2
  withdraw
  overrideredirect(true)
  # dim 60x86
  @llogo = TkLabel.new(self){
    image  Arcadia.image_res(A_LOGO_GIF)
    background  _bgcolor
    place('x'=> 20,'y' => 20)
  }


  #    @tkLabel1 = TkLabel.new(self){
  #      text 'Arcadia'
  #      background  _bgcolor
  #      foreground  '#ffffff'
  #      font Arcadia.conf('splash.title.font')
  #      justify  'left'
  #      place('width' => '190','x' => 110,'y' => 10,'height' => 25)
  #    }

  @tkLabel1 = TkLabel.new(self){
    image  Arcadia.image_res(ARCADIA_JAP_WHITE_GIF)
    background  _bgcolor
    justify  'left'
    place('x' => 90,'y' => 10)
  }

  @tkLabelRuby = TkLabel.new(self){
    image Arcadia.image_res(RUBY_DOCUMENT_GIF)
    background  _bgcolor
    place('x'=> 210,'y' => 12)
  }

  @tkLabel2 = TkLabel.new(self){
    text  'Arcadia IDE'
    background  _bgcolor
    foreground  '#ffffff'
    font Arcadia.instance['conf']['splash.subtitle.font']
    justify  'left'
    place('x' => 100,'y' => 40,'height' => 19)
  }
  @tkLabelVersion = TkLabel.new(self){
    text Arcadia.text('main.about.version', [$arcadia['applicationParams'].version])
    background  _bgcolor
    foreground  '#ffffff'
    font Arcadia.instance['conf']['splash.version.font']
    justify  'left'
    place('x' => 100,'y' => 65,'height' => 19)
  }
  @tkLabel21 = TkLabel.new(self){
    text  Arcadia.text("main.about.by", ['Antonio Galeone - 2004/2014'])
    background  _bgcolor
    foreground  '#ffffff'
    font Arcadia.instance['conf']['splash.credits.font']
    justify  'left'
    anchor 'w'
    place('width' => '220','x' => 100,'y' => 95,'height' => 25)
  }

  @tkLabelCredits = TkLabel.new(self){
    text  Arcadia.text("main.about.contributors", ['Roger D. Pack'])
    background  _bgcolor
    foreground  '#ffffff'
    font Arcadia.instance['conf']['splash.credits.font']
    justify  'left'
    anchor 'w'
    place('width' => '210','x' => 100,'y' => 115,'height' => 25)
  }

  @tkLabelStep = TkLabel.new(self){
    text  ''
    background  _bgcolor
    foreground  '#666666'
    font Arcadia.instance['conf']['splash.banner.font']
    justify  'left'
    anchor  'w'
    place('width'=>-5,'relwidth' => 1,'x' => 5,'y' => 160,'height' => 45)
  }
  @progress  = TkVariable.new
  reset
  _width = 380
  _height = 210
  #_width = 0;_height = 0
  _x = TkWinfo.screenwidth(self)/2 -  _width / 2
  _y = TkWinfo.screenheight(self)/2 -  _height / 2
  geometry = _width.to_s+'x'+_height.to_s+'+'+_x.to_s+'+'+_y.to_s
  Tk.tk_call('wm', 'geometry', self, geometry )
  #bind("ButtonPress-1", proc{self.destroy})
  bind("Double-Button-1", proc{self.destroy})
  info = TkApplication.sys_info
  set_sysinfo(info)
  Arcadia.attach_listener(self, ArcadiaProblemEvent)
  Arcadia.attach_listeners_listener(self, BuildEvent)
end

Instance Attribute Details

#progressObject (readonly)

Returns the value of attribute progress.



1793
1794
1795
# File 'lib/a-core.rb', line 1793

def progress
  @progress
end

Instance Method Details

#labelStep(_txt) ⇒ Object



1968
1969
1970
1971
# File 'lib/a-core.rb', line 1968

def labelStep(_txt)
  @tkLabelStep.text = _txt
  Tk.update
end

#last_step(_txt = nil) ⇒ Object



1973
1974
1975
1976
1977
1978
# File 'lib/a-core.rb', line 1973

def last_step(_txt = nil)
  @progress.numeric = @max
  labelStep(_txt) if _txt
  Arcadia.detach_listener(self, ArcadiaProblemEvent)
  Arcadia.detach_listeners_listener(self, BuildEvent)
end

#next_step(_txt = nil) ⇒ Object



1958
1959
1960
1961
# File 'lib/a-core.rb', line 1958

def next_step(_txt = nil)
  @progress.numeric += 1
  labelStep("#{perc}% #{_txt}")
end

#on_after_build(_event, _listener) ⇒ Object



1906
1907
1908
# File 'lib/a-core.rb', line 1906

def on_after_build(_event, _listener)
  next_step("... after building #{_listener.class}")
end

#on_arcadia_problem(_event) ⇒ Object



1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
# File 'lib/a-core.rb', line 1914

def on_arcadia_problem(_event)
  if !defined?(@problems_nums)
    @problems_nums=0
    #@problem_str = proc{@problems_nums > 1 ? "#{@problems_nums} problems found!" : "#{@problem_nums} problem found!"}
    @tkAlert = TkLabel.new(self){
      image Arcadia.image_res(ALERT_GIF)
      background  'black'
      place('x'=> 10,'y' => 152)
    }

    @tkLabelProblems = TkLabel.new(self){
      text  ''
      background  'black'
      foreground  'red'
      font Arcadia.instance['conf']['splash.problems.font']
      justify  'left'
      anchor 'w'
      place('width' => '210','x' => 28,'y' => 150,'height' => 25)
    }
  end
  @problems_nums=@problems_nums+1
  @tkLabelProblems.text=problem_str if @tkLabelProblems
end

#on_before_build(_event, _listener) ⇒ Object



1902
1903
1904
# File 'lib/a-core.rb', line 1902

def on_before_build(_event, _listener)
  next_step("... pre building #{_listener.class}")
end

#on_build(_event, _listener) ⇒ Object



1898
1899
1900
# File 'lib/a-core.rb', line 1898

def on_build(_event, _listener)
  next_step("... building #{_listener.class}")
end

#percObject



1963
1964
1965
1966
# File 'lib/a-core.rb', line 1963

def perc
  ret = @progress.numeric*100/@max
  ret > 100 ? 100:ret
end

#problem_strObject



1910
1911
1912
# File 'lib/a-core.rb', line 1910

def problem_str
  @problems_nums > 1 ? "#{@problems_nums} problems found!" : "#{@problems_nums} problem found!"
end

#resetObject



1954
1955
1956
# File 'lib/a-core.rb', line 1954

def reset
  @progress.value = -1
end

#set_progress(_max = 10) ⇒ Object



1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
# File 'lib/a-core.rb', line 1942

def set_progress(_max=10)
  @max = _max
  Tk::BWidget::ProgressBar.new(self, :width=>150, :height=>10,
    :background=>'#000000',
    :troughcolor=>'#000000',
    :foreground=>'#666666',
    :variable=>@progress,
    :borderwidth=>0,
    :relief=>'flat',
    :maximum=>_max).place('relwidth' => '1','y' => 144,'height' => 6)
end

#set_sysinfo(_info) ⇒ Object



1938
1939
1940
# File 'lib/a-core.rb', line 1938

def set_sysinfo(_info)
  @tkLabelStep.text(_info)
end