Så fort min patch för arenan i XMLDataInfo är inlagd så kommer ArenaPage att använda sig av det.
/Björn
#Boa:FramePanel:ArenaPage
# Mattricks, a free helper program for hattricks players. # Copyright (C) 2003-2004 Mattricks Team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import Countries import XMLParse import CommonData import Common
from wxPython.wx import * from wxPython.lib.anchors import LayoutAnchors
[wxID_ARENAPAGE, wxID_ARENAPAGEBUILD_BASIC_SEATS, wxID_ARENAPAGEBUILD_COST, wxID_ARENAPAGEBUILD_PANEL, wxID_ARENAPAGEBUILD_ROOFED, wxID_ARENAPAGEBUILD_TERRACES, wxID_ARENAPAGEBUILD_TOTAL, wxID_ARENAPAGEBUILD_VIP, wxID_ARENAPAGECURRENT_ARENA_PANEL, wxID_ARENAPAGECUR_BASIC, wxID_ARENAPAGECUR_ROOFED, wxID_ARENAPAGECUR_TERRACES, wxID_ARENAPAGECUR_TOTAL, wxID_ARENAPAGECUR_VIP, wxID_ARENAPAGENEW_ARENA_PANEL, wxID_ARENAPAGENEW_BASIC_SEATINGS, wxID_ARENAPAGENEW_ROOFED, wxID_ARENAPAGENEW_TERRACES, wxID_ARENAPAGENEW_TOTAL, wxID_ARENAPAGENEW_VIP, wxID_ARENAPAGEPANEL3, wxID_ARENAPAGEPANEL4, wxID_ARENAPAGEPREFERENCES_PANEL, wxID_ARENAPAGEPREF_62_5_PERCENT, wxID_ARENAPAGEPREF_63_PERCENT, wxID_ARENAPAGEPREF_BUILDTO, wxID_ARENAPAGEPREF_USE_BUILDTO, wxID_ARENAPAGEPREF_USE_SUPPORTERS, wxID_ARENAPAGEPREF_X20, wxID_ARENAPAGEPREF_X25, wxID_ARENAPAGEPREF_X30, wxID_ARENAPAGESTATICBOX1, wxID_ARENAPAGESTATICBOX2, wxID_ARENAPAGESTATICBOX3, wxID_ARENAPAGESTATICBOX4, wxID_ARENAPAGESTATICBOX5, wxID_ARENAPAGESTATICBOX6, wxID_ARENAPAGESTATICTEXT1, wxID_ARENAPAGESTATICTEXT10, wxID_ARENAPAGESTATICTEXT11, wxID_ARENAPAGESTATICTEXT12, wxID_ARENAPAGESTATICTEXT13, wxID_ARENAPAGESTATICTEXT14, wxID_ARENAPAGESTATICTEXT16, wxID_ARENAPAGESTATICTEXT17, wxID_ARENAPAGESTATICTEXT18, wxID_ARENAPAGESTATICTEXT2, wxID_ARENAPAGESTATICTEXT3, wxID_ARENAPAGESTATICTEXT4, wxID_ARENAPAGESTATICTEXT5, wxID_ARENAPAGESTATICTEXT6, wxID_ARENAPAGESTATICTEXT7, wxID_ARENAPAGESTATICTEXT8, wxID_ARENAPAGESTATICTEXT9, ] = map(lambda _init_ctrls: wxNewId(), range(54))
class ArenaPage(wxPanel): """""" def _init_utils(self): # generated method, don't edit pass
def _init_ctrls(self, prnt): # generated method, don't edit wxPanel.__init__(self, id=wxID_ARENAPAGE, name='ArenaPage', parent=prnt, pos=wxPoint(313, 222), size=wxSize(856, 659), style=wxTAB_TRAVERSAL) self._init_utils() self.SetClientSize(wxSize(856, 659)) self.SetAutoLayout(True)
self.current_arena_panel = wxPanel(id=wxID_ARENAPAGECURRENT_ARENA_PANEL, name='current_arena_panel', parent=self, pos=wxPoint(16, 64), size=wxSize(328, 168), style=wxTAB_TRAVERSAL)
self.staticText6 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT6, label=_("Terraces") + ':', name='staticText6', parent=self.current_arena_panel, pos=wxPoint(24, 32), size=wxSize(76, 18), style=0) self.staticText6.SetConstraints(LayoutAnchors(self.staticText6, True, True, False, False)) self.staticText6.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.cur_terraces = wxStaticText(id=wxID_ARENAPAGECUR_TERRACES, label='', name='cur_terraces', parent=self.current_arena_panel, pos=wxPoint(264, 32), size=wxSize(0, 18), style=0)
self.staticText2 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT2, label=_('Basic seating') + ':', name='staticText2', parent=self.current_arena_panel, pos=wxPoint(24, 56), size=wxSize(114, 18), style=0) self.staticText2.SetConstraints(LayoutAnchors(self.staticText2, True, True, False, False)) self.staticText2.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText3 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT3, label=_('Roofed seating') + ':', name='staticText3', parent=self.current_arena_panel, pos=wxPoint(24, 80), size=wxSize(129, 18), style=0) self.staticText3.SetConstraints(LayoutAnchors(self.staticText3, True, True, False, False)) self.staticText3.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText4 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT4, label=_('Seating in VIP boxes') + ':', name='staticText4', parent=self.current_arena_panel, pos=wxPoint(24, 104), size=wxSize(176, 18), style=0) self.staticText4.SetConstraints(LayoutAnchors(self.staticText4, True, True, False, False)) self.staticText4.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.cur_basic = wxStaticText(id=wxID_ARENAPAGECUR_BASIC, label='', name='cur_basic', parent=self.current_arena_panel, pos=wxPoint(264, 56), size=wxSize(0, 18), style=0)
self.cur_roofed = wxStaticText(id=wxID_ARENAPAGECUR_ROOFED, label='', name='cur_roofed', parent=self.current_arena_panel, pos=wxPoint(264, 80), size=wxSize(0, 18), style=0)
self.cur_VIP = wxStaticText(id=wxID_ARENAPAGECUR_VIP, label='', name='cur_VIP', parent=self.current_arena_panel, pos=wxPoint(264, 104), size=wxSize(0, 18), style=0)
self.cur_total = wxStaticText(id=wxID_ARENAPAGECUR_TOTAL, label='', name='cur_total', parent=self.current_arena_panel, pos=wxPoint(264, 128), size=wxSize(0, 18), style=0)
self.staticText5 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT5, label=_('Total capacity') +':', name='staticText5', parent=self.current_arena_panel, pos=wxPoint(24, 128), size=wxSize(119, 18), style=0) self.staticText5.SetConstraints(LayoutAnchors(self.staticText5, True, True, False, False)) self.staticText5.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticBox1 = wxStaticBox(id=wxID_ARENAPAGESTATICBOX1, label=_('Current arena'), name='staticBox1', parent=self.current_arena_panel, pos=wxPoint(8, 8), size=wxSize(320, 160), style=0)
self.preferences_panel = wxPanel(id=wxID_ARENAPAGEPREFERENCES_PANEL, name='preferences_panel', parent=self, pos=wxPoint(16, 264), size=wxSize(328, 304), style=wxTAB_TRAVERSAL)
self.staticBox2 = wxStaticBox(id=wxID_ARENAPAGESTATICBOX2, label=_('Preferences'), name='staticBox2', parent=self.preferences_panel, pos=wxPoint(8, 8), size=wxSize(320, 264), style=0)
self.panel3 = wxPanel(id=wxID_ARENAPAGEPANEL3, name='panel3', parent=self.preferences_panel, pos=wxPoint(24, 40), size=wxSize(288, 112), style=wxTAB_TRAVERSAL)
self.pref_use_buildto = wxRadioButton(id=wxID_ARENAPAGEPREF_USE_BUILDTO, label=_('Build to'), name='pref_use_buildto', parent=self.panel3, pos=wxPoint(8, 8), size=wxSize(120, 24), style=0) self.pref_use_buildto.SetValue(False) self.pref_use_buildto.SetAutoLayout(True) EVT_RADIOBUTTON(self.pref_use_buildto, wxID_ARENAPAGEPREF_USE_BUILDTO, self.OnPref_use_buildtoRadiobutton)
self.pref_use_supporters = wxRadioButton(id=wxID_ARENAPAGEPREF_USE_SUPPORTERS, label=_('Supporters'), name='pref_use_supporters', parent=self.panel3, pos=wxPoint(136, 8), size=wxSize(152, 24), style=0) self.pref_use_supporters.SetAutoLayout(True) self.pref_use_supporters.SetValue(False) EVT_RADIOBUTTON(self.pref_use_supporters, wxID_ARENAPAGEPREF_USE_SUPPORTERS, self.OnPref_use_supportersRadiobutton)
self.pref_buildto = wxTextCtrl(id=wxID_ARENAPAGEPREF_BUILDTO, name='pref_buildto', parent=self.panel3, pos=wxPoint(16, 40), size=wxSize(104, 24), style=0, value='') EVT_TEXT(self.pref_buildto, wxID_ARENAPAGEPREF_BUILDTO, self.OnPref_buildtoText)
self.panel4 = wxPanel(id=wxID_ARENAPAGEPANEL4, name='panel4', parent=self.panel3, pos=wxPoint(136, 32), size=wxSize(128, 80), style=wxTAB_TRAVERSAL) self.panel4.SetAutoLayout(True)
self.pref_x20 = wxRadioButton(id=wxID_ARENAPAGEPREF_X20, label='x 20', name='pref_x20', parent=self.panel4, pos=wxPoint(56, 8), size=wxSize(72, 22), style=0) self.pref_x20.SetValue(True) self.pref_x20.Enable(False) EVT_RADIOBUTTON(self.pref_x20, wxID_ARENAPAGEPREF_X20, self.OnPref_use_supportersRadiobutton)
self.pref_x25 = wxRadioButton(id=wxID_ARENAPAGEPREF_X25, label='x25', name='pref_x25', parent=self.panel4, pos=wxPoint(56, 32), size=wxSize(80, 24), style=0) self.pref_x25.SetValue(True) self.pref_x25.Enable(False) EVT_RADIOBUTTON(self.pref_x25, wxID_ARENAPAGEPREF_X25, self.OnPref_use_supportersRadiobutton)
self.pref_x30 = wxRadioButton(id=wxID_ARENAPAGEPREF_X30, label='x30', name='pref_x30', parent=self.panel4, pos=wxPoint(56, 56), size=wxSize(80, 24), style=0) self.pref_x30.SetValue(False) self.pref_x30.Enable(False) EVT_RADIOBUTTON(self.pref_x30, wxID_ARENAPAGEPREF_X30, self.OnPref_use_supportersRadiobutton)
self.staticBox3 = wxStaticBox(id=wxID_ARENAPAGESTATICBOX3, label=_('When building, use'), name='staticBox3', parent=self.preferences_panel, pos=wxPoint(16, 24), size=wxSize(304, 136), style=0)
self.new_arena_panel = wxPanel(id=wxID_ARENAPAGENEW_ARENA_PANEL, name='new_arena_panel', parent=self, pos=wxPoint(368, 64), size=wxSize(328, 168), style=wxTAB_TRAVERSAL)
self.staticText1 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT1, label=_('Terraces') +':', name='staticText1', parent=self.new_arena_panel, pos=wxPoint(24, 32), size=wxSize(76, 18), style=0) self.staticText1.SetConstraints(LayoutAnchors(self.staticText1, True, True, False, False)) self.staticText1.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText7 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT7, label=_('Seating in VIP boxes') + ':', name='staticText7', parent=self.new_arena_panel, pos=wxPoint(24, 104), size=wxSize(176, 18), style=0) self.staticText7.SetConstraints(LayoutAnchors(self.staticText7, True, True, False, False)) self.staticText7.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText8 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT8, label=_('Total capacity') + ':', name='staticText8', parent=self.new_arena_panel, pos=wxPoint(24, 128), size=wxSize(119, 18), style=0) self.staticText8.SetConstraints(LayoutAnchors(self.staticText8, True, True, False, False)) self.staticText8.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText9 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT9, label=_('Basic seating') + ':', name='staticText9', parent=self.new_arena_panel, pos=wxPoint(24, 56), size=wxSize(114, 18), style=0) self.staticText9.SetConstraints(LayoutAnchors(self.staticText9, True, True, False, False)) self.staticText9.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.new_terraces = wxStaticText(id=wxID_ARENAPAGENEW_TERRACES, label='', name='new_terraces', parent=self.new_arena_panel, pos=wxPoint(264, 32), size=wxSize(0, 18), style=0)
self.staticText10 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT10, label=_('Roofed seating') + ':', name='staticText10', parent=self.new_arena_panel, pos=wxPoint(24, 80), size=wxSize(129, 18), style=0) self.staticText10.SetConstraints(LayoutAnchors(self.staticText10, True, True, False, False)) self.staticText10.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.new_VIP = wxStaticText(id=wxID_ARENAPAGENEW_VIP, label='', name='new_VIP', parent=self.new_arena_panel, pos=wxPoint(264, 104), size=wxSize(0, 18), style=0)
self.new_roofed = wxStaticText(id=wxID_ARENAPAGENEW_ROOFED, label='', name='new_roofed', parent=self.new_arena_panel, pos=wxPoint(264, 80), size=wxSize(0, 18), style=0)
self.staticBox4 = wxStaticBox(id=wxID_ARENAPAGESTATICBOX4, label=_('The new arena'), name='staticBox4', parent=self.new_arena_panel, pos=wxPoint(8, 8), size=wxSize(320, 160), style=0)
self.new_basic_seatings = wxStaticText(id=wxID_ARENAPAGENEW_BASIC_SEATINGS, label='', name='new_basic_seatings', parent=self.new_arena_panel, pos=wxPoint(264, 56), size=wxSize(0, 18), style=0)
self.new_total = wxStaticText(id=wxID_ARENAPAGENEW_TOTAL, label='', name='new_total', parent=self.new_arena_panel, pos=wxPoint(264, 128), size=wxSize(0, 18), style=0)
self.staticBox5 = wxStaticBox(id=wxID_ARENAPAGESTATICBOX5, label=_('Formula'), name='staticBox5', parent=self.preferences_panel, pos=wxPoint(16, 168), size=wxSize(304, 88), style=0)
self.pref_62_5_percent = wxRadioButton(id=wxID_ARENAPAGEPREF_62_5_PERCENT, label='62,5/25/10/2,5 %', name='pref_62_5_percent', parent=self.preferences_panel, pos=wxPoint(80, 184), size=wxSize(176, 30), style=0) self.pref_62_5_percent.SetValue(True) EVT_RADIOBUTTON(self.pref_62_5_percent, wxID_ARENAPAGEPREF_62_5_PERCENT, self.OnPref_62_5_percentRadiobutton)
self.pref_63_percent = wxRadioButton(id=wxID_ARENAPAGEPREF_63_PERCENT, label='63/25/10/2 %', name='pref_63_percent', parent=self.preferences_panel, pos=wxPoint(80, 208), size=wxSize(176, 40), style=0) self.pref_63_percent.SetValue(True) EVT_RADIOBUTTON(self.pref_63_percent, wxID_ARENAPAGEPREF_63_PERCENT, self.OnPref_62_5_percentRadiobutton)
self.build_panel = wxPanel(id=wxID_ARENAPAGEBUILD_PANEL, name='build_panel', parent=self, pos=wxPoint(368, 272), size=wxSize(360, 352), style=wxTAB_TRAVERSAL)
self.staticBox6 = wxStaticBox(id=wxID_ARENAPAGESTATICBOX6, label=_('Build'), name='staticBox6', parent=self.build_panel, pos=wxPoint(8, 0), size=wxSize(320, 264), style=0)
self.staticText11 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT11, label=_('Terraces') + ':', name='staticText11', parent=self.build_panel, pos=wxPoint(24, 48), size=wxSize(76, 18), style=0) self.staticText11.SetConstraints(LayoutAnchors(self.staticText11, True, True, False, False)) self.staticText11.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText12 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT12, label=_('Basic seating') + ':', name='staticText12', parent=self.build_panel, pos=wxPoint(24, 72), size=wxSize(114, 18), style=0) self.staticText12.SetConstraints(LayoutAnchors(self.staticText12, True, True, False, False)) self.staticText12.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText13 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT13, label=_('Roofed seating') + ':', name='staticText13', parent=self.build_panel, pos=wxPoint(24, 96), size=wxSize(129, 18), style=0) self.staticText13.SetConstraints(LayoutAnchors(self.staticText13, True, True, False, False)) self.staticText13.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText14 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT14, label=_('Seating in VIP boxes') + ':', name='staticText14', parent=self.build_panel, pos=wxPoint(24, 120), size=wxSize(176, 18), style=0) self.staticText14.SetConstraints(LayoutAnchors(self.staticText14, True, True, False, False)) self.staticText14.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.build_terraces = wxStaticText(id=wxID_ARENAPAGEBUILD_TERRACES, label='', name='build_terraces', parent=self.build_panel, pos=wxPoint(256, 48), size=wxSize(0, 18), style=0)
self.build_basic_seats = wxStaticText(id=wxID_ARENAPAGEBUILD_BASIC_SEATS, label='', name='build_basic_seats', parent=self.build_panel, pos=wxPoint(256, 72), size=wxSize(0, 18), style=0)
self.build_roofed = wxStaticText(id=wxID_ARENAPAGEBUILD_ROOFED, label='', name='build_roofed', parent=self.build_panel, pos=wxPoint(256, 96), size=wxSize(0, 18), style=0)
self.build_VIP = wxStaticText(id=wxID_ARENAPAGEBUILD_VIP, label='', name='build_VIP', parent=self.build_panel, pos=wxPoint(256, 120), size=wxSize(0, 18), style=0)
self.build_total = wxStaticText(id=wxID_ARENAPAGEBUILD_TOTAL, label='', name='build_total', parent=self.build_panel, pos=wxPoint(256, 144), size=wxSize(0, 18), style=0)
self.staticText16 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT16, label=_('Build total') + ':', name='staticText16', parent=self.build_panel, pos=wxPoint(24, 144), size=wxSize(88, 18), style=0) self.staticText16.SetConstraints(LayoutAnchors(self.staticText16, True, True, False, False)) self.staticText16.SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.staticText17 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT17, label=_('Building cost') + ':', name='staticText17', parent=self.build_panel, pos=wxPoint(24, 184), size=wxSize(140, 22), style=0) self.staticText17.SetConstraints(LayoutAnchors(self.staticText17, True, True, False, False)) self.staticText17.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxBOLD, False, 'Sans'))
self.build_cost = wxStaticText(id=wxID_ARENAPAGEBUILD_COST, label='', name='build_cost', parent=self.build_panel, pos=wxPoint(208, 184), size=wxSize(0, 22), style=wxALIGN_RIGHT) self.build_cost.SetFont(wxFont(12, wxSWISS, wxNORMAL, wxNORMAL, False, 'Sans'))
self.staticText18 = wxStaticText(id=wxID_ARENAPAGESTATICTEXT18, label=_('Seats'), name='staticText18', parent=self.panel3, pos=wxPoint(40, 72), size=wxSize(56, 26), style=0)
def __init__(self, parent, id): self._init_ctrls(parent)
data = XMLParse.get(["economy"]) self.fanclub = data.get("Team.FanClubSize") (dummy, dummy, self.currency_name, self.currency_prefix, self.currency_rate, dummy) = Countries.country_info[CommonData.get_country_league_id()]
arena = XMLParse.get(["arena details"]) self.terraces = arena.get("Arena.CurrentCapacity.Terraces") self.basic_seats = arena.get("Arena.CurrentCapacity.Basic") self.roofed = arena.get("Arena.CurrentCapacity.Roof") self.vip = arena.get("Arena.CurrentCapacity.VIP") self.total_seats = arena.get("Arena.CurrentCapacity.Total") self.n_terraces = self.terraces self.n_basic_seats = self.basic_seats self.n_roofed = self.roofed self.n_vip = self.vip self.n_total_seats = self.total_seats
self.__updategui()
def __updategui(self): """Updates all labels on the page with new information. Run everytime we have made some choices on the page"""
self.cur_terraces.SetLabel(str(self.terraces)) self.cur_basic.SetLabel(str(self.basic_seats)) self.cur_roofed.SetLabel(str(self.roofed)) self.cur_VIP.SetLabel(str(self.vip)) self.cur_total.SetLabel(str(self.total_seats))
self.new_terraces.SetLabel(str(self.n_terraces)) self.new_basic_seatings.SetLabel(str(self.n_basic_seats)) self.new_roofed.SetLabel(str(self.n_roofed)) self.new_VIP.SetLabel(str(self.n_vip)) self.new_total.SetLabel(str(self.n_total_seats))
b_terraces = self.n_terraces - self.terraces b_basic = self.n_basic_seats - self.basic_seats b_roofed = self.n_roofed - self.roofed b_vip = self.n_vip - self.vip b_total = b_terraces + b_basic + b_roofed + b_vip
#calculate building cost b_cost = 0 if b_total != 0: b_cost = 300000.0
if b_terraces > 0: b_cost += b_terraces * 150 else: b_cost += -b_terraces * 20 if b_basic > 0: b_cost += b_basic * 250 else: b_cost += -b_basic * 20 if b_roofed > 0: b_cost += b_roofed * 300 else: b_cost += -b_roofed * 20 if b_vip > 0: b_cost += b_vip * 1000 else: b_cost += -b_vip * 20
#fix so the building cost is in correct currency b_cost = int(round(b_cost / self.currency_rate)) if self.currency_prefix: b_cost_string = self.currency_name + str(b_cost) else: b_cost_string = str(b_cost) + self.currency_name
self.build_terraces.SetLabel(str(b_terraces)) self.build_basic_seats.SetLabel(str(b_basic)) self.build_roofed.SetLabel(str(b_roofed)) self.build_VIP.SetLabel(str(b_vip)) self.build_total.SetLabel(str(b_total)) self.build_cost.SetLabel(b_cost_string)
def OnPref_use_buildtoRadiobutton(self, event): """Called when we have chosen to use the "build to # of seats" option."""
event.Skip()
self.pref_buildto.Enable(True) self.pref_x20.Enable(False) self.pref_x25.Enable(False) self.pref_x30.Enable(False)
self.OnPref_buildtoText(event)
def OnPref_use_supportersRadiobutton(self, event): """Called when we have chosen to base our calculations on how big the users fanclub is.""" event.Skip()
self.pref_buildto.Enable(False) self.pref_x20.Enable(True) self.pref_x25.Enable(True) self.pref_x30.Enable(True)
if self.pref_x20.GetValue(): multiplier = 20 elif self.pref_x25.GetValue(): multiplier = 25 else: multiplier = 30
total = self.fanclub * multiplier self.__calculate_different_seats(total) self.__updategui()
def __calculate_different_seats(self, total): """Split the total number of seats in the new arena on the different types of seating. We also check which formula to use.
total - The amount of seats the new arena should have."""
if self.pref_62_5_percent.GetValue(): self.n_terraces = int(round(total * 0.625)) self.n_basic_seats = int(round(total * 0.25)) self.n_roofed = int(round(total * 0.10)) self.n_vip = int(round(total * 0.025)) else: self.n_terraces = int(round(total * 0.63)) self.n_basic_seats = int(round(total * 0.25)) self.n_roofed = int(round(total * 0.10)) self.n_vip = int(round(total * 0.02))
self.n_total_seats = self.n_terraces + self.n_basic_seats + self.n_roofed + self.n_vip
def OnPref_62_5_percentRadiobutton(self, event): """Called when user selects another formula. """
event.Skip() self.__calculate_different_seats(self.n_total_seats) self.__updategui()
def OnPref_buildtoText(self, event): """Called when user inputs how large arena he wants to have."""
event.Skip()
#Fix so we dont get an error when textbox is empty or #when we type in something that is not a number. value = str(self.pref_buildto.GetValue()) try: total = int(value) except ValueError: value = value[0: self.pref_buildto.GetLastPosition() - 1] self.pref_buildto.Clear() self.pref_buildto.SetValue(value) if value != '': total = int(value) else: total = self.total_seats
self.__calculate_different_seats(total) self.__updategui()
I'm using cvs version of Mattricks and Mattricks starts fine, but when I login and it starts downloading the xml files it crashes all of a sudden. guess it is a typo or something in some of the xml handlers.
Traceback (most recent call last): File "mattricks.py", line 36, in ? Init.start() File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Init.py", line 57, in start Commandline.parse_and_start() File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Commandline.py", line 105, in p arse_and_start all_commands[command](args, help_command) File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Commandline.py", line 121, in p arse_cmd_gui Main.main(*args) File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Main.py", line 465, in main app = Main(filename) File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Main.py", line 417, in __init__ wxApp.__init__(self) File "/usr/lib/python2.3/site-packages/wxPython/wx.py", line 1951, in __init__ _wxStart(self.OnInit) File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Main.py", line 440, in OnInit frame.AfterInit() File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Main.py", line 260, in AfterIni t self.__do_fetch() File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Main.py", line 355, in __do_fet ch self.__change_hrf(hrffile) File "/home/zazell/cvs/cvs/Mattricks/Mattricks/Main.py", line 324, in __change _hrf page.ChangeHRF(hrffile) File "/home/zazell/cvs/cvs/Mattricks/Mattricks/EconomyPage.py", line 176, in C hangeHRF self.UpdateUI() File "/home/zazell/cvs/cvs/Mattricks/Mattricks/EconomyPage.py", line 195, in U pdateUI (dummy, dummy, currency, AttributeError: EconomyPage instance has no attribute 'league_id'
It should be fixd now. I really do not understand how it happened, especially since you were not starting with an empty database (I assume). However, now I've added code to check that the self.league_id is available and if not create it.
/Oscar
great! it works again. I do get a segfault when using the arena sizer and i first select Supporters and then select the Build to option again. I don't know what causes this, but it is easy to reproduce.
On Sat, 2004-09-04 at 14:45, Oscar Gustafsson wrote:
It should be fixd now. I really do not understand how it happened, especially since you were not starting with an empty database (I assume). However, now I've added code to check that the self.league_id is available and if not create it.
/Oscar _______________________________________________ Mattricks mailing list Mattricks@lists.lysator.liu.se http://lists.lysator.liu.se/mailman/listinfo/mattricks
On Sat, 4 Sep 2004, Zazell Kroeske wrote:
great! it works again.
Good to hear.
I do get a segfault when using the arena sizer and i first select Supporters and then select the Build to option again. I don't know what causes this, but it is easy to reproduce.
Yes, this is a problem. It works without any problems on Björn's computer. It crashes on my Win98 machine and Ragnar's Debian(?). On my WinXP it works, but the Radiobuttons are connected slightly random.
I'm sure that Björn will continue working on that.
/Oscar
mattricks@lists.lysator.liu.se