def update_current_search_tab(self):
sizer = self.current_sizer
sizer.Clear(True)
sizer.RemoveGrowableRow(0)
sizer.RemoveGrowableRow(1)
sizer.RemoveGrowableCol(0)
sizer.RemoveGrowableCol(2)
if( len(self.current_search) == 0 ):
sizer.AddGrowableRow(0)
sizer.AddGrowableCol(0)
sizer.Add(wx.StaticText(parent=self.current_tab,label="There are no search items."),flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL,pos=(0,0))
else:
sizer.AddGrowableCol(2)
for i in range(len(self.current_search)):
if i%2 == 0:
not_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i][0],choices=['','not'],style=wx.CB_READONLY,size=(60,-1),id=i/2)
not_box.Bind(wx.EVT_COMBOBOX,self.not_search_item)
sizer.Add(not_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)
key = self.current_search[i][1]
value = self.current_search[i][2]
sizer.Add(wx.StaticText(parent=self.current_tab,label=key+" = '"+value+"'"),pos=(i,1),flag=wx.TOP|wx.LEFT|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,border=5)
removeButton = wx.Button(self.current_tab,label='Remove',id=i/2)
removeButton.Bind(wx.EVT_BUTTON,self.remove_search_item)
sizer.Add(removeButton,pos=(i,2),flag=wx.ALIGN_RIGHT|wx.TOP,border=5)
else:
and_or_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i],choices=['and','or'],style=wx.CB_READONLY,size=(60,-1),id=(i-1)/2)
and_or_box.Bind(wx.EVT_COMBOBOX,self.and_or_search_item)
sizer.Add(and_or_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)
self.current_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
self.current_tab.SetScrollbars(20,20,10,10)
self.current_tab.Fit()
评论列表
文章目录