@@ -54,22 +54,23 @@ def getText(self, callingWindow, itmContext, mainItem):
5454 def activate (self , callingWindow , fullContext , mainItem , i ):
5555 fitID = self .mainFrame .getActiveFit ()
5656 fit = Fit .getInstance ().getFit (fitID )
57- bandwidth_per_drone = fit .drones [0 ].item . \
58- attributes ['droneBandwidthUsed' ].value
59- ship_bandwidth = fit .ship .item .attributes ['droneBandwidth' ].value
60- max_active_drones = int (ship_bandwidth / bandwidth_per_drone )
61- if max_active_drones == 0 :
62- wx .MessageDialog (
63- None , "Cannot split drone stack to fit bandwidth. Each drone "
64- "uses {0} mbit/s and this ship only has {1} mbit/s."
65- .format (int (bandwidth_per_drone ), int (ship_bandwidth )),
66- "Ship drone bandwidth exceeded" , wx .OK | wx .ICON_ERROR
67- ).ShowModal ()
68- else :
69- if max_active_drones > 5 :
70- max_active_drones = 5
57+ if mainItem in fit .drones :
58+ bandwidth_per_drone = mainItem .item .\
59+ attributes ['droneBandwidthUsed' ].value
60+ ship_bandwidth = fit .ship .item .attributes ['droneBandwidth' ].value
61+ max_active_drones = int (ship_bandwidth / bandwidth_per_drone )
62+ if max_active_drones == 0 :
63+ wx .MessageDialog (
64+ None , "Cannot split drone stack to fit bandwidth. This "
65+ "drone type uses {0} mbit/s and this ship only has {1} "
66+ "mbit/s." .format (int (bandwidth_per_drone ),
67+ int (ship_bandwidth )),
68+ "Ship drone bandwidth exceeded" , wx .OK | wx .ICON_ERROR
69+ ).ShowModal ()
70+ else :
71+ if max_active_drones > 5 :
72+ max_active_drones = 5
7173
72- if mainItem in fit .drones :
7374 position = fit .drones .index (mainItem )
7475 self .mainFrame .command .Submit (
7576 cmd .GuiSplitLocalDroneStackCommand (fitID = fitID ,
0 commit comments