from naja.constants import KEYS
from naja.widgets.base import Container
from naja.resources import resources
-from naja.resources.mutators import EIGHT_BIT, R270
+from naja.resources.mutators import EIGHT_BIT, R270, R90
from naja.sound import sound
def __init__(self, *args, **kwargs):
super(SelectorWidget, self).__init__(*args, **kwargs)
self.position = 0
- self.selector = resources.get_image('bits', 'arrow_on.png',
- transforms=(R270, EIGHT_BIT))
+ self.left_selector = resources.get_image('bits', 'arrow_on.png',
+ transforms=(R270, EIGHT_BIT))
+ self.right_selector = resources.get_image('bits', 'arrow_on.png',
+ transforms=(R90, EIGHT_BIT))
def render(self, surface):
super(SelectorWidget, self).render(surface)
- pos = self.selector.get_rect()
+ pos = self.left_selector.get_rect()
selected = self.widgets[self.position]
if not selected.is_selectable():
selected = self.change_pos(1)
pos = pos.move(selected.pos)
- pos = pos.move(-pos.width * 1.5, (selected.size[1] - pos.height) / 2)
- surface.blit(self.selector, pos)
+ left_pos = pos.move(-pos.width * 1.5,
+ (selected.size[1] - pos.height) / 2)
+ right_pos = pos.move(selected.size[0] + pos.width * 0.5,
+ (selected.size[1] - pos.height) / 2)
+ surface.blit(self.left_selector, left_pos)
+ surface.blit(self.right_selector, right_pos)
def change_pos(self, change):
self.position = (self.position + change) % len(self.widgets)