def __init__(self, parent, parent_list, columns, data, original_data, leftSpacer=0, rightSpacer=0, showChange=False, list_selected=LIST_SELECTED): # fetch bundle and descriptions self.bundle = original_data['bundle'] self.general_description = original_data.get( 'bundle_general_description') self.description = original_data.get('bundle_description') # use the head as original_data (needed for SearchList) original_data = self.bundle[0] # call the original constructor ListItem.__init__(self, parent, parent_list, columns, data, original_data, leftSpacer, rightSpacer, showChange, list_selected) # Now add the BundleListView (after AddComponents) self.AddBundlePanel(self.bundle[1:]) self.bundlepanel.Layout() self.expanded_panel = None self.expanded_panel_shown = False
def RefreshData(self, data): infohash, item_data, original_data = data if isinstance(original_data, dict) and 'bundle' in original_data: self.bundle = original_data['bundle'] head_original_data, bundled = self.bundle[0], self.bundle[1:] ListItem.RefreshData(self, (infohash, item_data, head_original_data)) showHighlight = self.bundlepanel.SetHits(bundled) if showHighlight: self.Highlight(1) self.bundlepanel.UpdateHeader( original_data['bundle_general_description'], original_data['bundle_description']) if DEBUG: print >> sys.stderr, "*** BundleListItem.RefreshData: bundle changed: %s #1+%s" % ( original_data['key'], len(bundled)) else: if infohash == self.original_data.infohash: # update top row ListItem.RefreshData(self, data) else: # update part of list self.bundlepanel.RefreshDataBundleList(infohash, original_data)
def BackgroundColor(self, color): if self.GetBackgroundColour() != color: self.Freeze() ListItem.BackgroundColor(self, color) self.bundlepanel.SetBackgroundColour(color) self.Thaw()
def Collapse(self): panel = ListItem.Collapse(self) self.expanded_panel = None self.expanded_panel_shown = False self.bundlepanel.ChangeState(BundlePanel.COLLAPSED) return panel
def Expand(self, panel): ListItem.Expand(self, panel) self.vSizer.Detach(panel) self.vSizer.Insert(1, panel, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, 3) self.expanded_panel = panel self.expanded_panel_shown = True
def __init__(self, parent, parent_list, columns, data, original_data, leftSpacer=0, rightSpacer= 0, showChange = False, list_selected = LIST_SELECTED): # fetch bundle and descriptions self.bundle = original_data['bundle'] self.general_description = original_data.get('bundle_general_description') self.description = original_data.get('bundle_description') # use the head as original_data (needed for SearchList) original_data = self.bundle[0] # call the original constructor ListItem.__init__(self, parent, parent_list, columns, data, original_data, leftSpacer, rightSpacer, showChange, list_selected) # Now add the BundleListView (after AddComponents) self.AddBundlePanel(self.bundle[1:]) self.bundlepanel.Layout() self.expanded_panel = None self.expanded_panel_shown = False
def OnClick(self, event = None): if event: #ignore onclick from bundlegrid control = event.GetEventObject() if getattr(control, 'action', False): return if self.expanded == self.expanded_panel_shown: ListItem.OnClick(self, event) else: self.ShowExpandedPanel(not self.expanded_panel_shown)
def OnClick(self, event=None): if event: # ignore onclick from bundlegrid control = event.GetEventObject() if getattr(control, 'action', False): self.showing_similar_item = True return if getattr(self, 'showing_similar_item', False): self.showing_similar_item = False self.parent_list.OnExpand(self) self.bundlepanel.SetBackgroundColour( self.bundlepanel.parent.GetBackgroundColour()) if True: # self.expanded == self.expanded_panel_shown: ListItem.OnClick(self, event) else: self.ShowExpandedPanel(not self.expanded_panel_shown)
def OnEventSize(self, width): ListItem.OnEventSize(self, width) return self.bundlepanel.OnEventSize(width)
def AddEvents(self, control): if isinstance(control, LinkStaticText): control.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) else: ListItem.AddEvents(self, control)