def init_widget(self): super(AccountTab, self).init_widget() self.widget.mapEvents({ 'show_production_overview/mouseClicked': self.show_production_overview, }) # FIXME having to access the WindowManager this way is pretty ugly self._windows = self.instance.session.ingame_gui.windows self.prod_overview = ProductionOverview(self._windows, self.settlement) self.widget.child_finder('headline').text = self.settlement.get_component(NamedComponent).name self.widget.child_finder('headline').helptext = T('Click to change the name of your settlement') path = 'icons/widgets/cityinfo/settlement_{}'.format(self.settlement.owner.color.name) self.widget.child_finder('show_production_overview').path = path
def __init__(self, instance): super(AccountTab, self).__init__(instance=instance, widget='tab_account.xml', icon_path='icons/tabwidget/warehouse/account') self.helptext = _("Account") self.widget.child_finder( 'headline').text = self.settlement.get_component( NamedComponent).name self.widget.child_finder('headline').helptext = _( 'Click to change the name of your settlement') path = 'icons/widgets/cityinfo/settlement_%s' % self.settlement.owner.color.name self.widget.child_finder('show_production_overview').path = path self.widget.mapEvents({ 'show_production_overview/mouseClicked': self.show_production_overview }) # FIXME having to access the WindowManager this way is pretty ugly self._windows = self.instance.session.ingame_gui.windows self.prod_overview = ProductionOverview(self._windows, self.settlement)
def show_production_overview(self): self.prod_overview = ProductionOverview(self.settlement) self.prod_overview.toggle_visibility()