Class: ItemList

Inherits:
Gtk::ComboBox
  • Object
show all
Includes:
ManqodCommon
Defined in:
lib/PrintEditor/ItemInfo/ItemList.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Constant Summary

Constants included from ManqodCommon

ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING

Constants included from Eprint

Eprint::DOMAIN, Eprint::LEVEL

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ManqodCommon

#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #qrow, #query, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick

Methods included from Eprint

#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception

Constructor Details

#initializeItemList

Returns a new instance of ItemList.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/PrintEditor/ItemInfo/ItemList.rb', line 7

def initialize
	@updated=false
	super(Gtk::ListStore.new(String,String))
	frenderer=Gtk::CellRendererText.new
	pack_start(frenderer,true).add_attribute(frenderer,:text,1)
	signal_connect("changed"){|me| 
		unless me.active_iter.nil? or @item.nil?
			@item.set_text(me.active_iter[0].to_s) 
			@item.child.set_label(active_iter[1])
		end
	}
end

Instance Attribute Details

#itemObject (readonly)

Returns the value of attribute item.



19
20
21
# File 'lib/PrintEditor/ItemInfo/ItemList.rb', line 19

def item
  @item
end

#updatedObject (readonly)

Returns the value of attribute updated.



19
20
21
# File 'lib/PrintEditor/ItemInfo/ItemList.rb', line 19

def updated
  @updated
end

Instance Method Details

#update(item) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/PrintEditor/ItemInfo/ItemList.rb', line 20

def update(item)
	@item=item
	rows("select moditems.id,moditems.display 
		from moditems 
		left join modules on moditems.modid = modules.id 
		left join buttons on buttons.moditemid = moditems.parent
		where modules.modname = 'listing' 
			and buttons.target_moditemid = '#{@item.moditemid}'"){|sublist|
		i=model.append
		i[0]=sublist["id"]
		i[1]=sublist["display"]
	} unless @updated
	@updated=true
	found=nil
	model.each{|model,path,iter| found=iter if @item.text.to_s == iter[0]}
	if found then 
		set_active_iter(found) 
		@item.child.set_label(found[1])
	else 
		set_active(-1)
	end
	self
end