class RunnerManager::RunnerMangerItem
Attributes
readonly[R]
runner_hash[R]
Public Class Methods
new(_runner_manager, _parent=nil, _runner_hash=nil, _row=0, _state_array=nil, *args)
click to toggle source
# File lib/a-core.rb, line 1810 def initialize(_runner_manager, _parent=nil, _runner_hash=nil, _row=0, _state_array=nil, *args) #super(_parent, Arcadia.style('panel')) @runner_hash = _runner_hash @readonly = _state_array && _state_array.include?(:disabled) @enable_close_button = !@readonly || _runner_hash[:origin] == 'runtime' @h_hash = {} p_update_height = proc{|tktext| index = tktext.index('end -1 chars') r,c = index.split('.') if tktext.cget('wrap') != 'none' w = tktext.width h = ((c.to_i-1)/w.to_i).round + 1 else h = r.to_i end h_to_set = h @h_hash.each{|k,v| h_to_set = v if k != tktext && v > h_to_set } @h_hash[tktext] = h if tktext.height != h_to_set tktext.height(h_to_set) @h_hash.each{|k,v| p_update_height.call(k) if k != tktext } end } row_fill = false # ICON @ttklicon = Arcadia.wf.label(_parent, 'image'=> _runner_hash[:image].nil? ? Arcadia.file_icon(_runner_hash[:file_exts]) : Arcadia.image_res(_runner_hash[:image]) , 'relief'=>'flat').grid(:column => 0, :row => _row, :sticky => "W", :padx=>1, :pady=>1) @ttklicon.state(:disabled) if @readonly # NAME @ename_old = _runner_hash[:name] @ttkename = Arcadia.wf.text(_parent, 'width' => _runner_manager.name_width, "height" => 1).hint(_runner_hash[:file]).grid(:column => 1, :row => _row, :sticky => "WE", :padx=>1, :pady=>1) @ttkename.insert('end', _runner_hash[:name]) @ttkename.state(:disabled) && @ttkename.fg('darkgray') if @readonly row_fill = row_fill || @ttkename.value.strip.length > 0 # TITLE @etitle_old = _runner_hash[:title] @ttketitle = Arcadia.wf.text(_parent, 'width' => _runner_manager.title_width, "height" => 1).hint(_runner_hash[:file]).grid(:column => 2, :row => _row, :sticky => "WE", :padx=>1, :pady=>1) @ttketitle.insert('end', _runner_hash[:title]) @ttketitle.state(:disabled) && @ttketitle.fg('darkgray') if @readonly row_fill = row_fill || @ttketitle.value.strip.length > 0 # CMD @ecmd_old = _runner_hash[:cmd] @ttkecmd = Arcadia.wf.text(_parent, 'width' => _runner_manager.cmd_width, 'wrap'=>'word', "height" => 1).grid(:column => 3, :row => _row, :sticky => "WE", :padx=>1, :pady=>1) @ttkecmd.insert('end', _runner_hash[:cmd]) @ttkecmd.state(:disabled) && @ttkecmd.fg('darkgray') if @readonly row_fill = row_fill || @ttkecmd.value.strip.length > 0 # FILE EXTS @eexts_old = _runner_hash[:file_exts] @ttkeexts = Arcadia.wf.text(_parent, 'width' => _runner_manager.ext_width, "height" => 1).grid(:column => 4, :row => _row, :sticky => "WE", :padx=>1, :pady=>1) @ttkeexts.insert('end', _runner_hash[:file_exts]) @ttkeexts.state(:disabled) && @ttkeexts.fg('darkgray') if @readonly row_fill = row_fill || @ttkeexts.value.strip.length > 0 # COPY BUTTON copy_command = proc{ _runner_manager.do_add(self) } @ttkbcopy = Arcadia.wf.toolbutton(_parent, 'command'=> copy_command, 'image'=> Arcadia.image_res(COPY_GIF) ).grid(:column => 5, :row => _row, :sticky => "W", :padx=>1, :pady=>1) # DELETE BUTTON 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') if _runner_hash[:origin] == 'runtime' Arcadia.unpersistent("runners.#{_runner_hash[:name]}") else Arcadia.del_conf("runners.#{_runner_hash[:name]}") end 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 _runner_manager.do_delete_item(self) self.destroy end } @ttkbclose = Arcadia.wf.toolbutton(_parent, 'command'=> close_command, 'image'=> Arcadia.image_res(CLOSE_FRAME_GIF) ).grid(:column => 6, :row => _row, :sticky => "W", :padx=>1, :pady=>1) @ttkbclose.hint=@runner_hash[:file] @ttkbclose.state(:disabled) if !@enable_close_button [@ttkename, @ttketitle, @ttkecmd, @ttkeexts].each{|tktext| p_update_height.call(tktext) if row_fill tktext.bind_append("KeyRelease"){p_update_height.call(tktext)} } end
Public Instance Methods
change?()
click to toggle source
# File lib/a-core.rb, line 1974 def change? title_change? || cmd_change? || exts_change? || exts_change? || name_change? end
cmd_change?()
click to toggle source
# File lib/a-core.rb, line 1966 def cmd_change? @ecmd_old != @ttkecmd.value end
destroy()
click to toggle source
# File lib/a-core.rb, line 1938 def destroy @ttklicon.destroy @ttkename.destroy @ttketitle.destroy @ttkecmd.destroy @ttkeexts.destroy @ttkbcopy.destroy @ttkbclose.destroy end
exts_change?()
click to toggle source
# File lib/a-core.rb, line 1970 def exts_change? @eexts_old != @ttkeexts.value end
hash_value()
click to toggle source
# File lib/a-core.rb, line 1948 def hash_value ret = {} ret[:name]=@ttkename.value ret[:title]=@ttketitle.value ret[:cmd]=@ttkecmd.value ret[:file_exts]=@ttkeexts.value ret[:image]=@runner_hash[:image] if @runner_hash[:image] ret end
name_change?()
click to toggle source
# File lib/a-core.rb, line 1958 def name_change? @ename_old != @ttkename.value end
reset_change()
click to toggle source
# File lib/a-core.rb, line 1978 def reset_change @ename_old = @ttkename.value @etitle_old = @ttketitle.value @ecmd_old = @ttkecmd.value @eexts_old = @ttkeexts.value end
title_change?()
click to toggle source
# File lib/a-core.rb, line 1962 def title_change? @etitle_old != @ttketitle.value end