Skip to content

Commit

Permalink
Fix wxCheckListBox's stubborn height issues
Browse files Browse the repository at this point in the history
Fixes #81
... I hope
  • Loading branch information
qu1ck committed Mar 13, 2019
1 parent b53826c commit 84c4db8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
8 changes: 8 additions & 0 deletions InteractiveHtmlBom/dialog/dialog_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def __init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.
bSizer32.Fit( self )

# Connect Events
self.Bind( wx.EVT_SIZE, self.OnSize )
self.m_button12.Bind( wx.EVT_BUTTON, self.OnNameFormatHintClick )
self.m_button1.Bind( wx.EVT_BUTTON, self.OnComponentSortOrderUp )
self.m_button2.Bind( wx.EVT_BUTTON, self.OnComponentSortOrderDown )
Expand All @@ -324,6 +325,9 @@ def __del__( self ):


# Virtual event handlers, overide them in your derived class
def OnSize( self, event ):
event.Skip()

def OnNameFormatHintClick( self, event ):
event.Skip()

Expand Down Expand Up @@ -462,6 +466,7 @@ def __init__( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.
bSizer42.Fit( self )

# Connect Events
self.Bind( wx.EVT_SIZE, self.OnSize )
self.netlistFilePicker.Bind( wx.EVT_FILEPICKER_CHANGED, self.OnNetlistFileChanged )
self.m_button1.Bind( wx.EVT_BUTTON, self.OnExtraFieldsUp )
self.m_button2.Bind( wx.EVT_BUTTON, self.OnExtraFieldsDown )
Expand All @@ -472,6 +477,9 @@ def __del__( self ):


# Virtual event handlers, overide them in your derived class
def OnSize( self, event ):
event.Skip()

def OnNetlistFileChanged( self, event ):
event.Skip()

Expand Down
14 changes: 14 additions & 0 deletions InteractiveHtmlBom/dialog/settings_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ def OnNameFormatHintClick(self, event):
wx.MessageBox(self.FILE_NAME_FORMAT_HINT, 'File name format help',
style=wx.ICON_NONE|wx.OK)

def OnSize(self, event):
# Trick the listCheckBox best size calculations
tmp = self.componentSortOrderBox.GetStrings()
self.componentSortOrderBox.SetItems([])
self.Layout()
self.componentSortOrderBox.SetItems(tmp)


# Implementing ExtraFieldsPanelBase
class ExtraFieldsPanel(dialog_base.ExtraFieldsPanelBase):
Expand Down Expand Up @@ -225,3 +232,10 @@ def OnBoardVariantFieldChange(self, event):
variant_set.add(field_dict[selection])
self.boardVariantWhitelist.SetItems(list(variant_set))
self.boardVariantBlacklist.SetItems(list(variant_set))

def OnSize(self, event):
# Trick the listCheckBox best size calculations
tmp = self.extraFieldsList.GetStrings()
self.extraFieldsList.SetItems([])
self.Layout()
self.extraFieldsList.SetItems(tmp)
2 changes: 1 addition & 1 deletion InteractiveHtmlBom/dialog_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class MyApp(wx.App):
def OnInit(self):
frame = SettingsDialog(None, lambda x: None)
if frame.ShowModal() == wx.ID_OK:
print "Should generate bom"
print("Should generate bom")
frame.Destroy()
return True

Expand Down
4 changes: 2 additions & 2 deletions settings_dialog.fbp
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSize">OnSize</event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
Expand Down Expand Up @@ -3608,7 +3608,7 @@
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnSize">OnSize</event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
Expand Down

0 comments on commit 84c4db8

Please sign in to comment.