@@ -130,33 +130,36 @@ def switchToFirepowerView(self, event):
130130 def refreshPanel (self , fit ):
131131 # If we did anything intresting, we'd update our labels to reflect the new fit's stats here
132132
133- stats = (("labelFullminingyieldMiner" , lambda : fit .minerYield , lambda : fit .minerWaste , 3 , 0 , 0 , "{} {} m\u00B3 /s" , None ),
134- ("labelFullminingyieldDrone" , lambda : fit .droneYield , lambda : fit .droneWaste , 3 , 0 , 0 , "{} {} m\u00B3 /s" , None ),
135- ("labelFullminingyieldTotal" , lambda : fit .totalYield , lambda : fit .totalWaste , 3 , 0 , 0 , "{} {} m\u00B3 /s" , None ))
133+ stats = (("labelFullminingyieldMiner" , lambda : fit .minerYield , lambda : fit .minerDrain , 3 , 0 , 0 , "{} m\u00B3 /s" , None ),
134+ ("labelFullminingyieldDrone" , lambda : fit .droneYield , lambda : fit .droneDrain , 3 , 0 , 0 , "{} m\u00B3 /s" , None ),
135+ ("labelFullminingyieldTotal" , lambda : fit .totalYield , lambda : fit .totalDrain , 3 , 0 , 0 , "{} m\u00B3 /s" , None ))
136136
137137 def processValue (value ):
138138 value = value () if fit is not None else 0
139139 value = value if value is not None else 0
140140 return value
141141
142142 counter = 0
143- for labelName , yieldValue , wasteValue , prec , lowest , highest , valueFormat , altFormat in stats :
143+ for labelName , yieldValue , drainValue , prec , lowest , highest , valueFormat , altFormat in stats :
144144 label = getattr (self , labelName )
145145 yieldValue = processValue (yieldValue )
146- wasteValue = processValue (wasteValue )
147- if self ._cachedValues [counter ] != (yieldValue , wasteValue ):
146+ drainValue = processValue (drainValue )
147+ if self ._cachedValues [counter ] != (yieldValue , drainValue ):
148+ try :
149+ efficiency = '{}%' .format (formatAmount (yieldValue / drainValue * 100 , 4 , 0 , 0 ))
150+ except ZeroDivisionError :
151+ efficiency = '0%'
148152 yps = formatAmount (yieldValue , prec , lowest , highest )
149153 yph = formatAmount (yieldValue * 3600 , prec , lowest , highest )
150- wps = formatAmount (wasteValue , prec , lowest , highest )
151- wph = formatAmount (wasteValue * 3600 , prec , lowest , highest )
152- wasteSuffix = '\u02b7 ' if wasteValue > 0 else ''
153- label .SetLabel (valueFormat .format (yps , wasteSuffix ))
154+ dps = formatAmount (drainValue , prec , lowest , highest )
155+ dph = formatAmount (drainValue * 3600 , prec , lowest , highest )
156+ label .SetLabel (valueFormat .format (yps ))
154157 tipLines = []
155- tipLines .append ("{} m\u00B3 mining yield per second ({} m\u00B3 per hour)" .format (yps , yph ))
156- if wasteValue > 0 :
157- tipLines .append ("{} m \u00B3 mining waste per second ({} m \u00B3 per hour)" . format ( wps , wph ) )
158+ tipLines .append ("{} m\u00B3 yield per second ({} m\u00B3 per hour)" .format (yps , yph ))
159+ tipLines . append ( "{} m \u00B3 drain per second ({} m \u00B3 per hour)" . format ( dps , dph ))
160+ tipLines .append (f' { efficiency } efficiency' )
158161 label .SetToolTip (wx .ToolTip ('\n ' .join (tipLines )))
159- self ._cachedValues [counter ] = (yieldValue , wasteValue )
162+ self ._cachedValues [counter ] = (yieldValue , drainValue )
160163 counter += 1
161164 self .panel .Layout ()
162165 self .headerPanel .Layout ()
0 commit comments