def print_increment_data(): from horizons.util.python.roman_numerals import int_to_roman upgrade_increments = xrange(1, SETTLER.CURRENT_MAX_INCR+1) print '%15s %12s %s %s %s' % ('increment', 'residential', 'max_inh', 'base_tax', 'upgrade_prod_line') print '=' * 64 for inc, name, hut, inh, tax in db('SELECT level, name, residential_name, inhabitants_max, tax_income FROM settler_level'): str = '%3s %11s %12s %5s %4s' % (int_to_roman(inc+1), name, hut, inh, tax) if inc+1 in upgrade_increments: line = db("SELECT production_line FROM upgrade_material WHERE level = ?", inc+1)[0][0] str += 5 * ' ' + '%2s: ' % line (consumption, _) = get_prod_line(line, list) for (res, amount) in consumption: str += '%i %s(%s), ' % (-amount, get_res_name(res), res) print str print '\n' + 'Settler Consumption Lines:' for inc in xrange(SETTLER.CURRENT_MAX_INCR+1): settlername = get_settler_name(inc) print "In increment %3s, %ss desire the following goods:" % \ (int_to_roman(inc+1), settlername) lines = db("SELECT production_line FROM settler_production_line \ WHERE level = ? ORDER BY production_line", inc) sorted_lines = sorted([(get_prod_line(line[0], tuple)[0][0],line[0]) for i,line in enumerate(lines)]) for item,id in sorted_lines: time = db("SELECT time FROM production_line WHERE id == ?",id)[0][0] str = '%2s: Each %5s seconds, %ss consume ' % (id, time, settlername) (consumption,production) = get_prod_line(id, tuple) str += '%2i %-12s(%2s) for ' % (-consumption[1], get_res_name(consumption[0]), consumption[0]) str += '%2i %s(%2s).' % (production[1], get_res_name(production[0]), production[0]) print str print ''
def __init__(self, tabindex = 0, events = {}): super(BuildTab, self).__init__(widget = 'build_menu/hud_build_tab' + str(tabindex) + '.xml') self.init_values() self.widget.mapEvents(events) self.button_up_image = 'content/gui/images/icons/hud/common/level%s_u.png' % tabindex self.button_active_image = 'content/gui/images/icons/hud/common/level%s_a.png' % tabindex self.button_down_image = 'content/gui/images/icons/hud/common/level%s_d.png' % tabindex self.button_hover_image = 'content/gui/images/icons/hud/common/level%s_h.png' % tabindex self.tooltip = unicode(_("Increment")+" "+int_to_roman(tabindex+1)) self.tabindex = tabindex
def __init__(self, tabindex=1, callback_mapping=None, session=None, icon_path='content/gui/icons/tabwidget/buildmenu/level{incr}_%s.png'): if callback_mapping is None: callback_mapping = {} super(BuildTab, self).__init__(widget='buildtab.xml', icon_path=icon_path.format(incr=tabindex)) self.session = session self.tabindex = tabindex self.callback_mapping = callback_mapping self.helptext = _("Increment {increment}").format(increment = int_to_roman(self.tabindex))
def __init__(self, tabindex = 0, events = None): super(BuildTab, self).__init__(widget = 'buildtab_increment' + str(tabindex) + '.xml') self.init_values() icon_path = 'content/gui/icons/tabwidget/buildmenu/level%s_%s.png' self.widget.mapEvents(events or {}) self.button_up_image = icon_path % (tabindex,'u') self.button_active_image = icon_path % (tabindex,'a') self.button_down_image = icon_path % (tabindex,'d') self.button_hover_image = icon_path % (tabindex,'h') self.tooltip = unicode(_("Increment")+" "+int_to_roman(tabindex+1)) self.tabindex = tabindex
def __init__(self, tabindex = 0, events = {}): super(BuildTab, self).__init__(widget = 'buildtab_increment' + str(tabindex) + '.xml') self.init_values() icon_path = 'content/gui/icons/tabwidget/buildmenu/level%s_%s.png' self.widget.mapEvents(events) self.button_up_image = icon_path % (tabindex,'u') self.button_active_image = icon_path % (tabindex,'a') self.button_down_image = icon_path % (tabindex,'d') self.button_hover_image = icon_path % (tabindex,'h') self.tooltip = unicode(_("Increment")+" "+int_to_roman(tabindex+1)) self.tabindex = tabindex
def print_increment_data(): from horizons.util.python.roman_numerals import int_to_roman upgrade_increments = xrange(1, SETTLER.CURRENT_MAX_INCR+1) print '%15s %s %s %s' % ('increment', 'max_inh', 'base_tax', 'upgrade_prod_line') print '=' * 64 for inc, name, inh, tax in db('SELECT level, name, inhabitants_max, tax_income FROM settler_level'): str = '%3s %11s %5s %4s' % (int_to_roman(inc+1), name, inh, tax) if inc+1 in upgrade_increments: line = db("SELECT production_line FROM upgrade_material WHERE level = ?", inc+1)[0][0] str += 5 * ' ' + '%2s: ' % line (consumption, _) = get_prod_line(line, list) for (res, amount) in consumption: str += '%i %s(%s), ' % (-amount, get_res_name(res), res) print str
def __init__(self, tabindex = 1, callback_mapping=None, session=None): if callback_mapping is None: callback_mapping = {} super(BuildTab, self).__init__(widget = 'buildtab.xml') self.session = session self.tabindex = tabindex self.callback_mapping = callback_mapping icon_path = 'content/gui/icons/tabwidget/buildmenu/level{incr}_%s.png'.format(incr=self.tabindex) self.button_up_image = icon_path % ('u') self.button_active_image = icon_path % ('a') self.button_down_image = icon_path % ('d') self.button_hover_image = icon_path % ('h') self.helptext = _("Increment {increment}").format(increment = int_to_roman(self.tabindex))