rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if isinstance(control, AETextCtrl): pass
def BeginControlEdit (self, item, attributeName, control): self.sampleText = self.GetSampleText(item, attributeName) self.item = item self.attributeName = attributeName self.control = control # logger.debug("BeginControlEdit: context for %s.%s is '%s'", item, attributeName, self.sampleText)
self.control.SetSelection(-1,-1)
self.control.SetSelection(0, self.control.GetLastPosition())
def onGainFocus(self, event): if self.showingSample: self.control.SetSelection(-1,-1) event.Skip()
if isSample and wx.Window.FindFocus() == control: control.SetSelection (-1,-1)
def __shadeBetween(shade, color1, color2): shade1 = shade(color1) shade2 = shade(color2) smaller = min(shade1, shade2) delta = abs(shade1 - shade2) return smaller + (delta / 2)
control.SetSelection(-1, -1)
control.SetSelection(0, control.GetLastPosition())
def onClick(self, event): """ Ignore clicks if we're showing the sample """ control = event.GetEventObject() if self.showingSample: if control == wx.Control.FindFocus(): # logger.debug("onClick: ignoring click because we're showing the sample.") control.SetSelection(-1, -1) # Make sure the whole thing's still selected ...
self.repository.view.refresh(_mergeFunction)
view = self.UIRepositoryView try: view.refresh(_mergeFunction) except: logger.exception("Changes cancelled because of refresh error") view.itsVersion -= 1 view.refresh() raise
def propagateAsynchronousNotifications(self):
dirtyBlocks = [self.UIRepositoryView.findUUID(theUUID) for theUUID in Block.dirtyBlocks]
dirtyBlocks = [view[theUUID] for theUUID in Block.dirtyBlocks]
def propagateAsynchronousNotifications(self):
result = tkMessageBox.askquestion('Subscription Request', message) if result == 'yes':
dialog = wxMessageDialog(self.application.wxMainFrame, message, _("Confirm Subscription"), wxYES_NO | wxICON_QUESTION) result = dialog.ShowModal() if result == wxID_YES:
def ConfirmSubscription(self, subscriptionType, who): message = '%s wishes to %s to your presence information. Do you approve?' % (who, subscriptionType) result = tkMessageBox.askquestion('Subscription Request', message) if result == 'yes': if subscriptionType == 'subscribe': self.connection.send(Presence(to=who, typ...
self.SetVirtualSize((self.GetVirtualSize().width, self.hourHeight*24))
self.size = self.GetSize() self.size.width -= wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) if (self.hourHeight > 0): self.size.height = self.hourHeight * 24 self.SetVirtualSize(self.size)
def OnInit(self): super (wxWeekColumnCanvas, self).OnInit() # @@@ rationalize drawing calculations... self.hourHeight = 40 self._scrollYRate = 10 self._bgSelectionStartTime = None self._bgSelectionEndTime = None # determines if we're dragging the start or the end of an event, usually # the end self._bgSelectionDrag...
self.size = self.GetVirtualSize()
self.size = self.GetSize() self.size.width -= wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X) if (self.hourHeight > 0): self.size.height = self.hourHeight * 24 self.SetVirtualSize(self.size)
def _doDrawingCalculations(self):
d = { 'changes' changes: , 'keywords' : kwds }
d = { 'changes' : changes , 'keywords' : kwds }
def repositoryCallback(changes, notification, **kwds): if notification == 'History': eventPath = '//parcels/osaf/framework/commit_history' else: return event = Globals.repository.findPath(eventPath) from osaf.framework.notifications.Notification import Notification note = Notification(event) note.threadid = id(thread...
self.mainFrame.Layout()
sizer.Layout()
def RenderMainView (self): mainViewRoot = Globals.mainViewRoot mainViewRoot.lastDynamicBlock = False assert len (Globals.views) == 0 mainViewRoot.render() """ We have to wire up the block mainViewRoot, it's widget and sizer to a new sizer that we add to the mainFrame. """ sizer = wx.BoxSizer (wx.HORIZONTAL) self.mainFr...
sidebar = Block.findBlockByName("Sidebar") filterClasses = [] if sidebar.filterKind is not None: klass = sidebar.filterKind.classes['python'] className = "%s.%s" % (klass.__module__, klass.__name__) filterClasses.append(className) collName = sharing.getFilteredCollectionDisplayName(collection, filterClasses) menuTitl...
collName = collection.getItemDisplayName() menuTitle = _(u'Sync "%(collectionName)s"') % \ {'collectionName': collName}
def onSyncCollectionEventUpdateUI (self, event): """ Update the menu to reflect the selected collection name """ collection = self.getSidebarSelectedCollection () if collection is not None:
else: if self.hoverRow != wx.NOT_FOUND and self.hoverRow != hoverRow: self.SetRowHighlight(self.hoverRow, False) if hoverRow != wx.NOT_FOUND and hoverRow != self.hoverRow: self.SetRowHighlight(hoverRow, True)
if self.hoverRow != wx.NOT_FOUND and self.hoverRow != hoverRow: self.SetRowHighlight(self.hoverRow, False)
def OnHover (self, x, y): hoverRow = self.YToRow(y) try: self.hoverRow except AttributeError: # If it's our first time hovering then set previous state to be NOT_FOUND self.hoverRow = wx.NOT_FOUND else: # Clear the selection colour if necessary if self.hoverRow != wx.NOT_FOUND and self.hoverRow != hoverRow: self.SetRow...
self.hoverRow = hoverRow
if hoverRow != wx.NOT_FOUND and hoverRow != self.hoverRow: self.SetRowHighlight(hoverRow, True) self.hoverRow = hoverRow
def OnHover (self, x, y): hoverRow = self.YToRow(y) try: self.hoverRow except AttributeError: # If it's our first time hovering then set previous state to be NOT_FOUND self.hoverRow = wx.NOT_FOUND else: # Clear the selection colour if necessary if self.hoverRow != wx.NOT_FOUND and self.hoverRow != hoverRow: self.SetRow...
os.rename(installSource, installTarget) if buildenv['version'] == 'release': _outputLine(buildenv['outputdir'] + os.sep + "enduser", installTargetFile) else: _outputLine(buildenv['outputdir'] + os.sep + "developer", installTargetFile) else: if buildenv['version'] == 'release': _outputLine(buildenv['outputdir']+os.sep+...
if os.path.exists(installSource): os.rename(installSource, installTarget) if buildenv['version'] == 'release': _outputLine(buildenv['outputdir'] + os.sep + "enduser", installTargetFile) else: _outputLine(buildenv['outputdir'] + os.sep + "developer", installTargetFile)
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...
share.put(updateCallback=callback)
try: share.put(updateCallback=callback) except: share.destroy() raise
def publish(collection, account, classesToInclude=None, publishType = 'collection', attrsToExclude=None, displayName=None, updateCallback=None): """ Publish a collection, automatically determining which conduits/formats to use, and how many @type collection: pim.ContentCollection @param collection: The collection to p...
self.lineAboveToday = '__WXGTK__' in wx.PlatformInfo
self.lineAboveToday = not '__WXMSW__' in wx.PlatformInfo
def __init__(self, *arguments, **keywords): super (wxMiniCalendar, self).__init__(*arguments, **keywords) # on Linux, because there are no borders around windows, we # want a line separating the minicalendar and preview area, # bug 4273 self.lineAboveToday = '__WXGTK__' in wx.PlatformInfo self.Bind(minical.EVT_MINI_C...
if '__WXMAC__' in wx.PlatformInfo: style = wx.BORDER_SIMPLE else: style = wx.BORDER_STATIC
style = PLATFORM_BORDER
def wxSynchronizeWidget(self, useHints=False): if '__WXMAC__' in wx.PlatformInfo: style = wx.BORDER_SIMPLE else: style = wx.BORDER_STATIC if isMainCalendarVisible() and not self.blockItem.dayMode: style |= minical.CAL_HIGHLIGHT_WEEK self.SetWindowStyle(style) self.setFreeBusy(None, useHints)
if '__WXMAC__' in wx.PlatformInfo: style = wx.BORDER_SIMPLE else: style = wx.BORDER_STATIC
def instantiateWidget(self): if '__WXMAC__' in wx.PlatformInfo: style = wx.BORDER_SIMPLE else: style = wx.BORDER_STATIC return wxMiniCalendar(self.parentBlock.widget, self.getWidgetID(), style=style)
self.getWidgetID(), style=style)
self.getWidgetID(), style=PLATFORM_BORDER)
def instantiateWidget(self): if '__WXMAC__' in wx.PlatformInfo: style = wx.BORDER_SIMPLE else: style = wx.BORDER_STATIC return wxMiniCalendar(self.parentBlock.widget, self.getWidgetID(), style=style)
self.setHasBeenRendered()
self.setHasBeenRendered() if '__WXMAC__' in wx.PlatformInfo: self.parentBlock.widget.SetWindowStyle(wx.BORDER_SIMPLE)
def instantiateWidget(self): if not self.getHasBeenRendered(): self.setRange( datetime.now().date() ) self.setHasBeenRendered() return wxPreviewArea(self.parentBlock.widget, self.getWidgetID(), timeCharStyle = self.timeCharacterStyle, eventCharStyle = self.eventCharacterStyle)
platform = 'windows'
buildplatform = 'windows'
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
platform = 'maciosx'
buildplatform = 'maciosx'
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
platform = 'macosx'
buildplatform = 'macosx'
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
platform = 'linux'
buildplatform = 'linux'
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
platform)
buildplatform)
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
rsyncServer + ":staging/" + platform])
rsyncServer + ":staging/" + buildplatform])
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
platform + "/" + timestamp)
buildplatform + "/" + timestamp)
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
rsyncServer + ":staging/" + platform + "/" + timestamp])
rsyncServer + ":staging/" + buildplatform + "/" + timestamp])
def UploadToStaging(nowString, log, rsyncProgram, rsyncServer): timestamp = nowString.replace("-", "") timestamp = timestamp.replace(":", "") timestamp = timestamp.replace(" ", "") if not os.path.isdir(timestamp): print "skipping rsync to staging area, no dir", timestamp log.write("skipping rsync to staging area, no d...
self.uriDictMap = PersistentDict()
def __init__(self): """ sideBarURLTree is a dict mapping what this instance of SideBar has visible to the application's full URLTree. The dict is a tree of dicts that contain extra data specific to this instance of SideBar (like which levels are expanded). """ self.sideBarURLTree = PersistentDict() self.uriDictMap = P...
self.uriDictMap[name] = itemId
wxWindow.uriDictMap[name] = itemId
def __UpdateURLTree(self, sideBarURLTree, appURLTree, parent, wasEmpty): """ Synchronizes the sidebar's URLTree with the application's URLTree. The sidebar only stores a dict mapping visible items in the sidebar to their instances in the application. """ wxWindow = app.association[id(self)] for item in appURLTree: ins...
wxWindow.SelectItem(self.uriDictMap[uri])
wxWindow.SelectItem(wxWindow.uriDictMap[uri])
def SelectUri(self, uri): """ Selects the proper uri when we have navigated to a different one via some tool other than the sideBar. """ wxWindow = app.association[id(self)] self.ignoreChangeSelect = true wxWindow.SelectItem(self.uriDictMap[uri]) self.ignoreChangeSelect = false
note.SetAttr(displayName=uw("Test Note in TestCollection"), body=uw("This is the body, can i give it \n for new line."))
def startTest(self): # action -- Setup mail accounts #execfile(os.path.join(functional_dir,"TestCreateAccounts.py")) ## Create Accounts for Mail ap = QAUITestAppLib.UITestAccounts(self.logger) # action self.logger.startAction("Setup email account") ap.Open() # first, open the accounts dialog window ap.CreateAccount...
if status == "FAILED": self.PrintTBOX(elapsed)
def Close(self, quit=True): now = datetime.now() if self.toClose: # The file must close (time to report a summary) TestLogger.logger = None elapsed = now - self.startDate elapsed_secs = elapsed.seconds + elapsed.microseconds / 1000000.0 self.Print("") self.Print("++++++++++++++++++++++++SUMMARY++++++++++++++++++++++++"...
if status == "FAILED": self.PrintTBOX(elapsed, "Testcase")
def Close(self, quit=True): now = datetime.now() if self.toClose: # The file must close (time to report a summary) TestLogger.logger = None elapsed = now - self.startDate elapsed_secs = elapsed.seconds + elapsed.microseconds / 1000000.0 self.Print("") self.Print("++++++++++++++++++++++++SUMMARY++++++++++++++++++++++++"...
message = "Printing is currently only supported when viewing week/month/day view of the calendar."
message = "Printing is currently only supported when viewing week or day view of the calendar."
def printEvent(self, isPreview): try: activeView = Globals.views [1] except IndexError: pass else: for canvas in activeView.childrenBlocks: if isinstance(canvas, CollectionCanvas.CollectionBlock): printObject = Printing.Printing(wx.GetApp().mainFrame, canvas.widget) if isPreview: printObject.OnPrintPreview() else: prin...
if not contents.isSelected((indexStart, indexEnd)):
if -1 not in (indexStart, indexEnd) and \ not contents.isSelected((indexStart, indexEnd)):
def OnRangeSelect(self, event): """ Synchronize the grid's selection back into the row """ blockItem = self.blockItem # Ignore notifications that arrise as a side effect of # changes to the selection blockItem.stopNotificationDirt() try: # map row ranges to index ranges contents = self.blockItem.contents
return data != 'False'
if data in ('True', 'true'): return True elif data in ('False', 'false'): return False else: raise ValueError, "'%s' is not 'T|true' or 'F|false'" %(data)
def makeValue(self, data): return data != 'False'
self.postEventByName ('RequestSelectSidebarItem', {'item':schema.ns('osaf.app', self).allCollection}) viewFilter = Block.findBlockByName ("Sidebar").filterKind
sidebar = Block.findBlockByName("Sidebar") sidebaritem = sidebar.selectedItemToView isReadOnly = getattr(sidebaritem, 'isReadOnly', None) if isReadOnly and isReadOnly(): allCollection = schema.ns('osaf.app', self).allCollection self.postEventByName ('RequestSelectSidebarItem', {'item': allCollection}) elif hasattr(...
def onNewEvent (self, event): # Create a new Content Item # Triggered from "File | New Item" menu, for any of the item kinds. try: kindParam = event.kindParameter except AttributeError: kindParam = pim.Note.getKind(self.itsView) # default kind for "New" newItem = kindParam.newItem (None, None) newItem.InitOutgoingAttri...
sidebarCollection = Block.findBlockByName ("Sidebar").contents
sidebarCollection = schema.ns("osaf.app").sidebarCollection
def onGenerateContentItemsEvent(self, event): # triggered from "Test | Generate Some Content Items" and # "Test | Generate Many Content Items" menu items count = event.arguments['sender'].blockName == 'GenerateMuchDataItem' and 100 or 4 sidebarCollection = Block.findBlockByName ("Sidebar").contents mainView = Globals.v...
m.body = strToText(m, "body", mimePart.get_payload())
m.body = strToText(m, "body", mimePart.get_payload().replace("\r", ""))
def messageObjectToKind(messageObject, messageText=None): """ 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(m...
m.body = strToText(m, "body", messageObject.get_payload())
m.body = strToText(m, "body", messageObject.get_payload().replace("\r", ""))
def messageObjectToKind(messageObject, messageText=None): """ 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(m...
return block.post(block.event)
return block.post(toolbarItem.event, {})
def press (self, toolbarItem = None, name=''): # post the event for the toolbarItem, or toolbarItem located by name if toolbarItem is None: toolbarItem = self._item_named (name) block = self.blockItem return block.post(block.event)
if isNewShare:
if not share.exists():
def onShareItemEvent (self, event): """ Share an ItemCollection. """ itemCollection = event.arguments ['item']
except:
except Sharing.SharingError, err: self.setStatusMessage (_("Sharing failed.")) msg = "Couldn't share collection:\n%s" % err.message application.dialogs.Util.ok(wx.GetApp().mainFrame, "Error", msg)
def onShareItemEvent (self, event): """ Share an ItemCollection. """ itemCollection = event.arguments ['item']
raise
if isNewShare: share.conduit.delete() share.format.delete() share.delete() return
def onShareItemEvent (self, event): """ Share an ItemCollection. """ itemCollection = event.arguments ['item']
return self.defaultText
return self._defaultText
def __unicode__(self): # [@@@] Get translation from I18Manager return self.defaultText
def __init__(self, defaultText=""):
def __init__(self, domain, defaultText):
def __init__(self, defaultText=""): super(LocalizableString, self).__init__() self.defaultText = defaultText
self.defaultText = defaultText
self._defaultText = defaultText self._domain = domain
def __init__(self, defaultText=""): super(LocalizableString, self).__init__() self.defaultText = defaultText
else: try: kc = schema.ns("osaf.pim.collections", item.itsView).kind_collections for i in kc.collections: if item in i and hasattr(i,'contentsUpdated'): i.contentsUpdated(item) except AttributeError, ae: logger.debug(ae) pass
try: kc = schema.ns("osaf.pim.collections", item.itsView).kind_collections for i in kc.collections: if item in i: i.contentsUpdated (item) except AttributeError, ae: pass
def mapChangesCallable(item, version, status, literals, references): """ """ # handle changes to items in a ListCollection if hasattr(item,'collections'): for i in item.collections: i.contentsUpdated(item) else: # handle changes to items in an existing KindCollection # is the item in a kind collection? try: #@@@ this i...
self.saveTextValue(validate = event.m_keyCode == wx.WXK_RETURN)
self.saveTextValue(validate = event.m_keyCode == wx.WXK_RETURN and self.lineStyleEnum != "MultiLine")
def onKeyPressed (self, event): # called when we get an event; to saves away the data and skips the event self.saveTextValue(validate = event.m_keyCode == wx.WXK_RETURN) event.Skip()
attributeName = GetRedirectAttribute(item, 'body'); textType = item.getAttributeAspect(attributeName, 'type') widgetText = widget.GetValue() if widgetText: text = unicode(widgetText, 'utf-8', 'ignore').encode('ascii', 'ignore') item.body = textType.makeValue(text, encoding='ascii', indexed=True)
if validate: attributeName = GetRedirectAttribute(item, 'body'); textType = item.getAttributeAspect(attributeName, 'type') widgetText = widget.GetValue() if widgetText: 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: #XXX: Ensures that any non-ascii text entered in to the detail view # is properly encoded to ascii. ...
item.setAttributeValue(self.whichAttribute(), widget.GetValue())
if validate: item.setAttributeValue(self.whichAttribute(), widget.GetValue())
def saveAttributeFromWidget(self, item, widget, validate): item.setAttributeValue(self.whichAttribute(), widget.GetValue())
try: reminderDelta = event.valarm[0].trigger[0].value except AttributeError: reminderDelta = None
def importProcess(self, text, extension=None, item=None, changes=None, previousView=None, updateCallback=None): # the item parameter is so that a share item can be passed in for us # to populate.
sizer.Add((5,5), 0, wx.EXPAND)
sizer.Add((7,7), 0, wx.EXPAND)
def OnInit(self): self.SetBackgroundColour(self.parent.bgColor)
navigationRow.Add((5,5), 0, wx.EXPAND) navigationRow.Add(self.colorSelect, 0, wx.CENTER)
navigationRow.Add((7,7), 0, wx.EXPAND) navigationRow.Add(self.colorSelect, 0, wx.ALIGN_CENTER)
def OnInit(self): self.SetBackgroundColour(self.parent.bgColor)
monthSizer = wx.BoxSizer(wx.VERTICAL) monthSizer.Add((7,7),0) monthSizer.Add(self.monthText, 0) monthSizer.Add((5,5), 0) navigationRow.Add(monthSizer, 0, wx.ALIGN_CENTER)
navigationRow.Add(self.monthText, 0, wx.ALIGN_CENTER)
def OnInit(self): self.SetBackgroundColour(self.parent.bgColor)
navigationRow.Add(self.prevButton, 0, wx.CENTER)
navigationRow.Add(self.prevButton, 0, wx.ALIGN_CENTER)
def OnInit(self): self.SetBackgroundColour(self.parent.bgColor)
navigationRow.Add(self.nextButton, 0, wx.CENTER) navigationRow.Add((5,5), 0)
navigationRow.Add(self.nextButton, 0, wx.ALIGN_CENTER) navigationRow.Add((7,7), 0)
def OnInit(self): self.SetBackgroundColour(self.parent.bgColor)
self.getIndex().setRanges (ranges)
self.rep.setRanges(self.indexName, ranges)
def setSelectionRanges (self, ranges): """ Sets the ranges associated with the current index with C(ranges) which should be an array of tuples, where each tuple represents a start and end of the range. The ranges must be sorted ascending, non-overlapping and postive. """ self.getIndex().setRanges (ranges)
self.getIndex().setRanges ([(index, index)])
self.rep.setRanges(self.indexName, [(index, index)])
def setSelectionToItem (self, item): """ Sets the entire selection to include only the C(item). """ index = self.index (item) self.getIndex().setRanges ([(index, index)])
self.getIndex().addRange(range)
self.rep.addRange(self.indexName, range)
def addSelectionRange (self, range): """ Selects a C(range) of indexes. C(range) may be a tuple: (start, end) or an integer index, where negative indexing works like Python indexing. """ self.getIndex().addRange(range)
self.getIndex().removeRange(range)
self.rep.removeRange(self.indexName, range)
def removeSelectionRange (self, range): """ unselects a C(range) of indexes. C(range) may be a tuple: (start, end) or an integer index, where negative indexing works like Python indexing.. """ self.getIndex().removeRange(range)
item = self.GetItem() try: anyTime = item.anyTime except AttributeError: anyTime = False try: allDay = item.allDay except AttributeError: allDay = False
item = self.GetItem() anyTime = getattr(item, 'anyTime', False) allDay = getattr(item, 'allDay', False)
def GetAnyTimeOrAllDay(self): item = self.GetItem() try: anyTime = item.anyTime except AttributeError: anyTime = False try: allDay = item.allDay except AttributeError: allDay = False return anyTime or allDay
hasLeftRounded = Calendar.datetimeOp(item.startTime, '==', item.endTime)
isAllDay = getattr(item, 'allDay', False) hasLeftRounded = ((not isAllDay and Calendar.datetimeOp(item.startTime, '==', item.endTime)) or getattr(item, 'anyTime', False))
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item if item.isDeleted(): return
return super(GridCellAttributeEditor, self).IsAcceptedKey()
return super(GridCellAttributeEditor, self).IsAcceptedKey(event)
def IsAcceptedKey(self, event):
if self.IsModal(): self.EndModal(True) else: self.Destroy()
self.Destroy()
def OnCloseWindow(self, event): """ Stops the timer from running and closes the window. """ if self.timer != None: self.timer.Stop() if self.IsModal(): self.EndModal(True) else: self.Destroy()
newViews = self.DecodePythonObject(reponseBody)
newViews = self.DecodePythonObject(responseBody)
def HandleViewResponse(self, fromAddress, responseBody): newViews = self.DecodePythonObject(reponseBody) self.SetAccessibleViews(fromAddress, newViews)
self.exclusions.append (item)
if self._rule: self.exclusions.append (item)
def remove (self, item): """ Remove an item from the exclusions. Optimize changes to inclusions and exclusions. """ if item not in self.exclusions: self.exclusions.append (item) if item in self.inclusions: self.inclusions.remove (item) if item in self._resultSet: self._resultSet.remove (item) self.ruleIsStale = True
data = re.sub(r'<(\S+?)\s*?/>', self._shorttag_replace, data)
data = re.sub(r'<([^<\s]+?)\s*/>', self._shorttag_replace, data)
def feed(self, data): data = re.compile(r'<!((?!DOCTYPE|--|\[))', re.IGNORECASE).sub(r'&lt;!\1', data) data = re.sub(r'<(\S+?)\s*?/>', self._shorttag_replace, data) data = data.replace('&#39;', "'") data = data.replace('&#34;', '"') if self.encoding and type(data) == type(u''): data = data.encode(self.encoding) sgmllib...
for proposed_encoding in (result['encoding'], xml_encoding, sniffed_xml_encoding, 'utf-8', 'windows-1252'):
for proposed_encoding in (result['encoding'], xml_encoding, sniffed_xml_encoding): if not proposed_encoding: continue
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]): '''Parse a feed from a URL, file, stream, or string''' result = FeedParserDict() result['feed'] = FeedParserDict() result['entries'] = [] if _XML_AVAILABLE: result['bozo'] = 0 if type(handlers) == types.InstanceType:...
if not proposed_encoding: continue
tried_encodings.append(proposed_encoding)
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]): '''Parse a feed from a URL, file, stream, or string''' result = FeedParserDict() result['feed'] = FeedParserDict() result['entries'] = [] if _XML_AVAILABLE: result['bozo'] = 0 if type(handlers) == types.InstanceType:...
known_encoding = 1 use_strict_parser = 1
known_encoding = use_strict_parser = 1
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]): '''Parse a feed from a URL, file, stream, or string''' result = FeedParserDict() result['feed'] = FeedParserDict() result['entries'] = [] if _XML_AVAILABLE: result['bozo'] = 0 if type(handlers) == types.InstanceType:...
tried_encodings.append(proposed_encoding)
if (not known_encoding) and chardet: try: proposed_encoding = chardet.detect(data)['encoding'] if proposed_encoding and (proposed_encoding not in tried_encodings): tried_encodings.append(proposed_encoding) data = _toUTF8(data, proposed_encoding) known_encoding = use_strict_parser = 1 except: pass if (not known_encodin...
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]): '''Parse a feed from a URL, file, stream, or string''' result = FeedParserDict() result['feed'] = FeedParserDict() result['entries'] = [] if _XML_AVAILABLE: result['bozo'] = 0 if type(handlers) == types.InstanceType:...
containingCollections = event.itemCollectionInclusions
def getEventCalendarData(self, event): """ Get the eventColors object which contains all the right color tints for the given event. If the given event doesn't have color data, then we return the default one associated with the view """ collections = self.contents.source selectedCollection = collections.first() containi...
if wx.GetApp().GetComCtl32Version() >= 600 and wx.DisplayDepth() >= 32: value = 2 else: value = 0 wx.SystemOptions.SetOptionInt ("msw.remap", value)
wx.SystemOptions.SetOptionInt ("msw.remap", 0)
def __init__(self, *arguments, **keywords): super (wxMainFrame, self).__init__(*arguments, **keywords)
else:
elif not self.cellRect.InsideXY (event.GetX(), event.GetY()):
def OnMouseEvents (self, event): """ This code is tricky, tred with care -- DJA """ event.Skip() #Let the grid also handle the event gridWindow = self.GetGridWindow()
ctrl.Hide() ctrl.Show()
if ctrl: ctrl.Hide() ctrl.Show()
def showhide(ctrl): ctrl.Hide() ctrl.Show()
def onReloadParcelsEvent(self, event):
def onReloadParcelsEvent(self, event, traceItem = None): """ Reloads the parcels and UI by deleting the UI elements and creating a new set. Often this operation exposes bugs in the copying cloud where data items referenced by the UI get deleted too. If this happens, you can get debugging help by passing in a traceIte...
def onReloadParcelsEvent(self, event): theApp = wx.GetApp() theApp.UnRenderMainView ()
def onShareCollectionEvent (self, event):
def onShareSidebarCollectionEvent(self, event): self._onShareOrManageSidebarCollectionEvent(event) def onManageSidebarCollectionEvent(self, event): self._onShareOrManageSidebarCollectionEvent(event) def _onShareOrManageSidebarCollectionEvent(self, event): """ Share the collection selected in the Sidebar. If the curre...
def onShareCollectionEvent (self, event): # Triggered from "Test | Share collection..."
def onShareCollectionEventUpdateUI (self, event): """ Update the menu to reflect the selected collection name """ if not Sharing.isWebDAVSetUp(self.itsView): event.arguments ['Enable'] = False return collection = self.getSidebarSelectedCollection () event.arguments ['Enable'] = collection is not None if collection: m...
def onShareCollectionEvent (self, event): # Triggered from "Test | Share collection..."
formattedBacktrace = "".join(backtrace[len(backtrace)-frames:])
formattedBacktrace = "".join(backtrace[-frames:])
def realMain(): if __debug__ and Globals.options.wing: # Check for -wing command line argument; if specified, try to # connect to an already-running WingIDE instance. See # http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#wingIDE # for details.
"Here are the bottom %s frames of the stack:\n%s") % (frames, formattedBacktrace)
"Here are the bottom %s frames of the stack:\n%s") % (frames - 1, formattedBacktrace)
def realMain(): if __debug__ and Globals.options.wing: # Check for -wing command line argument; if specified, try to # connect to an already-running WingIDE instance. See # http://wiki.osafoundation.org/bin/view/Chandler/DebuggingChandler#wingIDE # for details.
LoadParcels.LoadParcels(parcelDir, self.repository)
if __debug__ and debugParcelDir: parcelSearchPath = "%s%s%s" % (parcelDir, os.pathsep, debugParcelDir) else: parcelSearchPath = parcelDir LoadParcels.LoadParcels(parcelSearchPath, self.repository)
def loadClass(moduleName, className): return getattr(__import__(moduleName, {}, {}, className), className)
return self.results [index]
iterator = iter(self.results) item = iterator.next() for count in xrange (index): item = iterator.next() return item
def __getitem__ (self, index): return self.results [index]
if collection.shares:
if hasattr(collection, 'shares') and collection.shares:
def getShare(collection): """ Return the Share item (if any) associated with an AbstractCollection. @param collection: an AbstractCollection @type collection: AbstractCollection @return: A Share item, or None """ # First, see if there is a 'main' share for this collection. If not, # return the first "non-hidden" sha...
self.homeDirectory path to a folder in the user's home directory
def __setstate__(self, dict): """ Data often lives a long time, even longer than code and we may need to update it over time as it's structure changes. A convienent way to do this is to check for an old version in __setstate__, which is called each time the object is loaded, and update the data as necessary. Until the ...
if not self.dbroot.has_key('Application'):
if self.dbroot.has_key('Application'): self.model = self.dbroot['Application'] else:
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
else: self.model = self.dbroot['Application']
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
EVT_MENU(self, XRCID("ImportItems"), self.OnImportItems) EVT_MENU(self, XRCID("ExportItems"), self.OnExportItems)
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
self.homeDirectory = wxGetHomeDir() + os.sep + ".Chandler"; if not os.path.exists (self.homeDirectory): os.makedirs (self.homeDirectory)
def OnInit(self): """ Main application initialization. Open the persistent object tore, lookup of the application's persitent model counterpart, or create it if it doesn't exist. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.ja...
[buildenv['make']],
[buildenv['make'], "CHANDLER_ROOT="+buildenv['root'], "VPATH=.." ],
def build(buildenv): # Build the linux launcher program if buildenv['os'] == 'posix': os.chdir("distrib/linux/launcher") if buildenv['version'] == 'release': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['make']], "Making launcher programs") hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.se...
hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.sep + "release") hardhatlib.copyFile("chandler", buildenv['root'] + \ os.sep + "release") if buildenv['version'] == 'debug':
else:
def build(buildenv): # Build the linux launcher program if buildenv['os'] == 'posix': os.chdir("distrib/linux/launcher") if buildenv['version'] == 'release': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['make']], "Making launcher programs") hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.se...
[buildenv['make'], "DEBUG=1"],
[buildenv['make'], "DEBUG=1", "CHANDLER_ROOT="+buildenv['root'], "VPATH=.." ],
def build(buildenv): # Build the linux launcher program if buildenv['os'] == 'posix': os.chdir("distrib/linux/launcher") if buildenv['version'] == 'release': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['make']], "Making launcher programs") hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.se...
hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.sep + "debug") hardhatlib.copyFile("chandler", buildenv['root'] + \ os.sep + "debug") os.chdir("../../..")
hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.sep + version) hardhatlib.copyFile("chandler", buildenv['root'] + \ os.sep + version) os.chdir("../../../..")
def build(buildenv): # Build the linux launcher program if buildenv['os'] == 'posix': os.chdir("distrib/linux/launcher") if buildenv['version'] == 'release': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['make']], "Making launcher programs") hardhatlib.copyFile("chandler_bin", buildenv['root'] + \ os.se...
Check to see if we need to reorder the source list
Check to see if we need to reorder the source list. The list is kept sorted by the order of the collections as they overlay one another. We don't bother to sort when we're looking up a collection that isn't displayed in the summary view, both because it's not necessary and because it causes the source attribute to chan...
def _mapItemToCacheKeyItem(self, item): key = item rerender = False sidebar = Block.Block.findBlockByName ("Sidebar") """ collectionList should be in the order that the source items are overlayed in the Calendar view """ collectionList = [theItem for theItem in sidebar.contents if (theItem in sidebar.checkedItems) and ...
for new, old in map (None, key.source, collectionList): if new is not old: key.source = collectionList rerender = True
if sidebar.selectedItemToView is item: for new, old in map (None, key.source, collectionList): if new is not old: key.source = collectionList rerender = True break
def _mapItemToCacheKeyItem(self, item): key = item rerender = False sidebar = Block.Block.findBlockByName ("Sidebar") """ collectionList should be in the order that the source items are overlayed in the Calendar view """ collectionList = [theItem for theItem in sidebar.contents if (theItem in sidebar.checkedItems) and ...
""""
"""
def _parse(self, inputString): """" parse the durationString into a timedelta. """ seconds = self.hourMinuteFormat.parse(inputString) - self.zeroHours theDuration = timedelta(seconds=seconds) return theDuration
assert self.filterKind != event.kindParameter self.filterKind = event.kindParameter toolbar = Block.Block.findBlockByName("ApplicationBar") for button in toolbar.childrenBlocks: try: buttonEvent = button.event except: continue if buttonEvent == event: button.widget.selectTool() continue self.widget.Refresh() self.post...
if self.filterKind != event.kindParameter: self.filterKind = event.kindParameter toolbar = Block.Block.findBlockByName("ApplicationBar") for button in toolbar.childrenBlocks: try: buttonEvent = button.event except: continue if buttonEvent == event: button.widget.selectTool() continue self.widget.Refresh() self.postEve...
def onKindParameterizedEvent (self, event): assert self.filterKind != event.kindParameter self.filterKind = event.kindParameter # We need to update the click state of the toolbar as well toolbar = Block.Block.findBlockByName("ApplicationBar") for button in toolbar.childrenBlocks: try: buttonEvent = button.event except:...
self.canvasItemList = []
canvasItemList = []
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...