Skip to content

Commit

Permalink
Merge pull request #12 from fronzbot/fix-legend-redraw
Browse files Browse the repository at this point in the history
Legend now properly redrawn on new load
  • Loading branch information
fronzbot authored Oct 30, 2023
2 parents 574376c + e602660 commit f763c54
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions waferview/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ def create_panels(self):
size=self.grid_size,
name="Data Grid",
)
self.legend_panel = scrolled.ScrolledPanel(
self.left_panel,
size=self.legend_size,
pos=self.legend_pos,
name="Legend",
)

# Add main panels to the primary sizer
self.main_sizer = wx.BoxSizer(wx.HORIZONTAL)
Expand All @@ -123,20 +117,10 @@ def create_panels(self):
"left": wx.BoxSizer(wx.VERTICAL),
"right": wx.BoxSizer(),
"grid": wx.BoxSizer(),
"legend": wx.BoxSizer(wx.VERTICAL),
}

# Draw the grid and legend panels at startup
self.sizers["left"].Add(self.grid_panel, 1, wx.EXPAND | wx.ALL, border=1)
self.sizers["left"].Add(self.legend_panel, 1, wx.EXPAND | wx.ALL, border=2)

# Add text to the legend panel
font = wx.Font(wx.FontInfo(16).Bold())
legend_text = wx.StaticText(
self.legend_panel, label="Wafer Map Legend", style=wx.ALIGN_CENTER
)
legend_text.SetFont(font)
self.sizers["legend"].Add(legend_text, 1, wx.ALL | wx.ALIGN_CENTER, border=5)

def create_menu(self):
"""Create the menu bar."""
Expand All @@ -152,15 +136,34 @@ def create_viewer(self):
except AttributeError:
pixels = {}
colors = {}
# self.sizers["right"].AddStretchSpacer(1)
self.create_legend()
self.viewer = semimap.Viewer(
self, self.right_panel, self.viewer_size[0], self.viewer_size[1]
)
self.viewer.pixel_elements = pixels
self.viewer.color_map = colors
self.sizers["right"].Add(self.viewer, 1, wx.EXPAND | wx.ALL)

# self.sizers["right"].AddStretchSpacer(1)
def create_legend(self):
"""Create the legend section."""
try:
self.legend_panel.Destroy()
except AttributeError:
pass
self.legend_panel = scrolled.ScrolledPanel(
self.left_panel,
size=self.legend_size,
pos=self.legend_pos,
name="Legend",
)
self.sizers["left"].Add(self.legend_panel, 1, wx.EXPAND | wx.ALL, border=2)
self.sizers["legend"] = wx.BoxSizer(wx.VERTICAL)
font = wx.Font(wx.FontInfo(16).Bold())
legend_text = wx.StaticText(
self.legend_panel, label="Wafer Map Legend", style=wx.ALIGN_CENTER
)
legend_text.SetFont(font)
self.sizers["legend"].Add(legend_text, 1, wx.ALL | wx.ALIGN_CENTER, border=5)

def create_status(self):
"""Create the data grid table."""
Expand Down

0 comments on commit f763c54

Please sign in to comment.