def build_ship_info(self, index, ship, prodline):
        size = (260, 90)
        widget = Container(name='showcase_%s' % index,
                           position=(0, 20 + index * 90),
                           min_size=size,
                           max_size=size,
                           size=size)
        bg_icon = Icon(image='content/gui/images/background/square_80.png',
                       name='bg_%s' % index)
        widget.addChild(bg_icon)

        image = 'content/gui/images/objects/ships/76/{unit_id}.png'.format(
            unit_id=ship)
        helptext = self.instance.session.db.get_ship_tooltip(ship)
        unit_icon = Icon(image=image,
                         name='icon_%s' % index,
                         position=(2, 2),
                         helptext=helptext)
        widget.addChild(unit_icon)

        # if not buildable, this returns string with reason why to be displayed as helptext
        #ship_unbuildable = self.is_ship_unbuildable(ship)
        ship_unbuildable = False
        if not ship_unbuildable:
            button = OkButton(position=(60, 50),
                              name='ok_%s' % index,
                              helptext=_('Build this ship!'))
            button.capture(Callback(self.start_production, prodline))
        else:
            button = CancelButton(position=(60, 50),
                                  name='ok_%s' % index,
                                  helptext=ship_unbuildable)

        widget.addChild(button)

        # Get production line info
        production = self.producer.create_production_line(prodline)
        # consumed == negative, reverse to sort in *ascending* order:
        costs = sorted(production.consumed_res.iteritems(), key=itemgetter(1))
        for i, (res, amount) in enumerate(costs):
            xoffset = 103 + (i % 2) * 55
            yoffset = 20 + (i // 2) * 20
            icon = create_resource_icon(res, self.instance.session.db)
            icon.max_size = icon.min_size = icon.size = (16, 16)
            icon.position = (xoffset, yoffset)
            label = Label(name='cost_%s_%s' % (index, i))
            if res == RES.GOLD:
                label.text = unicode(-amount)
            else:
                label.text = u'{amount:02}t'.format(amount=-amount)
            label.position = (22 + xoffset, yoffset)
            widget.addChild(icon)
            widget.addChild(label)
        return widget
	def build_ship_info(self, index, ship, prodline):
		size = (260, 90)
		widget = Container(name='showcase_%s' % index, position=(0, 20 + index*90),
		                   min_size=size, max_size=size, size=size)
		bg_icon = Icon(image='content/gui/images/background/square_80.png', name='bg_%s'%index)
		widget.addChild(bg_icon)

		icon_path = 'content/gui/images/objects/ships/76/{unit_id}.png'.format(unit_id=ship)
		helptext = self.instance.session.db.get_ship_tooltip(ship)
		unit_icon = Icon(image=icon_path, name='icon_%s'%index, position=(2, 2),
		                 helptext=helptext)
		widget.addChild(unit_icon)

		# if not buildable, this returns string with reason why to be displayed as helptext
		#ship_unbuildable = self.is_ship_unbuildable(ship)
		ship_unbuildable = False
		if not ship_unbuildable:
			button = OkButton(position=(60, 50), name='ok_%s'%index, helptext=_('Build this ship!'))
			button.capture(Callback(self.start_production, prodline))
		else:
			button = CancelButton(position=(60, 50), name='ok_%s'%index,
			helptext=ship_unbuildable)

		widget.addChild(button)

		#TODO since this code uses the boat builder as producer, the
		# gold cost of ships is in consumed res is always 0 since it
		# is paid from player inventory, not from the boat builder one.
		production = self.producer.create_production(prodline)
		# consumed == negative, reverse to sort in *ascending* order:
		costs = sorted(production.get_consumed_resources().iteritems(), key=itemgetter(1))
		for i, (res, amount) in enumerate(costs):
			xoffset = 103 + (i  % 2) * 55
			yoffset =  20 + (i // 2) * 20
			icon = create_resource_icon(res, self.instance.session.db)
			icon.max_size = icon.min_size = icon.size = (16, 16)
			icon.position = (xoffset, yoffset)
			label = Label(name='cost_%s_%s' % (index, i))
			if res == RES.GOLD:
				label.text = unicode(-amount)
			else:
				label.text = u'{amount:02}t'.format(amount=-amount)
			label.position = (22 + xoffset, yoffset)
			widget.addChild(icon)
			widget.addChild(label)
		return widget
	def build_groundunit_info(self, index, groundunit, prodline):
		size = (260, 90)
		widget = Container(name='showcase_%s' % index, position=(0, 20 + index*90),
		                   min_size=size, max_size=size, size=size)
		bg_icon = Icon(image='content/gui/images/background/square_80.png', name='bg_%s'%index)
		widget.addChild(bg_icon)

		image = 'content/gui/images/objects/groundunit/76/{unit_id}.png'.format(unit_id=groundunit)
		helptext = self.instance.session.db.get_unit_tooltip(groundunit)
		unit_icon = Icon(image=image, name='icon_%s'%index, position=(2, 2),
		                 helptext=helptext)
		widget.addChild(unit_icon)

		# if not buildable, this returns string with reason why to be displayed as helptext
		#groundunit_unbuildable = self.is_groundunit_unbuildable(groundunit)
		groundunit_unbuildable = False
		if not groundunit_unbuildable:
			button = OkButton(position=(60, 50), name='ok_%s'%index, helptext=_('Build this groundunit!'))
			button.capture(Callback(self.start_production, prodline))
		else:
			button = CancelButton(position=(60, 50), name='ok_%s'%index,
			helptext=groundunit_unbuildable)

		widget.addChild(button)

		# Get production line info
		production = self.producer.create_production_line(prodline)
		# consumed == negative, reverse to sort in *ascending* order:
		costs = sorted(production.consumed_res.iteritems(), key=itemgetter(1))
		for i, (res, amount) in enumerate(costs):
			xoffset = 103 + (i  % 2) * 55
			yoffset =  20 + (i // 2) * 20
			icon = create_resource_icon(res, self.instance.session.db)
			icon.max_size = icon.min_size = icon.size = (16, 16)
			icon.position = (xoffset, yoffset)
			label = Label(name='cost_%s_%s' % (index, i))
			if res == RES.GOLD:
				label.text = unicode(-amount)
			else:
				label.text = u'{amount:02}t'.format(amount=-amount)
			label.position = (22 + xoffset, yoffset)
			widget.addChild(icon)
			widget.addChild(label)
		return widget