(self, maxColumns=1337)
| 834 | |
| 835 | # noinspection PyPropertyAccess |
| 836 | def MakeSnapshot(self, maxColumns=1337): |
| 837 | if self.FVsnapshot: |
| 838 | self.FVsnapshot = None |
| 839 | |
| 840 | tbmp = wx.Bitmap(16, 16) |
| 841 | tdc = wx.MemoryDC() |
| 842 | tdc.SelectObject(tbmp) |
| 843 | tdc.SetFont(self.font) |
| 844 | |
| 845 | columnsWidths = [] |
| 846 | for i in range(len(self.DEFAULT_COLS)): |
| 847 | columnsWidths.append(0) |
| 848 | |
| 849 | sFit = Fit.getInstance() |
| 850 | try: |
| 851 | fit = sFit.getFit(self.activeFitID) |
| 852 | except (KeyboardInterrupt, SystemExit): |
| 853 | raise |
| 854 | except Exception as e: |
| 855 | pyfalog.critical("Failed to get fit") |
| 856 | pyfalog.critical(e) |
| 857 | return |
| 858 | |
| 859 | if fit is None: |
| 860 | return |
| 861 | |
| 862 | slotMap = {} |
| 863 | |
| 864 | for slot in [e.value for e in FittingSlot]: |
| 865 | slotMap[slot] = fit.getSlotsFree(slot) < 0 |
| 866 | |
| 867 | padding = 2 |
| 868 | isize = 16 |
| 869 | headerSize = max(isize, tdc.GetTextExtent("W")[0]) + padding * 2 |
| 870 | |
| 871 | maxRowHeight = isize |
| 872 | rows = 0 |
| 873 | for st in self.mods: |
| 874 | for i, col in enumerate(self.activeColumns): |
| 875 | if i > maxColumns: |
| 876 | break |
| 877 | name = col.getText(st) |
| 878 | |
| 879 | if not isinstance(name, str): |
| 880 | name = "" |
| 881 | |
| 882 | nx, ny = tdc.GetTextExtent(name) |
| 883 | imgId = col.getImageId(st) |
| 884 | cw = 0 |
| 885 | if imgId != -1: |
| 886 | cw += isize + padding |
| 887 | if name != "": |
| 888 | cw += nx + 4 * padding |
| 889 | |
| 890 | if imgId == -1 and name == "": |
| 891 | cw += isize + padding |
| 892 | |
| 893 | maxRowHeight = max(ny, maxRowHeight) |
no test coverage detected