MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / refresh

Method refresh

gui/builtinViews/fittingView.py:754–819  ·  view source on GitHub ↗

Displays fitting Sends data to d.Display.refresh where the rows and columns are set up, then does a bit of post-processing (colors)

(self, stuff)

Source from the content-addressed store, hash-verified

752 return slotColourMap.get(slot) or self.GetBackgroundColour()
753
754 def refresh(self, stuff):
755 """
756 Displays fitting
757
758 Sends data to d.Display.refresh where the rows and columns are set up, then does a
759 bit of post-processing (colors)
760 """
761 self.Freeze()
762 d.Display.refresh(self, stuff)
763
764 sFit = Fit.getInstance()
765 fit = sFit.getFit(self.activeFitID)
766 slotMap = {}
767
768 # test for too many modules (happens with t3s / CCP change in slot layout)
769 for slot in [e.value for e in FittingSlot]:
770 slotMap[slot] = fit.getSlotsFree(slot) < 0
771
772 for i, mod in enumerate(self.mods):
773 self.SetItemBackgroundColour(i, self.GetBackgroundColour())
774
775 # only consider changing color if we're dealing with a Module
776 if isinstance(mod, Module):
777 hasRestrictionOverriden = False
778 if not mod.isEmpty:
779 fits = mod.fits(fit, False)
780 hasRestrictionOverriden = getattr(mod, 'restrictionOverridden', None)
781 # If module had broken fitting restrictions but now doesn't,
782 # ensure it is now valid, and remove restrictionOverridden
783 # variable. More in #1519
784 if not fit.ignoreRestrictions and hasRestrictionOverriden:
785 clean = False
786 if fits:
787 if not mod.hardpoint:
788 clean = True
789 elif fit.getHardpointsFree(mod.hardpoint) >= 0:
790 clean = True
791 if clean:
792 del mod.restrictionOverridden
793 hasRestrictionOverriden = not hasRestrictionOverriden
794
795
796 if slotMap[mod.slot] or hasRestrictionOverriden: # Color too many modules as red
797 self.SetItemBackgroundColour(i, errColorDark if isDark() else errColor)
798 elif sFit.serviceFittingOptions["colorFitBySlot"]: # Color by slot it enabled
799 self.SetItemBackgroundColour(i, self.slotColour(mod.slot))
800
801 # Set rack face to bold
802 if isinstance(mod, Rack) and \
803 sFit.serviceFittingOptions["rackSlots"] and \
804 sFit.serviceFittingOptions["rackLabels"]:
805 self.font.SetWeight(wx.FONTWEIGHT_BOLD)
806 self.SetItemFont(i, self.font)
807 else:
808 self.font.SetWeight(wx.FONTWEIGHT_NORMAL)
809 self.SetItemFont(i, self.font)
810
811 self.Thaw()

Callers 4

fitChangedMethod · 0.95
fitChangedMethod · 0.45
DoMethod · 0.45
DoMethod · 0.45

Calls 7

slotColourMethod · 0.95
isDarkFunction · 0.90
getFitMethod · 0.80
getSlotsFreeMethod · 0.80
getHardpointsFreeMethod · 0.80
getInstanceMethod · 0.45
fitsMethod · 0.45

Tested by

no test coverage detected