rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
MenuItem.template('FileSeparator1', menuItemKind = 'Separator'),
MenuItem.template('ItemSeparator1', menuItemKind = 'Separator'), MenuItem.template('SendMessageItem', event = main.SendShareItem, title = messages.SEND, helpString = _(u'Send the selected Mail Message')), MenuItem.template('ItemSeparator2', menuItemKind = 'Separator'), MenuItem.template('StampMessageItem', event = main...
def makeColorMenuItems (parcel, cls, hues): """ dynamically creates an array of type 'cls' based on a list of colors """ menuItems = [] # make sure that all the events end up in the main parcel mainParcel = schema.parcel_for_module ("osaf.views.main", repositoryView) for shortName, title, hue in hues: rgb = wx.Image.H...
MenuItem.template('FileSeparator2', menuItemKind = 'Separator'), MenuItem.template('PrintPreviewItem', event = globalBlocks.PrintPreview, title = _(u'Print Preview')), MenuItem.template('PrintItem', event = globalBlocks.Print, title = _(u'Print...'), accel = _(u'Ctrl+P'), helpString = _(u'Print the current calendar')),...
MenuItem.template('CollectionSeparator1', menuItemKind = 'Separator'),
def makeColorMenuItems (parcel, cls, hues): """ dynamically creates an array of type 'cls' based on a list of colors """ menuItems = [] # make sure that all the events end up in the main parcel mainParcel = schema.parcel_for_module ("osaf.views.main", repositoryView) for shortName, title, hue in hues: rgb = wx.Image.H...
MenuItem.template('CollectionSeparator1',
MenuItem.template('CollectionSeparator2',
def makeColorMenuItems (parcel, cls, hues): """ dynamically creates an array of type 'cls' based on a list of colors """ menuItems = [] # make sure that all the events end up in the main parcel mainParcel = schema.parcel_for_module ("osaf.views.main", repositoryView) for shortName, title, hue in hues: rgb = wx.Image.H...
endDateString = "%d-%d-%d" % (year,month+1,1)
if month == 12: month1 = 1 year1 = year+1 endDateString = "%d-%d-%d" % (year1,month1,1)
def testDateQuery(self): """ Test a date range in the query predicate """ tools.timing.reset() import osaf.contentmodel.tests.GenerateItems as GenerateItems
pass
listData += '<value>' + value + '</value>'
def syncToServer(dav, item): from Dav import DAV url = unicode(dav.url) # set them here, even though we have to set them again later item.sharedVersion = item._version kind = item.itsKind # build a giant property string and then do a PROPPATCH props = makePropString('kind', '//core', kind.itsPath) + \ makePropString...
xmlgoop = davlib.XML_DOC_HEADER + \ '<doc>' + value + '</doc>' doc = libxml2.parseDoc(xmlgoop) nodes = doc.xpathEval('/doc/*')
nodes = nodesFromXml(value)
def syncFromServer(item, davItem): from Dav import DAV kind = davItem.itsKind for (name, attr) in kind.iterAttributes(True): value = davItem.getAttribute(attr) if not value: continue print 'Getting:', name, '(' + attr.type.itsName + ')' # see if its an ItemRef or not if isinstance(attr.type, Kind): # time for some ...
print 'Got.....: ', value item.setAttributeValue(name, attr.type.makeValue(value))
if attr.cardinality == 'list': nodes = nodesFromXml(value) for node in nodes: item.addValue(name, node.content) print 'Got.....: ', value elif attr.cardinality == 'single': print 'Got.....: ', value item.setAttributeValue(name, attr.type.makeValue(value))
def syncFromServer(item, davItem): from Dav import DAV kind = davItem.itsKind for (name, attr) in kind.iterAttributes(True): value = davItem.getAttribute(attr) if not value: continue print 'Getting:', name, '(' + attr.type.itsName + ')' # see if its an ItemRef or not if isinstance(attr.type, Kind): # time for some ...
setup(name='chandlerdb', version='0.4',
setup(name='chandlerdb', version='0.5',
def main(): PREFIX = os.environ['PREFIX'] extensions = [] modules = ['chandlerdb.__init__', 'chandlerdb.util.__init__', 'chandlerdb.schema.__init__', 'chandlerdb.item.__init__', 'chandlerdb.item.ItemError', 'chandlerdb.persistence.__init__'] extensions.append(Extension('chandlerdb.util.uuid', sources=['chandlerdb/ut...
collection.displayName = args[0]
collection.displayName = u"%s" %args[0]
def GenerateCollection(view, mainView, args): """ Generate one Collection Item """ collection = pim.ListCollection(view=view) if args[0]=='*': # semi-random data while True: # Find a name that isn't already in use potentialName = ' '.join((random.choice(COLLECTION_ADJECTIVES), random.choice(COLLECTION_NOUNS),)) if not...
note.displayName = args[0]
note.displayName = u"%s" %args[0]
def GenerateNote(view, mainView, args): """ Generate one Note item """ note = pim.Note(view=view) #displayName if args[0]=='*': # semi-random data note.displayName = random.choice(TITLES) elif not args[0]=='': note.displayName = args[0] else: note.displayName = u'untitled' #default value which does not require locali...
event.displayName = args[0]
event.displayName = u"%s" %args[0]
def GenerateCalendarEvent(view, mainView, args): """ Generate one calendarEvent item """ event = Calendar.CalendarEvent(view=view) # displayName if args[0]=='*': # semi-random data event.displayName = random.choice(HEADLINES) elif not args[0]=='': event.displayName = args[0] else: event.displayName = u'untitled' if ...
event.location = Calendar.Location.getLocation(view,args[8])
event.location = Calendar.Location.getLocation(view,u"%s"%args[8])
def GenerateCalendarEvent(view, mainView, args): """ Generate one calendarEvent item """ event = Calendar.CalendarEvent(view=view) # displayName if args[0]=='*': # semi-random data event.displayName = random.choice(HEADLINES) elif not args[0]=='': event.displayName = args[0] else: event.displayName = u'untitled' if ...
task.displayName = args[0]
task.displayName = u"%s" %args[0]
def GenerateTask(view, mainView, args): """ Generate one Task item """ task = Task(view=view) # displayName if args[0]=='*': # semi-random data task.displayName = random.choice(TITLES) elif not args[0]=='': task.displayName = args[0] else: task.displayName = u'untitled' if TEST_I18N: task.displayName = addSurrogate...
email.emailAddress = emailAddress
email.emailAddress = u"%s" %emailAddress
def GenerateCalendarParticipant(view, emailAddress): """ Generate an email address corresponding to the parameters """ email = Mail.EmailAddress(view=view) if emailAddress=='*': # semi-random data domainName = random.choice(DOMAIN_LIST) handle = random.choice(LASTNAMES).lower() email.emailAddress = "%s@%s" % (handle, d...
message.subject = args[0]
message.subject = u"%s" %args[0]
def GenerateMailMessage(view, mainView, args): """ Generate one Mail message item """ message = Mail.MailMessage(view=view) # subject if args[0]=='*': # semi-random data message.subject = random.choice(TITLES) elif not args[0]=='': message.subject = args[0] else: #default value message.subject = u'untitled' if TES...
message.body = message.getAttributeAspect('body', 'type').makeValue(args[9])
txt = u"%s"%args[9] message.body = message.getAttributeAspect('body', 'type').makeValue(txt)
def GenerateMailMessage(view, mainView, args): """ Generate one Mail message item """ message = Mail.MailMessage(view=view) # subject if args[0]=='*': # semi-random data message.subject = random.choice(TITLES) elif not args[0]=='': message.subject = args[0] else: #default value message.subject = u'untitled' if TES...
self.view.commit()
def _finishedShare(self, uuid):
is not set then determins the flags needed based on build
is not set then determines the flags needed based on build
def Verify_WX_CONFIG(): """ Called below for the builds that need wx-config, if WX_CONFIG is not set then determins the flags needed based on build options and searches for wx-config on the PATH. """ # if WX_CONFIG hasn't been set to an explicit value then construct one. global WX_CONFIG if WX_CONFIG is None: WX_CONFIG...
self.DoCapturedDragAndDrop(self, copyOnly)
self.DoCapturedDragAndDrop(copyOnly)
def DoDragAndDrop(self, copyOnly=None): # capture the mouse, so mouse moves don't trigger activities # in other windows, like the sidebar. self.CaptureMouse() try: self.DoCapturedDragAndDrop(self, copyOnly) finally: if self.HasCapture(): self.ReleaseMouse()
app.mainFrame, account=account, itsView=view)
app.mainFrame, account=account, rv=view)
def ensureAccountSetUp(view, sharing=False, inboundMail=False, outboundMail=False): """ A helper method to make sure the user gets the account info filled out. This method will examine all the account info and if anything is missing, a dialog will explain to the user what is missing; if they want to proceed to enter t...
Takes the existing self.canvasItemList, and realigns the rectangles to deal with conflicts and the current drag state, and then resorts it to be in drawing order.
Takes the existing self.canvasItemList and realigns the rectangles to deal with conflicts and the current drag state.
def RealignCanvasItems(self): """ Takes the existing self.canvasItemList, and realigns the rectangles to deal with conflicts and the current drag state, and then resorts it to be in drawing order. """ if self.dragState is not None: currentDragBox = self.dragState.currentDragBox else: currentDragBox = None # now genera...
self.canvasItemsByDate = self.canvasItemList self.canvasItemList = sorted(self.canvasItemsByDate, key=TimedCanvasItem.GetDrawingOrderKey)
def RealignCanvasItems(self): """ Takes the existing self.canvasItemList, and realigns the rectangles to deal with conflicts and the current drag state, and then resorts it to be in drawing order. """ if self.dragState is not None: currentDragBox = self.dragState.currentDragBox else: currentDragBox = None # now genera...
def drawCanvasItems(canvasItems, selected): for canvasItem in canvasItems: canvasItem.Draw(dc, styles, selected) unselectedBoxes = []
contents = CalendarSelection(self.blockItem.contents) for canvasItem in self.drawOrderedCanvasItems(): selected = contents.isItemSelected(canvasItem.item) canvasItem.Draw(dc, styles, selected) def drawOrderedCanvasItems(self): """ Calculate the order of canvas items, taking selection, history, and active collection i...
def DrawCells(self, dc): styles = self.blockItem.calendarContainer # Set up fonts and brushes for drawing the events dc.SetTextForeground(wx.BLACK) dc.SetBrush(wx.WHITE_BRUSH)
orderLastMap = {}
activeBoxes = [] orderLastMap = {}
def drawCanvasItems(canvasItems, selected): for canvasItem in canvasItems: canvasItem.Draw(dc, styles, selected)
unselectedBoxes.append(canvasItem) orderLastBoxes = [orderLastMap.get(i) for i in self.orderLast if \ orderLastMap.get(i) is not None] drawCanvasItems(unselectedBoxes, False) drawCanvasItems(orderLastBoxes, False) drawCanvasItems(selectedBoxes, True)
ordered.append(canvasItem) ordered.extend(activeBoxes) ordered.extend(orderLastMap.get(i) for i in self.orderLast if \ orderLastMap.get(i) is not None) ordered.extend(selectedBoxes) return ordered
def drawCanvasItems(canvasItems, selected): for canvasItem in canvasItems: canvasItem.Draw(dc, styles, selected)
if len(self.canvasItemsByDate) == 0:
if len(self.canvasItemList) == 0:
def OnNavigateItem(self, direction):
middle = len(self.canvasItemsByDate)/2 currentCanvasItem = self.canvasItemsByDate[middle]
middle = len(self.canvasItemList)/2 currentCanvasItem = self.canvasItemList[middle]
def OnNavigateItem(self, direction):
canvasItemIndex = self.canvasItemsByDate.index(currentCanvasItem)
canvasItemIndex = self.canvasItemList.index(currentCanvasItem)
def OnNavigateItem(self, direction):
searchEnd = len(self.canvasItemsByDate)
searchEnd = len(self.canvasItemList)
def OnNavigateItem(self, direction):
newCanvasItem = self.canvasItemsByDate[idx]
newCanvasItem = self.canvasItemList[idx]
def OnNavigateItem(self, direction):
if 0 <= newItemIndex < len(self.canvasItemsByDate): self.OnSelectItem(self.canvasItemsByDate[newItemIndex].item)
if 0 <= newItemIndex < len(self.canvasItemList): self.OnSelectItem(self.canvasItemList[newItemIndex].item)
def OnNavigateItem(self, direction):
firstHit = None contents = CalendarSelection(self.blockItem.contents) for canvasItem in reversed(self.canvasItemList): if canvasItem.isHit(unscrolledPosition) and \ canvasItem.item in contents: item = canvasItem.item if contents.isItemSelected(item): return canvasItem if not firstHit: firstHit = canvasItem ret...
for canvasItem in reversed(self.drawOrderedCanvasItems()): if canvasItem.isHit(unscrolledPosition): return canvasItem
def GetCanvasItemAt(self, unscrolledPosition): """ Similar to the one in CollectionCanvas, but take selection into account, because sometimes items on the bottom of a stack of conflicting events is the currently selected one. """ firstHit = None contents = CalendarSelection(self.blockItem.contents) for canvasItem in re...
return max(self.GetIndentLevel(), maxchildren, maxparents) def GetDrawingOrderKey(self): """ Drawing order defined first by activeness, then level of indent """ return (self.isActive, self.GetIndentLevel())
return max(self.GetIndentLevel(), maxchildren, maxparents)
def GetMaxDepth(self): """ This determines how 'deep' this item is: the maximum Indent Level of ALL items that CONFLICT with this one. e.g. 3 items might conflict, and they all might be indented by one due to an earlier conflict, so the maximum 'depth' is 4. """ maxparents = maxchildren = 0 if self._afterConflicts: max...
y += self.timeHeight + 3
y += self.timeHeight
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item time = item.startTime isAnyTimeOrAllDay = self.GetAnyTimeOrAllDay() # Draw one event - an event consists of one or more bounds clipRect = None (cx,cy,cwidth,cheight) = dc.GetClippingBox() ...
if '__WXMAC__' in wx.PlatformInfo: bigFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.NORMAL) bigBoldFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.BOLD) smallFont = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, face="Verdana") smallBoldFont = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, face="Verdana") else: bigFont = wx.Font(11...
defaultStyle = Styles.CharacterStyle() defaultBoldStyle = \ Styles.CharacterStyle(fontStyle='bold', fontSize=10.0) defaultBigBoldStyle = \ Styles.CharacterStyle(fontStyle='bold', fontSize=13.0) defaultFont = Styles.getFont(defaultStyle) defaultBoldFont = Styles.getFont(defaultBoldStyle) defaultBigBoldFont = Styles.ge...
def InitializeStyles(self): # This is where all the styles come from if '__WXMAC__' in wx.PlatformInfo: bigFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.NORMAL) bigBoldFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.BOLD) smallFont = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, face="Verdana") smallBoldFont = wx.Font(10, wx....
self.eventLabelFont = smallFont
self.eventLabelFont = defaultFont
def InitializeStyles(self): # This is where all the styles come from if '__WXMAC__' in wx.PlatformInfo: bigFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.NORMAL) bigBoldFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.BOLD) smallFont = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, face="Verdana") smallBoldFont = wx.Font(10, wx....
self.eventTimeFont = smallBoldFont self.legendFont = smallFont
self.eventLabelHeight = Styles.getMeasurements(defaultFont).height self.eventTimeFont = defaultBoldFont self.legendFont = defaultFont
def InitializeStyles(self): # This is where all the styles come from if '__WXMAC__' in wx.PlatformInfo: bigFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.NORMAL) bigBoldFont = wx.Font(13, wx.NORMAL, wx.NORMAL, wx.BOLD) smallFont = wx.Font(11, wx.SWISS, wx.NORMAL, wx.NORMAL, face="Verdana") smallBoldFont = wx.Font(10, wx....
ALLDAY_EVENT_HEIGHT = 17
def onSelectItemBroadcast(self, event): #@@@ untested. doesn't seem to be receiving SIB's correctly print "allday evt cvs receives SIB" self.selection = event.arguments['item']
self.ALLDAY_EVENT_HEIGHT * gridRow,
self.eventHeight * gridRow,
def RebuildCanvasItem(self, item, columnWidth, dayStart, dayEnd, gridRow): """ @param columnWidth is pixel width of one column under the current view but all the other paramters though are grid-based, NOT datetime or pixel-based. """ size = self.GetSize() drawInfo = self.blockItem.calendarContainer.calendarControl.widg...
self.ALLDAY_EVENT_HEIGHT)
self.eventHeight)
def RebuildCanvasItem(self, item, columnWidth, dayStart, dayEnd, gridRow): """ @param columnWidth is pixel width of one column under the current view but all the other paramters though are grid-based, NOT datetime or pixel-based. """ size = self.GetSize() drawInfo = self.blockItem.calendarContainer.calendarControl.widg...
return kind.isKeyForInstance(item, self._recursive)
instance = self._view.find(item, False) if instance is None: return kind.isKeyForInstance(item, self._recursive) else: item = instance
def __contains__(self, item, excludeMutating=False):
print "CONFIG: ", self.CONFIG
print "PYTHON: ", self.PYTHON print "GETTEXT: ", self.GETTEXT
def debug(self): print "CHANDLERHOME: ", self.CHANDLERHOME print "CHANDLERBIN: ", self.CHANDLERBIN print "BINROOT: ", self.BINROOT print "CONFIG: ", self.CONFIG print "ROOTDIR: ", self.ROOTDIR print "OUTPUTFILE: ", self.OUTPUTFILE print "WXRC: ", self.WXRC print "XRC_FILES: ", self.XRC_FILES
print "---------------------------\n%s\n\n" % txt
print "----------------------------------------\n%s\n\n" % txt
def raiseError(self, txt): print "\n\nThe following error was raised: " print "---------------------------\n%s\n\n" % txt sys.exit(-1)
}
'Verbose': ('-v', '--Verbose', False, 'Prints Verbose debugging information to the stdout'), }
def getOpts(self): _configItems = { 'Chandler': ('-c', '--Chandler', False, 'Extract localization strings from Chandler Python and XRC files. A gettext .pot template file "Chandler.pot" is written to the current working directory'), 'ChandlerExamples': ('-e', '--ChandlerExamples', False, 'Extract localization strings ...
oldurl = self.model.history[-1] newurl = self.urlBox.GetValue()
oldURL = self.model.history[-1] newURL = self.urlBox.GetValue()
def URLEntered(self, event): """When the user enters a location in the url text box of the toolbar, we navigate to that url. If switching to that url fails (because of a typo or because that url does not exist), then we simply reset the text box to the current url.""" if not hasattr(self, 'urlBox'): self.urlBox = self...
ch.AddItem( itemIndex, "", (wx.colheader.CH_ALIGN_Cente, wx.colheader.CH_ALIGN_Center), 40, 0, 0, 1 )
ch.AddItem( itemIndex, "", (wx.colheader.CH_ALIGN_Center, wx.colheader.CH_ALIGN_Center), 40, 0, 0, 1 )
def OnButtonTestAddBitmapItem( self, event ): ch = self.ch2 itemCount = ch.GetItemCount() if (itemCount <= 8): itemIndex = ch.GetSelectedItem() if (itemIndex < 0): itemIndex = itemCount ch.AddItem( itemIndex, "", (wx.colheader.CH_ALIGN_Cente, wx.colheader.CH_ALIGN_Center), 40, 0, 0, 1 ) ch.SetItemAttribute( itemIndex, ...
resultString = self.EncodeObjectList(resultList)
resultString = self.EncodePythonObject(resultList)
def HandleObjectRequest(self, fromAddress, url): objectList = self.application.GetViewObjects(url) # we can send the objects back in ask many responses as we like # for simplicity's sake, we'll send them back one at a time at # first, and then later tweak for better performance resultList = [] granularity = 3 for resu...
objectList = self.DecodeObjectList(body)
objectList = self.DecodePythonObject(body)
def HandleObjectResponse(self, fromAddress, url, body, lastFlag): # decode the string from the body of the received message to an objectlist objectList = self.DecodeObjectList(body) # send the objects back to the relevant view if len(objectList) > 0: self.application.AddObjectsToView(url, objectList) if lastFlag: sel...
def SetContactMethods(self, contactMethods): self.setRdfAttribute(chandler.contactMethods, contactMethods, ContactEntityItem.rdfs)
def SetContactMethods(self, contactMethod): self.setRdfAttribute(chandler.contactMethods, contactMethod, ContactEntityItem.rdfs)
def SetContactMethods(self, contactMethods): self.setRdfAttribute(chandler.contactMethods, contactMethods, ContactEntityItem.rdfs)
contactMethods = property(GetContactMethods, SetContactMethods)
def GetContactValue(self, contactLocation, attributeName): for method in self.contactMethods: if method.GetMethodDescription() == contactLocation: return method.GetFormattedAttribute(attributeName) return ''
referenceAttributeNames = ['superKinds', 'attributes',
referenceAttributeNames = ['superKinds', 'attributes', 'clouds',
def testAttributeIteration(self): """Test iteration over attributes""" kind = self._find('//Schema/Core/Kind') self.assert_(kind is not None)
DEBUG = os.environ.get('DEBUG', 0)
def main(): PREFIX = os.environ['PREFIX'] extensions = [] modules = ['chandlerdb.__init__', 'chandlerdb.util.__init__', 'chandlerdb.schema.__init__', 'chandlerdb.item.__init__', 'chandlerdb.item.ItemError', 'chandlerdb.persistence.__init__'] extensions.append(Extension('chandlerdb.util.uuid', sources=['chandlerdb/ut...
libraries=['libdb43', 'ws2_32'])
libraries=[libdb_name, 'ws2_32'])
def main(): PREFIX = os.environ['PREFIX'] extensions = [] modules = ['chandlerdb.__init__', 'chandlerdb.util.__init__', 'chandlerdb.schema.__init__', 'chandlerdb.item.__init__', 'chandlerdb.item.ItemError', 'chandlerdb.persistence.__init__'] extensions.append(Extension('chandlerdb.util.uuid', sources=['chandlerdb/ut...
self.addIndex(indexName, 'attribute', attribute=indexName)
self.addIndex(indexName, 'attribute', attributes=(indexName, 'date'))
def getCollectionIndex(self, indexName=None): """ Get the index. If it doesn't exist, create. Also create a RangeSet for storing the selection on the index
raise i18n.I18nException("Only OSAF domain supported in .6")
raise i18n.I18nException("Only OSAF domain supported in .7")
def __getResource(self, rootPath, relPath, resourceName, domain=None): # Will cache the path of the found resource # for the given locale set. # The cache will be flushed when a change to the # locale set occurs
logging.error("Unable to set Python locale to: '%s'" % lc)
logging.debug("Unable to set Python locale to: '%s'" % lc)
def __setPythonLocale(self, lc): try: # Set the Python locale locale.setlocale(locale.LC_ALL, lc) except locale.Error: if __debug__: # Log the error only in debug mode logging.error("Unable to set Python locale to: '%s'" % lc) return False
return type(value) in (type, classobj)
return isinstance(value,(type, classobj))
def recognizes(self, value): return type(value) in (type, classobj)
itemId = wxWindow.uriDictMap[uriToDelete] wxWindow.Delete(itemId) del wxWindow.uriDictMap[uriToDelete]
if wxWindow.uriDictMap.has_key(uriToDelete): itemId = wxWindow.uriDictMap[uriToDelete] wxWindow.Delete(itemId) del wxWindow.uriDictMap[uriToDelete]
def __UpdateURLTree(self, sideBarLevel, parentUri, parentItem, wasEmpty=false): """ Synchronizes the sideBar's URLTree with the application's URLTree. The sideBar only stores a dict mapping visible items in the sideBar to their instances in the application. """ wxWindow = app.association[id(self)] uriList = app.model...
m = __import__(module, {}, {}, name)
try: m = __import__(module, {}, {}, name) except ImportError: raise except Exception, e: raise ImportError, 'Importing class %s.%s failed with %s' %(module, name, e)
def loadClass(cls, name, module=None):
if (item is not None and item not in self.contentsCollection):
if not (issingleref(item) or item in self.contentsCollection):
def onSetContentsEvent (self, event): """ Here would be a good place to make sure that items selected in the old contents are also selected in the new contents.
assert item is not None
assert not issingleref(item)
def DeleteSelection(self, cutting=False, *args, **kwargs): selection = self.GetSelection() for item in selection.iterSelection(): assert item is not None item.removeFromCollection(self.contentsCollection, cutting) self.ClearSelection()
else:
elif atype is not None:
def syncToServer(dav, item): from Dav import DAV url = unicode(dav.url) # set them here, even though we have to set them again later item.sharedVersion = item._version kind = item.itsKind # build a giant property string and then do a PROPPATCH # we don't ever want to actually change the UUID value on the server # s...
isReadOnly = False shareMode = 'both'
isReadOnly = True shareMode = 'get' hasPrivileges = False
def subscribe(view, url, accountInfoCallback=None, updateCallback=None, username=None, password=None): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ...
testCollName = u'.%s.tmp' % (chandlerdb.util.c.UUID())
def subscribe(view, url, accountInfoCallback=None, updateCallback=None, username=None, password=None): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ...
child = handle.blockUntil(resource.createCollection, testCollName) handle.blockUntil(child.delete)
privilege_set = handle.blockUntil(resource.getPrivileges) if ('read', 'DAV:') in privilege_set.privileges: hasPrivileges = True if ('write', 'DAV:') in privilege_set.privileges: isReadOnly = False shareMode = 'both'
def subscribe(view, url, accountInfoCallback=None, updateCallback=None, username=None, password=None): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ...
logger.debug("Failed to create test subcollection %s; error status %d", testCollName, err.status) isReadOnly = True shareMode = 'get' if isReadOnly: dummyICS = vobject.iCalendar() vevent = dummyICS.add('vevent') vevent.add('dtstart').value = datetime.datetime.now(vobject.icalendar.utc) vevent.add('duration').valu...
logger.debug("PROPFIND of current-user-privilege-set failed; error status %d", err.status) if isReadOnly and not hasPrivileges: testCollName = u'.%s.tmp' % (chandlerdb.util.c.UUID())
def subscribe(view, url, accountInfoCallback=None, updateCallback=None, username=None, password=None): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ...
handle.blockUntil(dummyResource.put, dummyICS.serialize(), checkETag=False, contentType="text/calendar")
child = handle.blockUntil(resource.createCollection, testCollName) handle.blockUntil(child.delete) isReadOnly = False shareMode = 'both'
def subscribe(view, url, accountInfoCallback=None, updateCallback=None, username=None, password=None): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ...
logger.debug("Failed to create dummy event; error status %d", err.status) else: try: handle.blockUntil(dummyResource.delete) except zanshin.webdav.ConnectionError, M2Crypto.BIO.BIOError: msg = "Failed to delete dummy event, dangling resource " \ "%s left on server!" logger.debug(msg, dummypath) isReadOnly = False s...
logger.debug("Failed to create test subcollection %s; error status %d", testCollName, err.status)
def subscribe(view, url, accountInfoCallback=None, updateCallback=None, username=None, password=None): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ...
self.weekdays = [unicode(d) for d in dateFormatSymbols.getShortWeekdays()]
self.weekdays = [unicode(d) for d in dateFormatSymbols.getWeekdays(DateFormatSymbols.STANDALONE, DateFormatSymbols.NARROW)]
def Init(self):
self._status |= verify and RepositoryView.VERIFY or 0
def __init__(self, verify=False):
for ver, doc in roots.itervalues(): view._loadDoc(doc)
for name, (ver, doc) in roots.iteritems(): if not name in view._roots: view._loadDoc(doc)
def loadRoots(self, view):
def Draw(self, dc, boundingRect, styles):
def Draw(self, dc, boundingRect, styles, bitmapBrush):
def Draw(self, dc, boundingRect, styles): item = self._item
def MakeGradientBrush(self, width, leftColor, rightColor):
def MakeGradientBitmap(self, width, leftColor, rightColor):
def MakeGradientBrush(self, width, leftColor, rightColor): """ Creates a gradient brush from leftColor to rightColor, specified as color tuples (r,g,b) The brush is a bitmap, width of self.dayWidth, height 1. The color gradient is made by varying the color saturation from leftColor to rightColor. This means that the Hu...
bitmap = wx.BitmapFromImage(image) brush = wx.Brush(leftColor) brush.SetStipple(bitmap) return brush def GetGradientBrush(self, width, leftColor, rightColor):
return wx.BitmapFromImage(image) def GetGradientBitmap(self, width, leftColor, rightColor):
def MakeGradientBrush(self, width, leftColor, rightColor): """ Creates a gradient brush from leftColor to rightColor, specified as color tuples (r,g,b) The brush is a bitmap, width of self.dayWidth, height 1. The color gradient is made by varying the color saturation from leftColor to rightColor. This means that the Hu...
brush = self._gradientCache.get(key, None) if not brush: brush = self.MakeGradientBrush(*key) self._gradientCache[key] = brush return brush
bitmap = self._gradientCache.get(key, None) if not bitmap: bitmap = self.MakeGradientBitmap(*key) self._gradientCache[key] = bitmap return bitmap
def GetGradientBrush(self, width, leftColor, rightColor): """ Gets an appropriately sized gradient brush from the cache, or creates one if necessary """ key = (width, leftColor, rightColor) brush = self._gradientCache.get(key, None) if not brush: brush = self.MakeGradientBrush(*key) self._gradientCache[key] = brush ret...
brush = styles.GetGradientBrush(self.dayWidth, eventColors.selectedGradientLeft, eventColors.selectedGradientRight)
bitmap = styles.GetGradientBitmap(self.parent.dayWidth, eventColors.selectedGradientLeft, eventColors.selectedGradientRight) brush = wx.Brush(wx.WHITE) brush.SetStipple(bitmap)
def DrawCells(self, dc): styles = self.parent
dc.SetBrush(styles.GetGradientBrush(self.dayWidth, eventColors.gradientLeft, eventColors.gradientRight))
bitmap = styles.GetGradientBitmap(self.dayWidth, eventColors.gradientLeft, eventColors.gradientRight)
def DrawCells(self, dc): styles = self.parent # Set up fonts and brushes for drawing the events dc.SetTextForeground(wx.BLACK) dc.SetBrush(wx.WHITE_BRUSH)
canvasItem.Draw(dc, boundingRect, styles)
canvasItem.Draw(dc, boundingRect, styles, bitmap)
def DrawCells(self, dc): styles = self.parent # Set up fonts and brushes for drawing the events dc.SetTextForeground(wx.BLACK) dc.SetBrush(wx.WHITE_BRUSH)
brush = styles.GetGradientBrush(self.dayWidth, eventColors.selectedGradientLeft, eventColors.selectedGradientRight) dc.SetBrush(brush)
bitmap = styles.GetGradientBitmap(self.dayWidth, eventColors.selectedGradientLeft, eventColors.selectedGradientRight)
def DrawCells(self, dc): styles = self.parent # Set up fonts and brushes for drawing the events dc.SetTextForeground(wx.BLACK) dc.SetBrush(wx.WHITE_BRUSH)
selectedBox.Draw(dc, boundingRect, styles)
selectedBox.Draw(dc, boundingRect, styles, bitmap)
def DrawCells(self, dc): styles = self.parent # Set up fonts and brushes for drawing the events dc.SetTextForeground(wx.BLACK) dc.SetBrush(wx.WHITE_BRUSH)
try: import cjkcodecs.aliases except: pass try: import iconv_codec except: pass
def _xmlescape(data): data = data.replace("&", "&amp;") data = data.replace(">", "&gt;") data = data.replace("<", "&lt;") return data
if _debug: sys.stderr.write('self.baseuri=%s\n' % baseuri)
def unknown_starttag(self, tag, attrs): if _debug: sys.stderr.write('start %s with %s\n' % (tag, attrs)) # normalize attrs attrs = [(k.lower(), sgmllib.charref.sub(lambda m: unichr(int(m.groups()[0])), v).strip()) for k, v in attrs] attrs = [(k, k in ('rel', 'type') and v.lower() or v) for k, v in attrs] # track xml:b...
if _debug: sys.stderr.write('self.baseuri=%s\n' % baseuri)
def unknown_endtag(self, tag): if _debug: sys.stderr.write('end %s\n' % tag) # match namespaces if tag.find(':') <> -1: prefix, suffix = tag.split(':', 1) else: prefix, suffix = '', tag prefix = self.namespacemap.get(prefix, prefix) if prefix: prefix = prefix + '_'
text = "&
ref = ref.lower() if ref in ('34', '38', '39', '60', '62', 'x22', 'x26', 'x27', 'x3c', 'x3e'): text = "& else: if ref[0] == 'x': c = int(ref[1:], 16) else: c = int(ref) text = unichr(c).encode('utf-8')
def handle_charref(self, ref): # called for each character reference, e.g. for "&#160;", ref will be "160" # Reconstruct the original character reference. if not self.elementstack: return text = "&#%s;" % ref self.elementstack[-1][2].append(text)
text = "&%s;" % ref
if _debug: sys.stderr.write("entering handle_entityref with %s\n" % ref) if ref in ('lt', 'gt', 'quot', 'amp', 'apos'): text = '&%s;' % ref else: def name2cp(k): import htmlentitydefs if hasattr(htmlentitydefs, "name2codepoint"): return htmlentitydefs.name2codepoint[k] k = htmlentitydefs.entitydefs[k] if k.startswith(...
def handle_entityref(self, ref): # called for each entity reference, e.g. for "&copy;", ref will be "copy" # Reconstruct the original entity reference. if not self.elementstack: return text = "&%s;" % ref self.elementstack[-1][2].append(text)
if element in self.can_contain_dangerous_markup: output = _sanitizeHTML(output, self.encoding) if type(output) == types.StringType:
if self.contentparams.get('type', 'text/html') in self.html_types: if element in self.can_contain_dangerous_markup: output = _sanitizeHTML(output, self.encoding) if self.encoding and (type(output) == types.StringType):
def pop(self, element): if not self.elementstack: return
if _debug: sys.stderr.write(attrsD['lastmod'] + '\n')
def _cdf_common(self, attrsD): if attrsD.has_key('lastmod'): if _debug: sys.stderr.write(attrsD['lastmod'] + '\n') self._start_modified({}) self.elementstack[-1][-1] = attrsD['lastmod'] self._end_modified() if attrsD.has_key('href'): self._start_link({}) self.elementstack[-1][-1] = attrsD['href'] self._end_link()
def _sync_author_detail(self):
def _sync_author_detail(self, key='author'):
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
detail = context.get('author_detail')
detail = context.get('%s_detail' % key)
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
context['author'] = "%s (%s)" % (name, email)
context[key] = "%s (%s)" % (name, email)
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
context['author'] = name
context[key] = name
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
context['author'] = email
context[key] = email
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
author = context.get('author')
author = context.get(key)
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
context.setdefault('author_detail', FeedParserDict()) context['author_detail']['name'] = author context['author_detail']['email'] = email
context.setdefault('%s_detail' % key, FeedParserDict()) context['%s_detail' % key]['name'] = author context['%s_detail' % key]['email'] = email
def _sync_author_detail(self): context = self._getContext() detail = context.get('author_detail') if detail: name = detail.get('name') email = detail.get('email') if name and email: context['author'] = "%s (%s)" % (name, email) elif name: context['author'] = name elif email: context['author'] = email else: author = con...
if _debug: sys.stderr.write('_end_dcterms_modified, value=' + value + '\n')
def _end_dcterms_modified(self): value = self.pop('modified') if _debug: sys.stderr.write('_end_dcterms_modified, value=' + value + '\n') parsed_value = _parse_date(value) self._save('date', value) self._save('date_parsed', parsed_value) self._save('modified_parsed', parsed_value)
class _StrictFeedParser(_FeedParserMixin, xml.sax.handler.ContentHandler, xml.sax.handler.EntityResolver):
class _StrictFeedParser(_FeedParserMixin, xml.sax.handler.ContentHandler):
def _end_content(self): value = self.pop('content') if self.contentparams.get('type') in (['text/plain'] + self.html_types): self._save('description', value) self.incontent -= 1 self.contentparams.clear()
def resolveEntity(self, publicId, systemId): return _StringIO()
def resolveEntity(self, publicId, systemId): return _StringIO()
attrs = [(k.lower(), sgmllib.charref.sub(lambda m: unichr(int(m.groups()[0])), v).strip()) for k, v in attrs]
attrs = [(k.lower(), v) for k, v in attrs]
def normalize_attrs(self, attrs): # utility method to be called by descendants attrs = [(k.lower(), sgmllib.charref.sub(lambda m: unichr(int(m.groups()[0])), v).strip()) for k, v in attrs] attrs = [(k, k in ('rel', 'type') and v.lower() or v) for k, v in attrs] return attrs
if _debug: sys.stderr.write("i=%s, declstartpos=%s, rawdata=%s\n" % (i, declstartpos, rawdata))
def _scan_name(self, i, declstartpos): rawdata = self.rawdata if _debug: sys.stderr.write("i=%s, declstartpos=%s, rawdata=%s\n" % (i, declstartpos, rawdata)) n = len(rawdata) if i == n: return None, -1 m = self._new_declname_match(rawdata, i) if m: s = m.group() name = s.strip() if (i + len(s)) == n: return None, -1 #...
if _debug: for p in self.pieces: sys.stderr.write(p) sys.stderr.write('\n')
def output(self): """Return processed HTML as a single string""" if _debug: for p in self.pieces: sys.stderr.write(p) sys.stderr.write('\n') return "".join([str(p) for p in self.pieces])