def AddItems(self, itemList): """ The table's self.contents may contain a collectionList, in case this collection is composed of other collections. In this case, collectionList.first() is the 'primary' collection that should handle adds/deletes and other status updates """ collection = self.blockItem.contents if hasattr (collection, 'collectionList'): collection = collection.collectionList.first() # Vefify that we don't have a readonly collection if __debug__: assert not isReadOnly(collection), "Can't add items to readonly collection - should block before the drop" for item in itemList: RecurrenceDialog.getProxy(u'ui', item).addToCollection(collection)
def BeginEdit (self, row, column, grid): item, attributeName = grid.GetElementValue (row, column) assert not item.isDeleted() item = RecurrenceDialog.getProxy(u'ui', item) self.initialValue = self.delegate.GetAttributeValue (item, attributeName) self.delegate.BeginControlEdit (item, attributeName, self.control) self.control.SetFocus() self.control.ActivateInPlace()
def AddItems(self, itemList): """ The table's self.contents may contain a collectionList, in case this collection is composed of other collections. In this case, collectionList.first() is the 'primary' collection that should handle adds/deletes and other status updates """ collection = self.blockItem.contents if hasattr(collection, 'collectionList'): collection = collection.collectionList.first() # Vefify that we don't have a readonly collection if __debug__: assert not isReadOnly( collection ), "Can't add items to readonly collection - should block before the drop" for item in itemList: RecurrenceDialog.getProxy(u'ui', item).addToCollection(collection)
def BeginEdit(self, row, column, grid): item, attributeName = grid.GetElementValue(row, column) assert not item.isDeleted() item = RecurrenceDialog.getProxy(u'ui', item) self.initialValue = self.delegate.GetAttributeValue( item, attributeName) self.delegate.BeginControlEdit(item, attributeName, self.control) self.control.SetFocus() self.control.ActivateInPlace()
def AddItems(self, itemList): """ Override this to add the dropped items to your widget. """ if self.hoverDate is not None: for item in itemList: proxy = RecurrenceDialog.getProxy(u"ui", item, cancelCallback=self.wxSynchronizeWidget) event = EventStamp(proxy) if not has_stamp(proxy, EventStamp): event.add() # stamp as an event event.anyTime = True oldTime = getattr(event, "startTime", self.hoverDate).timetz() event.startTime = datetime.combine(self.hoverDate, oldTime) proxy.setTriageStatus("auto") self.hoverDate = None self.Refresh()
def AddItems(self, itemList): """ Override this to add the dropped items to your widget. """ if self.hoverDate is not None: for item in itemList: proxy = RecurrenceDialog.getProxy( u'ui', item, cancelCallback=self.wxSynchronizeWidget) event = EventStamp(proxy) if not has_stamp(proxy, EventStamp): event.add() # stamp as an event event.anyTime = True oldTime = getattr(event, 'startTime', self.hoverDate).timetz() event.startTime = datetime.combine(self.hoverDate, oldTime) proxy.setTriageStatus('auto') self.hoverDate = None self.Refresh()
def EndEdit (self, row, column, grid): value = self.delegate.GetControlValue (self.control) item, attributeName = grid.GetElementValue (row, column) assert not item.isDeleted() item = RecurrenceDialog.getProxy(u'ui', item) if value == self.initialValue: changed = False # @@@ For now we do not want to allow users to blank out fields. This should eventually be # replaced by proper editor validation. elif value.strip() == '': changed = False else: changed = True # set the value using the delegate's setter, if it has one. try: attributeSetter = self.delegate.SetAttributeValue except AttributeError: grid.SetElementValue (row, column, value) else: attributeSetter (item, attributeName, value) self.delegate.EndControlEdit (item, attributeName, self.control) return changed
def EndEdit(self, row, column, grid): value = self.delegate.GetControlValue(self.control) item, attributeName = grid.GetElementValue(row, column) assert not item.isDeleted() item = RecurrenceDialog.getProxy(u'ui', item) if value == self.initialValue: changed = False # @@@ For now we do not want to allow users to blank out fields. This should eventually be # replaced by proper editor validation. elif value.strip() == '': changed = False else: changed = True # set the value using the delegate's setter, if it has one. try: attributeSetter = self.delegate.SetAttributeValue except AttributeError: grid.SetElementValue(row, column, value) else: attributeSetter(item, attributeName, value) self.delegate.EndControlEdit(item, attributeName, self.control) return changed
if theText is None: # No sample text, or we have a value. Use the value. theText = self.GetAttributeValue(item, attributeName) elif len(theText) > 0: # theText is the sample text - switch to gray isSample = True return (None, theText, isSample) def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): """ Draw this control's value; used only by Grid when the attribute's not being edited. Note: @@@ Currently only handles left justified single line text. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False) #logger.debug("StringAE.Draw: %s, %s of %s; %s in selection", #self.isShared and "shared" or "dv", #attributeName, item, #isInSelection and "is" or "not") # Erase the bounding box dc.SetBackgroundMode (wx.SOLID) dc.SetPen (wx.TRANSPARENT_PEN) dc.DrawRectangleRect (rect) # Get the text we'll display, and note whether it's the sample text. prefix, theText, isSample = self.GetTextToDraw(item, attributeName) # We'll draw the sample or prefix in gray (unless it's part of the
if theText is None: # No sample text, or we have a value. Use the value. theText = self.GetAttributeValue(item, attributeName) elif len(theText) > 0: # theText is the sample text - switch to gray isSample = True return (None, theText, isSample) def Draw(self, grid, dc, rect, (item, attributeName), isInSelection=False): """ Draw this control's value; used only by Grid when the attribute's not being edited. Note: @@@ Currently only handles left justified single line text. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False) #logger.debug("StringAE.Draw: %s, %s of %s; %s in selection", #self.isShared and "shared" or "dv", #attributeName, item, #isInSelection and "is" or "not") # Erase the bounding box dc.SetBackgroundMode(wx.SOLID) dc.SetPen(wx.TRANSPARENT_PEN) dc.DrawRectangleRect(rect) # Get the text we'll display, and note whether it's the sample text. prefix, theText, isSample = self.GetTextToDraw(item, attributeName) # We'll draw the sample or prefix in gray (unless it's part of the