rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
(itemPath, item.getItemDisplayName().encode('utf8'), item, data))
(itemPath, item.getItemDisplayName().encode('ascii', 'replace'), item, data))
def _conditionalGetItem(self, itemPath, into=None): """ Get an item from the server if we don't yet have it or our copy is out of date """
if not isinstance(v, (list,tuple)):
if not isinstance(group, (list,tuple)):
def __init__(self,*byValue,**groups): self.endpoints = [AttributeAsEndpoint(ep,'byValue') for ep in byValue] for policy,group in groups.items(): if not isinstance(v, (list,tuple)): raise TypeError("Endpoint groups must be lists or tuples") self.endpoints.extend( [AttributeAsEndpoint(ep,policy) for ep in group] )
return ((date > begin) and (date < end))
return ((date >= begin) and (date < end))
def isDateInRange(self, date): """ Returns true if the given date appears on the calendar """ begin = self.rangeStart end = begin + self.rangeIncrement return ((date > begin) and (date < end))
if ((item.startTime > date) and (item.startTime < nextDate)):
if ((item.startTime >= date) and (item.startTime < nextDate)):
def getItemsByDate(self, date): # make this a generator? items = [] nextDate = date + DateTime.RelativeDateTime(days=1) for item in self.contents: if ((item.startTime > date) and (item.startTime < nextDate)): items.append(item) return items
def onAddScriptsToSidebarEventUpdateUI(self, event):
def onAddSharingLogToSidebarEventUpdateUI(self, event):
def onAddScriptsToSidebarEventUpdateUI(self, event): sidebar = Block.findBlockByName ("Sidebar").contents log = schema.ns('osaf.sharing', self.itsView).activityLog if log in sidebar: menuTitle = u'Show Sharing Activity' else: menuTitle = u'Add sharing activity log to Sidebar' event.arguments ['Text'] = menuTitle event....
timeString = time.Format('%I:%M %p').lower()
hour = str(int(time.Format('%I'))) timeString = hour + time.Format(':%M %p').lower()
def Draw(self, dc, boundingRect, brushContainer): item = self._item
if (full_name.rfind(chandler_debug) < 0) and \ (full_name.rfind(chandler_release) < 0): recursiveTest(buildenv, full_name)
def recursiveTest(buildenv, path): path = os.path.abspath(path) os.chdir(path) testFiles = glob.glob('Test*.py') for testFile in testFiles: fullTestFilePath = os.path.join(path, testFile) runTest(buildenv, testFile, fullTestFilePath) chandler_debug = os.sep + 'chandler' + os.sep + 'debug' chandler_release = os.sep +...
myKindPath = "//parcels/osaf/examples/zaobao/RSSChannel"
myKindPath = "//parcels/osaf/examples/zaobao/schema/RSSChannel"
def NewChannelFromURL(view, url, update = True): data = feedparser.parse(url) if data['channel'] == {} or data['status'] == 404: return None channel = RSSChannel(view=view) channel.url = url if update: try: channel.Update(data) except: channel.delete() raise return channel
myKindPath = "//parcels/osaf/examples/zaobao/RSSItem"
myKindPath = "//parcels/osaf/examples/zaobao/schema/RSSItem"
def _DoItems(self, items): # make children # lets look for each existing item. This is ugly and is an O(n^2) problem # if the items are unsorted. Bleah. view = self.itsView if len(items) == 0: return for newItem in items: found = False for oldItem in self.items: # check to see if this doesn't already exist if oldItem...
def DestroyControl (self, control): """ Notification that the control is about to be destroyed. """ pass
def DestroyControl (self, control): """ Notification that the control is about to be destroyed. """ pass
del self.focusedSince
if hasattr(self, 'focusedSince'): del self.focusedSince
def OnKillFocus(self, event): del self.focusedSince
enable = item.itsKind.isKindOf(ContentModel.getNoteKind())
enable = item.itsKind.isKindOf(ContentModel.ContentModel.getNoteKind())
def onButtonPressedUpdateUI (self, notification): item = self.selectedItem() # DLDTBD - fix the line below to False when the block copy problem is fixed. enable = True if item is not None: enable = item.itsKind.isKindOf(ContentModel.getNoteKind()) notification.data ['Enable'] = enable
if False: try: isMultiLine = self.presentationStyle.lineStyleEnum == "MultiLine" except AttributeError: isMultiLine = False if not isMultiLine: self.widget.Navigate()
try: isMultiLine = self.presentationStyle.lineStyleEnum == "MultiLine" except AttributeError: isMultiLine = False if not isMultiLine: self.widget.Navigate()
def onKeyUpFromWidget(self, event): if event.m_keyCode == wx.WXK_RETURN: self.saveValue() # Do the tab thing if we're not a multiline thing # @@@ Actually, don't; it doesn't mix well when one of the fields you'd # "enter" through is multiline - it clears the content. if False: try: isMultiLine = self.presentationStyle...
newStartTime = self.GetDragAdjustedTime() newEndTime = newStartTime + canvasItem.GetItem().duration
resizeMode = self.dragState.originalDragBox.resizeMode if (resizeMode is None or resizeMode == canvasItem.RESIZE_MODE_START): newStartTime = self.GetDragAdjustedTime() newEndTime = newStartTime + canvasItem.GetItem().duration elif resizeMode == canvasItem.RESIZE_MODE_END: newEndTime = \ self.getDateTimeFromPosition(se...
def RebuildCanvasItems(self): self.canvasItemList = []
resizeMode = self.GetResizeMode()
resizeMode = self.dragState.originalDragBox.resizeMode
def OnResizingItem(self, unscrolledPosition): newTime = self.getDateTimeFromPosition(unscrolledPosition) item = self.dragState.currentDragBox.GetItem() resizeMode = self.GetResizeMode() delta = timedelta(minutes=15) tzinfo = item.startTime.tzinfo if tzinfo is None or newTime.tzinfo is None: newTime = newTime.replace(t...
def GetResizeMode(self): """ Helper method for drags """ return self.dragState.originalDragBox.resizeMode
def GetDragAdjustedTime(self, position=None): """ When a drag is originated within a canvasItem, the drag originates from a point within the canvasItem, represented by dragOffset
rgb = wx.Image.HSVtoRGB (wx.Image_RGBValue (self.hue, 0.5, 1.0))
rgb = wx.Image.HSVtoRGB (wx.Image_HSVValue (self.hue, 0.5, 1.0))
def __init__(self, collection): color = getattr (collection, 'color', None) if color is not None: rgb = wx.Image_RGBValue (color.red, color.green, color.blue) self.hue = wx.Image.RGBtoHSV (rgb).hue else: self.hue = ColorInfo.getNextHue() try: dn = collection.displayName except: dn = str(collection)
doit()
doit(item)
def doit(item): stampClass(item).add()
def onSetContentsEvent(self, event): pass
def onSelectItemEvent(self, event): self.widget.wxSynchronizeWidget() #self.widget.Refresh()
val = control.GetClientData(index)
if index == -1: val = None else: val = control.GetClientData(index)
def __StoreFormData(self, panelType, panel, data): for field in PANELS[panelType]['fields'].keys(): control = wx.xrc.XRCCTRL(panel, field) fieldInfo = PANELS[panelType]['fields'][field] valueType = fieldInfo['type'] valueRequired = fieldInfo.get('required', False) if valueType == "string": val = control.GetValue().stri...
u'sharedURL', u'sharedUUID']:
u'sharedURL', u'sharedUUID', u'collectionOwner']:
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...
item = Globals.mainViewRoot.postEventByName('NewCalendar',{})[0]
item = App_ns.root.NewCalendar()[0]
def __init__(self, type, logger): if not type in ["Event", "Note", "Task", "MailMessage", "Collection"]: # "Copy constructor" if isinstance(type,pim.calendar.CalendarEvent): self.isNote = self.isTask = self.isMessage = self.isCollection = self.allDay = self.recurring = False self.isEvent = True self.view = App_ns.itsVi...
item = Globals.mainViewRoot.postEventByName('NewNote',{})[0]
item = App_ns.root.NewNote()[0]
def __init__(self, type, logger): if not type in ["Event", "Note", "Task", "MailMessage", "Collection"]: # "Copy constructor" if isinstance(type,pim.calendar.CalendarEvent): self.isNote = self.isTask = self.isMessage = self.isCollection = self.allDay = self.recurring = False self.isEvent = True self.view = App_ns.itsVi...
item = Globals.mainViewRoot.postEventByName('NewTask',{})[0]
item = App_ns.root.NewTask()[0]
def __init__(self, type, logger): if not type in ["Event", "Note", "Task", "MailMessage", "Collection"]: # "Copy constructor" if isinstance(type,pim.calendar.CalendarEvent): self.isNote = self.isTask = self.isMessage = self.isCollection = self.allDay = self.recurring = False self.isEvent = True self.view = App_ns.itsVi...
item = Globals.mainViewRoot.postEventByName('NewMailMessage',{})[0]
item = App_ns.root.NewMailMessage()[0]
def __init__(self, type, logger): if not type in ["Event", "Note", "Task", "MailMessage", "Collection"]: # "Copy constructor" if isinstance(type,pim.calendar.CalendarEvent): self.isNote = self.isTask = self.isMessage = self.isCollection = self.allDay = self.recurring = False self.isEvent = True self.view = App_ns.itsVi...
item = Globals.mainViewRoot.postEventByName('NewItemCollection',{})[0]
item = App_ns.root.NewCollection()[0]
def __init__(self, type, logger): if not type in ["Event", "Note", "Task", "MailMessage", "Collection"]: # "Copy constructor" if isinstance(type,pim.calendar.CalendarEvent): self.isNote = self.isTask = self.isMessage = self.isCollection = self.allDay = self.recurring = False self.isEvent = True self.view = App_ns.itsVi...
scripting.User.emulate_sidebarClick(App_ns.sidebar, self.item.displayName) scripting.User.emulate_sidebarClick(App_ns.sidebar, self.item.displayName, double=True) scripting.User.emulate_typing(displayName) scripting.User.emulate_sidebarClick(App_ns.sidebar, "All")
if '__WXMAC__' in wx.PlatformInfo: self.item.displayName = displayName else: scripting.User.emulate_sidebarClick(App_ns.sidebar, self.item.displayName) scripting.User.emulate_sidebarClick(App_ns.sidebar, self.item.displayName, double=True) scripting.User.emulate_typing(displayName) scripting.User.emulate_sidebarC...
def SetDisplayName(self, displayName, dict=None): """ Set the title @type displayName : string @param displayName : the new title @type dict : dictionnary @param dict : optional dictionnary with expected item attributes values for automated checking """ if (self.isNote or self.isEvent or self.isTask or self.isMessage):...
col = App_ns.item_named(Collection.ListCollection, collectionName)
col = App_ns.item_named(pim.AbstractCollection, collectionName)
def SetCollection(self, collectionName): """ Put the item in the given collection @type collectionName : string @param collectionName : the name of a collection """ if (self.isNote or self.isEvent or self.isTask or self.isMessage): col = App_ns.item_named(Collection.ListCollection, collectionName) self.logger.Start("Gi...
if not scripting.User.emulate_sidebarClick(App_ns.sidebar, dict[field]):
if not GetCollectionRow(dict[field]):
def Check_Sidebar(self, dict): """ Check expected values by comparison to the data displayed in the sidebar @type dict : dictionnary @param dict : dictionnary with expected item attributes values for checking {"attributeName":"expected value",...} """ if self.isCollection: self.logger.SetChecked(True) # check the chang...
if __debug__: self.printCurrentView("catchErrors")
def catchErrors(self, err): """ This method captures all errors thrown while in the Twisted Reactor Thread. @return: C{None} """ if __debug__: self.printCurrentView("catchErrors")
self.proto.transport.loseConnection()
if self.proto is not None: self.proto.transport.loseConnection()
def __disconnect(self, result=None):
if 'test' in self._localeSet and not "Ctrl+" in defaultText:
if 'test' in self._localeSet and not "Ctrl+" in defaultText and not "DELETE" == defaultText:
def translate(self, domain, defaultText): assert isinstance(domain, StringType) assert isinstance(defaultText, UnicodeType)
elif value is Nil and newValue is Nil: continue
def _applyChanges(self, view, flag, dirties, ask, newChanges, changes, dangling):
if value is Nil: raise AssertionError, ("merging %s.%s" %(self._item._repr_(), name), value) item = view[newValue] if ask(MergeError.REF, name, item) is item: self._setRef(name, newValue) self._setDirty(name) if value is not None: _item = self._item kind = _item.itsKind otherName = kind.getOtherName(name, _item)
if ask(MergeError.REF, name, newValue) is newValue: if value not in (Nil, None): item = self._item kind = item.itsKind otherName = kind.getOtherName(name, item)
def _applyChanges(self, view, flag, dirties, ask, newChanges, changes, dangling):
_item.itsUUID))
item.itsUUID))
def _applyChanges(self, view, flag, dirties, ask, newChanges, changes, dangling):
view._e_2_overlap(MergeError.REF, item, name)
view._e_2_overlap(MergeError.REF, newValue, name)
def _applyChanges(self, view, flag, dirties, ask, newChanges, changes, dangling):
os.chdir("win")
def build(buildenv): os.chdir("distrib") os.chdir("win") if buildenv['os'] == 'posix' or buildenv['os'] == 'osx': if buildenv['version'] == 'release': hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Copying RunRelease to release") hardhatlib.copyFile("RunRelease", buildenv['root'] + \ os.sep + "re...
change = dict(method=self.propagateAddToCollection, args=(collection,), question = _(u'"%(displayName)s" is a recurring event. What do you want to add to the collection:'), disabled_buttons=('future', 'this')) self.delayChange(change)
trash = schema.ns('osaf.app', self.proxiedItem.itsView).TrashCollection if collection == trash: self.removeFromCollection(collection) else: change = dict(method=self.propagateAddToCollection, args=(collection,), question = _(u'"%(displayName)s" is a recurring event. What do you want to add to the collection:'), disable...
def addToCollection(self, collection): """ Add self to the given collection, or queue the add. """ if self.proxiedItem.rruleset is None: collection.add(self.proxiedItem.getMaster()) else: change = dict(method=self.propagateAddToCollection, args=(collection,), question = _(u'"%(displayName)s" is a recurring event. What ...
'all' : lambda: collection.remove( self.proxiedItem.getMaster())
'all' : lambda: self.trashAddOrDelete(collection)
def propagateDelete(self, collection): table = {'this' : self.proxiedItem.deleteThis, 'thisandfuture' : self.proxiedItem.deleteThisAndFuture, 'all' : lambda: collection.remove( self.proxiedItem.getMaster()) } table[self.currentlyModifying]()
__doc__ = "Item %s has changed, cannot be unloaded" def __str__(self): return self.getItem().itsPath
__doc__ = "Item is dirty, cannot be unloaded" def __str__(self): return self.getItem()._repr_()
def __str__(self): return self.getItem()._repr_()
def install(parent, name=None):
def install(self, parent, name=None):
def install(parent, name=None): if name is None: name=self.itsName
for childAttribute in self.childAttributeName:
for childAttribute in self.childAttributeNames:
def install(parent, name=None): if name is None: name=self.itsName
for server in webserver.Server.iterItems(itsView=self.itsView):
for server in webserver.Server.iterItems(self.itsView):
def onActivateWebserverEventUpdateUI (self, event): for server in webserver.Server.iterItems(itsView=self.itsView): if server.isActivated(): event.arguments['Enable'] = False return event.arguments['Enable'] = True
for server in webserver.Server.iterItems(itsView=self.itsView):
for server in webserver.Server.iterItems(self.itsView):
def onActivateWebserverEvent(self, event): # Test menu item for server in webserver.Server.iterItems(itsView=self.itsView): server.startup()
try: payload = mailMessage.body.encode('utf8') except AttributeError: payload = ""
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{Message.Message} """ assert isinstance(mailMessage, Mail.Mai...
messageObject.set_payload(payload)
messageObject.set_payload(mailMessage.body.encode('utf-8'))
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{Message.Message} """ assert isinstance(mailMessage, Mail.Mai...
if len(location) > 0: location = _(u"\n%(locationLabel)s: %(locationValue)s") \ % { 'locationLabel': _(u"Where"), 'locationValue': location } eventDescription = _(u"%(whenLabel)s: %(whenValue)s%(locationPair)s\n\n") \ % { 'whenLabel': _(u"When"), 'whenValue': timeDescription, 'locationPair': location } payload = _(u"%(...
if len(location.strip()) > 0: evtDesc = _(u"When: %(whenValue)s\nWhere: %(locationValue)s") \ % { 'whenValue': timeDescription, 'locationValue': location } else: evtDesc = _(u"When: %(whenValue)s") \ % { 'whenValue': timeDescription } payload = _(u"%(eventDescription)s\n\n%(bodyText)s\n") \ % {'eventDescription': ev...
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{Message.Message} """ assert isinstance(mailMessage, Mail.Mai...
messageObject.attach(MIMEText(payload))
messageObject.attach(MIMEText(payload.encode('utf-8'), _charset='utf-8'))
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{Message.Message} """ assert isinstance(mailMessage, Mail.Mai...
unicode(len(eventDescription)))
str(len(evtDesc)))
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{Message.Message} """ assert isinstance(mailMessage, Mail.Mai...
if self.blockItem.selectedItemToView is None and firstSelectedRow is not None:
if (self.blockItem.selectedItemToView not in self.blockItem.contents and firstSelectedRow is not None):
def wxSynchronizeWidget(self): """ A Grid can't easily redisplay its contents, so we write the following helper function to readjust everything after the contents change """ #Trim/extend the control's rows and update all values
assert isinstance (item, ItemCollection) self.contents = item
if isinstance (item, ItemCollection): self.contents = item
def onSetContentsEvent (self, event): item = event.arguments ['item'] assert isinstance (item, ItemCollection) self.contents = item
return hasattr(ob,'_find_schema_item') or ob in (Base,Kind)
fsi = getattr(ob,'_find_schema_item',None) if fsi: return fsi.im_self is not None return ob is Base or ob is Kind
def _is_schema(ob): return hasattr(ob,'_find_schema_item') or ob in (Base,Kind)
__kind_info__ = {'annotates':None}
__kind_info__ = {'annotates':Item}
def targetType(cls): try: return cls.__kind_info__['annotates'] except KeyError: raise TypeError( "Annotation must use schema.kindInfo(annotates=[classes])" )
values = ()
def fixup(): enum.itsParent = parcel_for_module(cls.__module__, view) enum.itsName = cls.__name__
for it in module.__dict__.values(): if hasattr(it,'_find_schema_item'): itemFor(it,view)
synchronize(view, self.moduleName)
def _init_schema_item(self,item,view): from application.Parcel import Parcel item.itsParent = self.getParent(view) item.itsName = self.name item.itsKind = itemFor(Parcel, view) module = importString(self.moduleName) if hasattr(module,'installParcel'): # make sure that the schema for the module is fully created for it i...
if hasattr(item,'_find_schema_item'):
if _is_schema(item):
def synchronize(repoView,moduleName): """Ensure that the named module's schema is incorporated into `repoView`""" module = importString(moduleName) # Create the parcel first parcel_for_module(moduleName,repoView) for item in module.__dict__.values(): if hasattr(item,'_find_schema_item'): # Import each kind/struct/enu...
'--profileDir=%s' % logDir,
'--profileDir=%s' % profileDir,
def doFunctionalTests(releaseMode, workingDir, log): chandlerDir = os.path.join(workingDir, 'chandler') logDir = os.path.join(chandlerDir, 'test_profile') chandlerLog = os.path.join(logDir, 'chandler.log') FuncTestLog = os.path.join(logDir, 'FunctionalTestSuite.log') if buildenv['os'] == 'win': runChan...
'--create', '--profileDir=%s' % logDir, '--scriptFile=%s' % testFile]
'--create', '--profileDir=%s' % profileDir, '--scriptFile=%s' % testFile]
def doPerformanceTests(hardhatScript, mode, workingDir, outputDir, buildVersion, log): chandlerDir = os.path.join(workingDir, "chandler") testDir = os.path.join(chandlerDir, 'tools', 'QATestScripts', 'Performance') logDir = os.path.join(chandlerDir, 'test_profile') chandlerLog = os.path.join(logDir, 'chan...
date = value if self.IsDateInRange(date): self.ChangeDay(date)
if self.IsDateInRange(value): self.ChangeDay(value)
def OnClick(self, event): (region, value) = self.HitTest(event.GetPosition())
date = value self.SetDateAndNotify(date)
self.SetDateAndNotify(value) self.SetVisibleDateAndNotify(value, True)
def OnClick(self, event): (region, value) = self.HitTest(event.GetPosition())
date = value self.SetVisibleDateAndNotify(date, False)
self.SetVisibleDateAndNotify(value, False)
def OnClick(self, event): (region, value) = self.HitTest(event.GetPosition())
date = value self.SetVisibleDate(date, True)
self.SetVisibleDate(value, True)
def OnClick(self, event): (region, value) = self.HitTest(event.GetPosition())
return "init_failed"
CopyLog(os.path.join(releaseModeDir, logPath), log) if releaseMode == "debug": continue else return "init_failed"
def Start(hardhatScript, workingDir, cvsVintage, buildVersion, clobber, log): # make sure workingDir is absolute, remove it, and create it workingDir = os.path.abspath(workingDir) if not os.path.exists(workingDir): os.mkdir(workingDir) os.chdir(workingDir) # remove outputDir and create it outputDir = os.path.join(wor...
if not hold: receiver = weak_receiver( receiver, lambda ref:cls._unsubscribe(sender_id,receiver)
if hold: rcv = receiver else: rcv = weak_receiver( receiver, lambda ref:cls._unsubscribe(sender_id,rcv)
def subscribe(cls,sender,receiver,hold=False): """Call `receiver` with events of this type from `sender`
cls._receivers[sender_id].add(receiver)
cls._receivers[sender_id].add(rcv)
def subscribe(cls,sender,receiver,hold=False): """Call `receiver` with events of this type from `sender`
cls._receivers.setdefault(ws,set()).add(receiver)
cls._receivers.setdefault(ws,set()).add(rcv)
def subscribe(cls,sender,receiver,hold=False): """Call `receiver` with events of this type from `sender`
def unsubscribe(cls,sender,receiver=None):
def unsubscribe(cls,sender,receiver):
def unsubscribe(cls,sender,receiver=None): """Stop sending events of this type from `sender` to `receiver`""" cls._unsubscribe(id(sender),receiver)
if __name__ == "__main__": unittest.main()
tzinfo = schema.One( schema.TimeZone, displayName = 'Time Zone', )
def suite(): """Unit test suite; run by testing 'parcels.osaf.framework.sharing.tests.suite'""" from run_tests import ScanningLoader from unittest import defaultTestLoader, TestSuite loader = ScanningLoader() return TestSuite( [loader.loadTestsFromName(__name__+'.'+test_name) for test_name in [ 'TimeZoneTestCase', 'Def...
if self.anyTime:
if self.allDay: fmt = (sameDate and _(u'%(startDay)s, %(startDate)s all day%(recurrenceSeparator)s%(recurrence)s') or _(u'%(startDate)s - %(endDate)s all day%(recurrenceSeparator)s%(recurrence)s')) elif self.anyTime:
def getTimeDescription(self): """ Get a description of the time components of this event; it'll be used in the static presentation in the detail view, and maybe in our initial cut at invitations. """ if self.duration == timedelta(0): # @time fmt = _(u'%(startDay)s, %(startDate)s at %(startTimeTz)s%(recurrenceSeparator)...
elif self.allDay: fmt = (sameDate and _(u'%(startDay)s, %(startDate)s all day%(recurrenceSeparator)s%(recurrence)s') or _(u'%(startDate)s - %(endDate)s all day%(recurrenceSeparator)s%(recurrence)s'))
def getTimeDescription(self): """ Get a description of the time components of this event; it'll be used in the static presentation in the detail view, and maybe in our initial cut at invitations. """ if self.duration == timedelta(0): # @time fmt = _(u'%(startDay)s, %(startDate)s at %(startTimeTz)s%(recurrenceSeparator)...
normal = Calendar.eventsInRange(view, start, end) recurring = Calendar.recurringEventsInRange(view, start, end)
all = schema.ns("osaf.pim", view).allCollection normal = Calendar.eventsInRange(view, start, end, all) recurring = Calendar.recurringEventsInRange(view, start, end, all)
def itemsToFreeBusy(view, start, end, calname = None): """ Create FREEBUSY components corresponding to all events between start and end. """ # eventsInRange defaults to all events, which is what we want normal = Calendar.eventsInRange(view, start, end) recurring = Calendar.recurringEventsInRange(view, start, end) e...
trash = schema.ns("osaf.pim", view).trashCollection
def itemsToFreeBusy(view, start, end, calname = None): """ Create FREEBUSY components corresponding to all events between start and end. """ # eventsInRange defaults to all events, which is what we want normal = Calendar.eventsInRange(view, start, end) recurring = Calendar.recurringEventsInRange(view, start, end) e...
event in trash or
def addFB(event): free = vfree.add('freebusy') free.fbtype_param = transparencyMap[event.transparency] return free
canvasItem.resizeMode = None
def makeCoercedCanvasItem(self, x, y, item): primaryCollection = self.blockItem.contentsCollection collection = self.blockItem.getContainingCollection(item, primaryCollection) canvasItem = TimedCanvasItem(collection, primaryCollection, item, self) unscrolledPosition = wx.Point(*self.CalcUnscrolledPosition(x, y)) start...
hasLeftRounded = ((isAnyTime and not isAllDay) or not duration)
hasLeftRounded = ((isAnyTime or not duration) and not isAllDay)
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item # recurring items, when deleted or stamped non-Calendar, are sometimes # passed to Draw before wxSynchronize is called, ignore those items if item.isDeleted() or not item.itsKind.isKindOf(Ca...
if buildenv['version'] == "debug": modeDot = "." + buildenv['version'] + "." mode = "_debug" else: modeDot = "." mode = "" platform = buildenv['oslabel'] distName = 'Chandler_' + platform + mode + '_' + buildVersionShort if platform == 'osx': distDirParent = buildenv['root'] + os.sep + distName distDir = distDi...
if buildenv['version'] == 'debug': if buildenv['os'] == 'osx': distName = 'Chandler_osx_debug_' + buildVersionShort distDirParent = buildenv['root'] + os.sep + distName distDir = distDirParent + os.sep + distName + ".app" buildenv['distdir'] = distDir if os.access(distDirParent, os.F_OK): hardhatlib.rmdir_recurs...
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...
arguments = {'wxEvent':event}
arguments = {}
def OnCommand(self, event): """ Catch commands and pass them along to the blocks. Our events have ids between MINIMUM_WX_ID and MAXIMUM_WX_ID Delay imports to avoid circular references. """ from osaf.framework.blocks.Block import Block, BlockEvent
c_diff = previous - avg
c_diff = avg - previous
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, previousTargets): line = '<tr><td><a href="detail_%s.html#%s" target="_new">%s</a></td>' % (enddate, testkey, testDisplayName) graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] else: targetAv...
if ((previous - variance) < avg) and (avg < (previous + variance)): s = 'ok' else: if c_perc < 0.0: if abs(c_perc) > self._options['p_alert']: s = 'alert' else: s = 'warn' else: if c_perc > 10.0: s = 'good' else: s = 'ok'
s = colorDelta(avg, previous, variance) timeClass = self.colorTime(testkey, avg, variance)
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, previousTargets): line = '<tr><td><a href="detail_%s.html#%s" target="_new">%s</a></td>' % (enddate, testkey, testDisplayName) graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] else: targetAv...
line += '<td class="number">%2.2fs</td>' % avg
line += '<td class="number"><span class="%s">%2.2fs</span></td>' % (timeClass, avg)
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, previousTargets): line = '<tr><td><a href="detail_%s.html#%s" target="_new">%s</a></td>' % (enddate, testkey, testDisplayName) graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] else: targetAv...
percent = int(self.workDone * 100 / self.totalWork)
try: percent = int(self.workDone * 100 / self.totalWork) except ZeroDivisionError: percent = 100
def callback(self, msg=None, work=None, totalWork=None):
nearFutureSeconds=6
nearFutureSeconds=2
def getstack(): stack = traceback.extract_stack(limit=5)[:-2] return "".join(traceback.format_list(stack))
logger.critical("Sleeping %d seconds", nearFutureSeconds) time.sleep(nearFutureSeconds) repoView.dispatchNotifications() scripting.User.idle()
while True: sleepDelta = (nearFuture + timedelta(1)) \ - datetime.now(tz=ICUtzinfo.default) sleepDeltaSeconds = (sleepDelta.days * 86400) + sleepDelta.seconds if sleepDeltaSeconds < 0: break sleepDeltaSeconds = sleepDeltaSeconds >= 1 and sleepDeltaSeconds or 1 logger.critical("Sleeping %d seconds", sleepDeltaSeconds) ...
def startTest(self): view = QAUITestAppLib.UITestView(self.logger) view.SwitchToAllView() repoView = self.app_ns.itsView
checkedbitmap = \ app.GetImage(self.blockItem.icon + "Checked.png") if not checkedbitmap:
if '__WXMAC__' in wx.PlatformInfo:
def OnInit(self): if hasattr(self.blockItem, 'icon'): app = wx.GetApp() uncheckedbitmap = \ app.GetImage(self.blockItem.icon + ".png") if uncheckedbitmap: checkedbitmap = \ app.GetImage(self.blockItem.icon + "Checked.png") if not checkedbitmap: checkedbitmap = uncheckedbitmap self.SetBitmaps(checkedbitmap, uncheckedbit...
widget = menuItem.widget
def synchronizeItems(self): """ Install the menus into supplied menu list, and submenus into their menu items. Used for both Menus and MenuBars. """ menuList = self.widget.getMenuItems () # keep track of menus here
if '__WXMSW__' in wx.PlatformInfo: if wx.GetApp().GetComCtl32Version() >= 600 and wx.DisplayDepth() >= 32: value = 2 else: value = 0 wx.SystemOptions.SetOptionInt ("msw.remap", value)
def __init__(self, *arguments, **keywords): super (MainFrame, self).__init__(*arguments, **keywords)
if '__WXMSW__' in wx.PlatformInfo: wx.SystemOptions.SetOptionInt( "msw.remap", 0 )
def OnAppActivate(self, event): if event.GetActive() and self.IsIconized(): self.Iconize(False)
root = ''
root = self.root if root is None or WXPREFIX.startswith(root): root = ''
def run(self): if os.name == 'nt': return headers = self.distribution.headers if not headers: return
def makeLabel(parcel, label=u'', borderTop=5, border=None):
def makeLabel(parcel, label=u'', borderTop=5, border=None, width=60):
def makeLabel(parcel, label=u'', borderTop=5, border=None): """ Make a StaticText label template for use in the detail view. Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel. @param parcel: The parcel that the lab...
minimumSize=SizeType(60, -1),
minimumSize=SizeType(width, -1),
def makeLabel(parcel, label=u'', borderTop=5, border=None): """ Make a StaticText label template for use in the detail view. Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel. @param parcel: The parcel that the lab...
def compressDirectory(buildenv, directory, fileRoot):
def compressDirectory(buildenv, directories, fileRoot):
def compressDirectory(buildenv, directory, fileRoot): """This assumes that directory is an immediate child of the current dir""" if buildenv['os'] == 'win': executeCommand(buildenv, "HardHat", [buildenv['zip'], "-r", fileRoot + ".zip", directory], "Zipping up " + os.path.abspath(directory) + " to " + fileRoot + ".zip")...
[buildenv['zip'], "-r", fileRoot + ".zip", directory], "Zipping up " + os.path.abspath(directory) + " to " + fileRoot + ".zip")
[buildenv['zip'], "-r", fileRoot + ".zip"] + directories, "Zipping up to " + fileRoot + ".zip")
def compressDirectory(buildenv, directory, fileRoot): """This assumes that directory is an immediate child of the current dir""" if buildenv['os'] == 'win': executeCommand(buildenv, "HardHat", [buildenv['zip'], "-r", fileRoot + ".zip", directory], "Zipping up " + os.path.abspath(directory) + " to " + fileRoot + ".zip")...
[buildenv['tar'], "cvf", fileRoot+".tar", directory], "Tarring " + os.path.abspath(directory) + " as " + fileRoot + ".tar")
[buildenv['tar'], "cvf", fileRoot+".tar"] + directories, "Tarring to " + fileRoot + ".tar")
def compressDirectory(buildenv, directory, fileRoot): """This assumes that directory is an immediate child of the current dir""" if buildenv['os'] == 'win': executeCommand(buildenv, "HardHat", [buildenv['zip'], "-r", fileRoot + ".zip", directory], "Zipping up " + os.path.abspath(directory) + " to " + fileRoot + ".zip")...
position.x -= 4
position.x -= 1
def SetItem(self, item, position, size, pointSize): self.item = item self.SetValue(item.displayName)
timesAndReminders.sort(cmp=lambda x,y:Calendar.datetimeOp(x, 'cmp', y))
def compareTimesAndReminders(tuple1, tuple2): result = Calendar.datetimeOp(tuple1[0], 'cmp', tuple2[0]) if result == 0: result = cmp(tuple1[1], tuple2[1]) return result timesAndReminders.sort(cmp=compareTimesAndReminders)
def getPendingReminders (self): # @@@BJS Eventually, the query should be able to do the sorting for us; # for now, that doesn't seem to work so we're doing it here. # ... this routine should just be "return self.contents.resultSet" timesAndReminders = [] for item in self.contents: try: reminderTime = item.reminderTime ...
unittest.main()
pass
def hasKey(self, col, key): if col is None: return False
cal = parsedatetime.Calendar()
cal = parsedatetime.Calendar(ptc.Constants(str(getLocaleSet()[0])))
def parseDate(cls, target): """Parses Natural Language date strings using parsedatetime library.""" target = target.lower() for matchKey in cls.textMatches: #natural language string for date found if ((cls.textMatches[matchKey]).lower()).startswith(target): cal = parsedatetime.Calendar() (dateVar, invalidFlag) = cal.pa...
notify = reNotifyInside (child, item) notifyParent = notifyParent or notify
notifyParent = reNotifyInside (child, item) or notifyParent
def reNotifyInside(block, item): notifyParent = False try: # process from the children up for child in block.childrenBlocks: notify = reNotifyInside (child, item) notifyParent = notifyParent or notify except AttributeError: pass try: notify = block.synchronizeItemDetail(item) notifyParent = notifyParent or notify excep...
notify = block.synchronizeItemDetail(item) notifyParent = notifyParent or notify
syncMethod = block.synchronizeItemDetail
def reNotifyInside(block, item): notifyParent = False try: # process from the children up for child in block.childrenBlocks: notify = reNotifyInside (child, item) notifyParent = notifyParent or notify except AttributeError: pass try: notify = block.synchronizeItemDetail(item) notifyParent = notifyParent or notify excep...
def saveAttributeFromWidget(self, item, widget): """" Update the attribute from the user edited string in the widget. """ dateString = widget.GetValue().strip('?')
def parseDateTime (self, dateString): theDate = None if DateTime.__version__ < '2.1': try: twelveLocation = dateString.upper().index('12:') except ValueError: pass else: dateString = dateString[:twelveLocation]\ + '00:' + dateString[twelveLocation+3:]
def saveAttributeFromWidget(self, item, widget): """" Update the attribute from the user edited string in the widget. """ dateString = widget.GetValue().strip('?') try: # convert to Date/Time theDate = DateTime.Parser.DateTimeFromString (dateString) except ValueError: pass except DateTime.RangeError: pass try: # save t...