rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
(x, y) = tableWidget.GetViewStart() if (x == 0 and y == 25): logger.ReportPass("Scrolled table")
(xEnd, yEnd) = calendarWidget.GetViewStart() if (yEnd == yStart + 1): logger.ReportPass("On scrolling calendar one unit")
def processNextIdle(): wx.GetApp().Yield() ev = wx.IdleEvent() wx.GetApp().ProcessEvent(ev) wx.GetApp().Yield()
logger.ReportFailure("Scrolled table") logger.Report("Scroll table 25 scroll units")
logger.ReportFailure("On scrolling calendar one unit") logger.Report("Scroll calendar one unit")
def processNextIdle(): wx.GetApp().Yield() ev = wx.IdleEvent() wx.GetApp().ProcessEvent(ev) wx.GetApp().Yield()
del oldMenu
oldMenu.Destroy()
def FindNameReturnIndex (menu, name): """ Searches a menu for a name (possibly translated) and returns an index to the item. """ index = 0 translatedName = _(name) for item in menu.GetMenuItems(): if item.GetLabel() == translatedName: return index index += 1 return wxNOT_FOUND
del oldMenu
oldMenu.Destroy()
def ReplaceViewParcelMenu(self): """ Override to customize your parcel menu. """ mainFrameId = id(app.model.mainFrame) if app.association.has_key(mainFrameId): mainFrame = app.association[mainFrameId] menuBar = mainFrame.GetMenuBar () menuIndex = menuBar.FindMenu (_('View')) + 1 assert (menuIndex != wxNOT_FOUND) noParc...
onDeleteEventUpdateUI = onRemoveEventUpdateUI
def onRemoveEventUpdateUI(self, event): (startSelect, endSelect) = self.GetSelection() event.arguments ['Enable'] = startSelect < self.GetLastPosition()
e = SMTPException("A '%s' is required to send an SMTP Mail Message" % str)
e = SMTPException("A %s is required to send an SMTP Mail Message." % str)
def __fatalError(self, str): """If a fatal error occurred before sending the message i.e. no To Address then record the error, log it, and commit the mailMessage containing the error info"""
link.setValue(self, key)
link.value = key
def _unloadRef(self, item):
def pluralize(string): if string == 'Alias': return 'Aliases' else: return string + 's' objectList = ["Kind", "Attribute", "Enumeration", "Alias", "Type"] pluralList = map(pluralize, objectList) xslFiles = pluralList + ["index", "sentences"] fileList = _findFiles(".", "parcel.xml") cssFile = os.path.join("distri...
xslFiles = ["Kinds", "Attributes", "Aliases", "Enumerations", "index", "Types", "sentences"] fileList = _findFiles(".", "parcel.xml") indexList = [('index.html', 'Main Schema Documentation'), ('sentences.html', 'Sentences Describing Schema')]
def pluralize(string): if string == 'Alias': return 'Aliases' else: return string + 's'
indexFile = file(os.path.join("..",buildenv['version'],"docs","index.html"), 'w+') indexFile.write("<html><head><title>Chandler Schema Documents</title>") indexFile.write("<link rel=\"stylesheet\" type=\"text/css\" \ href=\"schema.css\"/></head>") indexFile.write("<body><h1>Chandler Schema Documentation</h1>") indexFi...
for index, title in indexList: indexFile = file(os.path.join("..",buildenv['version'],"docs",index), 'w+') indexFile.write("<html><head><title>Chandler Schema Documents</title></head>") indexFile.write("<body><h1>%s</h1>" % title) indexFile.write("<h3>Generated %s</h3>" % time.strftime("%m/%d %I:%M%p")) indexFile.write...
def pluralize(string): if string == 'Alias': return 'Aliases' else: return string + 's'
sys.path.append(os.path.join(self.testdir, 'testparcels'))
def testKindAndItemParcel(self):
eventsWithReminders = FilteredCollection.update( parcel, 'eventsWithReminders',
eventsWithRemindersIncludingTrash = FilteredCollection.update( parcel, 'eventsWithRemindersIncludingTrash',
def installParcel(parcel, oldVersion=None): view = parcel.itsView collections.installParcel(parcel, oldVersion) Reference.update(parcel, 'currentContact') Reference.update(parcel, 'currentMailAccount') Reference.update(parcel, 'currentSMTPAccount') trashCollection = ListCollection.update( parcel, 'trashCollection', ...
if uuid in items or uuid in references:
if other._isCopyExport() or uuid in items or uuid in references:
def exportOther(copy, other, policy): if other is None: return None
kind = otherKind.findMatch(view, matches) if kind is None: kind = exportOther(None, otherKind, None)
if otherKind is not None: kind = otherKind.findMatch(view, matches) if kind is None: kind = exportOther(None, otherKind, None) if kind is None or kind is Nil: raise ValueError, 'export kind (%s) not found while exporting %s: %s' %(otherKind.itsPath, other.itsPath, otherKind) else: kind = None
def exportOther(copy, other, policy): if other is None: return None
self.parentBlock.synchronizeWidget()
self.parentBlock.widget.wxSynchronizeWidget(rerenderHint=True)
def resynchronizeDetailView (self): # Called to resynchronize the whole Detail View # Called when an itemCollection gets new sharees, # because the Notify button should then be enabled. # Also called after stamping. # @@@BJS: stripped-down for trees of blocks; used to be: ## @@@DLD - devise a block-dependency-event s...
for child in self.GetElementChildren (self.blockItem [parentUUID]):
for child in self.GetElementChildren (Globals.wxApplication.UIRepositoryView [parentUUID]):
def LoadChildren(self, parentId): """ Load the items in the tree only when they are visible. """ child, cookie = self.GetFirstChild (parentId) if not child.IsOk():
self.LoadParcelsInDirectory(systemParcelDir)
loadExternalParcels = False
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
In the debugging version, also load parcels from the PARCELDIR directory if that environment variable is set.
In the debugging version, if PARCELDIR env var is set, put that directory into sys.path because zodb might be loading objects based on modules in that directory. This must be done prior to loading the system parcels
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
self.LoadParcelsInDirectory(parcelDir)
self.LoadParcelsInDirectory(systemParcelDir) """ Load the (optional) external parcels """ if loadExternalParcels: self.LoadParcelsInDirectory(parcelDir)
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
if self.hasLocalAttributeValue('rrules'): if len(self.rrules) != 1: return True for recurtype in 'exrules', 'rdates': if self.hasLocalAttributeValue(recurtype) and \ len(getattr(self, recurtype)) != 0: return True rule = list(self.rrules)[0] if rule.interval != 1: return True for attr in RecurrenceRule.listNames: if ge...
if self.isComplex(): return True rule = self.rrules.first() if rule.interval != 1: return True elif rule.byweekday: return True else: return False
def isCustomRule(self): """Determine if this is a custom rule. For the moment, simple daily, weekly, or monthly repeating events, optionally with an UNTIL date, or the abscence of a rule, are the only rules which are not custom. """ if self.hasLocalAttributeValue('rrules'): if len(self.rrules) != 1: return True # mul...
return "not yet implemented"
if self.isComplex(): return _(u"complex rule - no description available") else: rule = self.rrules.first() freq = rule.freq interval = rule.interval dct = {} dct['weekdays'] = u"" if freq == 'weekly' and rule.byweekday is not None: daylist = [weekdayAbbrevMap[i.weekday] for i in rule.byweekday] if len(daylist) > 0: d...
def getCustomDescription(self): """Return a string describing custom rules.""" return "not yet implemented"
event.arguments['Enable'] = self.canRenameSelection()
event.arguments['Enable'] = \ not self.selectedItemToView.outOfTheBoxCollection
def onRemoveEventUpdateUI(self, event): event.arguments['Text'] = _(u'Delete Collection') """ this is enabled if any user item is selected in the sidebar """ event.arguments['Enable'] = self.canRenameSelection()
event.arguments['Enable'] = \ not self.selectedItemToView.outOfTheBoxCollection
event.arguments['Enable'] = self.canRenameSelection()
def onRenameEventUpdateUI (self, event): # can remove anything except library collections event.arguments['Enable'] = \ not self.selectedItemToView.outOfTheBoxCollection
for selectedItem in selection: selectedItem.removeFromCollection(selectedCollection)
trash = schema.ns('osaf.pim', self.itsView).trashCollection if selectedCollection == trash: for selectedItem in selection: selectedItem.delete() else: for selectedItem in selection: selectedItem.removeFromCollection(selectedCollection)
def onRemoveEvent(self, event): """ Actually perform a remove """
for selectedItem in selection: selectedItem.addToCollection(trash)
if selectedCollection == trash: for selectedItem in selection: selectedItem.delete() else: for selectedItem in selection: selectedItem.removeFromCollection(selectedCollection)
def onDeleteEvent(self, event): # Destructive action, worth an extra assert assert self.CanDelete(), "Can't remove right now.. some updateUI logic may be broken" selectedCollection = self.__getPrimaryCollection() selection = self.__getSelectedItems()
timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no dir") else: if os.name == 'nt' or sys.platform == 'cygwin': platf...
UploadToStaging(nowString, log, rsyncProgram, options.rsyncServer)
def main(): global buildscriptFile, buildDir, fromAddr, mailtoAddr, alertAddr, adminAddr, defaultDomain, defaultRsyncServer # this is a sane default - the "true" value is pulled from the module being built treeName = "Chandler" parser = OptionParser(usage="%prog [options] buildName", version="%prog 1.2") parser.add_o...
def SetAttributeValue (self, item, attributeName, value): if value is None and hasattr(item, attributeName): delattr(item, attributeName) self.AttributeChanged() else: super(ReminderDeltaAttributeEditor, \ self).SetAttributeValue(item, attributeName, value)
def SetAttributeValue (self, item, attributeName, value): if value is None and hasattr(item, attributeName): delattr(item, attributeName) self.AttributeChanged() else: super(ReminderDeltaAttributeEditor, \ self).SetAttributeValue(item, attributeName, value)
(item.itsPath, attributeName, reference.itsPath)
(item.itsPath, attributeName, displayPath)
def completeAssignments(self, item, assignments): """ Perform all the delayed attribute assignments for an item """
print "Check for output dir... (indicates first time through)" if not os.path.exists(outputDir): os.mkdir(outputDir)
print "Check for debug dir ... (indicates first time through)" debugDir = os.path.join(workingDir, "debug") if not os.path.exists(debugDir):
def Start(hardhatScript, workingDir, cvsVintage, buildVersion, clobber, log): global ret # find path to buildscripts thisScriptDir = os.path.join("/home/markie/hardhat", "buildscripts") print "Build scripts dir is " + thisScriptDir + "\n" # initialize return value ret = "no_changes" # make sure workingDir is absolu...
recurrenceid.value = dateForVObject(item.recurrenceID,item.allDay)
master = item.getMaster() allDay = master.allDay or master.anyTime recurrenceid.value = dateForVObject(item.recurrenceID, allDay)
def populate(comp, item): """Populate the given vobject vevent with data from item.""" if item.getAttributeValue('icalUID', default=None) is None: item.icalUID = unicode(item.itsUUID) comp.add('uid').value = item.icalUID
if anyTime:
if anyTime or isDate:
def importProcess(self, text, extension=None, item=None): # the item parameter is so that a share item can be passed in for us # to populate.
elif isDate: duration = datetime.timedelta(days=2)
def importProcess(self, text, extension=None, item=None): # the item parameter is so that a share item can be passed in for us # to populate.
elif isDate: eventItem.allDay = True
eventItem.allDay = False else: eventItem.anyTime = False if isDate: eventItem.allDay = True else: eventItem.allDay = False
def importProcess(self, text, extension=None, item=None): # the item parameter is so that a share item can be passed in for us # to populate.
mod.modificationFor = mod.occurenceFor = eventItem
mod.modificationFor = mod.occurrenceFor = eventItem
def itemsFromVObject(view, text, coerceTzinfo = None, filters = None, monolithic = True, changes=None, previousView=None, updateCallback=None): """ Take a string, create or update items from that stream. The updating of items uses Sharing.importValue; changes, previousView and updateCallback are all optional pass-thro...
if NAME_OR_ADDRESS: factory.domain = NAME_OR_ADDRESS
def _sendingMail(self, from_addr, to_addrs, messageText, deferred, testing=False): if __debug__: trace("_sendingMail")
stampClass(item).InitOutgoingAttributes()
stampClass(item).isOutbound = True
def onButtonPressedEvent(self, event): # Add or remove the associated Stamp type Block.Block.finishEdits() item = self.item if item is None or not self._isStampable(item): return
additional_path = buildenv['root'] + os.sep + 'debug' + os.sep + 'lib'
additional_path = buildenv['root'] + os.sep + 'release' + os.sep + 'lib'
def run(buildenv): if buildenv['version'] == 'debug': path = buildenv['root'] + os.sep + 'debug' + os.sep + 'bin' + os.pathsep + buildenv['path'] python = buildenv['python_d'] if buildenv['version'] == 'release': path = buildenv['root'] + os.sep + 'release' + os.sep + 'bin' + os.pathsep + buildenv['path'] python = b...
DOMAIN_LIST = ['aol.com', 'earthlink.net', 'mac.com', 'yahoo.com', 'hotmail.com', 'mailblocks.com', 'pacbell.net', 'osafoundation.org']
DOMAIN_LIST = ['flossrecycling.com', 'flossresearch.org', 'rosegardens.org', 'electricbagpipes.com', 'facelessentity.com', 'example.com', 'example.org', 'example.net', 'hangarhonchos.org']
def GenerateNotes(count): """ Generate _count_ notes """ for index in range(count): GenerateNote()
return "%s@%s" % (handle, domainName)
return "%s@%s" % (handle.lower(), domainName)
def GenerateEmailAddress(name): domainName = random.choice(DOMAIN_LIST) handle = random.choice([name.firstName, name.lastName]) return "%s@%s" % (handle, domainName)
if __debug__ and self.factory.useSSL: self.factory.log.info(">>> %s" % line)
self.resetTimeout()
def sendLine(self, line): """This method utilized for debugging SSL IMAP4 Communications""" if __debug__ and self.factory.useSSL: self.factory.log.info(">>> %s" % line)
if __debug__ and self.factory.useSSL: self.factory.log.info("<<< %s" % line)
self.resetTimeout()
def lineReceived(self, line): """This method utilized for debugging SSL IMAP4 Communications""" if __debug__ and self.factory.useSSL: self.factory.log.info("<<< %s" % line)
def __init__(self, username, password, fromEmail, toEmail, file, deferred, log, retries=5, contextFactory=None, heloFallback=False, requireAuthentication=True, requireTransportSecurity=True,
def __init__(self, username, password, fromEmail, toEmail, file, deferred, retries, contextFactory=None, heloFallback=False, requireAuthentication=True, requireTransportSecurity=True,
def __init__(self, username, password, fromEmail, toEmail, file, deferred, log, retries=5, contextFactory=None, heloFallback=False, requireAuthentication=True, requireTransportSecurity=True, useSSL=False):
self.log = log
self.done = False
def __init__(self, username, password, fromEmail, toEmail, file, deferred, log, retries=5, contextFactory=None, heloFallback=False, requireAuthentication=True, requireTransportSecurity=True, useSSL=False):
def __init__(self, account, mailMessage, deferred=None):
def __init__(self, account, mailMessage):
def __init__(self, account, mailMessage, deferred=None): if account is None or not account.isItemOf(Mail.MailParcel.getSMTPAccountKind()): raise SMTPMailException("You must pass an SMTPAccount instance")
viewName = "SMTPSender_%s" % str(UUID.UUID())
viewName = "SMTPSender_%s_%s" % (str(UUID.UUID()), DateTime.now())
def __init__(self, account, mailMessage, deferred=None): if account is None or not account.isItemOf(Mail.MailParcel.getSMTPAccountKind()): raise SMTPMailException("You must pass an SMTPAccount instance")
self.deferred = deferred self.failure = None self.success = None
self.factory = None
def __init__(self, account, mailMessage, deferred=None): if account is None or not account.isItemOf(Mail.MailParcel.getSMTPAccountKind()): raise SMTPMailException("You must pass an SMTPAccount instance")
self.view.commit()
self.view.refresh()
def __sendMail(self): self.setViewCurrent()
factory = ChandlerESMTPSenderFactory(username, password, from_addr, to_addrs, msg, d, self.log, retries, sslContext, heloFallback, authRequired, useSSL, useSSL) reactor.connectTCP(host, port, factory)
self.factory = ChandlerESMTPSenderFactory(username, password, from_addr, to_addrs, msg, d, retries, sslContext, heloFallback, authRequired, useSSL, useSSL) reactor.connectTCP(host, port, self.factory)
def __sendMail(self): self.setViewCurrent()
self.mailMessage.dateSent = DateTime.now() self.mailMessage.dateSentString = message.dateTimeToRFC2882Date(DateTime.now())
now = DateTime.now() self.mailMessage.dateSent = now self.mailMessage.dateSentString = message.dateTimeToRFC2882Date(now)
def __mailSuccess(self, result): if __debug__: self.printCurrentView("__mailSuccess")
self.success = result
def __mailSuccess(self, result): if __debug__: self.printCurrentView("__mailSuccess")
self.failure = result[1]
def __mailSomeFailed(self, result): """ result: (NumOk, [(emailAddress, serverStatusCode, serverResponseString)]) Collect all results that do not have a 250 and form a string for .4B """
self.failure = exc.value
def __mailFailure(self, exc): self.setViewCurrent()
a problem communicating with a SMTP server and no error code will be returned by theA
a problem communicating with an SMTP server and no error code will be returned by the
def __recordError(self, err): deliveryError = Mail.MailDeliveryError()
deliveryError.errorString = err.__str__() + " UNKNOWN TYPE NOT A EXCEPTION"
deliveryError.errorString = err.__str__() + " UNKNOWN TYPE NOT AN EXCEPTION"
def __recordError(self, err): deliveryError = Mail.MailDeliveryError()
if self.failure is not None: if self.deferred is not None: self.deferred.errback(self.failure) elif self.success is not None: if self.deferred is not None: self.deferred.callback(self.success)
def _viewCommitSuccess(self): """ Overides C{RepositoryView.AbstractRepositoryViewManager}. It posts a commit event to the GUI thread, unpins the C{SMTPAccountKind} and C{MailMessageKind} from memory, and writes commit info to the logger @return: C{None} """
cmd = ['./release/RunPython', './tools/run_tests.py'] if options.verbose: cmd += ['-v'] cmd += [test] return callRun_Test(cmd)
result = 0 for mode in modes: cmd = ['./%s/RunPython' % mode, './tools/run_tests.py'] if options.verbose: cmd += ['-v'] cmd += [test] result = callRun_Test(cmd) if result <> 0 and not options.nonstop: break return result
def doTest(test): cmd = ['./release/RunPython', './tools/run_tests.py'] if options.verbose: cmd += ['-v'] cmd += [test] return callRun_Test(cmd)
path = os.path.join(os.getenv('CHANDLERHOME') or '.',
sharePath = os.path.join(os.getenv('CHANDLERHOME') or '.',
def testImport(self): path = os.path.join(os.getenv('CHANDLERHOME') or '.', 'parcels', 'osaf', 'sharing', 'tests')
sharePath=path,
sharePath=sharePath,
def testImport(self): path = os.path.join(os.getenv('CHANDLERHOME') or '.', 'parcels', 'osaf', 'sharing', 'tests')
('importing_3000_event_calendar', '
('importing_3000_event_calendar.import', '
def __init__(self): self._app_path = os.getcwd() self._options = { 'tbox_data': '.', # raw .perf files 'html_data': '.', # where to output generated .html 'perf_data': '.', # where to store processed data 'verbose': False, 'debug': False, 'cleanup': False, # remove .perf files when processed 'c...
'importing_3000_event_calendar': 30,
'importing_3000_event_calendar.import': 30,
def __init__(self): self._app_path = os.getcwd() self._options = { 'tbox_data': '.', # raw .perf files 'html_data': '.', # where to output generated .html 'perf_data': '.', # where to store processed data 'verbose': False, 'debug': False, 'cleanup': False, # remove .perf files when processed 'c...
pass
return []
def SelectedItems(self): """ Override this to return the list of selected items. """ pass
self.minorLineColor = wx.Colour(229, 229, 229)
self.minorLineColor = wx.Colour(217, 217, 217)
def InitializeStyles(self):
assert rectHeight >= lineHeight, "Don't have enough room to write anything (have %d, need %d)" % (rectHeight, lineHeight)
if rectHeight < lineHeight: return 0
def DrawWrappedText(dc, text, rect, measurements=None): """ Simple wordwrap - draws the text into the current DC returns the height of the text that was written measurements is a FontMeasurements object as returned by Styles.getMeasurements() """ if measurements is None: measurements = Styles.getMeasurements(dc.GetF...
assert False, "Didn't draw any text!"
def DrawClippedText(dc, word, x, y, maxWidth, wordWidth = -1): """ Draw the text, clipping at letter boundaries. This is optimized to reduce the number of calls to GetTextExtent by first estimating the length of the word that will fit in the given width. Note that I did consider some sort of complex quicksearch algori...
if width == 0: width == 1
if width == 0: width = 1
def MakeGradientBrush(self, offset, 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 tha...
dateStr = [(u'Today',_(u'today')), (u'Tomorrow',_(u'tomorrow')), ( u'Yesterday',_(u'yesterday')), (u'EOW',_(u'end of week'))]
dateStr = [(u'Today',_(u'Today')), (u'Tomorrow',_(u'Tomorrow')), ( u'Yesterday',_(u'Yesterday')), (u'EOW',_(u'End of week'))]
def Draw (self, dc, rect, (item, attributeName), isInSelection=False): """ Draw the date & time, somewhat in the style that Apple Mail does: Date left justified, time right justified. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False)
textMatches = {'Lunch':_(u'lunch'),'Evening':_(u'evening'),'Noon':_(u'noon'), 'Midnight':_(u'midnight'),'Breakfast':_(u'breakfast'),'Now':_(u'now'), 'Morning':_(u'morning'),'Dinner':_(u'dinner'),'Tonight':_(u'tonight'), 'Night':_(u'night'),u'EOD':_(u'end of day')}
textMatches = {'Lunch':_(u'Lunch'),'Evening':_(u'Evening'),'Noon':_(u'Noon'), 'Midnight':_(u'Midnight'),'Breakfast':_(u'Breakfast'),'Now':_(u'Now'), 'Morning':_(u'Morning'),'Dinner':_(u'Dinner'),'Tonight':_(u'Tonight'), 'Night':_(u'Night'),u'EOD':_(u'End of day')}
def finishCompletion(self, completionString): if completionString is not None: dashIndex = completionString.find(' : ') if dashIndex != -1: # could be 'tomorrow - 08/02/2006' completionString = completionString[dashIndex + 3:] return super(DateAttributeEditor, self).finishCompletion(completionString)
elif ret == "success-changes": print "There were changes, and the tests were successful" log.write("There were changes, and the tests were successful\n")
elif ret == "success-changes" or ret == "success-first-run": if ret == "success-first-run": print "First run of tinderbox, and the tests were successful" log.write("First run of tinderbox, and the tests were successful\n") else: print "There were changes, and the tests were successful" log.write("There were changes, an...
def main(): global buildscriptFile, fromAddr, mailtoAddr, alertAddr, adminAddr, defaultDomain, defaultRsyncServer parser = OptionParser(usage="%prog [options] buildName", version="%prog 1.2") parser.add_option("-t", "--toAddr", action="store", type="string", dest="toAddr", default=mailtoAddr, help="Where to mail scrip...
for flickrPhoto in flickrPhotos: """ If we've already downloaded a photo with this id use it instead. """ photoUUID = flickrPhotosCollection.findInIndex ( 'flickrIDIndex', 'exact', lambda UUID: cmp(flickrPhoto.id, repView[UUID].flickrID)) if photoUUID is None: photoItem = FlickrPhoto(photo=flickrPhoto, itsView=repView...
if flickrPhotos: for flickrPhoto in flickrPhotos: """ If we've already downloaded a photo with this id use it instead. """ photoUUID = flickrPhotosCollection.findInIndex ( 'flickrIDIndex', 'exact', lambda UUID: cmp(flickrPhoto.id, repView[UUID].flickrID)) if photoUUID is None: photoItem = FlickrPhoto(photo=flickrPhoto...
def fillCollectionFromFlickr(self, repView): """ Fills the collection with photos from the flickr website. """ coll = pim.ListCollection(itsView = repView).setup() if self.userName: flickrUserName = flickr.people_findByUsername(self.userName.encode('utf8')) flickrPhotos = flickr.people_getPublicPhotos(flickrUserName.id...
self.SetDropTarget(self.dropTarget)
try: window = self.GetGridWindow() except AttributeError: window = self window.SetDropTarget(self.dropTarget)
def __init__(self, *arguments, **keywords): super (DropReceiveWidget, self).__init__ (*arguments, **keywords) self.dropTarget = DropTarget(self) self.SetDropTarget(self.dropTarget)
dc = wx.PaintDC(self)
if (event is None): dc = wx.ClientDC(self) else: dc = wx.PaintDC(self)
def OnPaint(self, event): dc = wx.PaintDC(self) dc.Clear() dc.SetBackground( wx.WHITE_BRUSH ) dc.SetTextBackground( (255,255,255) ) dc.SetTextForeground( (0,0,0) ) dc.SetFont(self.font) dc.DrawText(self.text, 0,0)
charStyle.fontSize = 10
if '__WXGTK__' in wx.PlatformInfo: charStyle.fontSize = 10 elif '__WXMAC__' in wx.PlatformInfo: charStyle.fontSize = 11 elif '__WXMSW__' in wx.PlatformInfo: charStyle.fontSize = 9
def __init__(self, *arguments, **keywords): super(wxPreviewArea, self).__init__(*arguments, **keywords) self.currentDaysItems = [] self.Bind(wx.EVT_PAINT, self.OnPaint) charStyle = Styles.CharacterStyle() charStyle.fontSize = 10 self.font = Styles.getFont(charStyle) self.fontHeight = Styles.getMeasurements(self.font)....
y = 0
m, r = self.margin, self.GetRect() dc.SetClippingRegion(m, m, r.width - 2*m, r.height - 2*m) y = self.margin
def Draw(self, dc): dc.Clear()
dc.DrawText(line, 0, y)
dc.DrawText(line, self.margin, y)
def Draw(self, dc): dc.Clear()
self.ChangeHeightAndAdjustContainers(numLines * self.fontHeight + 3)
self.ChangeHeightAndAdjustContainers(numLines * self.fontHeight + 2*self.margin)
def wxSynchronizeWidget(self): if isMainCalendarVisible(): # disappear! self.ChangeHeightAndAdjustContainers(0) return
for item in selection.iterSelection():
for item in list(selection.iterSelection()):
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.
raise ImportError, sys.exc_value, sys.exc_traceback
x, value, traceback = sys.exc_info() raise ImportError, value, traceback
def loadClass(cls, name, module=None):
body += self.TBoxLogURL % (treename, build_id)
body += self.TBoxLogURL % (treename, lgb_id)
def process(self): builds = {}
occurrence = newMaster.getRecurrenceID(newMaster.recurrenceID)
occurrence = newMaster.getRecurrenceID(newMaster.effectiveStartTime)
def SetAttributeValue(self, item, attributeName, value): """ Set the value of the attribute given by the value. """ assert value != RecurrenceAttributeEditor.customIndex # Changing the recurrence period on a non-master item could delete # this very 'item'; we'll try to select the "same" occurrence # afterwards ... asse...
parent = parcel_for_module(cls.__module__, view) item = parent.getItemChild(cls.__name__) if isinstance(item,Types.Struct): return item
parent = view.findPath(ModuleMaker(cls.__module__).getPath()) if parent is not None: item = parent.getItemChild(cls.__name__) if isinstance(item,Types.Struct): return item
def _find_schema_item(cls, view): parent = parcel_for_module(cls.__module__, view) item = parent.getItemChild(cls.__name__) if isinstance(item,Types.Struct): return item
cls.__name__, parcel_for_module(cls.__module__, view),
'tmp_'+cls.__name__, view,
def _create_schema_item(cls, view): return SchemaStruct( cls.__name__, parcel_for_module(cls.__module__, view), itemFor(Types.Struct, view) )
parent = parcel_for_module(cls.__module__, view) item = parent.getItemChild(cls.__name__) if isinstance(item,Types.Enumeration): return item
parent = view.findPath(ModuleMaker(cls.__module__).getPath()) if parent is not None: item = parent.getItemChild(cls.__name__) if isinstance(item,Types.Enumeration): return item
def _find_schema_item(cls, view): parent = parcel_for_module(cls.__module__, view) item = parent.getItemChild(cls.__name__) if isinstance(item,Types.Enumeration): return item
cls.__name__, parcel_for_module(cls.__module__, view),
'tmp_'+cls.__name__, view,
def _create_schema_item(cls, view): return Types.Enumeration( cls.__name__, parcel_for_module(cls.__module__, view), itemFor(Types.Enumeration, view) )
style = wx.CAPTION | wx.STAY_ON_TOP
style = wx.CAPTION
def __init__(self, exception=None): # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI dialog using the Create # method. pre = wx.PreDialog() style = wx.CAPTION | wx.STAY_ON_TOP pre.Create(None, -1, _(u"Startup Op...
def onGetNewMailEvent (self, event): if not sharing.ensureAccountSetUp(self.itsView, inboundMail=True): return view = self.itsView view.commit() for account in Mail.IMAPAccount.getActiveAccounts(self.itsView): Globals.mailService.getIMAPInstance(account).getMail() for account in Mail.POPAccount.getActiveAccounts...
def onGetNewMailEvent (self, event): # Make sure we have all the accounts; returns False if the user cancels # out and we don't. if not sharing.ensureAccountSetUp(self.itsView, inboundMail=True): return
def onSyncWebDAVEvent (self, event): """ Synchronize WebDAV sharing. The "File | Sync | WebDAV" menu item """ self.RepositoryCommitWithStatus()
def onSyncAllEvent (self, event): """ Synchronize Mail and all sharing. The "File | Sync | All" menu item, and the Sync All Toolbar button """ view = self.itsView DAVReady = sharing.isWebDAVSetUp(view) inboundMailReady = sharing.isInboundMailSetUp(view) activeShares = sharing.checkForActiveShares(view) if not (D...
def onSyncWebDAVEvent (self, event): """ Synchronize WebDAV sharing. The "File | Sync | WebDAV" menu item """ # commit repository changes before synch # @@@DLD bug 1998 - update comment above and use refresh instead? self.RepositoryCommitWithStatus()
self.setStatusMessage (_(u"Checking shared collections...")) if sharing.checkForActiveShares(self.itsView):
if activeShares:
def onSyncWebDAVEvent (self, event): """ Synchronize WebDAV sharing. The "File | Sync | WebDAV" menu item """ # commit repository changes before synch # @@@DLD bug 1998 - update comment above and use refresh instead? self.RepositoryCommitWithStatus()
sharing.syncAll(self.itsView) else: self.setStatusMessage (_(u"No shared collections found")) return self.setStatusMessage (_(u"Shared collections synchronized")) def onSyncWebDAVEventUpdateUI (self, event): accountOK = sharing.isWebDAVSetUp(self.itsView) haveActiveShares = sharing.checkForActiveShares(self.itsView) e...
sharing.syncAll(view) self.setStatusMessage (_(u"Shared collections synchronized")) else: if DAVReady: self.setStatusMessage (_(u"No shared collections found"))
def onSyncWebDAVEvent (self, event): """ Synchronize WebDAV sharing. The "File | Sync | WebDAV" menu item """ # commit repository changes before synch # @@@DLD bug 1998 - update comment above and use refresh instead? self.RepositoryCommitWithStatus()
if sharing.isInboundMailSetUp(self.itsView):
if inboundMailReady:
def onSyncAllEvent (self, event): """ Synchronize Mail and all sharing. The "File | Sync | All" menu item """ # find all the shared collections and sync them. self.onSyncWebDAVEvent (event)
elif subtype == "signed": logging.warn("Chandler Mail Service does not support multipart/signed at this time") return elif subtype == "encrypted": logging.warn("Chandler Mail Service does not support multipart/encrypted at this time") return
def __handleMultipart(view, mimePart, parentMIMEContainer, bodyBuffer, counter, buf, level): subtype = mimePart.get_content_subtype() multipart = mimePart.is_multipart() if verbose(): __trace("multipart/%s" % subtype, buf, level) """If the message is multipart then pass decode=False to get_poyload otherwise pass Tr...
Globals.repository.commit()
self.RepositoryCommitWithStatus ()
def onEditMailAccountEvent (self, notification): # @@@ Deprecated, replaced by onEditAccountPreferencesEvent, above
Globals.repository.commit()
self.RepositoryCommitWithStatus ()
def onNewEvent (self, notification): # create a new content item event = notification.event itemName = 'Anonymous'+str(UUID.UUID()) newItem = event.kindParameter.newItem (itemName, self) newItem.InitOutgoingAttributes () Globals.repository.commit()
Globals.repository.commit()
self.RepositoryCommitWithStatus ()
def onCommitRepositoryEvent(self, notification): Globals.repository.commit()
self.setStatusText ('Committing changes...')
def ShareCollection (self, itemCollection): # put a "committing" message into the status bar self.setStatusText ('Committing changes...')
Globals.repository.commit()
self.RepositoryCommitWithStatus()
def ShareCollection (self, itemCollection): # put a "committing" message into the status bar self.setStatusText ('Committing changes...')
str = "error"
if len (errorStrings) == 0: errorMessage = "An unknown error occurred." else: if len (errorStrings) == 1: str = "error" else: str = "errors"
def displaySMTPSendError (self, mailMessageUUID): """ Called when the SMTP Send generated an error. """ # Lookup the message mailMessageKind = Mail.MailParcel.getMailMessageKind () mailMessage = mailMessageKind.findUUID(mailMessageUUID) if mailMessage is not None and mailMessage.isOutbound: """DLDTBD - Select the mess...
if len(errorStrings) > 1: str = "errors" errorMessage = "The following %s occurred. %s" % (str, ', '.join(errorStrings)) errorMessage = errorMessage.encode ('utf-8')
errorMessage = "The following %s occurred. %s" % (str, ', '.join(errorStrings)) errorMessage = errorMessage.encode ('utf-8')
def displaySMTPSendError (self, mailMessageUUID): """ Called when the SMTP Send generated an error. """ # Lookup the message mailMessageKind = Mail.MailParcel.getMailMessageKind () mailMessage = mailMessageKind.findUUID(mailMessageUUID) if mailMessage is not None and mailMessage.isOutbound: """DLDTBD - Select the mess...
def RepositoryCommitWithStatus (self): self.setStatusText ("committing changes to the repository...") Globals.repository.commit() self.setStatusText ('')
def displaySMTPSendError (self, mailMessageUUID): """ Called when the SMTP Send generated an error. """ # Lookup the message mailMessageKind = Mail.MailParcel.getMailMessageKind () mailMessage = mailMessageKind.findUUID(mailMessageUUID) if mailMessage is not None and mailMessage.isOutbound: """DLDTBD - Select the mess...
master = event.getMaster()
master = event.getMaster().itsItem
def Draw(self, dc, styles, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? event = self.event # recurring items, when deleted or stamped non-Calendar, are sometimes # passed to Draw before wxSynchronize is called, ignore those items if (event.itsItem.isDeleted() or not has_stamp(event, Calendar...
master = self.event.getMaster()
master = self.event.getMaster().itsItem
def DrawCollectionSwatches(self, dc, topLeft, bottomRight, vertical=True): """ topLeft and bottomRight must be vectors (lists which can be added and subtracted like vectors) """ master = self.event.getMaster() app_ns = schema.ns('osaf.app', self.event.itsItem.itsView) sidebarCollections = app_ns.sidebarCollection allCo...
allCollection = schema.ns('osaf.pim', self.event.itsView).allCollection
allCollection = schema.ns('osaf.pim', self.event.itsItem.itsView).allCollection
def DrawCollectionSwatches(self, dc, topLeft, bottomRight, vertical=True): """ topLeft and bottomRight must be vectors (lists which can be added and subtracted like vectors) """ master = self.event.getMaster() app_ns = schema.ns('osaf.app', self.event.itsItem.itsView) sidebarCollections = app_ns.sidebarCollection allCo...