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.


2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
# File 'lib/a-core.rb', line 2253

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)
    place('x'=> 140,'y' => 55)
  }


  #    @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)
#    }

  @tkLabel1 = TkLabel.new(self){
    image  Arcadia.image_res(ARCADIA_7THE_GIF)
    background  _bgcolor
    justify  'left'
    place('x' => 26,'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  '#009999'
    font Arcadia.instance['conf']['splash.version.font']
    justify  'left'
    #place('x' => 100,'y' => 65,'height' => 19)
    place('x' => 28,'y' => 47,'height' => 19)
  }
  @tkLabel21 = TkLabel.new(self){
    text  Arcadia.text("main.about.by", ['Antonio Galeone - 2004/2015'])
    background  _bgcolor
    foreground  '#009999'
    font Arcadia.instance['conf']['splash.credits.font']
    justify  'left'
    anchor 'w'
    place('width' => '220','x' => 28,'y' => 32,'height' => 19)
  }

#    @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  '#009999'
    font Arcadia.instance['conf']['splash.banner.font']
    justify  'left'
    anchor  'w'
    place('width'=>-28,'relwidth' => 1,'x' => 28,'y' => 160,'height' => 45)
  }
  @progress  = TkVariable.new
  reset
  _width = 345
  _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("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


2252
2253
2254
# File 'lib/a-core.rb', line 2252

def progress
  @progress
end

Instance Method Details

#labelStep(_txt) ⇒ Object


2438
2439
2440
2441
# File 'lib/a-core.rb', line 2438

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

#last_step(_txt = nil) ⇒ Object


2443
2444
2445
2446
2447
2448
# File 'lib/a-core.rb', line 2443

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


2428
2429
2430
2431
# File 'lib/a-core.rb', line 2428

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

#on_after_build(_event, _listener) ⇒ Object


2374
2375
2376
# File 'lib/a-core.rb', line 2374

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

#on_arcadia_problem(_event) ⇒ Object


2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
# File 'lib/a-core.rb', line 2382

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'=> 28,'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' => 46,'y' => 150,'height' => 25)
    }
  end
  @problems_nums=@problems_nums+1
  @tkLabelProblems.text=problem_str if @tkLabelProblems
end

#on_before_build(_event, _listener) ⇒ Object


2370
2371
2372
# File 'lib/a-core.rb', line 2370

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

#on_build(_event, _listener) ⇒ Object


2366
2367
2368
# File 'lib/a-core.rb', line 2366

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

#percObject


2433
2434
2435
2436
# File 'lib/a-core.rb', line 2433

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

#problem_strObject


2378
2379
2380
# File 'lib/a-core.rb', line 2378

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

#resetObject


2424
2425
2426
# File 'lib/a-core.rb', line 2424

def reset
  @progress.value = -1
end

#set_progress(_max = 10) ⇒ Object


2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
# File 'lib/a-core.rb', line 2410

def set_progress(_max=10)
  @max = _max
  Tk::BWidget::ProgressBar.new(self, :width=>340, :height=>5,
    :background=>'#000000',
    :troughcolor=>'#000000',
    :foreground=>'#990000',
    :variable=>@progress,
    :borderwidth=>0,
    :relief=>'flat',
#      :maximum=>_max).place('relwidth' => '1','y' => 145,'height' => 1)
#      :maximum=>_max).place('width' => '280','x'=>28,'y' => 33,'height' => 1)
    :maximum=>_max).place('width' => '280','x'=>28,'y' => 189,'height' => 10)
end

#set_sysinfo(_info) ⇒ Object


2406
2407
2408
# File 'lib/a-core.rb', line 2406

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