rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self._logDL(27)
self._logDL(26)
def next(_self, uRef):
self._logDL(8)
self._logDL(30)
def readName(self, view, version, key, name):
self._logDL(9)
self._logDL(31)
def readName(self, view, version, key, name):
self._logDL(15)
self._logDL(16)
def next(_self, key):
self._logDL(27)
self._logDL(28)
def _find(_self, version, uuid):
self._logDL(28)
self._logDL(27)
def _find(_self, version, uuid):
self._logDL(19)
self._logDL(18)
def next(_self):
self._logDL(28)
self._logDL(29)
def next(_self):
try: txnStatus = store.startTransaction(None, True) return self._versionSeq.get(store.txn) - 1 finally: store.abortTransaction(None, txnStatus)
while True: try: try: txnStatus = store.startTransaction(None, True) return self._versionSeq.get(store.txn) - 1 finally: store.abortTransaction(None, txnStatus) except DBLockDeadlockError: if txnStatus & store.TXN_STARTED: self._logDL(32) else: raise
def getVersion(self):
message = _('Please specify who to share this collection with in the "sharees" field.')
message = _('Please specify who to share this collection with in the "to" field.')
def onSendShareItemEvent (self, notification): item = self.selectedItem() # preflight the send/share request # mail items and collections need their recievers set up try: whoTo = item.who except AttributeError: whoTo = [] if len (whoTo) == 0: if isinstance (item, ItemCollection.ItemCollection): message = _('Please spec...
redirectAttr = ' ' + redirectAttr + ' '
redirectAttr = redirectAttr + _(' ')
def staticTextLabelValue (self, item): redirectName = self.whichAttribute () try: redirectAttr = item.getAttributeAspect(redirectName, 'redirectTo') except AttributeError: redirectAttr = redirectName if redirectAttr is None: redirectAttr = redirectName # lookup better names for display of some attributes try: redirectA...
contactKind = Contacts.ContactsParcel.getContactKind () if item is None or item.isItemOf (contactKind): return False return True
return ItemCollectionOrMailMessageMixin (item)
def shouldShow (self, item): contactKind = Contacts.ContactsParcel.getContactKind () if item is None or item.isItemOf (contactKind): return False return True
contactKind = Contacts.ContactsParcel.getContactKind () shouldShow = not item.isItemOf (contactKind) return shouldShow
return ItemCollectionOrMailMessageMixin (item)
def shouldShow (self, item): # don't show if the item is a Contact contactKind = Contacts.ContactsParcel.getContactKind () shouldShow = not item.isItemOf (contactKind) return shouldShow
redirectName = self.whichAttribute () if 'home' in redirectName: label = 'home email address' elif 'work' in redirectName: label = 'work email address' if len (label) > 0: label = label + ' '
label = self.title + _(' ')
def staticTextLabelValue (self, item): redirectName = self.whichAttribute () if 'home' in redirectName: label = 'home email address' elif 'work' in redirectName: label = 'work email address' if len (label) > 0: label = label + ' ' return label
logLines = file(log, "r").readlines()[-500:] combined = "".join(logLines)
if not isinstance(log, unicode): log = unicode(log, sys.getfilesystemencoding()) f = codecs.open(log, encoding='utf-8', mode="r", errors="ignore") combined = u"".join(f.readlines()[-500:])
def __init__(self, parent, ID, logList, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
self.forClipboard += "==> %s <==\n\n" % log
self.forClipboard += u"==> %s <==\n\n" % log
def __init__(self, parent, ID, logList, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
self.forClipboard += "%s\n\n" % combined
self.forClipboard += u"%s\n\n" % combined
def __init__(self, parent, ID, logList, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE):
'Chandler', '0.7')
'Chandler', version.release)
def _makeRandomProfileDir(pattern): chars = string.letters + string.digits name = ''.join([chars[ord(c) % len(chars)] for c in os.urandom(8)]) profileDir = pattern.replace('*', '%s') %(name) createProfileDir(profileDir) return profileDir
profileDir = os.path.join(dataDir, '.chandler', '0.7')
profileDir = os.path.join(dataDir, '.chandler', version.release)
def _makeRandomProfileDir(pattern): chars = string.letters + string.digits name = ''.join([chars[ord(c) % len(chars)] for c in os.urandom(8)]) profileDir = pattern.replace('*', '%s') %(name) createProfileDir(profileDir) return profileDir
cert = Certificate(view=repView)
cert = Certificate(view=repView, trust=trust, type=type, fingerprint=fingerprint, fingerprintAlgorithm='sha1', subjectCommonName=subjectCommonName)
def importCertificate(x509, fingerprint, trust, repView): """ Import X.509 certificate. @param x509: The X.509 certificate to import @param fingerprint: The fingerprint of the certificate (in SHA1) @param trust: The trust value for this certificate """ pem = x509.as_pem() if _isInRepository(repView, pem):...
cert.type = type cert.trust = trust cert.fingerprintAlgorithm = 'sha1' cert.fingerprint = fingerprint cert.subjectCommonName = subjectCommonName
def importCertificate(x509, fingerprint, trust, repView): """ Import X.509 certificate. @param x509: The X.509 certificate to import @param fingerprint: The fingerprint of the certificate (in SHA1) @param trust: The trust value for this certificate """ pem = x509.as_pem() if _isInRepository(repView, pem):...
handle = conduit._getServerHandle() resource = handle.getResource(location) if ticket: resource.ticketId = ticket logger.debug('Examining %s ...', location) try: exists = handle.blockUntil(resource.exists) if not exists: logger.debug("...doesn't exist") raise NotFound(message="%s does not exist" % location) except zan...
(shareMode, hasSubCollection, isCalendar) = interrogate(conduit, location, ticket=ticket)
def subscribe(view, url, updateCallback=None, username=None, password=None, forceFreeBusy=False): if updateCallback: progressMonitor = ProgressMonitor(0, updateCallback) callback = progressMonitor.callback else: progressMonitor = None callback = None (useSSL, host, port, path, query, fragment) = splitUrl(url) ticket...
file = I18nManager.getImage(name)
root, extension = os.path.splitext (name) file = I18nManager.getImage(root + "-" + sys.platform + extension)
def GetImage (self, name): """ Return None if image isn't found, otherwise loads a bitmap. Looks first for platform specific bitmaps. """ file = I18nManager.getImage(name) if file is None: return None
return None
file = I18nManager.getImage(name) if file is None: return None
def GetImage (self, name): """ Return None if image isn't found, otherwise loads a bitmap. Looks first for platform specific bitmaps. """ file = I18nManager.getImage(name) if file is None: return None
self.icon = wx.Icon("resources/images/Chandler_16.ico", wx.BITMAP_TYPE_ICO)
self.icon = wx.Icon("resources/images/Chandler_32.ico", wx.BITMAP_TYPE_ICO)
def __init__(self, *arguments, **keywords): super (MainFrame, self).__init__(*arguments, **keywords)
include_dirs = [my_inc, openssl_dir + '/include'] library_dirs = [openssl_dir + '\\lib']
prefix_dir = get_config_var('prefix') include_dirs = [prefix_dir + '\\..\\include', my_inc, openssl_dir + '/include'] library_dirs = [prefix_dir + '\\..\\lib', openssl_dir + '\\lib']
def swig_sources (self, sources): """Walk the list of source files in 'sources', looking for SWIG interface (.i) files. Run SWIG on all that are found, and return a modified 'sources' list with SWIG source files replaced by the generated C (or C++) files. """ new_sources = [] swig_sources = [] swig_targets = {} # X...
include_dirs = [my_inc, '/usr/include'] library_dirs = ['/usr/lib']
include_dirs = [get_config_var('INCLUDEDIR'), my_inc, '/usr/include'] library_dirs = [get_config_var('LIBDIR'), '/usr/lib']
def swig_sources (self, sources): """Walk the list of source files in 'sources', looking for SWIG interface (.i) files. Run SWIG on all that are found, and return a modified 'sources' list with SWIG source files replaced by the generated C (or C++) files. """ new_sources = [] swig_sources = [] swig_targets = {} # X...
i,k = os.popen4(args_str) i.close() outputList = k.readlines() exitCode = k.close()
output = os.popen(args_str, 'r') outputList = output.readlines() exitCode = output.close()
def executeCommandReturnOutput(args): args[0] = escapeSpaces(args[0]) args = map(escapeBackslashes, args) if not os.path.exists(args[0]): raise CommandNotFound # all args need to be quoted # args = map(quoteString, args) args_str = ' '.join(args) print args_str if os.name not in ['nt', 'os2'] and sys.platform != 'c...
for calendar in vobject.readComponents(text, validate=True,
for calendar in vobject.readComponents(text, validate=False,
def itemsFromVObject(view, text, coerceTzinfo = None, filters = None, monolithic = True, updateCallback=None, stats=None): """ Take a string, create or update items from that stream. The filters argument is an optional sequence of attributes to not populate. monolithic is True for calendars that may contain multiple ...
self.weekColumnHeader.Thaw() self.Thaw()
def wxSynchronizeWidget(self, useHints=False): selectedDate = self.blockItem.selectedDate startDate = self.blockItem.rangeStart
image.SetRGB(x,0, *color)
imageBuffer[bufferX:bufferX+3] = '%c%c%c' % color bufferX += 3
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...
heightGutter = 23
heightGutter = self.buttonsLabeled and 23 or 6
def instantiateWidget (self): self.ensureDynamicChildren () heightGutter = 23 toolbar = wxToolbar(self.parentBlock.widget, Block.Block.getWidgetID(self), wx.DefaultPosition, (-1, self.toolSize.height+heightGutter), style=self.calculate_wxStyle()) # set the tool bitmap size right away toolbar.SetToolBitmapSize((self.too...
if mailMessage.body is not None: messageObject.set_payload(textToStr(mailMessage.body))
try: payload = mailMessage.body except AttributeError: payloadStr = "" else: payloadStr = textToStr(payload) messageObject.set_payload(payloadStr)
def kindToMessageObject(mailMessage): """ This method converts a email message string to a Chandler C{Mail.MailMessage} object @param messageObject: A C{email.Message} object representation of a mail message @type messageObject: C{email.Message} @return: C{Mail.MailMessage} """ if not isinstance(mailMessage, Mail.Mai...
wxWindow.navigationBar.model.SynchronizeView()
if wxPlatform != '__WXGTK__': wxWindow.navigationBar.model.SynchronizeView()
def SynchronizeView(self): """ Notifies the window's wxPython view counterpart that they need to synchronize themselves to match their peristent model counterpart. """ app = application.Application.app if not app.association.has_key(id(self)): wxWindow = app.applicationResources.LoadFrame (None, "ChandlerWindow") asser...
self.navigationBar = self.FindWindowByName("NavigationBar") assert (self.navigationBar != None)
if wxPlatform != '__WXGTK__': self.navigationBar = self.FindWindowByName("NavigationBar") assert (self.navigationBar != None)
def OnInit(self, model): """ There's a tricky problem here. We need to postpone wiring up OnMove, OnSize, etc. after __init__, otherwise OnMove, etc. will get called before we've had a chance to set the windows size using the value in our model. """ self.model = model
sharingHeader = MailSharing.getChandlerSharingHeader()
sharingHeader = MailMessage.createChandlerHeader(MailConstants.SHARING_HEADER)
def _getSharingHeaderInfo(mailItem): """ Return the Chandler sharing header's values, split into a handy list. Throws if not present. """ sharingHeader = MailSharing.getChandlerSharingHeader() divider = MailConstants.SHARING_DIVIDER urlAndCollectionName = mailItem.chandlerHeaders[sharingHeader].split(divider) return ur...
return not (item.allDay or item.anyTime)
return not (item.anyTime or not item.duration)
def shouldShow (self, item): return not (item.allDay or item.anyTime)
attributes.extend(('allDay', 'anyTime'))
attributes.extend(('duration', 'anyTime'))
def attributesToWatch(self): attributes = super(TransparencyConditionalBlock, self).attributesToWatch() attributes.extend(('allDay', 'anyTime')) return attributes
return self._get(item._uuid).alias
if isuuid(item): key = item else: key = item.itsUUID return self._get(key).alias
def getAlias(self, item): """ Get the alias this item is keyed on in this collection.
oldAlias = super(RefList, self).setAlias(item._uuid, alias)
if isuuid(item): key = item else: key = item.itsUUID oldAlias = super(RefList, self).setAlias(key, alias)
def setAlias(self, item, alias):
if False:
if True:
def getstack(): stack = traceback.extract_stack(limit=5)[:-2] return "".join(traceback.format_list(stack))
value = cursor.next()
value = _self.cursor.next()
def next(_self, key):
else: event.Skip()
return event.Skip()
def OnCommand(self, event): """ Catch commands and pass them along to the blocks. Our events have ids greater than wx.ID_HIGHEST Delay imports to avoid circular references. """ from osaf.framework.blocks.Block import Block
dc.SetBrush(wx.Brush(wx.Colour(180, 192, 159))) dc.SetTextForeground(self.smallFontColor)
dc.SetTextForeground(wx.WHITE)
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
dc.SetPen(wx.BLACK_PEN)
dc.SetBrush(wx.Brush(wx.Colour(128, 128, 128))) dc.SetPen(wx.Pen(wx.Colour(153, 153, 153)))
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(wx.Brush(wx.Colour(204, 204, 204))) dc.SetPen(wx.Pen(wx.Colour(179, 179, 179)))
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
if (True): dc.BeginDrawing() self.DrawBackground(dc) self.DrawCells(dc) dc.EndDrawing() else: updateRect = self.GetUpdateRegion().GetBox() point = self.CalcUnscrolledPosition((updateRect.GetLeft(), updateRect.GetTop())) wBuffer = updateRect.GetWidth() hBuffer = updateRect.GetHeight() memoryDC = wx.MemoryDC() buf...
dc.BeginDrawing() self.DrawBackground(dc) self.DrawCells(dc) dc.EndDrawing()
def DrawCanvas(self, dc):
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) def OnEraseBackground(self, event): """ Do nothing on EraseBackground events, to avoid flicker. """ pass
def __init__(self, parent, text, font, fgcolor, bgcolor): """
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
def __init__(self, parent, name): """
def OnEraseBackground(self, event): """ Do nothing on EraseBackground events, to avoid flicker. """ pass
def __init__(self, parent, name): """
"Chandler_osx_dev_debug" + buildVersionShort)
"Chandler_osx_dev_debug_" + buildVersionShort)
def distribute(buildenv): _CreateVersionFile(buildenv) buildVersionShort = \ hardhatutil.RemovePunctuation(buildenv['buildVersion']) # When the build version string is based on one of our CVS tags # (which usually begin with "CHANDLER_") let's remove the "CHANDLER_" # prefix from the string so it doesn't end up in t...
super(XMLRefDict, self)._xmlValues(generator, mode)
super(XMLRefDict, self)._xmlValues(generator, version, mode)
def _xmlValues(self, generator, version, mode):
print "compile failed", abs
print "compile failed", ae
def subscribe(self, callbackItem = None, callbackMethodName = None, inSameView = True, inOtherViews = True): """ This query should subscribe to repository changes
return self.changed(item, attribute) def changed(self, item, attribute=None):
return self.changed(item, attribute, op) def changed(self, item, attribute=None, monitorOp=None):
def monitored(self, op, item, attribute, *args, **kwds): return self.changed(item, attribute)
result = eval(self._predicate) log.debug(u"change(): %s %s %s" % (i, self._predicate, result))
if monitorOp == 'kind': result = True else: result = eval(self._predicate) log.debug(u"change(): %s %s %s" % (i, self._predicate, result))
def changed(self, item, attribute=None): """ determine whether item has entered/exited the query result set
def changed(self, item, attribute=None):
def changed(self, item, attribute=None, monitorOp=None):
def changed(self, item, attribute=None): """ determine whether item has entered/exited the query result set
return self.changed(item, attribute)
return self.changed(item, attribute, op)
def monitored(self, op, item, attribute, *args, **kwds): return self.changed(item, attribute)
retries, sslContext, heloFallback, authRequired, useSSL, useSSL)
self.log, retries, sslContext, heloFallback, authRequired, useSSL, useSSL)
def __sendInvitation(self): self.setViewCurrent()
scriptOption = '/DSNAP_%s /DDISTRIB_DIR=%s' % (buildenv['version'].upper(), fileRoot)
def makeInstaller(buildenv, directories, fileRoot): """This assumes that directory is an immediate child of the current dir""" # currently only windows is processed # TODO: added Linux (RPM) and OS X (dmg?) support if buildenv['os'] == 'win': nsisScriptPath = os.path.join(buildenv['root'], "internal", "installers", "wi...
[scriptName, nsisScriptPath, "chandler.nsi", buildenv['root'], fileRoot],
[scriptName, scriptOption, nsisScriptPath, "chandler.nsi"],
def makeInstaller(buildenv, directories, fileRoot): """This assumes that directory is an immediate child of the current dir""" # currently only windows is processed # TODO: added Linux (RPM) and OS X (dmg?) support if buildenv['os'] == 'win': nsisScriptPath = os.path.join(buildenv['root'], "internal", "installers", "wi...
[buildenv['makensis'], os.path.join(nsisScriptPath, "chandler.nsi")],
[buildenv['makensis'], scriptOption, os.path.join(nsisScriptPath, "chandler.nsi")],
def makeInstaller(buildenv, directories, fileRoot): """This assumes that directory is an immediate child of the current dir""" # currently only windows is processed # TODO: added Linux (RPM) and OS X (dmg?) support if buildenv['os'] == 'win': nsisScriptPath = os.path.join(buildenv['root'], "internal", "installers", "wi...
height = bmp.GetHeight() width = bmp.GetWidth()
def __init__(self, parent, bmp): height = bmp.GetHeight() width = bmp.GetWidth() padding = 7 # padding under and right of the progress percent text (in pixels) fontsize = 12 # font size of the progress text (in pixels) super(StartupSplash, self).__init__(parent=parent, style=wx.SIMPLE_BORDER) sizer = wx.BoxSizer...
titleText = wx.StaticText(self, -1, _(u"Experimentally Usable Calendar")) titleText.SetBackgroundColour(wx.WHITE) sizer.Add(titleText, 1, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, padding) titleText.SetFont(wx.Font(fontsize, wx.NORMAL, wx.NORMAL, wx.NORMAL))
def __init__(self, parent, bmp): height = bmp.GetHeight() width = bmp.GetWidth() padding = 7 # padding under and right of the progress percent text (in pixels) fontsize = 12 # font size of the progress text (in pixels) super(StartupSplash, self).__init__(parent=parent, style=wx.SIMPLE_BORDER) sizer = wx.BoxSizer...
sizer.Add(bitmap, 0, wx.ALL, 0)
sizer.Add(bitmap, 0, wx.ALIGN_CENTER, 0) text1 = wx.StaticText(self, -1, _(u"Chandler")) text1.SetBackgroundColour(wx.WHITE) sizer.Add(text1, 1, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, padding) text1.SetFont(wx.Font(16, wx.NORMAL, wx.NORMAL, wx.BOLD)) text2 = wx.StaticText(self, -1, _(u"Version %(version)s") % { 've...
def __init__(self, parent, bmp): height = bmp.GetHeight() width = bmp.GetWidth() padding = 7 # padding under and right of the progress percent text (in pixels) fontsize = 12 # font size of the progress text (in pixels) super(StartupSplash, self).__init__(parent=parent, style=wx.SIMPLE_BORDER) sizer = wx.BoxSizer...
self.progressText = wx.StaticText(self, -1, style=wx.ALIGN_CENTER)
self.progressText = wx.StaticText(self, -1)
def __init__(self, parent, bmp): height = bmp.GetHeight() width = bmp.GetWidth() padding = 7 # padding under and right of the progress percent text (in pixels) fontsize = 12 # font size of the progress text (in pixels) super(StartupSplash, self).__init__(parent=parent, style=wx.SIMPLE_BORDER) sizer = wx.BoxSizer...
progressSizer.Add((padding, padding), 1, wx.EXPAND) progressSizer.Add(self.progressText, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.BOTTOM, padding)
progressSizer.Add((padding, padding), 1) progressSizer.Add(self.progressText, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
def __init__(self, parent, bmp): height = bmp.GetHeight() width = bmp.GetWidth() padding = 7 # padding under and right of the progress percent text (in pixels) fontsize = 12 # font size of the progress text (in pixels) super(StartupSplash, self).__init__(parent=parent, style=wx.SIMPLE_BORDER) sizer = wx.BoxSizer...
progressSizer.Add(self.progressPercent, 1, wx.BOTTOM | wx.RIGHT, padding)
def __init__(self, parent, bmp): height = bmp.GetHeight() width = bmp.GetWidth() padding = 7 # padding under and right of the progress percent text (in pixels) fontsize = 12 # font size of the progress text (in pixels) super(StartupSplash, self).__init__(parent=parent, style=wx.SIMPLE_BORDER) sizer = wx.BoxSizer...
SyncProgress.Show(wx.GetApp().mainFrame, itsView=self.itsView)
SyncProgress.Show(wx.GetApp().mainFrame, rv=self.itsView)
def onSyncWebDAVEvent (self, event): """ Synchronize WebDAV sharing. The "File | Sync | Shares" menu item """
else: self.assert_(False, "Unstamping a stamp not present should raise an exception!")
def testStamping(self): # Make sure the contentModel is loaded. self.loadParcel("osaf.pim") # @@@ Also make sure the default imap account is loaded, in order to # have a "me" EmailAddress self.loadParcel("osaf.mail") view = self.rep.view # Get the stamp kinds mailMixin = Mail.MailMessageMixin.getKind(view) taskMixin =...
return
def testMixin(self):
primaryCollection = self.blockItem.contents.collectionList[0]
primaryCollection = self.blockItem.contentsCollection
def fixTimezone(d): if d.tzinfo is None: return d.replace(tzinfo=defaultTzinfo) else: return d.astimezone(defaultTzinfo)
primaryCollection = self.blockItem.contents.collectionList[0]
primaryCollection = self.blockItem.contentsCollection
def makeCoercedCanvasItem(self, x, y, item): primaryCollection = self.blockItem.contents.collectionList[0] collection = self.blockItem.getContainingCollection(item) canvasItem = TimedCanvasItem(collection, primaryCollection, item, self)
indent = self.GetIndentLevel() * 10 widthAdjust = self.GetMaxDepth() * 10
newWidthPercent = .80 indentPercent = 1-newWidthPercent indent = self.GetIndentLevel() * indentPercent conflicts = self.GetMaxDepth()
def UpdateForConflicts(rect): rect.width /= (maxDepth + 1) rect.x += rect.width * indentLevel
rect.width -= widthAdjust rect.x += indent
if conflicts > 0: rect.x += rect.width * indent / conflicts rect.width *= newWidthPercent
def UpdateForConflicts(rect): rect.width -= widthAdjust rect.x += indent
timedelta(minutes=30)
timedelta(hours=1)
def OnSelectNone(self, unscrolledPosition): selectedTime = self.getDateTimeFromPosition(unscrolledPosition) # only select something new if there's no existing selection, or if # we're outside of an existing selection if (not self._bgSelectionStartTime or selectedTime < self._bgSelectionStartTime or selectedTime > self...
duration = None
duration = timedelta(hours=1)
def OnCreateItem(self, unscrolledPosition): # @@@ this code might want to live somewhere else, refactored view = self.parent.blockItem.itsView event = Calendar.CalendarEvent(view=view) # if a region is selected, then use that for the event span if (self._bgSelectionStartTime): newTime = self._bgSelectionStartTime dura...
if duration and duration >= timedelta(hours=1): event.duration = duration
event.duration = duration
def OnCreateItem(self, unscrolledPosition): # @@@ this code might want to live somewhere else, refactored view = self.parent.blockItem.itsView event = Calendar.CalendarEvent(view=view) # if a region is selected, then use that for the event span if (self._bgSelectionStartTime): newTime = self._bgSelectionStartTime dura...
"TestMoveToTrash.py",
def run_tests(*tests): for filename in tests: execfile(os.path.join(functional_dir, filename))
self.sslContext = ssl.getContext(repositoryView=delegate.view, protocol="sslv3")
self.sslContext = ssl.getContext(repositoryView=delegate.view, protocol="tlsv1")
def __init__(self, delegate): """ @param delegate: A Chandler protocol class containing: 1. An account object inherited from c{Mail.AccountBase} 2. A loginClient method implementation callback 3. A catchErrors method implementation errback @type delegate: c{object}
kind1 = Item('kind1', view, kind)
kind1 = Kind('kind1', view, kind)
def testLiteralAttributes(self): view = self.rep.view """Test basic features of literal attributes""" kind = self._find('//Schema/Core/Kind') itemKind = self._find('//Schema/Core/Item') self.assert_(itemKind is not None)
Returns a DateTime object set to 0 ticks.
Returns a DateTime object with today's date and the current Operating System timezone set to 0 ticks.
def getEmptyDate(): """ Returns a DateTime object set to 0 ticks. @return: C{datetime} object """ return datetime.today().replace(hour=0, minute=0, second=0, microsecond=0)
return datetime.today().replace(hour=0, minute=0, second=0, microsecond=0)
tz = ICUtzinfo.default return datetime.now(tz).replace(hour=0, minute=0, second=0, microsecond=0)
def getEmptyDate(): """ Returns a DateTime object set to 0 ticks. @return: C{datetime} object """ return datetime.today().replace(hour=0, minute=0, second=0, microsecond=0)
line = "<p>Build identifier: '%s'</p>" % version.build
line = "<p>Version: %s (rev %s build %s)</p>" % \ (version.release, version.buildRevision, version.build)
def onAboutEvent(self, event): # The "Help | About Chandler..." menu item """ Show the splash screen in response to the about command """ import version html = '' for line in i18n.getHTML('welcome.html'): if line.find('@@buildid@@') >= 0: line = "<p>Build identifier: '%s'</p>" % version.build html += line splash = Spla...
if self._status & Item.NODIRTY: return getattr(self, name).itemChanged(item, attribute)
if not (item.isDeleting() or self._isNoDirty()): getattr(self, name).itemChanged(item, attribute)
def _filteredItemChanged(self, op, item, attribute, name):
setattr(kindVar, attr, ea)
if ea is not None: setattr(kindVar, attr, ea) elif __debug__: logging.error("in osaf.mail.message.__assignToKind: invalid email address found")
def __assignToKind(kindVar, messageObject, key, type, attr = None): if type == "String": if messageObject[key] is not None: setattr(kindVar, attr, messageObject[key]) # XXX: This logic will need to be expanded elif type == "StringList": if messageObject[key] is not None: kindVar.append(messageObject[key]) elif type ...
kindVar.append(ea)
if ea is not None: kindVar.append(ea) elif __debug__: logging.error("in osaf.mail.message.__assignToKind: invalid email address found")
def __assignToKind(kindVar, messageObject, key, type, attr = None): if type == "String": if messageObject[key] is not None: setattr(kindVar, attr, messageObject[key]) # XXX: This logic will need to be expanded elif type == "StringList": if messageObject[key] is not None: kindVar.append(messageObject[key]) elif type ...
from twisted.internet import reactor
def invokeTarget(self, target): """ Run a target in the reactor thread w/a new repository view """ run_reactor() from twisted.internet import reactor reactor.callFromThread(target, fork_item(self))
global reactor from twisted.internet import reactor if item.run_at_startup: self.run_once() else: self.reschedule()
def __init__(self, item): self._cache[item.itsUUID] = self self.subject = item.getTarget()(item) self.interval = item.interval self.runlock = threading.Lock()
self.invokeTarget(lambda self: self.startRunning()) def startRunning(self): """ Set up for running and repeating the task """ TaskRunner(self)
run_at_startup = self.run_at_startup def start_running(runner): if run_at_startup: runner.run_once() else: runner.reschedule() run_reactor() reactor.callFromThread( lambda: start_running(TaskRunner(fork_item(self))) )
def onStart(self): """ Start our wrapper in the reactor thread """ self.invokeTarget(lambda self: self.startRunning())
reactor.callFromThread(self._get_runner().run_once)
self._with_runner(lambda r: r.run_once())
def run_once(self): """Request to run the task once, immediately""" reactor.callFromThread(self._get_runner().run_once)
reactor.callFromThread(self._get_runner().stop)
self._with_runner(lambda r: r.stop())
def stop(self): """Stop running the task until/unless reschedule() is called""" reactor.callFromThread(self._get_runner().stop)
reactor.callFromThread(self._get_runner().reschedule, interval) def _get_runner(self): return TaskRunner._cache[self.itsUUID]
self._with_runner(lambda r: r.reschedule(interval)) def _with_runner(self, f): uuid = self.itsUUID def callback(): try: runner = TaskRunner._cache[uuid] except KeyError: runner = TaskRunner(fork_item(self)) f(runner) reactor.callFromThread(callback)
def reschedule(self, interval=None): """Reschedule the next occurrence of the task""" if interval is None: interval = self.interval else: self.interval = interval reactor.callFromThread(self._get_runner().reschedule, interval)
global reactor
def run_reactor(in_thread=True): """ Safely run the Twisted reactor """ global _reactor_thread from osaf.framework.twisted import TwistedThreadPool # initializes threads from twisted.python import threadpool threadpool.ThreadPool = TwistedThreadPool.RepositoryThreadPool from twisted.internet import reactor if not ...
'>',
'>=',
def drawCanvasItems(canvasItems, selected): for canvasItem in canvasItems: pastEnd = Calendar.datetimeOp(canvasItem.GetItem().endTime, '>', self.blockItem.rangeEnd) canvasItem.Draw(dc, styles, brushOffset, selected, rightSideCutOff=pastEnd)
if Calendar.datetimeOp(item.endTime, '>', endDateTime):
if Calendar.datetimeOp(item.endTime, '>=', endDateTime):
def GetColumnRange(item, (startDateTime, endDateTime)): # get first and last column of its span if Calendar.datetimeOp(item.startTime, '<', startDateTime): dayStart = 0 else: dayStart = wxAllDayEventsCanvas.DayOfWeekNumber(item.startTime)
Monitors.attach(self, 'onColorChanged', 'set', 'color') def render(self, *args, **kwds): super(CalendarBlock, self).render(*args, **kwds) Monitors.attach(self, 'onColorChanged', 'set', 'color') def unRender(self, *args, **kwds): Monitors.detach(self, 'onColorChanged', 'set', 'color') super(CalendarBlock, self).unRend...
def __init__(self, *arguments, **keywords): super(CalendarBlock, self).__init__(*arguments, **keywords)
monthText = u"%s %d" %(months[selectedDate.month - 1],
monthText = _("%s %d") %(months[selectedDate.month - 1],
def wxSynchronizeWidget(self): selectedDate = self.blockItem.selectedDate startDate = self.blockItem.rangeStart
monthText = u"%s - %s %d" %(months[startDate.month - 1],
monthText = _("%s - %s %d") %(months[startDate.month - 1],
def wxSynchronizeWidget(self): selectedDate = self.blockItem.selectedDate startDate = self.blockItem.rangeStart
except Exception, e:
except:
def realMain(): Utility.initProfileDir(Globals.options) Globals.chandlerDirectory = Utility.locateChandlerDirectory() os.chdir(Globals.chandlerDirectory) Utility.initLogging(Globals.options) Utility.initI18n(Globals.options)
from i18n import OSAFMessageFactory as _
frames = 8 try: from i18n import OSAFMessageFactory as _ line1 = _(u"Chandler encountered an unexpected problem while trying to start.\n") line2 = _(u"Here are the bottom %(frames)s frames of the stack:\n") % {'frames': frames - 1} line3 = _(u"The clipboard contains the stack trace.\n") except: line1 = u"Chandler e...
def realMain(): Utility.initProfileDir(Globals.options) Globals.chandlerDirectory = Utility.locateChandlerDirectory() os.chdir(Globals.chandlerDirectory) Utility.initLogging(Globals.options) Utility.initI18n(Globals.options)