Class: RunnerManager::RunnerMangerItem

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

Instance Method Summary collapse

Constructor Details

#initialize(_parent = nil, _runner_hash = nil, *args) ⇒ RunnerMangerItem

Returns a new instance of RunnerMangerItem.



1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
# File 'lib/a-core.rb', line 1674

def initialize(_parent=nil, _runner_hash=nil, *args)
  super(_parent, Arcadia.style('panel'))
  @runner_hash = _runner_hash
  Tk::BWidget::Label.new(self,
  'image'=> Arcadia.file_icon(_runner_hash[:file_exts]),
  'relief'=>'flat').pack('side' =>'left')
  Tk::BWidget::Label.new(self,
  'text'=>_runner_hash[:title],
  'helptext'=>_runner_hash[:file],
  'compound'=>:left,
  'relief'=>'flat').pack('fill'=>'x','side' =>'left')
  _close_command = proc{
    if (Arcadia.dialog(self, 'type'=>'yes_no',
      'msg'=> Arcadia.text("main.d.confirm_delete_runner.msg", [_runner_hash[:name]]),
      'title' => Arcadia.text("main.d.confirm_delete_runner.title"),
      'level' => 'question')=='yes')

      Arcadia.unpersistent("runners.#{_runner_hash[:name]}")
      mr = Arcadia.menu_root('runcurr')
      index_to_delete = -1
      i_end = mr.index('end')
      if i_end
        0.upto(i_end){|j|
          type = mr.menutype(j)
          if type != 'separator'
            l = mr.entrycget(j,'label')
            if l == _runner_hash[:title]
              index_to_delete = j
              break
            end
          end
        }
      end
      if index_to_delete > -1
        mr.delete(index_to_delete)
      end
      self.destroy
    end
  }
  Tk::BWidget::Button.new(self,
  'command'=>_close_command,
  'helptext'=>@runner_hash[:file],
  'background'=>'white',
  'image'=> Arcadia.image_res(TRASH_GIF),
  'relief'=>'flat').pack('side' =>'right','padx'=>0)
  pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
end