rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.Expand(id)
if self.IsVisible (id): self.Expand(id)
def ExpandContainer (self, openedContainers, id): try: expand = openedContainers [self.GetItemData(id).GetData()] except KeyError: pass else: self.LoadChildren(id)
if collection is not None and item in collection:
if collection is not None and collection.__contains__(item, True):
def _reIndex(self, op, item, attrName, collectionName, indexName):
menuBar.Check(XRCID('CreateNewRepository'), hasattr (application.Application.app.model, 'CreateNewRepository'))
def ShowOrHideDebugMenu(self, showFlag): hasMenu = self.HasDebugMenu() if hasMenu == showFlag: return menuBar = self.GetMenuBar() if hasMenu: index = menuBar.FindMenu(_('Debug')) oldMenu = menuBar.Remove(index) del oldMenu else: applicationResources = application.Application.app.applicationResources debugMenu = applic...
Globals.app = self
Globals.application = self
def OnInit(self): """ Main application initialization. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.jabberClient = None self.presenceWindow = None self.chandlerDirectory = os.path.dirname (os.path.abspath (sys.argv[0]))
Globals.agentManager = AgentManager.AgentManager()
def OnInit(self): """ Main application initialization. """ self.applicationResources=None self.association={} self.chandlerDirectory=None self.parcels={} self.storage=None self.model=None self.jabberClient = None self.presenceWindow = None self.chandlerDirectory = os.path.dirname (os.path.abspath (sys.argv[0]))
self.InvalidateSelection () def OnLabelLeftClicked (self, event): assert (event.GetRow() == -1) blockItem = self.blockItem column = blockItem.columns[event.GetCol()] indexName = column.indexName sameColumn = blockItem.contents.indexName == indexName blockItem.contents.setCollectionIndex(indexName, toggleDescending=sam...
lastRow = self.GetNumberCols() - 1 for rowStart, rowEnd in self.SelectedRowRanges(): dirtyRect = wx.Rect() dirtyRect.SetTopLeft(self.CellToRect(rowStart, 0).GetTopLeft()) dirtyRect.SetBottomRight(self.CellToRect(rowEnd, lastRow).GetBottomRight()) dirtyRect.OffsetXY (self.GetRowLabelSize(), self.GetColLabelSize()) self...
def OnLoseFocus (self, event): self.SetLightSelectionBackground() # Calling InvalidateSelection when the Table block is # out of sync with the data, i.e. the data has changed # but the block hasn't yet synchronized to the data # triggers an assert. So let's fire the notifications # and, if the block is dirtied, skip in...
if not loading: self._changeRef(key)
def __setitem__(self, key, value, previousKey=None, nextKey=None, alias=None, load=True):
old.detach(item, self._name, old.other(item), self._otherName)
if value is not old: old.detach(item, self._name, old.other(item), self._otherName)
def __setitem__(self, key, value, previousKey=None, nextKey=None, alias=None, load=True):
"linkedTo" : ("SMTP_PORT", { True:"465", False:"25" } )
"linkedTo" : ("SMTP_PORT", { True:"25", False:"25" } )
def IMAPSaveHandler(item, fields, values): newAddressString = values['IMAP_EMAIL_ADDRESS'] newFullName = values['IMAP_FULL_NAME'] newUsername = values['IMAP_USERNAME'] newServer = values['IMAP_SERVER'] # If either the host or username changes, we need to set this account item # to inactive and create a new one. if (it...
super(wxInPlaceEditor, self).__init__(style=wx.TE_PROCESS_ENTER | wx.NO_BORDER,
style=wx.TE_PROCESS_ENTER | wx.NO_BORDER if '__WXGTK__' in wx.PlatformInfo: style |= wx.TE_MULTILINE super(wxInPlaceEditor, self).__init__(style=style,
def __init__(self, *arguments, **keywords): super(wxInPlaceEditor, self).__init__(style=wx.TE_PROCESS_ENTER | wx.NO_BORDER, *arguments, **keywords) self.item = None self.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter) self.Bind(wx.EVT_KILL_FOCUS, self.OnTextEnter) self.Hide()
if '__WXGTK__' in wx.PlatformInfo: newSize.height = pointSize + 8
def SetItem(self, item, position, size, pointSize): self.item = item self.SetValue(item.displayName)
if not super(PyMiniCalendar, self).Create(parent, id, pos, size, style | wx.CLIP_CHILDREN, wx.DefaultValidator, name): return False
def Create(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, name="PyMiniCalendar", targetDate=None): if not super(PyMiniCalendar, self).Create(parent, id, pos, size, style | wx.CLIP_CHILDREN, wx.DefaultValidator, name): return False
def GetDefaultAttributes(self): return self.GetClassDefaultAttributes(self.GetWindowVariant()) @staticmethod def GetClassDefaultAttributes(variant): return wx.ListBox.GetClassDefaultAttributes(variant)
def HitTest(self, pos): # we need to find out if the hit is on left arrow, on month or # on right arrow
whoTo = item.whoTo
whoTo = item.who
def onSendShareItemEvent (self, notification): item = self.selectedItem() # preflight the send/share request # mail items and collections need their recievers set up try: whoTo = item.whoTo except AttributeError: whoTo = [] if len (whoTo) == 0: if isinstance (item, ItemCollection.ItemCollection): message = _('Please sp...
doCopyLog("***Error during tests***", testDir, 'do_tests.log', log)
doCopyLog("***Error during unit tests***", testDir, 'do_tests.log', log)
def doTests(mode, workingDir, outputDir, buildVersion, log): testDir = os.path.join(workingDir, "chandler") os.chdir(testDir) try: print "Testing " + mode log.write(separator) log.write("Testing " + mode + " ...\n") outputList = hardhatutil.executeCommandReturnOutput(['./tools/do_tests.sh', '-u', '-m %s' % mode]) har...
event.arguments['Enabled'] = False
event.arguments['Enable'] = False
def onRemoveEventUpdateUI(self, event): # so you can't use the delete key to delete a collection event.arguments['Enabled'] = False
preferDate = False
preferDate = hideTime
def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): """ Draw the date & time, somewhat in the style that Apple Mail does: Date left justified, time right justified. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False)
if timeString is None:
if timeString is None and not hideTime:
def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): """ Draw the date & time, somewhat in the style that Apple Mail does: Date left justified, time right justified. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False)
timeWidth, ignored = dc.GetTextExtent(timeString)
timeWidth, ignored = dc.GetTextExtent(timeString) if not hideTime else (0, 0)
def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): """ Draw the date & time, somewhat in the style that Apple Mail does: Date left justified, time right justified. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False)
dc.DrawText(timeString, rect.x + rect.width - (timeWidth + 2), rect.y + 1)
if not hideTime: dc.DrawText(timeString, rect.x + rect.width - (timeWidth + 2), rect.y + 1)
def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): """ Draw the date & time, somewhat in the style that Apple Mail does: Date left justified, time right justified. """ item = RecurrenceDialog.getProxy(u'ui', item, createNew=False)
dc.DrawText(item.displayName, eventTitleOffset, y)
dc.DrawText(item.displayName, self.margin, y)
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...
dc.SetBrush(wx.WHITE_BRUSH) selectedBox = None
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
headline = time.Format('%I:%M %p ') + item.displayName if (self.parent.blockItem.selection is item): dc.SetBrush(wx.Brush(wx.Colour(229, 229, 229)))
if self.parent.blockItem.selection is item: selectedBox = canvasItem
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
dc.SetBrush(wx.WHITE_BRUSH) dc.SetPen(wx.Pen(wx.Colour(153, 153, 153))) dc.DrawRoundedRectangleRect(itemRect, radius=10) if (item.transparency == "confirmed"): pen = wx.Pen(wx.BLACK, 3) elif (item.transparency == "fyi"): pen = wx.Pen(wx.LIGHT_GREY, 3) elif (item.transparency == "tentative"): pen = wx.Pen(wx.BLACK, 3,...
self.DrawCanvasItem(canvasItem, dc)
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
dc.SetFont(self.smallBoldFont) y = self.DrawWrappedText(dc, timeString, timeRect)
if selectedBox: dc.SetBrush(wx.Brush(wx.Colour(229, 229, 229))) self.DrawCanvasItem(selectedBox, dc)
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
textRect = wx.Rect(itemRect.x + 3 + 5, y, itemRect.width - (3 + 10), itemRect.height - (y - itemRect.y)) dc.SetFont(self.smallFont) self.DrawWrappedText(dc, item.displayName, textRect)
def DrawCanvasItem(self, canvasItem, dc): item = canvasItem.item itemRect = canvasItem.bounds time = item.startTime headline = time.Format('%I:%M %p ') + item.displayName dc.SetPen(wx.Pen(wx.Colour(153, 153, 153))) dc.DrawRoundedRectangleRect(itemRect, radius=10) if (item.transparency == "confirmed"): pen = wx.Pen(...
def DrawDay(self, dc, date, rect): # Scaffolding, we'll get more sophisticated here
super(RecurrenceEndsAttributeEditor, self).\ SetAttributeValue(item, attributeName, valueString)
try: oldValue = getattr(item, attributeName, None) dateValue = pim.shortDateFormat.parse(newValueString, referenceDate=oldValue) except (ICUError, ValueError): self._changeTextQuietly(self.control, "%s ?" % newValueString) return if eventTZ == ICUtzinfo.floating: eventTZ == ICUtzinfo.default value = datetime.com...
def SetAttributeValue(self, item, attributeName, valueString): if attributeName != 'until': attributeName = 'until' try: item = item.rruleset.rrules.first() except AttributeError: assert False, "Hey - Setting 'ends' on an event without a recurrence rule?" # If the user removed the string, remove the attribute. newValu...
(proxy.startTime, proxy.endTime) = self.GetDragAdjustedTimes()
(startTime, endTime) = self.GetDragAdjustedTimes() duration = endTime - startTime proxy.duration = endTime - startTime
def FinishDrag(self): currentCanvasItem = self.dragState.currentDragBox if not currentCanvasItem.CanDrag(): return
if newEndTime - newStartTime <= timedelta(0): newStartTime = newEndTime - timedelta(minutes=15)
if newEndTime.tzinfo is None: newEndTime = newEndTime.replace(tzinfo=newStartTime.tzinfo)
def GetDragAdjustedTimes(self): """ Return a new start/end time for the currently selected event, based on the current position and drag state. Handles both move and resize drags """ item = self.dragState.originalDragBox.GetItem() resizeMode = self.dragState.originalDragBox.resizeMode if resizeMode is None: # moving an...
if newEndTime - newStartTime <= timedelta(0): newEndTime = newStartTime + timedelta(minutes=15)
if newStartTime.tzinfo is None: newStartTime = newStartTime.replace(tzinfo=newEndTime.tzinfo) if newEndTime < newStartTime: newEndTime = newStartTime + timedelta(minutes=15)
def GetDragAdjustedTimes(self): """ Return a new start/end time for the currently selected event, based on the current position and drag state. Handles both move and resize drags """ item = self.dragState.originalDragBox.GetItem() resizeMode = self.dragState.originalDragBox.resizeMode if resizeMode is None: # moving an...
if collection is None:
if collection is None and isinstance(self.contents, ContentCollection):
def __getPrimaryCollection(self): """ the primary collection is probably contentsCollection - that's the collection around which most remove/delete actions should occur. But in case that isn't set, we can just default to self.contents """ collection = self.contentsCollection if collection is None: collection = self.con...
self.itsView.unwatchItem(self, item, 'onWatchedItemChanged')
if item is not None: self.itsView.unwatchItem(self, item, 'onWatchedItemChanged')
def stopWatchingForChanges(self): try: watchedAttributes = self.widget.watchedAttributes except AttributeError: pass else: if watchedAttributes is not None: #logger.debug('%s: stopping watching for changes in %s on %s', #debugName(self), watchedAttributes, #debugName(self.item)) item = getattr(self.item, 'proxiedItem',...
changedAttributesWeCareAbout = self.widget.watchedAttributes.intersection(attributes)
changedAttributesWeCareAbout = watchedAttrs.intersection(attributes)
def onWatchedItemChanged(self, op, item, attributes): # Ignore notifications during stamping or deleting if isitem(item) and item.isMutating(): #logger.debug("%s: ignoring changes to %s during stamping or deletion.", #debugName(self), attributes) return
def __del__(self):
def Destroy(self):
def __del__(self): Block.wxOnDestroyWidget (self)
line = '<tr><td><a href="detail_%s.html
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, currentValue, previousValue): line = '<tr><td><a href="detail_%s.html#%s" target="_new">%s</a></td>' % (enddate, testkey, testDisplayName) graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] el...
line += '<td class="number">%2.0fs</td>' % targetAvg
def _generateSummaryDetailLine(self, platforms, testkey, enddate, testDisplayName, currentValue, previousValue): line = '<tr><td><a href="detail_%s.html#%s" target="_new">%s</a></td>' % (enddate, testkey, testDisplayName) graph = [] if testkey in self.SummaryTargets.keys(): targetAvg = self.SummaryTargets[testkey] el...
tboxfile.write('<tr><th></th>') tboxfile.write('<th colspan="5">Windows (r %s vs %s)</th>' % (revisions['win'][0], revisions['win'][1])) tboxfile.write('<th colspan="5">OS X (r %s vs %s)</th>' % (revisions['osx'][0], revisions['osx'][1])) tboxfile.write('<th colspan="5">Linux (r %s vs %s)</th></tr>\n' % (revisions['lin...
tboxfile.write('<tr><th></th><th></th>') tboxfile.write('<th colspan="4">Windows (r %s vs %s)</th>' % (revisions['win'][0], revisions['win'][1])) tboxfile.write('<th colspan="4">OS X (r %s vs %s)</th>' % (revisions['osx'][0], revisions['osx'][1])) tboxfile.write('<th colspan="4">Linux (r %s vs %s)</th></tr>\n' % (revis...
def generateSummaryPage(self, pagename, tests, startdate, enddate): # tests { testname: { build: { date: { hour: [ (testname, itemDateTime, delta.days, buildname, hour, revision, runs, total, average) ] }}}}
unary_fns = ['len']
unary_fns = ['date','len']
def compile_predicate(ast): """ Compile an abstract syntax tree into a python expression that can be passed to eval
pred = "%s(%s)" % (fn, compile_predicate(args[0]))
if fn == 'date': pred = "mx.DateTime.ISO.ParseDateTime(%s)" % compile_predicate(args[0]) else: pred = "%s(%s)" % (fn, compile_predicate(args[0]))
def infix_op(op, args): """ Helper function to construct an infix operator """ log.debug("infix op: %s %s" % (op, args)) return "%s %s %s" % (compile_predicate(args[0]), op, compile_predicate(args[1]))
print ast
def analyze_union(ast): """ Produce a logical plan that corresponds to the 'union' statement represented by the AST. (The AST is actually the list of arguments to 'union') """ print ast queries = [ self.__analyze(i) for i in ast[0] ] return ('union', queries)
print ast
def analyze_intersect(ast): """ Produce a logical plan that corresponds to the 'intersect' statement represented by the AST (The AST is the two arguments to 'intersect') """ print ast queries = [ self.__analyze(i) for i in ast[0:2] ] print queries return ('intersect', queries)
print queries
def analyze_intersect(ast): """ Produce a logical plan that corresponds to the 'intersect' statement represented by the AST (The AST is the two arguments to 'intersect') """ print ast queries = [ self.__analyze(i) for i in ast[0:2] ] print queries return ('intersect', queries)
def cleanDependencies(buildenv, module_name, history={}):
def cleanDependencies(buildenv, module_name, history=None):
def cleanDependencies(buildenv, module_name, history={}): """ Based on the list of dependencies in the module's __hardhat_.py file, call each one's clean(), and then call module's clean(). Parameters: buildenv: the build environment dictionary module_name: the directory name of the subproject history: keeps track of wh...
def buildDependencies(buildenv, module_name, history={}):
def buildDependencies(buildenv, module_name, history=None):
def buildDependencies(buildenv, module_name, history={}): """ Based on the list of dependencies in the module's __hardhat_.py file, call each one's build(), and then call module's build(). Parameters: buildenv: the build environment dictionary module_name: the directory name of the subproject history: keeps track of wh...
def scrubDependencies(buildenv, module_name, history={}):
def scrubDependencies(buildenv, module_name):
def scrubDependencies(buildenv, module_name, history={}): """ Based on the list of dependencies in the module's __hardhat_.py file, call scrub() on each one, and then call scrub() on the module. Parameters: buildenv: the build environment dictionary module_name: the directory name of the subproject history: keeps track...
history: keeps track of which subprojects have been scrubbed, so that each is scrubbed only once
def scrubDependencies(buildenv, module_name, history={}): """ Based on the list of dependencies in the module's __hardhat_.py file, call scrub() on each one, and then call scrub() on the module. Parameters: buildenv: the build environment dictionary module_name: the directory name of the subproject history: keeps track...
def getDependencies(buildenv, module_name, history={}):
def getDependencies(buildenv, module_name, history=None): if not history: history = {}
def getDependencies(buildenv, module_name, history={}): module_path = buildenv['root'] + os.sep + module_name + os.sep + \ "__hardhat__.py" module = module_from_file(buildenv, module_path, module_name) for dependency in module.dependencies: if not history.has_key(dependency): getDependencies(buildenv, dependency, histo...
buildPrepareSource(buildenv, releaseId, cvsModule)
buildPrepareSource(buildenv, releaseId, cvsModule, True)
def buildComplete(buildenv, releaseId, cvsModule, module): if os.environ.has_key('CVS') and os.environ.has_key('SCP') and \ os.environ.has_key('TAR') and \ (buildenv['os'] == 'win' and os.environ.has_key('ZIP') or \ buildenv['os'] != 'win' and os.environ.has_key('GZIPEXE') ): log(buildenv, HARDHAT_MESSAGE, "HardHat", "...
os.chdir(buildenv['root'])
def buildRelease(buildenv, releaseId, module): compressedFileRoot = module + "_" + buildenv['oslabel'] + \ "_dev_release_" + releaseId distName = module + "_" + buildenv['oslabel'] + "_" + releaseId distCompressedFileRoot = module + "_" + buildenv['oslabel'] + "_" + \ releaseId try: buildenv['version'] = 'release' bui...
os.chdir(buildenv['root'])
def buildDebug(buildenv, releaseId, module): compressedFileRoot = module + "_" + buildenv['oslabel'] + \ "_dev_debug_" + releaseId try: buildenv['version'] = 'debug' buildDependencies(buildenv, module) os.chdir(buildenv['root']) compressedFile = compressDirectory(buildenv, "debug", compressedFileRoot) log(buildenv, ...
modDir = os.path.exists(os.path.join(workingDir, module))
modDir = os.path.join(workingDir, module)
def Start(hardhatScript, workingDir, cvsVintage, buildVersion, clobber, log): global buildenv, changes try: buildenv = hardhatlib.defaults buildenv['root'] = workingDir buildenv['hardhatroot'] = whereAmI hardhatlib.init(buildenv) except hardhatlib.HardHatMissingCompilerError: print "Could not locate compiler. Exiti...
commonName = itsName itsName = itsName.replace('/', '_')
if itsName is not None: commonName = itsName itsName = itsName.replace('/', '_') else: commonName = x509.get_subject().commonName or ''
def loadCerts(parcel, moduleName, filename='cacert.pem'): # Load cacert.pem into the repository import os, sys import logging from M2Crypto import X509, util from M2Crypto.EVP import MessageDigest log = logging.getLogger(__name__) chop = -1 cert = schema.ns('osaf.framework.certstore', parcel) lobType = schema.item...
subject = x509.get_subject()
def loadCerts(parcel, moduleName, filename='cacert.pem'): # Load cacert.pem into the repository import os, sys import logging from M2Crypto import X509, util from M2Crypto.EVP import MessageDigest log = logging.getLogger(__name__) chop = -1 cert = schema.ns('osaf.framework.certstore', parcel) lobType = schema.item...
(subject.CN))
(commonName))
def loadCerts(parcel, moduleName, filename='cacert.pem'): # Load cacert.pem into the repository import os, sys import logging from M2Crypto import X509, util from M2Crypto.EVP import MessageDigest log = logging.getLogger(__name__) chop = -1 cert = schema.ns('osaf.framework.certstore', parcel) lobType = schema.item...
method = getattr (type(widget), 'GetParent', None) if method is not None: parent = method (widget) """ Remove child from parent before destroying child. """ if isinstance (widget, wx.Window): parent = widget.GetParent() if parent: parent.RemoveChild (widget)
methodGetParent = getattr (type(widget), 'GetParent', None) if methodGetParent is not None: parent = methodGetParent (widget) methodGetChildren = getattr (type(parent), 'GetChildren', None) if methodGetChildren is not None: numberChildren = len (methodGetChildren (parent))
def unRender (self): for child in self.childrenBlocks: child.unRender() widget = getattr (self, 'widget', None)
'--chandlerTestLogfile=FunctionalTestSuite.log', '--chandlerTestDebug=1',
'--chandlerTestDebug=0',
def doFunctionalTests(releaseMode, workingDir, log): chandlerDir = os.path.join(workingDir, 'chandler') logDir = os.path.join(chandlerDir, 'test_profile') chandlerLog = os.path.join(logDir, 'chandler.log') FuncTestLog = os.path.join(logDir, 'FunctionalTestSuite.log') if buildenv['os'] == 'win': runChan...
dumpTestLogs(log, chandlerLog, FuncTestLog)
dumpTestLogs(log, chandlerLog)
def doFunctionalTests(releaseMode, workingDir, log): chandlerDir = os.path.join(workingDir, 'chandler') logDir = os.path.join(chandlerDir, 'test_profile') chandlerLog = os.path.join(logDir, 'chandler.log') FuncTestLog = os.path.join(logDir, 'FunctionalTestSuite.log') if buildenv['os'] == 'win': runChan...
items = [RSSItemFactory(app.repository).newItem(itemData)
encoding = parseData.get('encoding', 'ascii') items = [RSSItemFactory(app.repository).newItem(itemData, encoding)
def getItemsFromParseData(self,parseData): items = [RSSItemFactory(app.repository).newItem(itemData) for itemData in parseData['items']] return items
def newItem(self, itemData): item = RSSItem(itemData.get('title',''),self._container,self._kind) item.initAttributes(itemData)
def newItem(self, itemData, encoding): item = RSSItem(unicode(itemData.get('title',''), encoding), self._container,self._kind) item.initAttributes(itemData, encoding)
def newItem(self, itemData): item = RSSItem(itemData.get('title',''),self._container,self._kind) item.initAttributes(itemData) return item
for index in xrange(self.GetColumnCount()):
for index in xrange(wx.gizmos.TreeListCtrl.GetColumnCount(self)):
def ExpandContainer (self, openedContainers, id): try: expand = openedContainers [self.GetItemData(id).GetData()] except KeyError: pass else: self.LoadChildren(id)
info = wx.gizmos.TreeListColumnInfo()
def ExpandContainer (self, openedContainers, id): try: expand = openedContainers [self.GetItemData(id).GetData()] except KeyError: pass else: self.LoadChildren(id)
imageName = self.GetAttributeValue(item, attributeName) + ".png" image = wx.GetApp().GetImage(imageName) if image is not None: x = rect.GetLeft() + (rect.GetWidth() - image.GetWidth()) / 2 y = rect.GetTop() + (rect.GetHeight() - image.GetHeight()) / 2 dc.DrawBitmap (image, x, y, True)
imageName = self.GetAttributeValue(item, attributeName) if len(imageName): imageName += ".png" image = wx.GetApp().GetImage(imageName) if image is not None: x = rect.GetLeft() + (rect.GetWidth() - image.GetWidth()) / 2 y = rect.GetTop() + (rect.GetHeight() - image.GetHeight()) / 2 dc.DrawBitmap (image, x, y, True)
def Draw (self, dc, rect, item, attributeName, isInSelection=False): dc.DrawRectangleRect(rect) # always draw the background imageName = self.GetAttributeValue(item, attributeName) + ".png" image = wx.GetApp().GetImage(imageName) if image is not None: x = rect.GetLeft() + (rect.GetWidth() - image.GetWidth()) / 2 y = re...
info['name'], "Copying MSVCR70.DLL to debug/bin") hardhatlib.copyFile("msvcr70.dll", buildenv['root'] + \
info['name'], "Copying MSVCR70D.DLL to debug/bin") hardhatlib.copyFile("msvcr70d.dll", buildenv['root'] + \
def build(buildenv): os.chdir("distrib") if buildenv['os'] == 'posix' or buildenv['os'] == 'osx': if buildenv['os'] == 'posix': os.chdir("linux") if buildenv['os'] == 'osx': os.chdir("osx") if buildenv['version'] == 'release': hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Copying RunRelease to r...
if self.blockItem.doSelectWeek: style |= wx.minical.CAL_HIGHLIGHT_WEEK
calendarButton = Block.Block.findBlockByName("ApplicationBarEventButton") try: if calendarButton.selected and self.blockItem.doSelectWeek: style |= wx.minical.CAL_HIGHLIGHT_WEEK except AttributeError: pass
def wxSynchronizeWidget(self): style = wx.minical.CAL_SUNDAY_FIRST | wx.minical.CAL_SHOW_SURROUNDING_WEEKS if '__WXMAC__' in wx.PlatformInfo: style |= wx.BORDER_SIMPLE else: style |= wx.BORDER_STATIC if self.blockItem.doSelectWeek: style |= wx.minical.CAL_HIGHLIGHT_WEEK self.SetWindowStyle(style)
doSelectWeek = schema.One(schema.Boolean, initialValue = False)
doSelectWeek = schema.One(schema.Boolean, initialValue = True)
def resetMonth(self): for day in range(1,32): self.ResetAttr(day)
msg = "Error syncing the '%s' collection\n" % share.contents.getItemDisplayName() msg += "using the '%s' account:\n\n" % share.conduit.account.getItemDisplayName() msg += err.message
try: msg = "Error syncing the '%s' collection\n" % share.contents.getItemDisplayName() msg += "using the '%s' account:\n\n" % share.conduit.account.getItemDisplayName() msg += err.message except: msg = "Error during sync"
def syncShare(share): try: share.sync() except SharingError, err: msg = "Error syncing the '%s' collection\n" % share.contents.getItemDisplayName() msg += "using the '%s' account:\n\n" % share.conduit.account.getItemDisplayName() msg += err.message application.dialogs.Util.ok(wx.GetApp().mainFrame, "Synchronization Er...
title = u'Restore published shares...', helpString = u'Restore previously published shares'),
title = _(u'Restore published shares...'), helpString = _(u'Restore previously published shares')),
def makeVisibleHourMenuItems(parcel): """ Create the 'Visible Hours' submenu. Should look like: Automatic --------- 5 hours 6 hours
if event.transparency == "confirmed": if event.allDay: hours = 12.0 else: hours = event.duration.seconds / (60 * 60)
if (event.transparency == "confirmed" and (event.allDay or (not event.anyTime and event.duration != zero_delta))):
def updateBusy(event, start): # Broken out into a separate function because we're going # to call it for each non-recurring events, and for each # individual occurrence of all the recurring events. # In the case of the latter, event may be the master, or # a modification; we're trying to avoid creating all the # items ...
fraction = busyFractions.get(offset, 0.0) fraction = max(fraction, 0.25) fraction += (hours / 12.0) busyFractions[offset] = min(fraction, 1.0)
midnightStart = datetime.combine(event.startTime.date(), time(0, tzinfo=defaultTzinfo)) if event.allDay: days = event.duration.days + 1 else: days = (event.endTime - midnightStart).days + 1 for day in xrange(days): if event.allDay: hours = 12.0 elif event.anyTime: hours = 1.0 else: dayStart = max(event.startTime, midn...
def updateBusy(event, start): # Broken out into a separate function because we're going # to call it for each non-recurring events, and for each # individual occurrence of all the recurring events. # In the case of the latter, event may be the master, or # a modification; we're trying to avoid creating all the # items ...
timeDeltaDay = timedelta(days=1)
def updateBusy(event, start): # Broken out into a separate function because we're going # to call it for each non-recurring events, and for each # individual occurrence of all the recurring events. # In the case of the latter, event may be the master, or # a modification; we're trying to avoid creating all the # items ...
startDate += timeDeltaDay
startDate += one_day
def updateBusy(event, start): # Broken out into a separate function because we're going # to call it for each non-recurring events, and for each # individual occurrence of all the recurring events. # In the case of the latter, event may be the master, or # a modification; we're trying to avoid creating all the # items ...
self.rangeIncrement = timedelta(days=1)
self.rangeIncrement = one_day
def __init__(self, *arguments, **keywords): super(PreviewArea, self).__init__(*arguments, **keywords) self.rangeIncrement = timedelta(days=1)
endDay = startDay + timedelta(days=1)
endDay = startDay + one_day
def wxSynchronizeWidget(self, useHints=False): # We now want the preview area to always appear. If the # calendar is visible, however, we always want the preview # area to describe today, rather than the currently selected # day. minical = Block.Block.findBlockByName("MiniCalendar") if isMainCalendarVisible() or not m...
if not recover:
if not recover and exclusive:
def restoreTest(f): return (f.endswith('.db') or f.startswith('log.') or f in ('DB_CONFIG', 'DB_VERSION'))
attribute = item.itsKind.getAttribute(self.attributeName, True) if attribute is not None: theType = attribute.getAspect('type') cardinality = attribute.getAspect('cardinality') if theType is None: typeName = "NoneType" else: typeName = theType.itsName
theType = item.getAttributeAspect(self.attributeName, 'type', True) if theType is not None: typeName = theType.itsName cardinality = item.getAttributeAspect(self.attributeName, 'cardinality')
def getItemAttributeTypeInfo(self): """ Get the type & cardinality of the current attribute. @returns: A tuple containing the name of the type and the cardinality of the item/attribute we're operating on @rtype: String """ item = self.item if item is None: return (None, 'single')
def __init__(self, proto): self.proto = proto
s = m.as_string()
def __init__(self, proto): self.proto = proto
def display(self): self.transport.write(">>> ")
if self._debug: self.printMsg("Message:\n %s" % s)
def display(self): self.transport.write(">>> ")
def lineReceived(self, line): self.proto.sendCommand(line)
return sendmail(self._host, self._from, self._to, s ).addCallback(self._messageSent).addErrback(self._sendError)
def lineReceived(self, line): self.proto.sendCommand(line)
class ImapProtocolClient(LineReceiver):
def _messageSent(self, result): msg = "\n\n==================== MESSAGE SENT ================\n\n" self.printMsg(msg) reactor.stop()
def lineReceived(self, line): self.proto.sendCommand(line)
def __init__(self): self._cmdNumber = 1 self.io = TerminalIO(self) stdio.StandardIO(self.io) def dataReceived(self, data): print "\n", data self.io.display() def sendCommand(self, cmd): cmd = "%d %s" % (self._cmdNumber, cmd) self.sendLine(cmd) self._cmdNumber += 1 def disconnect(self): self.transport.loseConnection(...
def _sendError(self, reason): self.printMsg("\n===================SMTP ERROR ==================") print reason reactor.stop()
def __init__(self): self._cmdNumber = 1 self.io = TerminalIO(self) stdio.StandardIO(self.io)
print "\n=========================== Imap Protocol Client ========================\n"
print "\n=========================== SMTP Protocol Client ========================\n"
def clientConnectionLost(self, connector, reason): print '\n================ %s =====================\n' % reason.getErrorMessage() reactor.stop()
host = raw_input(">>> Hostname: ") factory = ClientConnectorFactory() reactor.connectTCP(host, 143, factory)
smtpInput = SMTPMessageInput() stdio.StandardIO(smtpInput)
def clientConnectionLost(self, connector, reason): print '\n================ %s =====================\n' % reason.getErrorMessage() reactor.stop()
promptYesNoCancel(_(u'Do you want to remove the items in this collection?'), viewsmain.clearCollectionPref)
promptYesNoCancel(_(u'Do you also want to delete the items in this collection?'), viewsmain.clearCollectionPref)
def onRemoveEvent(self, event): """ Permanently remove the collection - we eventually need a user confirmation here """
self.assert_(True)
pass except RepositoryOpenDeniedError: pass
def _repositoryExists(self): try: self.rep.open() self.fail() except DBNoSuchFileError: self.assert_(True)
splash = wx.SplashScreen(splashBitmap, wx.SPLASH_CENTRE_ON_SCREEN|wx.SPLASH_TIMEOUT, 6000, None, -1, wx.DefaultPosition, wx.DefaultSize, wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR)
splash=StartupSplash(None, splashBitmap)
def _displayHook(obj): sys.stdout.write(str(obj))
wx.Yield()
def _displayHook(obj): sys.stdout.write(str(obj))
self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_MENU, self.OnCommand, id=-1) self.Bind(wx.EVT_UPDATE_UI, self.OnCommand, id=-1) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroyWindow, id=-1) self.Bind(wx.EVT_SHOW, self.OnShow, id=-1)
def _displayHook(obj): sys.stdout.write(str(obj))
if isinstance(collectionName, unicode): collectionName = str(collectionName)
collectionName = str(collectionName)
def __init__(self, url, collectionName, sendToList, account=None):
factory = smtp.ChandlerESMTPSenderFactory(username, password, self.from_addr, self.sendToList, msg, d, self.account.numRetries, common.TIMEOUT, sslContext, heloFallback, authRequired, self.account.useSSL)
factory = smtpTwisted.ESMTPSenderFactory(username, password, self.from_addr, self.sendToList, msg, d, self.account.numRetries, common.TIMEOUT, sslContext, heloFallback, authRequired, self.account.useSSL) factory.protocol = smtp.ChandlerESMTPSender
def __sendInvitation(self):
_redrawCount = 1
def instantiateWidget(self): if not self.getHasBeenRendered(): self.setRange( datetime.now().date() ) self.setHasBeenRendered() return wxPreviewArea(self.parentBlock.widget, Block.Block.getWidgetID(self), timeCharStyle = self.timeCharacterStyle, eventCharStyle = self.eventCharacterStyle)
self._checkRedraw()
def OnPaint(self, event): self._checkRedraw() dc = wx.PaintDC(self) self.Draw(dc)
self._redrawCount += 1 def _checkRedraw(self): if self._redrawCount > 0: self._redrawCount = 0 if isMainCalendarVisible(): self.ChangeHeightAndAdjustContainers(0) return inRange = list(self.blockItem.getItemsInCurrentRange(dayItems=True, timedItems=True)) self.currentDaysItems = [item for item in inRange if item.tr...
minical = Block.Block.findBlockByName("MiniCalendar") if isMainCalendarVisible() or not minical: startDay = datetime.today() endDay = datetime(startDay.year, startDay.month, startDay.day + 1) else: startDay = minical.widget.getSelectedDate() endDay = datetime(startDay.year, startDay.month, startDay.day + 1) inRange = ...
def wxSynchronizeWidget(self): self._redrawCount += 1
global includeTests, lastFocus, lastSentToWidget
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
if includeTests:
if ProcessEvent.includeTests: if eventType is wx.EVT_MENU: updateUIEvent = wx.UpdateUIEvent (event.GetId()) updateUIEvent.SetEventObject (sentToWidget) sentToWidget.ProcessEvent (updateUIEvent) assert updateUIEvent.GetEnabled() is True, "You're sending a command to a disable menu"
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
if lastFocus != focusWindow: assert newFocusWindow is not None, "Focus window unexpectedly changed"
def focusShouldLookLikeNewFocusWindow (focusWindow, newFocusWindow):
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
assert isinstance (focusWindow, theClass)
assert isinstance (focusWindow, theClass), "The window with the focus is of the wrong class"
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
lastFocus = focusWindow
if ProcessEvent.lastFocus != focusWindow: assert newFocusWindow is not None, "Focus window unexpectedly changed" focusShouldLookLikeNewFocusWindow (focusWindow, newFocusWindow) ProcessEvent.lastFocus = focusWindow
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
assert newFocusWindow is None, "Focus window should have changed"
if newFocusWindow is not None: focusShouldLookLikeNewFocusWindow (focusWindow, newFocusWindow)
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
if lastSentToWidget is not None: method = getattr (lastSentToWidget, "GetValue", None)
if ProcessEvent.lastSentToWidget is not None: method = getattr (ProcessEvent.lastSentToWidget, "GetValue", None)
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...
lastSentToWidget = sentToWidget
ProcessEvent.lastSentToWidget = sentToWidget
def NameToWidget (name): """ Given a name, returns the corresponding widget. """ if type (name) is str: if name == "MainFrame": sentTo = application.mainFrame elif name == "__FocusWindow__": sentTo = wx.Window_FindFocus() else: sentTo = Block.findBlockByName (name) if sentTo is not None: sentTo = sentTo.widget if isins...