rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
logging.error("Unable to connect to server ", reason)
logging.error("Unable to connect to server; reason: '%s'", reason)
def clientConnectionFailed(self, connector, reason): logging.error("Unable to connect to server ", reason)
btn = wx.Button(self, wx.ID_OK, u" " + messages.OK + u" ") box.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 5) btn = wx.Button(self, wx.ID_CANCEL, u" " + messages.CANCEL + u" ")
btn = wx.Button(self, wx.ID_OK) box.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 5) btn = wx.Button(self, wx.ID_CANCEL)
def __init__(self, parent, type, fingerprint, x509, choices, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER): """ Ask the user if they would like to import and trust a certificate. @param type: Certificate type @param fingerprint: The certificate fingerprint @param x...
btn = wx.Button(self, wx.ID_OK, messages.OK) box.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 5) btn = wx.Button(self, wx.ID_CANCEL, messages.CANCEL)
btn = wx.Button(self, wx.ID_OK) box.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 5) btn = wx.Button(self, wx.ID_CANCEL)
def __init__(self, parent, x509, storedUntrusted, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER): """ Initialize dialog.
s = SMTPClient(self.__createView(), account)
s = SMTPClient(self.__createView("SMTPClient", account), account)
def getSMTPInstance(self, account): """ Returns a C{SMTPClient} instance for the given account
i = IMAPClient(self.__createView(), account)
i = IMAPClient(self.__createView("IMAPClient", account), account)
def getIMAPInstance(self, account): """Returns a C{IMAPClient} instance for the given account
i = POPClient(self.__createView(), account)
i = POPClient(self.__createView("POPClient", account), account)
def getPOPInstance(self, account): """Returns a C{POPClient} instance for the given account
recover = kwds.get('recover', False) exclusive = kwds.get('exclusive', False)
def open(self, **kwds):
finally:
except DBNoSuchFileError: raise else:
def open(self, **kwds):
if len(self.currentDaysItems) == 0: return None
def _getItem(self, event): """Return the appropriate item, or None for the expand/contract line.""" maxEvents = schema.ns("osaf.framework.blocks.calendar", self.blockItem.itsView).previewPrefs.maximumEventsDisplayed
return None
return -1
def _getItem(self, event): """Return the appropriate item, or None for the expand/contract line.""" maxEvents = schema.ns("osaf.framework.blocks.calendar", self.blockItem.itsView).previewPrefs.maximumEventsDisplayed
if item is None:
if item == -1:
def OnDClick(self, event): item = self._getItem(event) if item is None: self.ExpandOrContract() return self._avoidDrawing = True # Select the calendar filter self.blockItem.postEventByName ('ApplicationBarEvent', {})
if item is None:
if item == -1:
def OnClick(self, event): item = self._getItem(event) if item is None: self.ExpandOrContract() return sidebarBPB = Block.Block.findBlockByName("SidebarBranchPointBlock") sidebarBPB.childrenBlocks.first().postEventByName ( 'SelectItemsBroadcast', {'items':[item]} ) self.Refresh()
makeLabel(parcel, _(u''), borderTop=5),
makeLabel(parcel, u'', borderTop=5),
def makeNoteSubtree(parcel, oldVersion): """ Build the subtree (and related stuff) for Note. """ blocks = schema.ns("osaf.framework.blocks", parcel.itsView) # First, the headline AEBlock and the area it sits in headlineAEBlock = makeEditor(parcel, 'HeadlineBlock', viewAttribute=u'about', characterStyle=blocks.BigTextS...
makeLabel(parcel, _(u''), borderTop=4),
makeLabel(parcel, u'', borderTop=4),
def makeNoteSubtree(parcel, oldVersion): """ Build the subtree (and related stuff) for Note. """ blocks = schema.ns("osaf.framework.blocks", parcel.itsView) # First, the headline AEBlock and the area it sits in headlineAEBlock = makeEditor(parcel, 'HeadlineBlock', viewAttribute=u'about', characterStyle=blocks.BigTextS...
def SetAttr(self, displayName=None, startDate=None, startTime=None, endDate=None, endTime=None, location=None, body=None, status=None, timeZone=None, recurrence=None, recurrenceEnd=None, alarm=None, fromAddress=None, toAddress=None, allDay=None, stampEvent=None, stampMail=None,stampTask=None):
def SetAttr(self, **args):
def SetAttr(self, displayName=None, startDate=None, startTime=None, endDate=None, endTime=None, location=None, body=None, status=None, timeZone=None, recurrence=None, recurrenceEnd=None, alarm=None, fromAddress=None, toAddress=None, allDay=None, stampEvent=None, stampMail=None,stampTask=None): """ Set the item attribut...
methodDict = {displayName:self.SetDisplayName, startDate:self.SetStartDate, startTime:self.SetStartTime, endDate:self.SetEndDate, endTime:self.SetEndTime, location:self.SetLocation, body:self.SetBody, status:self.SetStatus, alarm:self.SetAlarm, fromAddress:self.SetFromAddress, toAddress:self.SetToAddress, allDay:self.S...
methodDict = { 'displayName': self.SetDisplayName, 'startDate': self.SetStartDate, 'startTime': self.SetStartTime, 'endDate': self.SetEndDate, 'endTime': self.SetEndTime, 'location': self.SetLocation, 'body': self.SetBody, 'status': self.SetStatus, 'alarm': self.SetAlarm, 'fromAddress': self.SetFromAddress, 'toAddress'...
def SetAttr(self, displayName=None, startDate=None, startTime=None, endDate=None, endTime=None, location=None, body=None, status=None, timeZone=None, recurrence=None, recurrenceEnd=None, alarm=None, fromAddress=None, toAddress=None, allDay=None, stampEvent=None, stampMail=None,stampTask=None): """ Set the item attribut...
if param: methodDict[param](param, timeInfo=False)
if param in args: methodDict[param](args[param], timeInfo=False)
def SetAttr(self, displayName=None, startDate=None, startTime=None, endDate=None, endTime=None, location=None, body=None, status=None, timeZone=None, recurrence=None, recurrenceEnd=None, alarm=None, fromAddress=None, toAddress=None, allDay=None, stampEvent=None, stampMail=None,stampTask=None): """ Set the item attribut...
class UITestView:
class UITestView(object):
def VerifyValues(self, type, name, **keys): """ Check the accounts settings @type type : string @param type : the type of account you want to check (IMAP,SMTP,WebDAV,POP) @type name : string @param name : the name of the account to check @param keys : key:value pairs """ if type == "SMTP": iter = Mail.SMTPAccount.iterI...
result += "<tr class='oddrow'>\n" result += "<td>" result += "<div class='tree'>" result += "<form method=get action=/repo><input type=text name=text size=40><input type=hidden name=mode value=search>" result += "</div>" result += "</td></tr></table></form>\n"
def RenderSearchForm(repoView): result = """
result += '<tr class="block"><td class="block" width="100%">%s</td></tr>' % childRender
result += '<tr class="block"><td class="block" width="100%%">%s</td></tr>' % childRender
def RenderBlock(repoView, block): if block.hasLocalAttributeValue('blockName'): name = block.blockName else: name = "[no block name]" if block.childrenBlocks.refCount(False) == 0: hasChildren = False else: hasChildren = True result = "" if hasChildren: result += "<table class=block width=100%%>" else: result += "<ta...
self.caps = []
self.caps = [CAP_START]
def sendCapabilities(self): if self.caps is None: self.caps = []
if conduit.share and conduit.share.hidden == False:
if(getattr(conduit, 'share', None) and conduit.share.hidden == False):
def findMatchingShare(view, url): """ Find a Share which corresponds to a URL. @param view: The repository view object @type view: L{repository.persistence.RepositoryView} @param url: A url pointing at a WebDAV Collection @type url: String @return: A Share item, or None """ account = WebDAVAccount.findMatchingAccount...
self.tabNames[activeTab] = self.getUniqueName(node.getItemDisplayName()) page = self.widget.GetPage(activeTab) previousChild = self.childrenBlocks.previous(page.blockItem) page.blockItem.parentBlock = None
nodeName = node.getItemDisplayName() found = False for tabIndex in range(self.widget.GetPageCount()): tabName = self.widget.GetPageText(tabIndex) if tabName == nodeName: found = True newItem = node.item self.widget.SetSelection(tabIndex) if not found: self.tabNames[activeTab] = nodeName page = self.widget.GetPage(activ...
def ChangeCurrentTab(self, node): if hasattr (self, 'widget'): # tabbed container hasn't been rendered yet activeTab = self.widget.GetSelection() self.tabNames[activeTab] = self.getUniqueName(node.getItemDisplayName()) page = self.widget.GetPage(activeTab) previousChild = self.childrenBlocks.previous(page.blockItem) pa...
name = self.getUniqueName("untitled")
name = self._getUniqueName("untitled")
def onNewEvent (self, notification): "Create a new tab" kind = Globals.repository.findPath("parcels/osaf/framework/blocks/HTML") name = self.getUniqueName("untitled") self.widget.selectedTab = len(self.tabNames) self.tabNames.append(name) item = kind.newItem(name, self) item.url = "" item.parentBlock = self item.render...
def getUniqueName (self, name):
def _getUniqueName (self, name):
def getUniqueName (self, name): if not self.hasChild(name): return name number = 1 while self.hasChild(name + str(number)): number += 1 return name + str(number)
while not Sharing.isWebDAVSetUp(self.itsView): if Util.okCancel(wx.GetApp().mainFrame, "Account information required", "Please set up your accounts."): if not AccountPreferences.ShowAccountPreferencesDialog( \ wx.GetApp().mainFrame, view=self.itsView): return else: return
if not Sharing.ensureAccountSetUp(self.itsView): return
def onShareItemEvent (self, event): """ Share an ItemCollection. """ itemCollection = event.arguments ['item']
if not Sharing.isWebDAVSetUp(self.itsView): """ @@@MOR: This needs to change... webdavAccount = self.findPath('//parcels/osaf/framework/sharing/accounts/WebDAVAccount') application.dialogs.AccountPreferences.ShowAccountPreferencesDialog(wx.GetApp().mainFrame, account=webdavAccount) """
if not Sharing.ensureAccountSetUp(self.itsView):
def _onShareOrManageSidebarCollectionEvent(self, event): """ Share the collection selected in the Sidebar. If the current collection is already shared, then manage the collection. In either case, the real work here is to tell the summary view to deselect, and the detail view that the selection has changed to the entire...
""" This doesn't work: navigationBarWidget = Block.findBlockByName('NavigationBar').widget if not navigationBarWidget.GetToolState(0): navigationBarWidget.ToggleTool(0, True)
""" This doesn't appear to work: allKindFilterToolbarItemWidget = Block.findBlockByName('KindFilterAllItem').widget if not allKindFilterToolbarItemWidget.IsToggled(): allKindFilterToolbarItemWidget.Toggle()
def _onShareOrManageSidebarCollectionEvent(self, event): """ Share the collection selected in the Sidebar. If the current collection is already shared, then manage the collection. In either case, the real work here is to tell the summary view to deselect, and the detail view that the selection has changed to the entire...
event.arguments['Enable'] = doManage == (collection is not None and Sharing.isShared(collection))
event.arguments['Enable'] = collection is not None and (doManage == Sharing.isShared(collection))
def _onShareOrManageSidebarCollectionEventUpdateUI (self, event, doManage): """ Update the menu to reflect the selected collection name """ collection = self.getSidebarSelectedCollection () verb = (doManage and _('Manage') or _('Share')) if collection is not None: # event.arguments['Enable'] = True menuTitle = _('%s c...
sharedCollections = self.sharedWebDAVCollections () enable = accountOK and len (sharedCollections) > 0 event.arguments ['Enable'] = enable
haveActiveShares = Sharing.checkForActiveShares(self.itsView) event.arguments ['Enable'] = accountOK and haveActiveShares
def onSyncWebDAVEventUpdateUI (self, event): accountOK = Sharing.isWebDAVSetUp(self.itsView) sharedCollections = self.sharedWebDAVCollections () enable = accountOK and len (sharedCollections) > 0 event.arguments ['Enable'] = enable # @@@DLD set up the help string to let the user know why it's disabled
line += '<td class="number">%2.0fs</td>' % targetAvg
line += '<td class="centered">%2.0fs</td>' % targetAvg
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, currentValue, previousValue): graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] else: targetAvg = 0.0
line += '<td class="number"><span class="%s">%2.2fs</span></td>' % (timeClass, current)
line += '<td class="number%s">%2.2fs</td>' % (timeClass, current)
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, currentValue, previousValue): graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] else: targetAvg = 0.0
tboxfile.write('<table>\n') tboxfile.write('<tr><th></th><th></th>')
tboxfile.write('<table cellspacing="1">\n') tboxfile.write('<tr><th rowspan="2">Test</th><th rowspan="2">0.6<br/>Target</th>')
def generateSummaryPage(self, pagename, tests, startdate, enddate): # tests { testname: { build: { date: { hour: [ (testname, itemDateTime, delta.days, buildname, hour, revision, runs, total, average) ] }}}}
tboxfile.write('<tr><th>Test</th><th>0.6 Target</th>')
tboxfile.write('<tr>')
def generateSummaryPage(self, pagename, tests, startdate, enddate): # tests { testname: { build: { date: { hour: [ (testname, itemDateTime, delta.days, buildname, hour, revision, runs, total, average) ] }}}}
def AddChildNode (self, data, names, hasChildren):
def AddChildNode (self, item, names, hasChildren):
def AddChildNode (self, data, names, hasChildren): childNodeId = self.treeList.AppendItem (self.nodeId, names.pop(0), -1, -1, wxTreeItemData (data)) index = 1 for name in names: self.treeList.SetItemText (childNodeId, name, index) index += 1
wxTreeItemData (data))
wxTreeItemData (item.getUUID()))
def AddChildNode (self, data, names, hasChildren): childNodeId = self.treeList.AppendItem (self.nodeId, names.pop(0), -1, -1, wxTreeItemData (data)) index = 1 for name in names: self.treeList.SetItemText (childNodeId, name, index) index += 1
def AddRootNode (self, data, names, hasChildren): rootNodeId = self.treeList.AddRoot (names.pop(0), -1, -1, wxTreeItemData (data))
def AddRootNode (self, item, names, hasChildren): rootNodeId = self.treeList.AddRoot (names.pop(0), -1, -1, wxTreeItemData (item.getUUID()))
def AddRootNode (self, data, names, hasChildren): rootNodeId = self.treeList.AddRoot (names.pop(0), -1, -1, wxTreeItemData (data)) index = 1 for name in names: SetItemText (rootNodeId, name, index) index += 1
return self.treeList.GetPyData (self.nodeId)
return self.treeList.GetItemData (self.nodeId)
def GetData (self): if self.nodeId: return self.treeList.GetPyData (self.nodeId) else: return None
counterpart.openedContainers [self.GetPyData(id).getUUID()] = True
counterpart.openedContainers [self.GetPyData(id)] = True
def OnExpanding(self, event): """ Load the items in the tree only when they are visible. """ counterpart = Globals.repository.find (self.counterpartUUID) id = event.GetItem() counterpart.GetTreeData(TreeNode (id, self)) """ if the data passed in has a UUID we'll keep track of the state of the opened tree """ try: count...
del counterpart.openedContainers [self.GetPyData(id).getUUID()]
del counterpart.openedContainers [self.GetPyData(id)]
def OnCollapsing(self, event): counterpart = Globals.repository.find (self.counterpartUUID) id = event.GetItem() self.DeleteChildren (id) """ if the data passed in has a UUID we'll keep track of the state of the opened tree """ try: del counterpart.openedContainers [self.GetPyData(id).getUUID()] except AttributeError: ...
notification.SetData ({'item':self.GetPyData(eventId),
notification.SetData ({'item':self.GetItemData(eventId),
def On_wxSelectionChanged(self, event): if self.ignoreSelect: return selection = '' id = self.GetSelection() while id.IsOk(): selection = '/' + self.GetItemText(id) + selection id = self.GetItemParent (id)
item = self.GetPyData(id)
def ExpandContainer (self, openedContainers, id): item = self.GetPyData(id) try: expand = openedContainers [item.getUUID()] except: return
expand = openedContainers [item.getUUID()]
expand = openedContainers [self.GetPyData(id)]
def ExpandContainer (self, openedContainers, id): item = self.GetPyData(id) try: expand = openedContainers [item.getUUID()] except: return
if name == counterpart.GetTreeDataName (self.GetPyData(child)):
if name == counterpart.GetTreeDataName (self.GetItemData(child)):
def GoToPath(self, path): treeNode = self.GetRootItem() counterpart = Globals.repository.find (self.counterpartUUID) child = treeNode for name in path.split ('/'): if name: assert (self.ItemHasChildren (treeNode)) self.Expand (treeNode) child, cookie = self.GetFirstChild (treeNode, 0) while child.IsOk(): try: if name =...
self.SetMargins(0-wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X), 0-wx.SystemSettings_GetMetric(wx.SYS_HSCROLL_Y))
def __init__(self, *arguments, **keywords): """ Giant hack. Calling event.GetEventObject in OnShow of application, while the object is being created cause the object to get the wrong type because of a "feature" of SWIG. So we need to avoid OnShows in this case. """ oldIgnoreSynchronizeWidget = wx.GetApp().ignoreSynchro...
size = event.GetSize()
size = self.GetClientSize()
def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0
widthMinusLastColumn += self.GetColSize (column)
widthMinusLastColumn += self.GetColSize (column) + self._colBorderSize
def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0
lastColumnWidth = lastColumnWidth - wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X)
def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0
if lastColumnWidth > 0:
lastColumnWidth -= self._colBorderSize if lastColumnWidth > 0 and lastColumnIndex > 0:
def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0
self.ForceRefresh()
def OnSize(self, event): if not wx.GetApp().ignoreSynchronizeWidget: size = event.GetSize() widthMinusLastColumn = 0
widthMinusLastColumn += self.blockItem.columnWidths[columnIndex]
widthMinusLastColumn += self.blockItem.columnWidths[columnIndex] + self._colBorderSize
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
remaining = self.GetSize().width - widthMinusLastColumn """ 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 """ remaining = remaining - wx.Sys...
remaining = self.GetClientSize().width - widthMinusLastColumn remaining -= self._colBorderSize
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
def onItemKindChanged(self, op, uItem, attributes):
def onItemKindChanged(self, op, uuid, attributes):
def onItemKindChanged(self, op, uItem, attributes): # Ignore notifications for attributes we don't care about if 'itsKind' not in attributes: #logger.debug("%s: ignoring changes to %s.", #debugName(self), attributes) return
if self.item.isMutating():
if self.item is not None and self.item.isMutating():
def onItemKindChanged(self, op, uItem, attributes): # Ignore notifications for attributes we don't care about if 'itsKind' not in attributes: #logger.debug("%s: ignoring changes to %s.", #debugName(self), attributes) return
def onWatchedItemChanged(self, op, uItem, attributes):
def onWatchedItemChanged(self, op, uuid, attributes):
def onWatchedItemChanged(self, op, uItem, attributes): # Ignore notifications during stamping or deleting if self.item.isMutating(): #logger.debug("%s: ignoring changes to %s during stamping or deletion.", #debugName(self), attributes) return
if self.item.isMutating():
if self.item is None or self.item.isMutating():
def onWatchedItemChanged(self, op, uItem, attributes): # Ignore notifications during stamping or deleting if self.item.isMutating(): #logger.debug("%s: ignoring changes to %s during stamping or deletion.", #debugName(self), attributes) return
def onTimezonePrefsChanged(self, op, item, attributes): if self.synchronizeItemDetail(self.item):
def onTimezonePrefsChanged(self, op, uuid, attributes): if self.item is not None and self.synchronizeItemDetail(self.item):
def onTimezonePrefsChanged(self, op, item, attributes): if self.synchronizeItemDetail(self.item): self.detailRoot().relayoutSizer()
def DecodeObjectList(self, objectStr):
def DecodePythonObject(self, objectStr):
def DecodeObjectList(self, objectStr): mappedObjectStr = objectStr.encode('ascii') mappedObjectStr = self.FixExtraBlanks(mappedObjectStr) mappedObjectStr = base64.decodestring(mappedObjectStr) return cPickle.loads(mappedObjectStr)
def getKind(kindName): kindKind = view.findPath("//Schema/Core/Kind") matching = [] for kind in kindKind.iterItems(): if kind.itsName == kindName: matching.append(kind) if len(matching) == 0: return None return matching[0] def ofKind(kindName, recursive=True): kind = getKind(kindName) if kind is not None: for item ...
def getKind(kindName): kindKind = view.findPath("//Schema/Core/Kind") matching = []
for item in ofKind('Kind'):
for item in view.findPath("//Schema/Core/Kind").iterItems():
def ofKind(kindName, recursive=True): kind = getKind(kindName) if kind is not None: for item in kind.iterItems(recursive=recursive): yield item
coll = Globals.views[0].getSidebarSelectedCollection()
coll = Block.findBlockByName("MainView").getSidebarSelectedCollection()
def importEmail(text, view, coll=None, selectedCollection=False): item = osaf.mail.message.messageTextToKind(view, text) if selectedCollection or coll is None: coll = Globals.views[0].getSidebarSelectedCollection() if item is not None: coll.add(item) return item
eventItem = CalendarEvent(None, newItemParent, **changesDict) item = eventItem.itsItem
try: uuid = UUID(uid) except ValueError: uuid = UUID() logger.info("iCalendar UID not in UUID form (%s)", uid) parent = schema.Item.getDefaultParent(view) kind = Note.getKind(view) item = kind.instantiateItem(None, parent, uuid, withInitialValues=True, **changesDict) eventItem = EventStamp(item) eventItem.add()
def change(key, value): try: key = getattr(EventStamp, key).name except AttributeError: pass changesDict[key] = value
account=None, view=None):
account=None, view=None, modal=True):
def __init__(self, parent, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, resources=None, account=None, view=None):
self.EndModal(True)
if self.modal: self.EndModal(True)
def OnOk(self, evt): if self.__Validate(): self.__ApplyChanges() self.__ApplyDeletions() if sharing.isInboundMailSetUp (self.view): app = schema.ns('osaf.app', self.view) sidebarCollection = app.sidebarCollection sidebarSelectionCollection = Block.findBlockByName("Sidebar").contents assert (isinstance (sidebarSelection...
self.EndModal(False)
if self.modal: self.EndModal(False)
def OnCancel(self, evt): self.__ApplyCancellations() self.EndModal(False) self.Destroy()
if printer.GetLastError() != wx.PRINTER_CANCELLED:
printError = printer.GetLastError() if ((printError != wx.PRINTER_CANCELLED) and (printError != 0)):
def OnPrint(self): data = wx.PrintDialogData(self.printData) data.SetToPage(1) printer = wx.Printer(data) printout = CanvasPrintout(self.canvas) printSuccess = printer.Print(self.frame, printout, True) if not printSuccess: if printer.GetLastError() != wx.PRINTER_CANCELLED: wx.MessageBox("There was a problem printing.\...
print "issub", jabberID, realIDs, searchID
def IsSubscribed(self, jabberID): realIDs = self.roster.getJIDs() searchID = str(jabberID).lower() print "issub", jabberID, realIDs, searchID for realID in realIDs: idParts = str(realID).split('/') if idParts[0].lower() == searchID: print "true" return true print "False" return false
print "true"
def IsSubscribed(self, jabberID): realIDs = self.roster.getJIDs() searchID = str(jabberID).lower() print "issub", jabberID, realIDs, searchID for realID in realIDs: idParts = str(realID).split('/') if idParts[0].lower() == searchID: print "true" return true print "False" return false
print "False"
def IsSubscribed(self, jabberID): realIDs = self.roster.getJIDs() searchID = str(jabberID).lower() print "issub", jabberID, realIDs, searchID for realID in realIDs: idParts = str(realID).split('/') if idParts[0].lower() == searchID: print "true" return true print "False" return false
self.NotifyPresenceChanged(jabberID)
self.NotifyPresenceChanged(who)
def ConfirmSubscription(self, subscriptionType, who): # if we're already doing this, ignore the request if self.confirmDialog != None: return displayName = self.GetNameFromID(who) message = '%s wishes to %s to your presence information. Do you approve?' % (displayName, subscriptionType) self.confirmDialog = wxMessage...
item.isAttributeModifiable('itsKind')
item.isAttributeModifiable('displayName')
def onButtonPressedEventUpdateUI(self, event): item = self.item enable = item is not None and self._isStampable(item) and \ item.isAttributeModifiable('itsKind') event.arguments ['Enable'] = enable
enable = item is not None and item.isAttributeModifiable('private')
enable = item is not None and item.isAttributeModifiable('displayName')
def onTogglePrivateEventUpdateUI(self, event): item = self.item enable = item is not None and item.isAttributeModifiable('private') event.arguments ['Enable'] = enable
event.arguments['Enable'] = len(self.contents) > 0
event.arguments['Enable'] = self.contents is not None and len(self.contents) > 0
def onSelectAllEventUpdateUI(self, event): event.arguments['Enable'] = len(self.contents) > 0
"TestRecurrenceImporting.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)
if isinstance(kind, Kind) and kind.monitorSchema: kind.flushCaches(attrName)
if isinstance(kind, Kind): if kind.monitorSchema or kind.attributesCached: kind.flushCaches(attrName)
def schemaChange(self, op, kind, attrName): if isinstance(kind, Kind) and kind.monitorSchema: kind.flushCaches(attrName)
self.questionText.SetLabel(unicode(text))
self.questionText.SetLabel(unicode(txt))
def __init__(self, parent, proxy): self.proxy = proxy self._init_ctrls(parent) labels = {self.cancelButton : _('Cancel'), self.allButton : _('All events'), self.futureButton : _('All future events'), self.thisButton : _('Just this event')}
def OnDaySelect(self, event): index = event.GetEventObject().index
def OnDaySelect(self, day):
def OnDaySelect(self, event): # pick the date based on the index index = event.GetEventObject().index startDate = self.blockItem.rangeStart selectedDate = startDate + DateTime.RelativeDateTime(days=index) # @@@ add method on block item for setting selected date self.blockItem.selectedDate = selectedDate self.blockItem...
selectedDate = startDate + DateTime.RelativeDateTime(days=index)
selectedDate = startDate + DateTime.RelativeDateTime(days=day)
def OnDaySelect(self, event): # pick the date based on the index index = event.GetEventObject().index startDate = self.blockItem.rangeStart selectedDate = startDate + DateTime.RelativeDateTime(days=index) # @@@ add method on block item for setting selected date self.blockItem.selectedDate = selectedDate self.blockItem...
def OnWeekSelect(self, event):
def OnWeekSelect(self):
def OnWeekSelect(self, event): self.blockItem.dayMode = False self.blockItem.selectedDate = self.blockItem.rangeStart self.blockItem.postDateChanged() self.wxSynchronizeWidget()
def OnExpand(self, event):
def OnExpand(self):
def OnExpand(self, event): self.headerCanvas.toggleSize() self.wxSynchronizeWidget()
self.weekButton = CollectionCanvas.CanvasTextButton(self, "Week", self.bigFont, self.bigFontColor, self.bgColor) self.Bind(wx.EVT_BUTTON, self.parent.OnWeekSelect, self.weekButton) self.dayButtons = [] for day in range(7): button = CollectionCanvas.CanvasTextButton(self, " ", self.bigFont, self.bigFontColor, self.bgCo...
self.weekHeader = wx.colheader.ColumnHeader(self) self.weekHeaderHeight = self.weekHeader.GetSize().height headerLabels = ["Week", "S", "M", "T", "W", "T", "F", "S", "+"] for header in headerLabels: self.weekHeader.AppendItem(header, wx.colheader.COLUMNHEADER_JUST_Center, 30, bSortEnabled=False) self.Bind(wx.colheader....
def OnInit(self): super (wxWeekHeaderCanvas, self).OnInit()
self.weekButton.SetDimensions(0, self.yOffset - self.weekHeaderHeight, self.xOffset, self.weekHeaderHeight) for day in range(6): self.dayButtons[day].SetDimensions(self.xOffset + (self.dayWidth * day), self.yOffset - self.weekHeaderHeight, self.dayWidth, self.weekHeaderHeight) lastWidth = self.size.width - self.scroll...
self.weekHeader.SetDimensions(0, self.yOffset, self.size.width, -1) columnCount = self.weekHeader.GetItemCount() for day in range(columnCount - 2): self.weekHeader.SetUIExtent(day, (0, self.dayWidth)) lastWidth = self.size.width - (self.dayWidth * (columnCount-2)) - self.scrollbarWidth self.weekHeader.SetUIExtent...
def OnSize(self, event): self._doDrawingCalculations()
if (('__WXMAC__' in wx.PlatformInfo) or ('__WXGTK__' in wx.PlatformInfo)): if self.parent.blockItem.dayMode: self.weekButton.SetLabel("Week", font=self.bigFont, fgcolor=self.bigFontColor) else: self.weekButton.SetLabel("Week", font=self.bigBoldFont, fgcolor=wx.BLUE)
def wxSynchronizeWidget(self):
if (('__WXMAC__' in wx.PlatformInfo) or ('__WXGTK__' in wx.PlatformInfo)): if (self.parent.blockItem.dayMode and (selectedDate == currentDate)): self.dayButtons[day].SetLabel(dayName, font=self.bigBoldFont, fgcolor=wx.BLUE) else: self.dayButtons[day].SetLabel(dayName, font=self.bigFont, fgcolor=self.bigFontColor) else:...
self.weekHeader.SetLabelText(day+1, dayName)
def wxSynchronizeWidget(self):
self.yOffset - self.weekHeaderHeight,
self.yOffset,
def DrawBackground(self, dc): self._doDrawingCalculations()
dc.DrawLine(0, self.yOffset - self.weekHeaderHeight, self.xOffset + self.size.width, self.yOffset - self.weekHeaderHeight) dc.DrawLine(0, self.yOffset, self.xOffset + self.size.width, self.yOffset) for day in range(self.parent.blockItem.daysPerView): dc.DrawLine(self.xOffset + (self.dayWidth * day), self.yOffset - se...
def DrawBackground(self, dc): self._doDrawingCalculations()
rect = wx.Rect((self.dayWidth * day) + self.xOffset, self.yOffset,
rect = wx.Rect((self.dayWidth * day) + self.xOffset, self.yOffset + self.weekHeaderHeight,
def DrawCells(self, dc): self._doDrawingCalculations() self.canvasItemList = []
self.yOffset - 20,
self.yOffset,
def DrawCells(self, dc): self._doDrawingCalculations() self.canvasItemList = [] # Delegate the drawing of each day startDay = self.blockItem.rangeStart + \ DateTime.RelativeDateTime(days=-6, weekday=(DateTime.Sunday, 0))
(-1, self.toolSize.height),
(-1, self.toolSize.height+heightGutter),
def instantiateWidget (self): self.ensureDynamicChildren () toolbar = wxToolbar(self.parentBlock.widget, Block.Block.getWidgetID(self), wx.DefaultPosition, (-1, self.toolSize.height), style=self.calculate_wxStyle()) # set the tool bitmap size right away toolbar.SetToolBitmapSize((self.toolSize.width, self.toolSize.heig...
COLLECTION_ADJECTIVES = ['Critical', 'Eventual', 'Sundry', 'Ignorable', 'Miscellaneous', 'Fascinating'] COLLECTION_NOUNS = ['Items', 'Scratchings', 'Things', 'Oddments', 'Stuff', 'Dregs', 'Fewmets' ]
COLLECTION_NAMES = ['Scratchings', 'Home', 'Work', 'OSAF', 'Kids', 'School', 'Book club', 'Wine club', 'Karate', 'Knitting', 'Soccer', 'Chandler', 'Cosmo', 'Scooby', 'Choir', 'Movies', 'Snowball', 'Lassie', 'Humor', 'Odds n Ends', 'BayCHI', 'OSCON', 'IETF', 'Financial', 'Medical', 'Philanthropy']
def GenerateEventTask(view, days=30, tzinfo=None): """ Generate one Task/Event stamped item """ event = GenerateCalendarEvent(view, days, tzinfo=tzinfo) event.StampKind('add', pim.TaskMixin.getKind(event.itsView)) return event
potentialName = ' '.join((random.choice(COLLECTION_ADJECTIVES), random.choice(COLLECTION_NOUNS),))
potentialName = random.choice(COLLECTION_NAMES)
def GenerateCollection(view, postToView=None, existingNames=None): collection = pim.ListCollection(view=view) while True: # Find a name that isn't already in use potentialName = ' '.join((random.choice(COLLECTION_ADJECTIVES), random.choice(COLLECTION_NOUNS),)) if existingNames is None or potentialName not in existingN...
for index in range(random.randint(1, maxCollCount)):
for index in range(random.randint(0, maxCollCount)):
def GenerateItems(view, count, function, collections=[], *args, **dict): """ Generate 'count' content items using the given function (and args), and add them to a subset of the given collections (if given) """ # At most, we'll add each item to a third of the collections, if we were given any maxCollCount = (len(collec...
'subKinds', 'extent']
'subKinds', 'extent', 'inheritedSuperKinds', 'inheritingSubKinds']
def testAttributeIteration(self): """Test iteration over attributes""" kind = self._find('//Schema/Core/Kind') self.assert_(kind is not None)
def emulate_menu_accelerator(string, ctrlFlag=True, altFlag=False, shiftFlag=False):
def emulate_menu_accelerator(stringOrKeyCode, ctrlFlag=True, altFlag=False, shiftFlag=False):
def emulate_menu_accelerator(string, ctrlFlag=True, altFlag=False, shiftFlag=False): """ Emulate typing a key accelerator that's handled by a menu. This searches through the items in the main frame's menu bar, and tries to find once whose accelerator matches. Unfortunately, just processing a keydown/keyup pair doesn't...
Returns C{True} if a matching item is found, and it was dispatched
@param stringOrKeyCode: The keypress to emulate. Either specify one of the constants wx.WXK_* or a single-character str @type stringOrKeyCode: C{int} or C{str}. @param ctrlFlag: C{True} if you want to simulate the Control key being held down during the keypress. (This is the same as holding down the "open apple" key o...
def emulate_menu_accelerator(string, ctrlFlag=True, altFlag=False, shiftFlag=False): """ Emulate typing a key accelerator that's handled by a menu. This searches through the items in the main frame's menu bar, and tries to find once whose accelerator matches. Unfortunately, just processing a keydown/keyup pair doesn't...
""" assert len(string) == 1, "Pass in a single-character string to emulate_menu_accelerator"
@rtype: C{bool} """
def emulate_menu_accelerator(string, ctrlFlag=True, altFlag=False, shiftFlag=False): """ Emulate typing a key accelerator that's handled by a menu. This searches through the items in the main frame's menu bar, and tries to find once whose accelerator matches. Unfortunately, just processing a keydown/keyup pair doesn't...
try: desiredKeyCode = ord(stringOrKeyCode.upper()) except AttributeError: desiredKeyCode = stringOrKeyCode else: assert len(stringOrKeyCode) == 1, "Pass in a single-character string to emulate_menu_accelerator" if stringOrKeyCode.isupper(): shiftFlag = True
def emulate_menu_accelerator(string, ctrlFlag=True, altFlag=False, shiftFlag=False): """ Emulate typing a key accelerator that's handled by a menu. This searches through the items in the main frame's menu bar, and tries to find once whose accelerator matches. Unfortunately, just processing a keydown/keyup pair doesn't...
if shiftFlag or string.isupper(): desiredFlags |= wx.ACCEL_SHIFT desiredKeyCode = ord(string.upper())
if shiftFlag: desiredFlags |= wx.ACCEL_SHIFT
def emulate_menu_accelerator(string, ctrlFlag=True, altFlag=False, shiftFlag=False): """ Emulate typing a key accelerator that's handled by a menu. This searches through the items in the main frame's menu bar, and tries to find once whose accelerator matches. Unfortunately, just processing a keydown/keyup pair doesn't...
unicode(channel.get('description','')))
unicode(channel.get('description',''),encoding))
def setChannel(self,parserData,rssURL): encoding = parserData.get('encoding','latin_1') channel = parserData['channel'] self.setAttributeValue("creator", unicode(channel.get('creator',''),encoding)) self.setAttributeValue("description", unicode(channel.get('description',''))) self.setAttributeValue("link",channel.get('...
date = self.lastModified
date = self.getAttributeValue('lastModified',default=None)
def getModifiedDateString(self): date = self.lastModified if (date): return date.localtime().strftime('%a %m/%d %I:%M %p') else: return ''