Exemplo n.º 1
0
	def __init__(self, **kwargs):
		HBox.__init__(self, name='city_info_background', padding=0)
		TilingBackground.__init__(self,
			amount=0,
			base_path="content/gui/images/background/widgets/cityinfo_",
			start_img="left.png", tiles_img="fill.png", final_img="right.png",
			**kwargs)
Exemplo n.º 2
0
	def __init__(self, **kwargs):
		HBox.__init__(self, name='city_info_background', padding=0)
		TilingBackground.__init__(self,
			amount=0,
			base_path="content/gui/images/background/widgets/cityinfo_",
			start_img="left.png", tiles_img="fill.png", final_img="right.png",
			**kwargs)
Exemplo n.º 3
0
 def __init__(
     self,
     items=None,
     default_item_n=0,
     circular=True,
     min_size=(50, 14),
     max_size=(50, 14),
     font=None,
     background_color=None,
     **kwargs
 ):
     self._current_index = 0
     self._items = map(unicode, items) if items is not None else []
     self._default_item_n = default_item_n
     self._min_size = min_size
     self.circular = circular
     padding = 1
     self.text_field = TextField(background_color=background_color)
     self.decrease_button = ImageButton(
         up_image="gui/buttons/left_arrow_up.png",
         down_image="gui/buttons/left_arrow_down.png",
         hover_image="gui/buttons/left_arrow_hover.png",
     )
     # FIXME Technomage 2011-03-05: This is a hack to prevent the button
     #     from expanding width-wise and skewing the TextField orientation.
     #     Max size shouldn't be hard-coded like this though...
     self.decrease_button.max_size = (12, 12)
     self.decrease_button.capture(self.previousItem)
     self.increase_button = ImageButton(
         up_image="gui/buttons/right_arrow_up.png",
         down_image="gui/buttons/right_arrow_down.png",
         hover_image="gui/buttons/right_arrow_hover.png",
     )
     self.increase_button.capture(self.nextItem)
     increase_button_width, increase_button_height = self.increase_button.size
     decrease_button_width, decrease_button_height = self.decrease_button.size
     self.text_field = TextField(font=font)
     text_field_width = min_size[0] - (2 * padding) - (increase_button_width + decrease_button_width)
     self.text_field.min_width = text_field_width
     self.text_field.max_width = text_field_width
     self.text_field.min_height = min_size[1]
     self.text_field.text = self.items[default_item_n] if len(self.items) > 0 else u""
     HBox.__init__(self, **kwargs)
     self.opaque = 0
     self.padding = padding
     self.margins = (0, 0)
     self.addChildren(self.decrease_button, self.text_field, self.increase_button)