wafer_map icon indicating copy to clipboard operation
wafer_map copied to clipboard

Legend_bool doesnt seem to be working properly

Open jpernia101 opened this issue 5 years ago • 3 comments

Hey Doug hope you can help me w/ one little thing , I've decided is probably better to remove the legends and just make one legend separately but when I try to use the method legend_bool = False the legend still appears as it did before. do you think is something wrong in the way is implemented im pretty sure I'm correctly writing it . Let me know if you suspect anything. I'd really appreciate it

temp = wm_core.WaferMapPanel(listOfPanels[i//25], listOfTuples[i], waferDesign, data_type='discrete'.lower() , show_die_gridlines= False )
temp.legend_bool = True
listOfWaferPanels.append(temp)

jpernia101 avatar Oct 22 '18 18:10 jpernia101

UPDATE : I used the method toggle_legend() and it removed most of the legend on each wafer but it kept the one small square on each one. the code and image is shown below

temp = wm_core.WaferMapPanel(listOfPanels[i//30], listOfTuples[i], waferDesign, data_type='discrete'.lower() , show_die_gridlines= False )
temp.toggle_legend()
listOfWaferPanels.append(temp)

image

I also tried to do

temp = wm_core.WaferMapPanel(listOfPanels[i//30], listOfTuples[i], waferDesign, data_type='discrete'.lower() , show_die_gridlines= False )
temp.legend_bool = False
temp.toggle_legend()
listOfWaferPanels.append(temp)

and I got an error that said wx._core.wxAssertionError: C++ assertion "!sizer || m_containingSizer != sizer" failed at ..\..\src\common\wincmn.cpp(2470) in wxWindowBase::SetContainingSizer(): Adding a window to the same sizer twice?

when I set the temp.legend_bool = False to temp.legend_bool = True I got the same result I did on the image shown above

jpernia101 avatar Oct 22 '18 20:10 jpernia101

I'm unable to reproduce the issue - can you post a bit more code? Do you have a git repo for the project that I could look at?

Setting legend_bool after initializing the WaferMapPanel won't help you - at that point the legend has already been made. The correct way is to use toggle_legend() as you found. (I really ought to make legend_bool and a bunch of other attributes private...)

One thing you can try is hacking WaferMapPanel._init_ui(). Find the source code for it, copy it into your project, and remove the self._create_legend() line. Then overwrite the default function before you initialize any wafer maps:

def my_init_ui(self):
    ...

wm_core.WaferMapPanel._init_ui = my_init_ui          # note no parentheses
temp = wm_core.WaferMapPanel(...

dougthor42 avatar Oct 25 '18 14:10 dougthor42

no I don't have a Git repo for it but I found at intial load the legend does disappear but when I click on another tab from the notebook the little square appears again. My guess is that when it goes through the loop it keeps on toggling the legend on/off therefore resulting in that little square

for i in range(waferNum):
   for p in uniqueBins:
       keyValues.append({k: global_dict[k] for k in p}) 
    labels, colors = list(zip(*sorted(keyValues[i].items())))
    temp = wm_core.WaferMapPanel(listOfPanels[i//9], listOfTuples[i], waferDesign, data_type='discrete'.lower() , show_die_gridlines= False,discrete_legend_values =labels,discrete_legend_colors =colors )
    temp.toggle_legend()
    listOfWaferPanels.append(temp)
    tempBox = wx.BoxSizer(wx.VERTICAL)
    boxText = wx.StaticText( listOfPanels[i//9], wx.ID_ANY, flat_list[i][0], wx.DefaultPosition, wx.DefaultSize, 0 )
    boxText.Wrap(-1)
           
    tempBox.Add(boxText,0, wx.ALIGN_CENTER|wx.ALL, 0 )
    tempBox.Add( listOfWaferPanels[i], 1, wx.EXPAND |wx.ALL, 5 )
    listOfGridSizers[i//9].Add(tempBox, 1 , wx.EXPAND)

the image below is how it looks at first load image but when I click on the next tab the little square appears again image after that the little square appears in all of them including the beginning one

jpernia101 avatar Oct 25 '18 16:10 jpernia101