rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.canvasItemList.append(canvasItem) | canvasItemList.append(canvasItem) | def MakeCanvasItems(self, resort=False): """ makes new canvas items based on self.visibleItems """ if resort: self.visibleItems.sort(self.sortByStartTime) self.canvasItemList = [] dragState = self.dragState if (dragState and dragState.currentDragBox): currentDragItem = dragState.currentDragBox.item else: currentDragI... |
self.canvasItemList.append(self.coercedCanvasItem) | canvasItemList.append(self.coercedCanvasItem) | def MakeCanvasItems(self, resort=False): """ makes new canvas items based on self.visibleItems """ if resort: self.visibleItems.sort(self.sortByStartTime) self.canvasItemList = [] dragState = self.dragState if (dragState and dragState.currentDragBox): currentDragItem = dragState.currentDragBox.item else: currentDragI... |
useFingerprintSearch = False __nodeDescriptors = { 'CalendarEvent' : { 'kind' : '//parcels/osaf/contentmodel/calendar/CalendarEvent', 'fingerprint' : ( 'organizer.contactName.firstName', 'organizer.contactName.lastName' ), }, 'Contact' : { 'kind' : '//parcels/osaf/contentmodel/contacts/Contact', 'fingerprint' : ( 'con... | def fileStyle(self): """ Should return 'single' or 'directory' """ pass | |
result += "<%s uuid='%s'>\n" % (item.itsKind.itsName, item.itsUUID) | result += "<%s kind='%s' uuid='%s'>\n" % (item.itsKind.itsName, item.itsKind.itsPath, item.itsUUID) | def exportProcess(self, item, depth=0): |
def __iterMatchingItems(self, node): query = Query.Query(self.itsView.repository, "") desc = self.__nodeDescriptors[node.name] kindPath = desc['kind'] kind = self.itsView.findPath(kindPath) argString = "" args = {} i = 0 for arg in desc['fingerprint']: if i > 0: argString += " and " argString += "i.%s == $%d" % (arg... | def __iterMatchingItems(self, node): | |
desc = self.__nodeDescriptors[node.name] kindPath = desc['kind'] kind = self.itsView.findPath(kindPath) | kind = None kindPath = None kindNode = node.hasProp('kind') if kindNode: kindPath = kindNode.content kind = self.itsView.findPath(kindNode.content) if kind is None: if kindPath: logger.info("No kind found for %s" % kindPath) else: logger.info("Can't import an item without a kind provided") return None | def __importNode(self, node, item=None): desc = self.__nodeDescriptors[node.name] kindPath = desc['kind'] kind = self.itsView.findPath(kindPath) |
if self.useFingerprintSearch and item is None: matches = self.__getMatchingItems(node) length = len(matches) if length == 0: pass elif length == 1: item = matches[0] else: item = matches[0] if item is not None: print "Fingerprint match found", item | def __importNode(self, node, item=None): desc = self.__nodeDescriptors[node.name] kindPath = desc['kind'] kind = self.itsView.findPath(kindPath) | |
item.setAttributeValue(attrName, valueItem) | if valueItem is not None: item.setAttributeValue(attrName, valueItem) | def __importNode(self, node, item=None): desc = self.__nodeDescriptors[node.name] kindPath = desc['kind'] kind = self.itsView.findPath(kindPath) |
item.addValue(attrName, valueItem) | if valueItem is not None: item.addValue(attrName, valueItem) | def __importNode(self, node, item=None): desc = self.__nodeDescriptors[node.name] kindPath = desc['kind'] kind = self.itsView.findPath(kindPath) |
if not filterClasses or isinstance(item, filterClasses): | if (not filterClasses or self._matchesFilterClasses(item, filterClasses)): | def _get(self, contentView, updateCallback=None, getPhrase=None): # cvSelf (contentViewSelf) is me as I was in the past cvSelf = contentView.findUUID(self.itsUUID) |
if item in self.share.items: | if item in cvSelf.share.items: | def _get(self, contentView, updateCallback=None, getPhrase=None): # cvSelf (contentViewSelf) is me as I was in the past cvSelf = contentView.findUUID(self.itsUUID) |
if __debug__: logger.debug(u"No EggTranslations found for %s %s %s", project, name, self._localeSet) | def getText(self, project, name, txt, *args): """ Returns a c{unicode} string containing the localized value for key txt in the given project. The name parameter points to a key in a resource ini file that contain a value entry pointing to a gettext .mo resource in the same egg. | |
def GenerateCalendarEvent(view, days=30): | def GenerateCalendarEvent(view, days=30, tzinfo=None): | def GenerateCalendarEvent(view, days=30): event = Calendar.CalendarEvent(view=view) event.displayName = random.choice(HEADLINES) # Choose random days, hours startDelta = timedelta(days=random.randint(0, days), hours=random.randint(0, 24)) now = datetime.now() closeToNow = datetime(now.year, now.month, now.day, now.ho... |
now = datetime.now() | now = datetime.now(tzinfo) | def GenerateCalendarEvent(view, days=30): event = Calendar.CalendarEvent(view=view) event.displayName = random.choice(HEADLINES) # Choose random days, hours startDelta = timedelta(days=random.randint(0, days), hours=random.randint(0, 24)) now = datetime.now() closeToNow = datetime(now.year, now.month, now.day, now.ho... |
int(now.minute/30) * 30) | int(now.minute/30) * 30, tzinfo=now.tzinfo) | def GenerateCalendarEvent(view, days=30): event = Calendar.CalendarEvent(view=view) event.displayName = random.choice(HEADLINES) # Choose random days, hours startDelta = timedelta(days=random.randint(0, days), hours=random.randint(0, 24)) now = datetime.now() closeToNow = datetime(now.year, now.month, now.day, now.ho... |
def GenerateMailMessage(view): | def GenerateMailMessage(view, tzinfo=None): | def GenerateMailMessage(view): global M_FROM message = Mail.MailMessage(view=view) body = M_TEXT outbound = random.randint(0, 1) type = random.randint(1, 8) numTo = random.randint(1, 3) if M_FROM is None: M_FROM = GenerateCalendarParticipant(view) message.fromAddress = M_FROM for num in range(numTo): me... |
def GenerateNote(view): | def GenerateNote(view, tzinfo=None): | def GenerateNote(view): """ Generate one Note item """ note = pim.Note(view=view) note.displayName = random.choice(TITLES) delta = timedelta(days=random.randint(0, 5), hours=random.randint(0, 24)) note.createdOn = datetime.now() + delta return note |
note.createdOn = datetime.now() + delta | note.createdOn = datetime.now(tzinfo) + delta | def GenerateNote(view): """ Generate one Note item """ note = pim.Note(view=view) note.displayName = random.choice(TITLES) delta = timedelta(days=random.randint(0, 5), hours=random.randint(0, 24)) note.createdOn = datetime.now() + delta return note |
def GenerateTask(view): | def GenerateTask(view, tzinfo=None): | def GenerateTask(view): """ Generate one Task item """ task = pim.Task(view=view) delta = timedelta(days=random.randint(0, 5), hours=random.randint(0, 24)) task.dueDate = datetime.today() + delta task.displayName = random.choice(TITLES) return task |
def GenerateEventTask(view, days=30): | def GenerateEventTask(view, days=30, tzinfo=None): | def GenerateEventTask(view, days=30): """ Generate one Task/Event stamped item """ event = GenerateCalendarEvent(view, days) event.StampKind('add', pim.TaskMixin.getKind(event.itsView)) return event |
event = GenerateCalendarEvent(view, days) | event = GenerateCalendarEvent(view, days, tzinfo=tzinfo) | def GenerateEventTask(view, days=30): """ Generate one Task/Event stamped item """ event = GenerateCalendarEvent(view, days) event.StampKind('add', pim.TaskMixin.getKind(event.itsView)) return event |
for k, v in emps.items(): print k,v | def testPersistingPythonDictByUpdate(self): """Test making a regular Python dict persistent by using dict update method""" (managerKind, employeeKind) = self._createManagerAndEmployeeKinds('dict') | |
for k, v in manager.employees.items(): print k,v | def testPersistingPythonDictByUpdate(self): """Test making a regular Python dict persistent by using dict update method""" (managerKind, employeeKind) = self._createManagerAndEmployeeKinds('dict') | |
style = wx.minical.CAL_SUNDAY_FIRST | wx.minical.CAL_SHOW_SURROUNDING_WEEKS | wx.NO_BORDER | wx.minical.CAL_SHOW_PREVIEW | style = wx.minical.CAL_SUNDAY_FIRST | wx.minical.CAL_SHOW_SURROUNDING_WEEKS | wx.NO_BORDER | def wxSynchronizeWidget(self): style = wx.minical.CAL_SUNDAY_FIRST | wx.minical.CAL_SHOW_SURROUNDING_WEEKS | wx.NO_BORDER | wx.minical.CAL_SHOW_PREVIEW if self.blockItem.doSelectWeek: style |= wx.minical.CAL_HIGHLIGHT_WEEK self.SetWindowStyle(style) |
iconName += os.path.basename (str (ilterKind.itsPath)) | iconName += os.path.basename (str (filterKind.itsPath)) | def getButtonImage (self, item, mouseOverFlag): """ The rules for naming icons are complicated, which is a reflection of complexity of our sidebar design, so here is a summary of the rules: |
self.parentBlock.widget, -1, self, font) | self.parentBlock.widget, Block.getWidgetID(self), self, font) | def instantiateWidget(self): """ Ask our attribute editor to create a widget for us. """ existingWidget = getattr(self, 'widget', None) if existingWidget is not None: return existingWidget forEditing = getattr(self, 'forEditing', False) |
candidate = child | if candidate is None: candidate = child | def synchToDynamicBlock (block, isChild): """ Function to set and remember the dynamic Block we synch to. If it's a child block, it will be used so we must sync, and remember it for later. If it's not a child, we only need to sync if we had a different block last time. """ previous = Globals.mainView.lastDynamicBlock i... |
[cvsProgram, "-qn -z3", "update", "-d", cvsVintage]) | [cvsProgram, "-qn", "update", "-d", cvsVintage]) | def changesInCVS(moduleDir, workingDir, cvsVintage, log, filename): changesAtAll = False filenameChanged = False |
res = ImportExport.showFileDialog(wx.GetApp().mainFrame, _(u"Choose a filename to export to"), "", "export.ics", _(u"iCalendar files|*.ics|All files (*.*)|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT) | collection = Block.findBlockByName("Sidebar").selectedItemToView res = ImportExport.showFileDialog( wx.GetApp().mainFrame, _("Choose a filename to export to"), "", u"%s.ics" % (collection.displayName), _("iCalendar files|*.ics|All files (*.*)|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT) | def onExportIcalendarEvent(self, event): # triggered from "File | Import/Export" Menu res = ImportExport.showFileDialog(wx.GetApp().mainFrame, _(u"Choose a filename to export to"), "", "export.ics", _(u"iCalendar files|*.ics|All files (*.*)|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT) |
collection = ListCollection(view=self.itsView) for event in Calendar.CalendarEvent.iterItems(self.itsView): collection.add(event) | def onExportIcalendarEvent(self, event): # triggered from "File | Import/Export" Menu res = ImportExport.showFileDialog(wx.GetApp().mainFrame, _(u"Choose a filename to export to"), "", "export.ics", _(u"iCalendar files|*.ics|All files (*.*)|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT) | |
headertext = startDate.strftime("%B %Y") | headertext = _(u'%(currentMonth)s %(currentYear)d') % { 'currentMonth' : self.months[startDate.month-1], 'currentYear' : startDate.year } | def DrawMonth(self, dc, startDate, y, highlightDate = False): """ draw a single month return the updated value of y """ dc.SetTextForeground(wx.BLACK); |
self.DrawTime(item.startTime.time(), dc, self.margin, y) | self.DrawTime(item.startTime.time(), dc, self.margin, y, rightalign=True) | def DrawEventLine(self, dc, y, item): # A B C D D E F G # | | | | | | | | # my allday or anytime event # 12 15 - 14 45 doctor's appointment # 9 - 11 10 happy hour # @ 10 45 my at-time event # len(C->D) = len(D->E) = self.dashMargin # len(F->G) = self.eventTitleLe... |
def DrawTime(self, time, dc, x, y, leftpad=True): | def DrawTime(self, time, dc, x, y, leftpad=True, rightalign=False): | def DrawTime(self, time, dc, x, y, leftpad=True): """ @param time: a datetime.time object, its hour and minute get drawn with superscripts for the minutes does NOT change dc's font as a side effect. """ oldFont = dc.GetFont() |
if time.minute == 0: minutestr = " " else: minutestr = "%.2d" %time.minute if True or time.minute != 0: | if time.minute != 0: minutestr = "%.2d" %time.minute | def DrawTime(self, time, dc, x, y, leftpad=True): """ @param time: a datetime.time object, its hour and minute get drawn with superscripts for the minutes does NOT change dc's font as a side effect. """ oldFont = dc.GetFont() |
return y - self.margin + self.fontHeight | return y - self.margin | def Draw(self, dc): """ Draw all the items, based on what's in self.currentDaysItems @return the height of all the text drawn """ dc.Clear() |
def WalkParcels(parcel): yield parcel for part in parcel: if isinstance(part, Parcel): for subparcel in WalkParcels(part): yield subparcel | def WalkParcels(rootParcel): repo = rootParcel.getRepository() rootParcelPath = tuple(rootParcel.itsPath) rootParcelPathLen = len(rootParcelPath) parcels = {} parcelKind = repo.find("//Schema/Core/Parcel") for parcel in KindQuery().run([parcelKind]): p = tuple(parcel.itsPath) if p[:rootParcelPathLen] == rootParcelPat... | def WalkParcels(parcel): yield parcel for part in parcel: if isinstance(part, Parcel): for subparcel in WalkParcels(part): yield subparcel |
if event.GetEventType() == wx.wxEVT_COMMAND_TOOL_CLICKED: appBar = Block.findBlockByName("ApplicationBar") numToCheck = 4 for child in appBar.childrenBlocks: if numToCheck == 0: break if hasattr(child, "widget") and child.widget.GetId() == wxID: Block.findBlockByName("Sidebar").widget.SetFocus() break numToCh... | 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 | |
def FilterNone(list): return [x for x in list if x is not None] | def FilterGone(list): return [x for x in list if not issingleref(x)] | def FilterNone(list): return [x for x in list if x is not None] |
return FilterNone(selectedItems) | return FilterGone(selectedItems) | def __getSelectedItems(self, event=None): """ Get the list of items selected in this view. """ # We need the list of selected items to enable Send or actually send # them. Try several places: # If we were given an event, and it has 'items', we'll use that. if event is not None: selectedItems = event.arguments.get('item... |
return FilterNone(selectedItemsMethod(widget)) | return FilterGone(selectedItemsMethod(widget)) | def __getSelectedItems(self, event=None): """ Get the list of items selected in this view. """ # We need the list of selected items to enable Send or actually send # them. Try several places: # If we were given an event, and it has 'items', we'll use that. if event is not None: selectedItems = event.arguments.get('item... |
return FilterNone(selectedItemsMethod(self)) | return FilterGone(selectedItemsMethod(self)) | def __getSelectedItems(self, event=None): """ Get the list of items selected in this view. """ # We need the list of selected items to enable Send or actually send # them. Try several places: # If we were given an event, and it has 'items', we'll use that. if event is not None: selectedItems = event.arguments.get('item... |
wx.ID_NO: False }) | wx.ID_NO: False, wx.ID_CANCEL: False}) | def yesNo(parent, caption, message): """ Prompt the user with a Yes/No dialog. Return True if Yes, False if No. @param parent: A wx parent @type parent: wx frame @param caption: The caption string for the dialog @type caption: String @param message: A message prompting the user for input @type message: String """ re... |
Big fat hack. Since the grid is a scrolled window we set a border equal to the size of the scrollbar so the scroll bars won't show. Instead we should consider modifying grid adding a new style for not showing scrollbars. Bug | This is a temporary fix to get around an apparent bug in grids. We only want to adjust for scrollbars if they are present. The -2 is a hack, without which the sidebar will grow indefinitely when resizing the window. | def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0 |
lastColumnWidth = lastColumnWidth - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) | if (self.GetSize() == self.GetVirtualSize()): lastColumnWidth = lastColumnWidth - 2 else: lastColumnWidth = lastColumnWidth - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) | def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0 |
remaining = remaining - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) | if (self.GetSize() != self.GetVirtualSize()): remaining = remaining - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) | 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 |
if ctrl: | if ctrl and ctrl.IsShown(): | def showhide(ctrl): if ctrl: ctrl.Hide() ctrl.Show() |
if self.blockItem.isShown: try: blockName = self.blockItem.blockName splitter = list(self.blockItem.childrenBlocks)[1] splitterBlockName = splitter.blockName except (AttributeError, IndexError): pass else: if blockName == 'CalendarSummaryView' and \ splitterBlockName == 'MainCalendarCanvasSplitter' and \ spli... | def wxSynchronizeWidget(self, useHints=False): super (wxBoxContainer, self).wxSynchronizeWidget () | |
stamped.add(self.itsItem) | stamped.add(self.itsItem.getMembershipItem()) | def add(self): new_stamp_types = set([self.__class__]) if self.stamp_types is not None: if self.__class__ in self.stamp_types: raise StampAlreadyPresentError, \ "Item %r already has stamp %r" % (self.itsItem, self) new_stamp_types = new_stamp_types.union(self.stamp_types) stamped = self.collection if stamped is not ... |
all = schema.ns("osaf.pim", self.itsItem.itsView).allCollection inAllBeforeStamp = self.itsItem in all | all = schema.ns("osaf.pim", item.itsView).allCollection inAllBeforeStamp = item in all | def remove(self): new_stamp_types = set(self.stamp_types) try: new_stamp_types.remove(self.__class__) except KeyError: raise StampNotPresentError, \ "Item %r doesn't have stamp %r" % (self.itsItem, self) stamped = self.collection # This is gross, and was in the old stamping code. # Some items, like Mail messages, end... |
stamped.remove(self.itsItem) | stamped.remove(item) | def remove(self): new_stamp_types = set(self.stamp_types) try: new_stamp_types.remove(self.__class__) except KeyError: raise StampNotPresentError, \ "Item %r doesn't have stamp %r" % (self.itsItem, self) stamped = self.collection # This is gross, and was in the old stamping code. # Some items, like Mail messages, end... |
if inAllBeforeStamp and not self.itsItem in all: all.add(self.itsItem) | if inAllBeforeStamp and not item in all: all.add(item) | def remove(self): new_stamp_types = set(self.stamp_types) try: new_stamp_types.remove(self.__class__) except KeyError: raise StampNotPresentError, \ "Item %r doesn't have stamp %r" % (self.itsItem, self) stamped = self.collection # This is gross, and was in the old stamping code. # Some items, like Mail messages, end... |
"TestImportOverwrite.py", | def run_tests(tests): for filename in tests: try: execfile(os.path.join(functional_dir, filename)) except: import traceback print "%s failed due to exception" % fileName type, value, stack = sys.exc_info() traceback.print_exception(type, value, stack, None, sys.stderr) | |
return "Note" | return "ContentItem" | def ClipboardDataFormat(self): """ Override to define which kind you allow to be dropped. """ return "Note" # Default is any kind of Note or subclass of Note. |
self.isDayItem(view[key]) == dayItems)): | self.isDayItem(view[key]) == dayItems) and view[key].rruleset is None): | def mEnd(key): # gets the first event ending after date if Calendar.datetimeOp(date, '<=', view[key].endTime): return 0 return 1 |
if ((event != masterEvent) and (event.occurrenceFor is not None) and | if ((event.occurrenceFor is not None) and | def recurringEventsInRange(self, date, nextDate, dayItems, timedItems): masterEvents = CalendarCollections(self.contents).masterEvents for masterEvent in masterEvents: for event in masterEvent.getOccurrencesBetween(date, nextDate): # One or both of dayItems and timedItems must be # True. If both, then there's no need t... |
if event.occurrenceFor is not None: | def recurringEventsInRange(self, date, nextDate, dayItems, timedItems): masterEvents = CalendarCollections(self.contents).masterEvents for masterEvent in masterEvents: for event in masterEvent.getOccurrencesBetween(date, nextDate): # One or both of dayItems and timedItems must be # True. If both, then there's no need t... | |
except: explanation = "Couldn't add value to item" | except Exception, e: explanation = "Couldn't add value to item (%s)" % e | def completeAssignments(self, item, assignments): """ Perform all the delayed attribute assignments for an item """ |
if (imageRect.InsideXY (x, y) == (screenChecked == button['blockChecked'])): | if (imageRect.InsideXY (x, y) == (bool (screenChecked) == bool (button['blockChecked']))): | def OnMouseEvents (self, event): """ This code is tricky, tread with care -- DJA """ event.Skip() #Let the grid also handle the event by default |
if row == getattr (grid, 'hoverImageRow', wx.NOT_FOUND): | if (row == getattr (grid, 'hoverImageRow', wx.NOT_FOUND) and name != "SharingIcon"): | def drawButton (name): imagePrefix = "Sidebar" + name imageSuffix = ".png" if row == getattr (grid, 'hoverImageRow', wx.NOT_FOUND): imagePrefix += "MouseOver" if grid.buttonState[name]['screenChecked']: imageSuffix = "Checked" + imageSuffix else: imageSuffix = sidebar.getButtonState (name, item) + imageSuffix |
"onValueChange. Note that this attribute is only meaningful " | "onValueChanged. Note that this attribute is only meaningful " | def recurringEventsInRange(view, start, end, filterColl = None, dayItems = True, timedItems = True): """ Yield all recurring events between start and end that appear in filterColl. """ tzprefs = schema.ns('osaf.app', view).TimezonePrefs if tzprefs.showUI: startIndex = 'effectiveStart' endIndex = 'recurrenceEnd' else... |
if master.recurrenceID != master.startTime: | if not master.recurrenceID in (None, master.startTime): | def removeRecurrence(self): """ Remove modifications, rruleset, and all occurrences except master. The resulting event will occur exactly once. """ master = self.getMaster() if master.recurrenceID != master.startTime: master.changeNoModification('recurrenceID', master.startTime) rruleset = master.rruleset if rruleset ... |
reldate = self.blockItem.selectedDate - \ self.blockItem.rangeStart | reldate = self.blockItem.selectedDate.date() - \ self.blockItem.rangeStart.date() | def UpdateHeader(self): if self.blockItem.dayMode: # ugly back-calculation of the previously selected day reldate = self.blockItem.selectedDate - \ self.blockItem.rangeStart self.weekColumnHeader.SetSelectedItem(reldate.days+1) else: self.weekColumnHeader.SetSelectedItem(0) |
item.body = textType.makeValue(widgetText, encoding='ascii', indexed=True) | text = unicode(widgetText, 'utf-8', 'ignore').encode('ascii', 'ignore') item.body = textType.makeValue(text, encoding='ascii', indexed=True) | def saveAttributeFromWidget (self, item, widget, validate): attributeName = GetRedirectAttribute(item, 'body'); textType = item.getAttributeAspect(attributeName, 'type') widgetText = widget.GetValue() if widgetText: item.body = textType.makeValue(widgetText, encoding='ascii', indexed=True) |
sidebar.setPreferredClass(stampClass) | if sidebar.filterClass is not MissingClass: sidebar.setPreferredClass(stampClass) | def onNewItemEvent(self, event): # Create a new Content Item allCollection = schema.ns('osaf.pim', self).allCollection sidebar = Block.findBlockByName("Sidebar") classParameter = event.classParameter |
keys.setdefault('displayName', messages.UNTITLED) | defaultName = messages.UNTITLED if name is not None: defaultName = unicode(name) keys.setdefault('displayName', defaultName) | def __init__(self, name=None, parent=None, kind=None, view=None, bodyString=None, *args, **keys): keys.setdefault('displayName', messages.UNTITLED) super(Script, self).__init__(name, parent, kind, view, *args, **keys) |
test = _u("test is good %s %s") % ("one", "two") | test = _(u"test is good %s %s") % ("one", "two") | def testMessageFactory(self): from i18n import MessageFactory import i18n _ = MessageFactory("testDomain") |
args['itemName'] = 'AllTableView' | args['itemName'] = 'AllView' | def onNewEvent (self, notification): # Create a new Content Item # Triggered from "File | New Item" menu, for any of the item kinds. event = notification.event newItem = event.kindParameter.newItem (None, self) newItem.InitOutgoingAttributes () self.RepositoryCommitWithStatus () |
if not hasattr(cvSelf.share.contents, 'displayName'): | if not getattr(cvSelf.share.contents, 'displayName', ''): | def _get(self, contentView, updateCallback=None, getPhrase=None): |
cvSelf.share.displayName | self._getDisplayNameForShare(cvSelf.share) | def _get(self, contentView, updateCallback=None, getPhrase=None): |
def _getDisplayNameForShare(self, share): """ Return a C{str} (or C{unicode}) that specifies how the shared collection should be displayed. By default, this method just uses the share's displayName, but subclasses may override for custom behavior (e.g. fetching a DAV property). """ return share.displayName | def _getItemPath(self, item): """ Return a string that uniquely identifies a resource in the remote share, such as a URL path or a filesystem path. These strings will be used for accessing the manifest and resourceList dicts. """ extension = self.share.format.extension(item) style = self.share.format.fileStyle() if st... | |
originalName = itemCollection.displayName | def ShareCollection (self, itemCollection): """ Share an ItemCollection. Called by ItemCollection.shareSend(), when the Notify button is pressed in the itemCollection's Detail View. """ # commit changes, since we'll be switching to Twisted thread self.RepositoryCommitWithStatus() | |
Dav.DAV(url).put(itemCollection) | try: Dav.DAV(url).put(itemCollection) except: itemCollection.displayName = originalName raise | def ShareCollection (self, itemCollection): """ Share an ItemCollection. Called by ItemCollection.shareSend(), when the Notify button is pressed in the itemCollection's Detail View. """ # commit changes, since we'll be switching to Twisted thread self.RepositoryCommitWithStatus() |
'build_ext', '--inplace', 'install', | def build(buildenv): version = buildenv['version'] if buildenv['os'] in ('osx', 'posix'): # Create the build directory buildDir = os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Temporary build directory exists: " + buildDir... | |
'HYBRID=0'], | 'BUILD_BASE=build_release', 'build', 'install'], | def build(buildenv): version = buildenv['version'] if buildenv['os'] in ('osx', 'posix'): # Create the build directory buildDir = os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Temporary build directory exists: " + buildDir... |
'build_ext', '--inplace', | 'FINAL=1', 'BUILD_BASE=build_debug', 'build', | def build(buildenv): version = buildenv['version'] if buildenv['os'] in ('osx', 'posix'): # Create the build directory buildDir = os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Temporary build directory exists: " + buildDir... |
'install', 'FINAL=1', 'HYBRID=0'], | 'install'], | def build(buildenv): version = buildenv['version'] if buildenv['os'] in ('osx', 'posix'): # Create the build directory buildDir = os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Temporary build directory exists: " + buildDir... |
os.putenv('WXWIN', os.getcwd()) | os.putenv('WXWIN', buildenv['root_dos'] + "\\..\\..\\internal\\wx\\wxPython-2.5") | def clean(buildenv): version = buildenv['version'] if buildenv['os'] == 'posix': buildDir=os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Removing temporary build directory: " + buildDir) hardhatlib.rmdir_recursive(buildDir) ... |
[buildenv['python'], 'setup.py', 'clean', '--all'], "Cleaning wxPython") | [buildenv['python'], 'setup.py', 'BUILD_BASE=build_release', 'clean', '--all'], "Cleaning wxPython") | def clean(buildenv): version = buildenv['version'] if buildenv['os'] == 'posix': buildDir=os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Removing temporary build directory: " + buildDir) hardhatlib.rmdir_recursive(buildDir) ... |
[buildenv['python_d'], 'setup.py', 'clean', '--all'], "Cleaning wxPython") | [buildenv['python_d'], 'setup.py', 'BUILD_BASE=build_debug', 'clean', '--all'], "Cleaning wxPython") | def clean(buildenv): version = buildenv['version'] if buildenv['os'] == 'posix': buildDir=os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Removing temporary build directory: " + buildDir) hardhatlib.rmdir_recursive(buildDir) ... |
assert len(parts) >= 2, "Delegate " + counterpart.elementDelegate + "isn't a module and class" | assert len(parts) >= 2, "Delegate % isn't a module and class" % counterpart.elementDelegate | def ExpandContainer (self, openedContainers, id): try: expand = openedContainers [self.GetPyData(id)] except KeyError: return |
assert module.__dict__.get (delegateClassName), "Class " + counterpart.elementDelegate + "doesn't exist" | assert module.__dict__.get (delegateClassName), "Class % doesn't exist" % counterpart.elementDelegate | def ExpandContainer (self, openedContainers, id): try: expand = openedContainers [self.GetPyData(id)] except KeyError: return |
assert isinstance (item, ContentCollection) | assert item is None or isinstance (item, ContentCollection) | def _mapItemToCacheKeyItem(self, item, hints): assert isinstance (item, ContentCollection) # The sidebar can only contain ContentCollections key = item sidebar = Block.Block.findBlockByName ("Sidebar") """ collectionList should be in the order that the source items are overlayed in the Calendar view |
if ((highlightWeek and (self.GetWeek(weekDate, False) == self.GetWeek(self.selectedDate, False))) or (not highlightWeek and (weekDate == self.selectedDate))): | if ((weekDate.month == startDate.month) and ((highlightWeek and (self.GetWeek(weekDate, False) == self.GetWeek(self.selectedDate, False))) or (not highlightWeek and (weekDate == self.selectedDate)))): | def DrawMonth(self, dc, startDate, y, highlightDate = False): """ draw a single month return the updated value of y """ dc.SetTextForeground(wx.BLACK); |
channel = osaf.examples.zaobao.RSSData.NewChannelFromURL(view=self.itsView, url=url, update=True) | channel = RSSData.NewChannelFromURL(view=self.itsView, url=url, update=True) | def onNewZaoBaoChannelEvent(self, event): url = application.dialogs.Util.promptUser(wx.GetApp().mainFrame, "New Channel", "Enter a URL for the RSS Channel", "http://") if url and url != "": try: # create the zaobao channel channel = osaf.examples.zaobao.RSSData.NewChannelFromURL(view=self.itsView, url=url, update=True) |
import osaf.contentmodel.mail.Mail as Mail | import osaf.contentmodel.mail as Mail | def testOutBoxQueryWithMail(self): self.loadParcels( ['parcel:osaf.contentmodel.mail'] ) |
if ((item.startTime >= date) and (item.startTime < nextDate) and item.duration): | if (item.hasAttributeValue('startTime') and item.duration and (item.startTime >= date) and (item.startTime < nextDate)): | def getItemsByDate(self, date): """ Convenience method to look for the items in the block's contents that appear on the given date. @@@ We may push this work down into ItemCollections and/or Queries. |
self.daysPerView = 7 self.rangeIncrement = DateTime.RelativeDateTime(days=self.daysPerView) self.setRange(DateTime.today()) | def initAttributes(self): if not self.hasAttributeValue('rangeStart'): self.setRange(DateTime.today()) if not self.hasAttributeValue('rangeIncrement'): self.rangeIncrement = DateTime.RelativeDateTime(days=self.daysPerView) | def __init__(self, *arguments, **keywords): super(WeekBlock, self).__init__ (*arguments, **keywords) |
"TestCalView.py", | def run_tests(tests): for filename in tests: try: execfile(os.path.join(functional_dir, filename)) except: import traceback print "%s failed due to exception" % fileName type, value, stack = sys.exc_info() traceback.print_exception(type, value, stack, None, sys.stderr) | |
return item.itsKind, True | keyItem = item.itsKind newView = self.getTrunkForKeyItem(keyItem) trunkParentBlock = self.trunkParentBlock TPBSelectedItem = trunkParentBlock.TPBSelectedItem TPBDetailItem = self._getContentsForTrunk (newView, TPBSelectedItem, keyItem) rerender = (hasattr(trunkParentBlock, 'TPBDetailItem') and TPBDetailItem is not trun... | def _mapItemToCacheKeyItem(self, item): """ Overrides to use the item's kind as our cache key """ if item is None: # We use the subtree kind itself as the key for displaying "nothing"; # Mimi wants a particular look when no item is selected; we've got a # particular tree of blocks defined in parcel.xml for this Kind, #... |
return self.totalRows | if len(self.sectionRows) == 0: return len(self.blockItem.contents) else: return self.totalRows | def GetElementCount(self): return self.totalRows |
Block.Block.findBlockByName('StatusBar').setStatusMessage (statusMessage, progressPercentage) | Block.findBlockByName('StatusBar').setStatusMessage (statusMessage, progressPercentage) | def setStatusMessage (self, statusMessage, progressPercentage=-1): """ Allows you to set the message contained in the status bar. You can also specify values for the progress bar contained on the right side of the status bar. If you specify a progressPercentage (as a float 0 to 1) the progress bar will appear. If no ... |
assert (row < self.GetNumberRows() and column < self.GetNumberCols()) | if not (row < self.GetNumberRows() and column < self.GetNumberCols()): return None | def GetAttr (self, row, column, kind): attribute = super(wxTableData, self).GetAttr (row, column, kind) if attribute is None: type = self.GetTypeName (row, column) delegate = AttributeEditors.getSingleton (type) attribute = self.defaultROAttribute grid = self.GetView() assert (row < self.GetNumberRows() and column < se... |
masterEvents.filterExpression = "getattr(item, 'occurrences', None) is not None and getattr(item, 'rruleset', None) is not None" | masterEvents.filterExpression = "item.hasLocalAttributeValue('occurrences') and item.hasLocalAttributeValue('rruleset')" | def EnsureIndexes(self): events = self.contents.rep # make sure there are indexes. 'compare' indexes use methods # on the items being compared, i.e. CalendarEventMixin if not events.hasIndex('startTime'): events.addIndex('startTime', 'compare', compare='cmpStartTime', monitor=('startTime')) if not events.hasIndex('end... |
if line[0] == "U": print "needs update because of", line return True if line[0] == "P": print "needs update because of", line return True if line[0] == "A": | if line.lower().startswith('restored'): print "needs update because of", line return True s = line[:4] if s.find("U") != -1: print "needs update because of", line return True if s.find("P") != -1: print "needs update because of", line return True if s.find("A") != -1: print "needs update because of", line return Tr... | def NeedsUpdate(outputList): for line in outputList: if line.lower().find("ide scripts") != -1: # this hack is for skipping some Mac-specific files that # under Windows always appear to be needing an update continue if line.lower().find("xercessamples") != -1: # same type of hack as above continue if line[0] == "U": pr... |
self.SetSize(self.GetBestSize()) | def __init__(self, parent, proxy, cancelCallback = None): self.proxy = proxy self.cancelCallback = cancelCallback self._init_ctrls(parent) labels = {self.cancelButton : messages.CANCEL, self.allButton : _(u'All events'), self.futureButton : _(u'All future events'), self.thisButton : _(u'Just this event')} | |
RecurrenceDialog(wx.GetApp().mainFrame, self) | wx.GetApp().PostAsyncEvent(self.runDialog) | def __setattr__(self, name, value): if name in self.proxyAttributes: object.__setattr__(self, name, value) elif self.proxiedItem.rruleset is None: setattr(self.proxiedItem, name, value) else: if hasattr(self.proxiedItem, name) and \ getattr(self.proxiedItem, name) == value: pass elif self.currentlyModifying is None: se... |
account = sharing.WebDAVAccount(name='account', itsParent=sandbox, | account = sharing.WebDAVAccount('account', itsParent=sandbox, | def prepareCosmoAccount(self): view = self.views[0] |
event.startTime = startTime | if startTime: event.startTime = startTime | def CreateEmptyEvent(self, startTime, allDay, anyTime): """ shared routine to create an event, using the current view also forces consumers to specify important fields """ view = self.parent.blockItem.itsView event = Calendar.CalendarEvent(view=view) event.InitOutgoingAttributes() event.startTime = startTime event.allD... |
startTime = datetime(newTime.year, newTime.month, newTime.day, event.startTime.hour, event.startTime.minute) event = self.CreateEmptyEvent(startTime, True, False) | event = self.CreateEmptyEvent(None, True, False) event.startTime = datetime.combine(newTime.date(), event.startTime.time()) | def OnCreateItem(self, unscrolledPosition): newTime = self.getDateTimeFromPosition(unscrolledPosition) |
view.commit() | self.parent.blockItem.itsView.commit() | def OnCreateItem(self, unscrolledPosition): newTime = self.getDateTimeFromPosition(unscrolledPosition) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.