| 1 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | #  Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | #  This file is part of Outer Space. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | #  Outer Space is free software; you can redistribute it and/or modify | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | #  it under the terms of the GNU General Public License as published by | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | #  the Free Software Foundation; either version 2 of the License, or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | #  (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | #  Outer Space is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | #  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | #  GNU General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | #  You should have received a copy of the GNU General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | #  along with Outer Space; if not, write to the Free Software | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | # | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | import pygame | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | import pygameui as ui | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | from osci.StarMapWidget import StarMapWidget | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | from osci import gdata, res, client, sequip | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | import ige.ospace.Const as Const | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | from ige.ospace import ShipUtils, Rules | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | from ConstrSelTechDlg import ConstrSelTechDlg | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | from ConstrUpgradeDlg import ConstrUpgradeDlg | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | from ConfirmDlg import ConfirmDlg | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | from ige import GameException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | class ConstructionDlg: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     def __init__(self, app): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         self.app = app | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         self.createUI() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         self.selTechDlg = ConstrSelTechDlg(app) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         self.upgradeDlg = ConstrUpgradeDlg(app) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         self.confirmDlg = ConfirmDlg(app) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         self.selectedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         self.highlightedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         self.editMode = False | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     def display(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         self.itemCache = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         self.hullID = Const.OID_NONE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         self.ctrlID = Const.OID_NONE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         self.eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         self.selectedEqID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         self.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         self.win.show() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         # register for updates | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         if self not in gdata.updateDlgs: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |             gdata.updateDlgs.append(self) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     def hide(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         self.win.setStatus(_("Ready.")) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         self.win.hide() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         # unregister updates | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         if self in gdata.updateDlgs: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |             gdata.updateDlgs.remove(self) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     def update(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         self.showDesigns() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     def showDesigns(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         player = client.getPlayer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         # check if highlighted ship design exists | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         if self.highlightedDesignID not in player.shipDesigns: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             self.highlightedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         # designs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         highlighted = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         items = [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         for designID in player.shipDesigns: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |             spec = player.shipDesigns[designID] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |             # number of ships with this design in fleet | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             countInService = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             for fleetID in player.fleets: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |                 fleet = client.get(fleetID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |                 for tmpDesignID, hp, shieldHP, exp in fleet.ships: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |                     if tmpDesignID == designID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |                         countInService += 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |             hullTech = client.getFullTechInfo(spec.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |             # number of ships in build queue | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |             countInBuild = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |             for planetID in client.db.keys(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |                 planet = client.get(planetID, noUpdate = 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |                 # skip non-planets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |                 if not hasattr(planet, "type") or planet.type != Const.T_PLANET \ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |                     or not hasattr(planet, 'owner') or not planet.owner == player.oid \ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |                     or not planet.prodQueue: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |                     continue | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |                 for task in planet.prodQueue: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |                     if task.isShip and task.techID == designID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |                         countInBuild += task.quantity | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             # plus ships in global queue | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             for queue in player.prodQueues: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |                 for task in queue: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |                     if task.isShip and task.techID == designID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |                         countInBuild += task.quantity | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             # ui list item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             item = ui.Item(spec.name, tDesignID = designID, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |                 tClass = "%s/%s%d" % ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |                     _(gdata.shipClasses[spec.combatClass][:1].upper()),_("TL"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |                     hullTech.level, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |                 tNumber = countInService, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |                 tInBuild = countInBuild | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |             if spec.upgradeTo: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |                 item.foreground = gdata.sevColors[gdata.NONE] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |             if designID == self.highlightedDesignID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |                 highlighted = item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |             items.append(item) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         self.win.vDesigns.items = items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         self.win.vDesigns.itemsChanged() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         self.win.vDesigns.highlightItem(highlighted, 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     def _setDetailButtons(self, player): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         if self.selectedDesignID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |             self.win.vScrap.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |             if player.shipDesigns[self.selectedDesignID].upgradeTo == 0: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |                 self.win.vUpgrade.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                 self.win.vUpgrade.text = _("Upgrade") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |                 self.win.vUpgrade.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |                 self.win.vUpgrade.text = _("Cancel Upgrd") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |             self.win.vName.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             self.win.vEnginesButton.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |             self.win.vWeaponsButton.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             self.win.vEquipmentButton.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |             self.win.vUpgrade.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |             self.win.vUpgrade.text = _("Upgrade") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             self.win.vScrap.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |             # only view mode? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             # let's reset highlights in design listboxes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             self.selectedEqID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             self.win.vName.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             self.win.vEngines.unselectAll() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |             self.win.vWeapons.unselectAll() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |             self.win.vEquipment.unselectAll() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |             self.win.vDuplDesign.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |             self.win.vConstruct.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             self.win.vEnginesButton.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |             self.win.vWeaponsButton.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |             self.win.vEquipmentButton.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |             if not self.selectedDesignID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |                 self.win.vScrap.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |                 self.win.vUpgrade.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     def _designRepresentation(self, player): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         if self.highlightedDesignID is None: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |             if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |                 if self.ctrlID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |                     eqIDs = {self.ctrlID : 1} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |                 else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |                     eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |                 for eqID in self.eqIDs: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |                     eqIDs[eqID] = self.eqIDs[eqID] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |                 improvements = [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |                 self.hullID = self.ctrlID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |                 self.win.vName.text = "" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |                 self.eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |                 eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |                 improvements = [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |         else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             spec = player.shipDesigns[self.highlightedDesignID] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             self.hullID = spec.hullID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |             eqIDs = spec.eqIDs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |             improvements = spec.improvements | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |             self.win.vName.text = spec.name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |             self.win.vHull.text = client.getTechInfo(self.hullID).name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |             self.eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |             for eqID in eqIDs: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                 tech = client.getTechInfo(eqID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |                 if tech.subtype == "seq_ctrl": | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |                     self.ctrlID = eqID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |                     self.win.vCtrl.text = tech.name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |                 else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |                     self.eqIDs[eqID] = eqIDs[eqID] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         try: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |             result = ShipUtils.makeShipFullSpec(player, None, self.hullID, eqIDs, improvements) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |             if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |                 self.win.vConstruct.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         except GameException, e: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |             self.win.setStatus(e.args[0]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |             self.win.vConstruct.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |             try: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |                 result = ShipUtils.makeShipFullSpec(player, None, self.hullID, eqIDs, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |                     improvements, raiseExs = False) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |             except GameException: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |                 result = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |             self.win.setStatus(_("Ready.")) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         return result | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 203 |  |  |     def _detailEquipmentLists(self): | 
            
                                                                        
                            
            
                                    
            
            
                | 204 |  |  |         # design info | 
            
                                                                        
                            
            
                                    
            
            
                | 205 |  |  |         if self.hullID: | 
            
                                                                        
                            
            
                                    
            
            
                | 206 |  |  |             tech = client.getTechInfo(self.hullID) | 
            
                                                                        
                            
            
                                    
            
            
                | 207 |  |  |             self.win.vHull.text = tech.name # TODO _(tech.name) | 
            
                                                                        
                            
            
                                    
            
            
                | 208 |  |  |         elif self.editMode: | 
            
                                                                        
                            
            
                                    
            
            
                | 209 |  |  |             self.win.vHull.text = _("[Click to select]") | 
            
                                                                        
                            
            
                                    
            
            
                | 210 |  |  |         else: | 
            
                                                                        
                            
            
                                    
            
            
                | 211 |  |  |             self.win.vHull.text = "" | 
            
                                                                        
                            
            
                                    
            
            
                | 212 |  |  |         if self.ctrlID: | 
            
                                                                        
                            
            
                                    
            
            
                | 213 |  |  |             tech = client.getTechInfo(self.ctrlID) | 
            
                                                                        
                            
            
                                    
            
            
                | 214 |  |  |             self.win.vCtrl.text = tech.name # TODO _(tech.name) | 
            
                                                                        
                            
            
                                    
            
            
                | 215 |  |  |         elif self.editMode: | 
            
                                                                        
                            
            
                                    
            
            
                | 216 |  |  |             self.win.vCtrl.text = _("[Click to select]") | 
            
                                                                        
                            
            
                                    
            
            
                | 217 |  |  |         else: | 
            
                                                                        
                            
            
                                    
            
            
                | 218 |  |  |             self.win.vCtrl.text = "" | 
            
                                                                        
                            
            
                                    
            
            
                | 219 |  |  |         # equipments | 
            
                                                                        
                            
            
                                    
            
            
                | 220 |  |  |         engines = [] | 
            
                                                                        
                            
            
                                    
            
            
                | 221 |  |  |         weapons = [] | 
            
                                                                        
                            
            
                                    
            
            
                | 222 |  |  |         equipment = [] | 
            
                                                                        
                            
            
                                    
            
            
                | 223 |  |  |         selected = None | 
            
                                                                        
                            
            
                                    
            
            
                | 224 |  |  |         selected_type = None | 
            
                                                                        
                            
            
                                    
            
            
                | 225 |  |  |         for eqID in self.eqIDs: | 
            
                                                                        
                            
            
                                    
            
            
                | 226 |  |  |             tech = client.getTechInfo(eqID) | 
            
                                                                        
                            
            
                                    
            
            
                | 227 |  |  |             short = sequip.getShortDescr(eqID) | 
            
                                                                        
                            
            
                                    
            
            
                | 228 |  |  |             long = sequip.getLongDescr(eqID) | 
            
                                                                        
                            
            
                                    
            
            
                | 229 |  |  |             # cache has been introduced to let items preserve highlight information | 
            
                                                                        
                            
            
                                    
            
            
                | 230 |  |  |             if eqID in self.itemCache: | 
            
                                                                        
                            
            
                                    
            
            
                | 231 |  |  |                 item = self.itemCache[eqID] | 
            
                                                                        
                            
            
                                    
            
            
                | 232 |  |  |                 item.tNumber = self.eqIDs[eqID] | 
            
                                                                        
                            
            
                                    
            
            
                | 233 |  |  |             else: | 
            
                                                                        
                            
            
                                    
            
            
                | 234 |  |  |                 item = ui.Item(tech.name, techID = eqID, tNumber = self.eqIDs[eqID], | 
            
                                                                        
                            
            
                                    
            
            
                | 235 |  |  |                     tData = short, tooltipTitle = _("Details"), tooltip = long, statustip = long) | 
            
                                                                        
                            
            
                                    
            
            
                | 236 |  |  |                 self.itemCache[eqID] = item | 
            
                                                                        
                            
            
                                    
            
            
                | 237 |  |  |             if eqID == self.selectedEqID: | 
            
                                                                        
                            
            
                                    
            
            
                | 238 |  |  |                 selected = item | 
            
                                                                        
                            
            
                                    
            
            
                | 239 |  |  |                 selected_type = tech.subtype | 
            
                                                                        
                            
            
                                    
            
            
                | 240 |  |  |             if tech.subtype == "seq_eng": | 
            
                                                                        
                            
            
                                    
            
            
                | 241 |  |  |                 engines.append(item) | 
            
                                                                        
                            
            
                                    
            
            
                | 242 |  |  |             elif tech.subtype == "seq_wpn": | 
            
                                                                        
                            
            
                                    
            
            
                | 243 |  |  |                 weapons.append(item) | 
            
                                                                        
                            
            
                                    
            
            
                | 244 |  |  |             elif tech.subtype in ["seq_mod", "seq_struct"]: | 
            
                                                                        
                            
            
                                    
            
            
                | 245 |  |  |                 equipment.append(item) | 
            
                                                                        
                            
            
                                    
            
            
                | 246 |  |  |         self.win.vEngines.items = engines | 
            
                                                                        
                            
            
                                    
            
            
                | 247 |  |  |         self.win.vEngines.itemsChanged() | 
            
                                                                        
                            
            
                                    
            
            
                | 248 |  |  |         if selected_type == "seq_eng": | 
            
                                                                        
                            
            
                                    
            
            
                | 249 |  |  |             self.win.vEngines.selectItem(selected) | 
            
                                                                        
                            
            
                                    
            
            
                | 250 |  |  |         else: | 
            
                                                                        
                            
            
                                    
            
            
                | 251 |  |  |             self.win.vEngines.selectItem(None) | 
            
                                                                        
                            
            
                                    
            
            
                | 252 |  |  |         self.win.vWeapons.items = weapons | 
            
                                                                        
                            
            
                                    
            
            
                | 253 |  |  |         self.win.vWeapons.itemsChanged() | 
            
                                                                        
                            
            
                                    
            
            
                | 254 |  |  |         if selected_type == "seq_wpn": | 
            
                                                                        
                            
            
                                    
            
            
                | 255 |  |  |             self.win.vWeapons.selectItem(selected) | 
            
                                                                        
                            
            
                                    
            
            
                | 256 |  |  |         else: | 
            
                                                                        
                            
            
                                    
            
            
                | 257 |  |  |             self.win.vWeapons.selectItem(None) | 
            
                                                                        
                            
            
                                    
            
            
                | 258 |  |  |         self.win.vEquipment.items = equipment | 
            
                                                                        
                            
            
                                    
            
            
                | 259 |  |  |         self.win.vEquipment.itemsChanged() | 
            
                                                                        
                            
            
                                    
            
            
                | 260 |  |  |         if selected_type == "seq_mod": | 
            
                                                                        
                            
            
                                    
            
            
                | 261 |  |  |             self.win.vEquipment.selectItem(selected) | 
            
                                                                        
                            
            
                                    
            
            
                | 262 |  |  |         else: | 
            
                                                                        
                            
            
                                    
            
            
                | 263 |  |  |             self.win.vEquipment.selectItem(None) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     def _detailComputedAttributes(self, player, result): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         if result: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |             hull = client.getTechInfo(result.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             self.win.vAClass.text = _(gdata.shipClasses[result.combatClass]) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |             self.win.vASignature.text = _("%d") % result.signature | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |             self.win.vASpeed.text = _("%.2f") % result.speed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |             if result.shieldHP > 0: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                 self.win.vAHP.text = _("%d - %d") % (result.maxHP, result.shieldHP) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |                 self.win.vAHP.text = _("%d") % result.maxHP | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             self.win.vAAttack.text = _("%d") % result.combatAtt | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |             self.win.vADefence.text = _("%d / %d") % (result.combatDef, result.missileDef) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |             if hasattr(hull, "maxWeight"): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |                 self.win.vAPayload.text = _("%d") % (hull.maxWeight - result.weight) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |                 self.win.vAPayload.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |             if hasattr(hull, "slots"): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                 self.win.vASlots.text = _("%d") % (hull.slots - result.slots) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |                 self.win.vASlots.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |             self.win.vATanks.text = _("%d") % result.storEn | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |             if result.speed > 0: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |                 support = 10000000 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |                 if result.operEn > 0: support = min(support, result.storEn / result.operEn) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |                 self.win.vARange.text = _("%.2f") % (support * result.speed / Rules.turnsPerDay) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |                 self.win.vARange.text = _("None") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |             self.win.vACCPts.text = _("%d") % result.buildProd | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |             self.win.vACombatPwr.text = _("%d") % result.combatPwr | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |             if self.highlightedDesignID and player.shipDesigns[self.highlightedDesignID].upgradeTo: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |                 self.win.vAUpgrade.text = player.shipDesigns[player.shipDesigns[self.highlightedDesignID].upgradeTo].name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |                 self.win.vAUpgrade.font = "normal-italic" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |                 self.win.vAUpgrade.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |                 self.win.vAUpgrade.font = "normal" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |             self.win.vAClass.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |             self.win.vASignature.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |             self.win.vASpeed.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |             self.win.vAHP.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |             self.win.vAAttack.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |             self.win.vADefence.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |             self.win.vAPayload.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |             self.win.vASlots.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |             self.win.vATanks.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |             self.win.vARange.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |             self.win.vACCPts.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |             self.win.vACombatPwr.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |             self.win.vAUpgrade.text = _("N/A") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |     def showDetails(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |         player = client.getPlayer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |         self._setDetailButtons(player) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |         result = self._designRepresentation(player) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |         self._detailEquipmentLists() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |         self._detailComputedAttributes(player, result) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |     def onConstruct(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         name = self.win.vName.text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |         if not name: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |             self.win.setStatus(_("Enter name of the design.")) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |             return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |         # compute | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |         player = client.getPlayer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |         if self.ctrlID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |             eqIDs = {self.ctrlID: 1} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |         else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |             eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |         for eqID in self.eqIDs: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |             if self.eqIDs[eqID]: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |                 eqIDs[eqID] = self.eqIDs[eqID] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |         try: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |             self.win.setStatus(_("Executing ADD SHIP DESIGN command...")) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |             player = client.getPlayer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |             player.shipDesigns, self.selectedDesignID = \ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |                 client.cmdProxy.addShipDesign(player.oid, name, self.hullID, eqIDs) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |             self.win.vDuplDesign.enabled = 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |             self.win.setStatus(_('Command has been executed.')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         except GameException, e: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |             self.win.setStatus(_(e.args[0])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |             return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |         self.editMode = False | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |         self.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |     def onClose(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         self.editMode = False | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         self.hide() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     def onSelectHull(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |         if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |             self.selTechDlg.display('isShipHull', [], self.onHullSelected, self.hullID, self.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |     def onHullSelected(self, hullID): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |         self.hullID = hullID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |         self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |     def onSelectCtrl(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |         if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |             self.selTechDlg.display('isShipEquip', ["seq_ctrl"], self.onCtrlSelected, self.ctrlID, self.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     def onCtrlSelected(self, ctrlID): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |         self.ctrlID = ctrlID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |     def onAddEngine(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |         self.selTechDlg.display('isShipEquip', ["seq_eng"], self.onEqSelected, hullID = self.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |     def onAddWeapon(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |         self.selTechDlg.display('isShipEquip', ["seq_wpn"], self.onEqSelected, hullID = self.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |     def onAddEquipment(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         self.selTechDlg.display('isShipEquip', ["seq_mod", "seq_struct"], self.onEqSelected, hullID = self.hullID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |     def onEqSelected(self, eqID): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |         self.eqIDs[eqID] = self.eqIDs.get(eqID, 0) + 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |         self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |     def onSelectDesign(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |         item = self.win.vDesigns.selection[0] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |         self.editMode = False | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |         self.selectedDesignID = self.highlightedDesignID = item.tDesignID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |         self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |     def onHighlightDesign(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |         if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |             return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |         if data is None and not self.win.vDesigns.selection: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |             # unhighlight into non-selection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |             self.highlightedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |             self.win.vDuplDesign.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |             self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |             return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |         if data is not None: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |             item = self.win.vDesigns.highlight | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |         elif self.win.vDesigns.selection: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |             item = self.win.vDesigns.selection[0] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |         self.highlightedDesignID = item.tDesignID | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     def onNewDesign(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |         self.selectedDesignID = self.highlightedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |         self.editMode = True | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |         self.win.vDesigns.selectItem(None) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |         self.hullID = Const.OID_NONE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |         self.ctrlID = Const.OID_NONE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |         self.eqIDs = {} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |         self.win.vName.text = _(" ") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |         self.win.vDuplDesign.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |         self.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |     def onDuplDesign(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |         self.selectedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |         self.highlightedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         self.editMode = True | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |         self.win.vDesigns.selectItem(None) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |         self.win.vName.text = _(" ") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |         self.win.vDuplDesign.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |         self.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |     def _getSelectedWidget(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |         widgets = [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |         if self.win.vEngines.selection: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |             widgets.append(self.win.vEngines) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |         if self.win.vWeapons.selection: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |             widgets.append(self.win.vWeapons) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |         if self.win.vEquipment.selection: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |             widgets.append(self.win.vEquipment) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         return widgets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |     def onEqSelectedInListInc(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |         if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |             self._onEqSelectedInList(widget) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |             if not pygame.key.get_mods() & pygame.KMOD_SHIFT: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |                 self._onChangeEquipmentQty(1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |                 self._onChangeEquipmentQty(5) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |     def onEqSelectedInListDec(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |         if self.editMode: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |             self._onEqSelectedInList(widget) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |             if not pygame.key.get_mods() & pygame.KMOD_SHIFT: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |                 self._onChangeEquipmentQty(-1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |             else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |                 self._onChangeEquipmentQty(-5) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |     def _onEqSelectedInList(self, widget): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         for old_select_widget in self._getSelectedWidget(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |             if old_select_widget is not widget: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |                 old_select_widget.unselectAll() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |         self.selectedEqID = widget.selection[0].techID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |     def _onChangeEquipmentQty(self, delta): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |         for widget in self._getSelectedWidget(): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |             item = widget.selection[0] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |             eqID = item.techID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |             self.eqIDs[eqID] = max(self.eqIDs.get(eqID, 0) + delta, 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |             self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |     def onRemoveEquipment(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |         if self.win.vEquipment.selection: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |             item = self.win.vEquipment.selection[0] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |             eqID = item.techID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |             del self.eqIDs[eqID] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |             self.showDetails() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |     def onScrap(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |         # count number of ships using this design | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |         count = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |         for fleetID in client.getPlayer().fleets: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |             fleet = client.get(fleetID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |             for designID, hp, shieldHP, exp in fleet.ships: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |                 if designID == self.selectedDesignID: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |                     count += 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |         self.confirmDlg.display(_('Deletion of this design dismantle %d ship(s). Are you sure to scrap it?') % count, _('Yes'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |             _('No'), confirmAction = self.onScrapConfirmed) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |     def onScrapConfirmed(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |         self.win.vDuplDesign.enabled = 0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |         try: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |             self.win.setStatus(_("Executing SCRAP SHIP DESIGN command...")) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |             player = client.getPlayer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |             oldFleets = player.fleets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |             player.shipDesigns, player.fleets, player.stratRes, player.prodQueues = \ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |                 client.cmdProxy.scrapShipDesign(player.oid, self.selectedDesignID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |             self.selectedDesignID = None | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |             self.win.setStatus(_('Command has been executed.')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |         except GameException, e: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |             self.win.setStatus(_(e.args[0])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |             return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |         # reread information about fleets and planets | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |         oldFleets.extend(player.planets) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |         client.updateIDs(oldFleets) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |         gdata.mainGameDlg.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |         self.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |     def onUpgrade(self, widget, action, data): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |         player = client.getPlayer() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |         if player.shipDesigns[self.selectedDesignID].upgradeTo == 0: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |             # upgrade | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |             self.upgradeDlg.display(self.selectedDesignID, self) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |         else: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |             # cancel upgrade | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |             try: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |                 self.win.setStatus(_("Executing CANCEL UPGRADE SHIP DESIGN command...")) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |                 player.shipDesigns = \ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |                     client.cmdProxy.cancelUpgradeShipDesign(player.oid, self.selectedDesignID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |                 self.win.setStatus(_('Command has been executed.')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |             except GameException, e: | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |                 self.win.setStatus(_(e.args[0])) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |                 return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |             self.update() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |     def createUI(self): | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |         w, h = gdata.scrnSize | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |         self.win = ui.Window(self.app, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |             modal = 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |             escKeyClose = 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |             titleOnly = w == 800 and h == 600, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |             movable = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |             title = _('Construction Centre'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |             rect = ui.Rect((w - 800 - 4 * (w != 800)) / 2, (h - 600 - 4 * (h != 600)) / 2, 800 + 4 * (w != 800), 580 + 4 * (h != 600)), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |             layoutManager = ui.SimpleGridLM(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |         self.win.subscribeAction('*', self) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |         # player listing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |         ui.Title(self.win, layout = (0, 0, 15, 1), text = _('Ship Designs'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |             font = 'normal-bold', align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |         ui.Listbox(self.win, layout = (0, 1, 15, 25), id = 'vDesigns', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |             columns = ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |                 (_('#'), 'tNumber', 2, ui.ALIGN_E), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |                 (_('B'), 'tInBuild', 2, ui.ALIGN_E), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |                 (_('Name'), 'text', 8, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |                 (_('Class'), 'tClass', 2, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |             columnLabels = 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |             action = "onSelectDesign", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |             hoverAction = "onHighlightDesign" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |         ui.Button(self.win, layout = (0, 26, 7, 1), text = _("New design"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |             action = "onNewDesign") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |         ui.Button(self.win, layout = (7, 26, 7, 1), text = _("Dupl. design"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |             action = "onDuplDesign", enabled = 0, id = "vDuplDesign") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |         # current design | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |         ui.Title(self.win, layout = (15, 0, 25, 1), text = _('Design'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |             font = 'normal-bold', align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |         # info | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |         ui.Label(self.win, layout = (15, 1, 5, 1), text = _("Name"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |             align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 554 |  |  |         ui.Entry(self.win, layout = (20, 1, 10, 1), id = "vName", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 555 |  |  |             align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 556 |  |  |         ui.Label(self.win, layout = (15, 2, 5, 1), text = _("Hull type"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 557 |  |  |             align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 558 |  |  |         ui.ActiveLabel(self.win, layout = (20, 2, 10, 1), id = "vHull", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 559 |  |  |             align = ui.ALIGN_E, action = "onSelectHull") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 560 |  |  |         ui.Label(self.win, layout = (15, 3, 5, 1), text = _("Control unit"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 561 |  |  |             align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 562 |  |  |         ui.ActiveLabel(self.win, layout = (20, 3, 10, 1), id = "vCtrl", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 563 |  |  |             align = ui.ALIGN_E, action = "onSelectCtrl") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 564 |  |  |         ui.Button(self.win, layout = (15, 4, 6, 1), text = _('Engines'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 565 |  |  |             id = "vEnginesButton", font = 'normal-bold', action = "onAddEngine") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 566 |  |  |         ui.Title(self.win, layout = (21, 4, 19, 1),) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 567 |  |  |         ui.Listbox(self.win, layout = (15, 5, 25, 3), id = 'vEngines', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 568 |  |  |             columns = ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 569 |  |  |                 (_('#'), 'tNumber', 2, ui.ALIGN_E), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 570 |  |  |                 (_('Name'), 'text', 8, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 571 |  |  |                 (_('Data'), 'tData', 14, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 572 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 573 |  |  |             columnLabels = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 574 |  |  |             action = "onEqSelectedInListInc", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 575 |  |  |             rmbAction = "onEqSelectedInListDec" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 576 |  |  |         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 577 |  |  |         ui.Button(self.win, layout = (15, 8, 6, 1), text = _('Weapons'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 578 |  |  |             id = "vWeaponsButton", font = 'normal-bold', action = "onAddWeapon") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 579 |  |  |         ui.Title(self.win, layout = (21, 8, 19, 1),) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 580 |  |  |         ui.Listbox(self.win, layout = (15, 9, 25, 4), id = 'vWeapons', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 581 |  |  |             columns = ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 582 |  |  |                 (_('#'), 'tNumber', 2, ui.ALIGN_E), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 583 |  |  |                 (_('Name'), 'text', 8, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 584 |  |  |                 (_('Data'), 'tData', 14, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 585 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 586 |  |  |             columnLabels = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 587 |  |  |             action = "onEqSelectedInListInc", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 588 |  |  |             rmbAction = "onEqSelectedInListDec" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 589 |  |  |         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 590 |  |  |         ui.Button(self.win, layout = (15, 13, 6, 1), text = _('Equipment'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 591 |  |  |             id = "vEquipmentButton", font = 'normal-bold', action = "onAddEquipment") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 592 |  |  |         ui.Title(self.win, layout = (21, 13, 19, 1),) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 593 |  |  |         ui.Listbox(self.win, layout = (15, 14, 25, 5), id = 'vEquipment', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 594 |  |  |             columns = ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 595 |  |  |                 (_('#'), 'tNumber', 2, ui.ALIGN_E), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 596 |  |  |                 (_('Name'), 'text', 8, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 597 |  |  |                 (_('Data'), 'tData', 14, ui.ALIGN_W), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 598 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 599 |  |  |             columnLabels = 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 600 |  |  |             action = "onEqSelectedInListInc", | 
            
                                                                                                            
                            
            
                                    
            
            
                | 601 |  |  |             rmbAction = "onEqSelectedInListDec" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 602 |  |  |         ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 603 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 604 |  |  |         ui.Button(self.win, layout = (15, 19, 6, 1), text = _("Upgrade to"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 605 |  |  |                  id = "vUpgrade", font = 'normal-bold', action = "onUpgrade") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 606 |  |  |         ui.Label(self.win, layout = (21, 19, 6, 1), id = "vAUpgrade", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 607 |  |  |         ui.Title(self.win, layout = (27.5, 19, 12.5, 1)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 608 |  |  |         # ship's attrs | 
            
                                                                                                            
                            
            
                                    
            
            
                | 609 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 610 |  |  |         ui.Label(self.win, layout = (30.5, 1, 4.5, 1), text = _("Class"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 611 |  |  |         ui.Label(self.win, layout = (35, 1, 4.75, 1), id = "vAClass", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 612 |  |  |         ui.Label(self.win, layout = (30.5, 2, 6.5, 1), text = _("Free slots"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 613 |  |  |         ui.Label(self.win, layout = (37, 2, 2.75, 1), id = "vASlots", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 614 |  |  |         ui.Label(self.win, layout = (30.5, 3, 6.5, 1), text = _("Unused payload"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 615 |  |  |         ui.Label(self.win, layout = (37, 3, 2.75, 1), id = "vAPayload", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 616 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 617 |  |  |         ui.Label(self.win, layout = (17, 21, 4, 1), text = _("HP"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 618 |  |  |         ui.Label(self.win, layout = (21, 21, 5, 1), id = "vAHP", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 619 |  |  |         ui.Label(self.win, layout = (17, 22, 4, 1), text = _("Base attack"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 620 |  |  |         ui.Label(self.win, layout = (21, 22, 5, 1), id = "vAAttack", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 621 |  |  |         ui.Label(self.win, layout = (17, 23, 3, 1), text = _("Base defence"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 622 |  |  |         ui.Label(self.win, layout = (20, 23, 6, 1), id = "vADefence", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 623 |  |  |         ui.Label(self.win, layout = (17, 24, 5, 1), text = _("Military power"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 624 |  |  |         ui.Label(self.win, layout = (22, 24, 4, 1), id = "vACombatPwr", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 625 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 626 |  |  |         ui.Label(self.win, layout = (28, 20, 5, 1), text = _("Signature"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 627 |  |  |         ui.Label(self.win, layout = (33, 20, 5, 1), id = "vASignature", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 628 |  |  |         ui.Label(self.win, layout = (28, 21, 5, 1), text = _("Speed"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 629 |  |  |         ui.Label(self.win, layout = (33, 21, 5, 1), id = "vASpeed", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 630 |  |  |         ui.Label(self.win, layout = (28, 22, 5, 1), text = _("Tanks"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 631 |  |  |         ui.Label(self.win, layout = (33, 22, 5, 1), id = "vATanks", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 632 |  |  |         ui.Label(self.win, layout = (28, 23, 5, 1), text = _("Max. range"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 633 |  |  |         ui.Label(self.win, layout = (33, 23, 5, 1), id = "vARange", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 634 |  |  |         ui.Label(self.win, layout = (28, 24, 5, 1), text = _("Constr. pts"), align = ui.ALIGN_W) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 635 |  |  |         ui.Label(self.win, layout = (33, 24, 5, 1), font = 'normal-bold', id = "vACCPts", align = ui.ALIGN_E) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 636 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 637 |  |  |         # actions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 638 |  |  |         ui.Title(self.win, layout = (15, 25, 25, 1)) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 639 |  |  |         ui.Button(self.win, layout = (15, 26, 5, 1), text = _("Scrap"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 640 |  |  |             id = "vScrap", action = "onScrap") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 641 |  |  |         ui.Button(self.win, layout = (35, 26, 5, 1), text = _("Construct"), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 642 |  |  |             id = "vConstruct", action = "onConstruct", enabled = 0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 643 |  |  |         # status bar + submit/cancel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 644 |  |  |         ui.TitleButton(self.win, layout = (35, 27, 5, 1), text = _('Close'), action = 'onClose') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 645 |  |  |         ui.Title(self.win, id = 'vStatusBar', layout = (0, 27, 35, 1), align = ui.ALIGN_W) | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 646 |  |  |         #self.win.statusBar = self.win.vStatusBar | 
            
                                                        
            
                                    
            
            
                | 647 |  |  |  |