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.



1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
# File 'lib/a-core.rb', line 1707

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.hinner_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