rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if _debug: sys.stderr.write(repr(type(htmlSource)) + '\n')
def _resolveRelativeURIs(htmlSource, baseURI, encoding): if _debug: sys.stderr.write("entering _resolveRelativeURIs\n") p = _RelativeURIResolver(baseURI, encoding) if _debug: sys.stderr.write(repr(type(htmlSource)) + '\n') p.feed(htmlSource) return p.output()
from urllib import addinfourl infourl = addinfourl(fp, headers, req.get_full_url())
infourl = urllib.addinfourl(fp, headers, req.get_full_url())
def http_error_default(self, req, fp, code, msg, headers): if ((code / 100) == 3) and (code != 304): return self.http_error_302(req, fp, code, msg, headers) from urllib import addinfourl infourl = addinfourl(fp, headers, req.get_full_url()) infourl.status = code return infourl
infourl = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
if headers.dict.has_key('location'): infourl = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers) else: infourl = urllib.addinfourl(fp, headers, req.get_full_url())
def http_error_302(self, req, fp, code, msg, headers): infourl = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers) infourl.status = code return infourl
infourl = urllib2.HTTPRedirectHandler.http_error_301(self, req, fp, code, msg, headers)
if headers.dict.has_key('location'): infourl = urllib2.HTTPRedirectHandler.http_error_301(self, req, fp, code, msg, headers) else: infourl = urllib.addinfourl(fp, headers, req.get_full_url())
def http_error_301(self, req, fp, code, msg, headers): infourl = urllib2.HTTPRedirectHandler.http_error_301(self, req, fp, code, msg, headers) infourl.status = code return infourl
def _open_resource(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None):
def _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers):
def _open_resource(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """URL, filename, or string --> stream This function lets you define parsers that take any input source (URL, pathname to local or network file, or actual data as a string) and deal with it in a uniform manner. Returne...
auth = None if base64: urltype, rest = urllib.splittype(url_file_stream_or_string) realhost, rest = urllib.splithost(rest) if realhost: user_passwd, realhost = urllib.splituser(realhost) if user_passwd: url_file_stream_or_string = "%s://%s%s" % (urltype, realhost, rest) auth = base64.encodestring(user_passwd).strip()
def _open_resource(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """URL, filename, or string --> stream This function lets you define parsers that take any input source (URL, pathname to local or network file, or actual data as a string) and deal with it in a uniform manner. Returne...
if gzip:
if gzip and zlib: request.add_header("Accept-encoding", "gzip, deflate") elif gzip:
def _open_resource(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """URL, filename, or string --> stream This function lets you define parsers that take any input source (URL, pathname to local or network file, or actual data as a string) and deal with it in a uniform manner. Returne...
opener = urllib2.build_opener(_FeedURLHandler())
elif zlib: request.add_header("Accept-encoding", "deflate") else: request.add_header("Accept-encoding", "") if auth: request.add_header("Authorization", "Basic %s" % auth) if ACCEPT_HEADER: request.add_header("Accept", ACCEPT_HEADER) opener = apply(urllib2.build_opener, tuple([_FeedURLHandler()] + handlers))
def _open_resource(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """URL, filename, or string --> stream This function lets you define parsers that take any input source (URL, pathname to local or network file, or actual data as a string) and deal with it in a uniform manner. Returne...
try: return opener.open(request) except: return _StringIO('')
return opener.open(request)
def _open_resource(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """URL, filename, or string --> stream This function lets you define parsers that take any input source (URL, pathname to local or network file, or actual data as a string) and deal with it in a uniform manner. Returne...
date = str(date)
def _parse_date(date): """Parses a variety of date formats into a tuple of 9 integers""" date = str(date) try: # try the standard rfc822 library, which handles # RFC822, RFC1123, RFC2822, and asctime tm = rfc822.parsedate_tz(date) if tm: return time.gmtime(rfc822.mktime_tz(tm)) # not a RFC2822 date, try W3DTF profile o...
respected, and it defaults to "us-ascii" if not specified. If Content-Type is unspecified (input was local file or non-HTTP source)
respected, and it defaults to "us-ascii" if not specified. Furthermore, discussion on the atom-syntax mailing list with the author of RFC 3023 leads me to the conclusion that any document served with a Content-Type of text/* and no charset parameter must be treated as us-ascii. (We now do this.) And also that it mus...
def _getCharacterEncoding(http_headers, xml_data): """Get the character encoding of the XML document http_headers is a dictionary xml_data is a raw string (not Unicode) This is so much trickier than it sounds, it's not even funny. According to RFC 3023 ("XML Media Types"), if the HTTP Content-Type is application/xml...
"utf-8" as per the XML specification.
"utf-8" as per the XML specification. This part is probably wrong, as HTTP defaults to "iso-8859-1" if no Content-Type is specified. Also, the default Content-Type and well-formedness of XML documents served as wacky types like "application/octet-stream" is still under discussion.
def _getCharacterEncoding(http_headers, xml_data): """Get the character encoding of the XML document http_headers is a dictionary xml_data is a raw string (not Unicode) This is so much trickier than it sounds, it's not even funny. According to RFC 3023 ("XML Media Types"), if the HTTP Content-Type is application/xml...
true_encoding = None
sniffed_xml_encoding = '' xml_encoding = '' true_encoding = ''
def _parseHTTPContentType(content_type): """takes HTTP Content-Type header and returns (content type, charset)
xml_encoding_match = re.compile('<\?.*encoding=[\'"](.*?)[\'"].*\?>').match(xml_data) xml_encoding = xml_encoding_match and xml_encoding_match.groups()[0].lower() or ''
try: if xml_data[:4] == '\x4c\x6f\xa7\x94': xml_data = _ebcdic_to_ascii(xml_data) elif xml_data[:4] == '\x00\x3c\x00\x3f': sniffed_xml_encoding = 'utf-16be' xml_data = unicode(xml_data, 'utf-16be').encode('utf-8') elif (len(xml_data) >= 4) and (xml_data[:2] == '\xfe\xff') and (xml_data[2:4] != '\x00\x00'): sniffed_x...
def _parseHTTPContentType(content_type): """takes HTTP Content-Type header and returns (content type, charset)
return true_encoding, http_encoding, xml_encoding
return true_encoding, http_encoding, xml_encoding, sniffed_xml_encoding
def _parseHTTPContentType(content_type): """takes HTTP Content-Type header and returns (content type, charset)
def _changeEncodingDeclaration(data, encoding):
def _toUTF8(data, encoding):
def _changeEncodingDeclaration(data, encoding): """Changes an XML data stream on the fly to specify a new encoding data is a raw sequence of bytes (not Unicode) that is presumed to be in %encoding already encoding is a string recognized by encodings.aliases """ if _debug: sys.stderr.write('entering _changeEncodingDecl...
if _debug: sys.stderr.write('entering _changeEncodingDeclaration\n') if _debug: sys.stderr.write('proposed encoding: %s\n' % encoding) data = unicode(data, encoding) declmatch = re.compile(u'^<\?xml[^>]*?>') newdecl = unicode("""<?xml version='1.0' encoding='%s'?>""" % encoding, encoding) if declmatch.search(data): d...
if _debug: sys.stderr.write('entering _toUTF8, trying encoding %s\n' % encoding) if (len(data) >= 4) and (data[:2] == '\xfe\xff') and (data[2:4] != '\x00\x00'): if _debug: sys.stderr.write('stripping BOM\n') if encoding != 'utf-16be': sys.stderr.write('trying utf-16be instead\n') encoding = 'utf-16be' data = data[2:] ...
def _changeEncodingDeclaration(data, encoding): """Changes an XML data stream on the fly to specify a new encoding data is a raw sequence of bytes (not Unicode) that is presumed to be in %encoding already encoding is a string recognized by encodings.aliases """ if _debug: sys.stderr.write('entering _changeEncodingDecl...
data = newdecl + u'\n' + data return data.encode(encoding)
newdata = newdecl + u'\n' + newdata return newdata.encode("utf-8")
def _changeEncodingDeclaration(data, encoding): """Changes an XML data stream on the fly to specify a new encoding data is a raw sequence of bytes (not Unicode) that is presumed to be in %encoding already encoding is a string recognized by encodings.aliases """ if _debug: sys.stderr.write('entering _changeEncodingDecl...
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None):
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]):
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers"):
result['feed'] = FeedParserDict() result['entries'] = [] if _XML_AVAILABLE: result['bozo'] = 0 if type(handlers) == types.InstanceType: handlers = [handlers] try: f = _open_resource(url_file_stream_or_string, etag, modified, agent, referrer, handlers) data = f.read() except Exception, e: result['bozo'] = 1 result['bozo...
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
except:
except Exception, e: result['bozo'] = 1 result['bozo_exception'] = e
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
f.close() if result.get("status", 0) == 304: result['feed'] = FeedParserDict() result['entries'] = [] result['debug_message'] = "The feed has not changed since you last checked, so the server sent no data. This is a feature, not a bug!" return result result['encoding'], http_encoding, xml_encoding = _getCharacterEncod...
if hasattr(f, "close"): f.close() result['encoding'], http_encoding, xml_encoding, sniffed_xml_encoding = \ _getCharacterEncoding(result.get("headers", {}), data)
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
if result.get("status", 0) == 304: result['version'] = '' result['debug_message'] = "The feed has not changed since you last checked, " + \ "so the server sent no data. This is a feature, not a bug!" return result if not data: return result use_strict_parser = 0 known_encoding = 0 tried_encodings = [] for proposed...
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
if _debug: sys.stderr.write('no xml libraries available\n') use_strict_parser = _XML_AVAILABLE
use_strict_parser = 0
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
if _debug: sys.stderr.write('using xml library\n') result['bozo'] = 0 feedparser = _StrictFeedParser(baseuri, result['encoding']) if _debug and _debug_never_use_libxml2: sys.stderr.write('not using libxml2 (even if available)\n') additional_parsers = [] else: additional_parsers = ["drv_libxml2"] saxparser = xml.sax.mak...
feedparser = _StrictFeedParser(baseuri, 'utf-8') saxparser = xml.sax.make_parser(PREFERRED_XML_PARSERS)
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
try: saxparser.setDTDHandler(feedparser) except xml.sax.SAXNotSupportedException: if _debug: sys.stderr.write('using an xml library that does not support DTDHandler (not a big deal)\n') try: saxparser.setEntityResolver(feedparser) except xml.sax.SAXNotSupportedException: if _debug: sys.stderr.write('using an xml libr...
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
if _debug: sys.stderr.write('xml parsing failed\n') feedparser.bozo = 1 feedparser.bozo_exception = feedparser.exc or e if feedparser.bozo:
if _debug: import traceback traceback.print_stack() traceback.print_exc() sys.stderr.write('xml parsing failed\n')
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
result['bozo_exception'] = feedparser.bozo_exception
result['bozo_exception'] = feedparser.exc or e
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
if _debug: sys.stderr.write('using regexes, now you have two problems\n') feedparser = _LooseFeedParser(baseuri, result['encoding'])
feedparser = _LooseFeedParser(baseuri, known_encoding and 'utf-8' or '')
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None): """Parse a feed from a URL, file, stream, or string""" result = FeedParserDict() f = _open_resource(url_file_stream_or_string, etag=etag, modified=modified, agent=agent, referrer=referrer) data = f.read() if hasattr(f, "headers")...
sidebarBPB = Block.Block.findBlockByName ("SidebarBranchPointBlock") if sidebarBPB is not None: filteredCollection = sidebarBPB.delegate.\ _mapItemToCacheKeyItem(item, { "getOnlySelectedCollection": True, }) if filteredCollection.isEmpty(): dc.SetTextForeground (wx.SystemSettings.GetColour (wx.SYS_COLOUR_GRAYTEXT)) nam...
def Draw (self, grid, attr, dc, rect, row, col, isSelected): DrawingUtilities.SetTextColorsAndFont (grid, attr, dc, isSelected)
otherOther = other._references.get(otherName)
otherOther = other._references._getRef(otherName)
def _checkRef(self, logger, name, other):
collectionList = [theItem for theItem in sidebar.contents if ((theItem in sidebar.checkedItems) and (theItem is not item))]
checkedCollections = set(theItem for theItem in sidebar.contents if (theItem in sidebar.checkedItems)) selectedCollections = set(sidebar.contents.iterSelection()) collectionList = list(selectedCollections.union(checkedCollections)) try: itemIndex = collectionList.index(item) if itemIndex != 0: del collectionList[item...
def _mapItemToCacheKeyItem(self, item, hints): key = item sidebar = Block.Block.findBlockByName ("Sidebar") """ collectionList should be in the order that the source items are overlayed in the Calendar view """ if not hints.get ("getOnlySelectedCollection", False): collectionList = [theItem for theItem in sidebar.conte...
if isinstance (item, ContentCollection): collectionList.insert (0, item)
def _mapItemToCacheKeyItem(self, item, hints): key = item sidebar = Block.Block.findBlockByName ("Sidebar") """ collectionList should be in the order that the source items are overlayed in the Calendar view """ if not hints.get ("getOnlySelectedCollection", False): collectionList = [theItem for theItem in sidebar.conte...
self.colStartX = 10
def __init__( self, parent, log ): wx.Panel.__init__( self, parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE ) self.log = log
cb4 = wx.CheckBox( self, -1, "Proportional Resizing", (self.colStartX, miscControlsY + 75), (200, 20), wx.NO_BORDER )
cb4 = wx.CheckBox( self, -1, "Proportional Resizing", (self.colStartX, miscControlsY + 75), (165, 20), wx.NO_BORDER )
def __init__( self, parent, log ): wx.Panel.__init__( self, parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE ) self.log = log
self.colStartX = 175
self.colStartX = 200
def __init__( self, parent, log ): wx.Panel.__init__( self, parent, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE ) self.log = log
if readOnly or always:
if not readOnly or always:
def onRemoveEventUpdateUI (self, event): readOnly = True for range in self.selection: for row in xrange (range[0], range[1] + 1): readOnly, always = self.widget.ReadOnly (row, 0) if readOnly or always: break return not readOnly
return not readOnly
event.arguments['Enable'] = not readOnly return True
def onRemoveEventUpdateUI (self, event): readOnly = True for range in self.selection: for row in xrange (range[0], range[1] + 1): readOnly, always = self.widget.ReadOnly (row, 0) if readOnly or always: break return not readOnly
schema.ns("osaf.app", self).sidebarCollection.add (coll)
schema.ns("osaf.app", self).sidebarCollection.add (collection)
def onImportIcalendarEvent(self, event): # triggered from "File | Import/Export" menu #XXX: need to migrate this to application dialogs utilsA
def notify(self, op, other): self.sourceChanged(op, 'notification', None, None, False, other)
def _setView(self, view):
persist = self._getFlags('classes') & self.TRANSIENT == 0
persist = self._getFlags(key) & self.TRANSIENT == 0
def _xmlValues(self, generator, withSchema, version, mode):
formattedBacktrace = "".join (traceback.format_exception (type, value, stack))
formattedBacktrace = "".join (traceback.format_exception (type, value, stack, 5))
def realMain(): if __debug__ and application.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. """ import wingdbstub if __debug__ and applica...
message = "Chandler encountered an unexpected problem %s\n\n%s" % (message, formattedBacktrace)
message = ("Chandler encountered an unexpected problem %s\n" + \ "Here are the bottom 5 frames of the stack:\n%s") % (message, formattedBacktrace)
def realMain(): if __debug__ and application.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. """ import wingdbstub if __debug__ and applica...
versionFileHandle.write("version = \".5\"\n")
versionFileHandle.write("release = \".5\"\n")
def _createVersionFile(buildenv): versionFile = "version.py" if os.path.exists(versionFile): os.remove(versionFile) versionFileHandle = open(versionFile, 'w', 0) versionFileHandle.write("build = \"" + buildenv['buildVersion'] + "\"\n") versionFileHandle.write("version = \".5\"\n") versionFileHandle.close()
try:
if self._resultSet:
def __iter__(self): """ Return a generator of the query results """ if self.__resultsAreStale(): try: self._resultSet.clear() except: self._resultSet = [] self.stale = False for i in self._logical_plan.execute(): self._resultSet.append(i) yield i else: for i in self._resultSet: yield i
except: self._resultSet = [] self.stale = False
if self.stale: self.stale = False
def __iter__(self): """ Return a generator of the query results """ if self.__resultsAreStale(): try: self._resultSet.clear() except: self._resultSet = [] self.stale = False for i in self._logical_plan.execute(): self._resultSet.append(i) yield i else: for i in self._resultSet: yield i
try:
if self._resultSet:
def getResultSet(self): """ Return a reference collection of the query results """ if self.__resultsAreStale(): try: self._resultSet.clear() except: self._resultSet = [] self.stale = False for i in self._logical_plan.execute(): self._resultSet.append(i) return self._resultSet else: return self._resultSet
except: self._resultSet = [] self.stale = False
if self.stale: self.stale = False
def getResultSet(self): """ Return a reference collection of the query results """ if self.__resultsAreStale(): try: self._resultSet.clear() except: self._resultSet = [] self.stale = False for i in self._logical_plan.execute(): self._resultSet.append(i) return self._resultSet else: return self._resultSet
try:
if self._resultSet:
def __resultsAreStale(self): self._ensureQueryIsCurrent() if self.queryString == "": try: self._resultSet.clear() except AttributeError: self._resultSet = [] self.stale = False return self.stale
except AttributeError: self._resultSet = [] self.stale = False
if self.stale: self.stale = False
def __resultsAreStale(self): self._ensureQueryIsCurrent() if self.queryString == "": try: self._resultSet.clear() except AttributeError: self._resultSet = [] self.stale = False return self.stale
def formatCollection(self, collection, childstring):
def formatCollection(self, collection, childstring, attrName = None): linkText = collection.getItemDisplayName() if attrName is not None: linkText = linkText + "." + attrName
def formatCollection(self, collection, childstring): result = ('<div class="set-item">\n' ' <div class="set-title">' + ' <a href="%s" title="%s">%s</a>' % ( toLink(collection.itsPath), collection.__class__.__name__, collection.getItemDisplayName()) + ' </div>\n' + ' <div class="set-box">' + childstring + '</div>\n'...
collection.getItemDisplayName()) +
linkText) +
def formatCollection(self, collection, childstring): result = ('<div class="set-item">\n' ' <div class="set-title">' + ' <a href="%s" title="%s">%s</a>' % ( toLink(collection.itsPath), collection.__class__.__name__, collection.getItemDisplayName()) + ' </div>\n' + ' <div class="set-box">' + childstring + '</div>\n'...
collection = view[s[0]] set = getattr(collection, collection.__collection__) result = formatter.formatCollection(collection, getstring(set, True))
item = view.find(s[0], False) if item is None: result = '<em>deleted:</em>(%s, %s)' % (s[0], s[1]) else: attribute = s[1] set = getattr(item, attribute) if attribute != getattr(item, '__collection__', None): result = formatter.formatCollection(item, getstring(set, True), attribute) else: result = formatter.formatCollec...
def getstring(s, hasItem=False):
platformName = 'Mac OS X (intel)'
platformID = 'Mac OS X (intel)'
def getPlatformID(): import platform platformID = 'Unknown' if os.name == 'nt': platformID = 'win' elif os.name == 'posix': if sys.platform == 'darwin': # platform.processor() returns 'i386' or 'powerpc' # but we need to also check platform.machine() # which returns 'Power Macintosh' or 'i386' # to determine if we ar...
self.lastModified = lastModified[-1]
if lastModified: self.lastModified = lastModified[-1]
def _get(self, previousView=None, updateCallback=None):
self.cwd[-1] = os.path.join(self.cwd[-1], attrs['cwd'])
cwd = attrs['cwd'] if isinstance(cwd, unicode): cwd = cwd.encode(self.fsenc) self.cwd[-1] = os.path.join(self.cwd[-1], cwd)
def packStart(self, attrs):
self.view.loadPack(os.path.join(self.cwd[-1], attrs['file']),
file = attrs['file'] if isinstance(file, unicode): file = file.encode(self.fsenc) self.view.loadPack(os.path.join(self.cwd[-1], file),
def packStart(self, attrs):
self.cwd.append(os.path.join(self.cwd[-1], attrs['path']))
path = attrs['path'] if isinstance(path, unicode): path = path.encode(self.fsenc) self.cwd.append(os.path.join(self.cwd[-1], path))
def cwdStart(self, attrs):
parent = self.loadItem(os.path.join(self.cwd[-1], attrs['file']),
file = attrs['file'] if isinstance(file, unicode): file = file.encode(self.fsenc) parent = self.loadItem(os.path.join(self.cwd[-1], file),
def itemStart(self, attrs):
pattern = '^' + attrs['files'] + '$'
files = attrs['files'] if isinstance(files, unicode): files = files.encode(self.fsenc) pattern = '^' + files + '$'
def itemStart(self, attrs):
self.cwd.append(os.path.join(self.cwd[-1], attrs['cwd']))
cwd = attrs['cwd'] if isinstance(cwd, unicode): cwd = cwd.encode(self.fsenc) self.cwd.append(os.path.join(self.cwd[-1], cwd))
def itemStart(self, attrs):
self.InOnMouseEvents = True try: """ This code is tricky, tread with care -- DJA """ event.Skip()
event.Skip() gridWindow = self.GetGridWindow() blockItem = self.blockItem x = event.GetX() y = event.GetY() unscrolledX, unscrolledY = self.CalcUnscrolledPosition (x, y) row = self.YToRow (unscrolledY) cellRect = self.CalculateCellRect (row) item, attribute = self.GetTable().GetValue (row, 0) if cellRect.InsideXY...
def OnMouseEvents (self, event): self.InOnMouseEvents = True try: """ This code is tricky, tread with care -- DJA """ event.Skip() #Let the grid also handle the event by default gridWindow = self.GetGridWindow() blockItem = self.blockItem x = event.GetX() y = event.GetY() unscrolledX, unscrolledY = self.CalcUnscroll...
gridWindow = self.GetGridWindow() blockItem = self.blockItem x = event.GetX() y = event.GetY() unscrolledX, unscrolledY = self.CalcUnscrolledPosition (x, y) row = self.YToRow (unscrolledY) cellRect = self.CalculateCellRect (row) item, attribute = self.GetTable().GetValue (row, 0) if cellRect.InsideXY (x, y): if no...
elif event.LeftUp(): if self.buttonPressed: imageRect = self.buttonState[self.buttonPressed]['imageRect'] if (imageRect.InsideXY (x, y)): blockItem.setButtonState (self.buttonPressed, item, not blockItem.getButtonState (self.buttonPressed, item)) blockItem.postEventByName ("SelectItemBroadcast", {'item':blockItem.selec...
def OnMouseEvents (self, event): self.InOnMouseEvents = True try: """ This code is tricky, tread with care -- DJA """ event.Skip() #Let the grid also handle the event by default gridWindow = self.GetGridWindow() blockItem = self.blockItem x = event.GetX() y = event.GetY() unscrolledX, unscrolledY = self.CalcUnscroll...
self.buttonState = {} for (buttonName, offset) in blockItem.buttonOffsets.iteritems(): checked = blockItem.getButtonState (buttonName, item) imageRect = GetRectFromOffsets (cellRect, offset) self.buttonState[buttonName] = {'imageRect': imageRect, 'screenChecked': checked, 'blockChecked': checked} self.RefreshRect (ima...
elif event.LeftDClick(): """ On Macintosh, an apparent wxWidgets bug causes us to not have the mouse capture event though we never released it. You can verify his by commenting in this assert: assert gridWindow.HasCapture() """ gridWindow.ReleaseMouse() del self.hoverImageRow elif not (event.LeftIsDown() or self.cellR...
def OnMouseEvents (self, event): self.InOnMouseEvents = True try: """ This code is tricky, tread with care -- DJA """ event.Skip() #Let the grid also handle the event by default gridWindow = self.GetGridWindow() blockItem = self.blockItem x = event.GetX() y = event.GetY() unscrolledX, unscrolledY = self.CalcUnscroll...
if not getattr (self, "InOnMouseEvents", False): DrawingUtilities.SetTextColorsAndFont (grid, attr, dc, isSelected) dc.SetBackgroundMode (wx.SOLID) dc.SetPen (wx.TRANSPARENT_PEN) dc.DrawRectangleRect(rect) dc.SetBackgroundMode (wx.TRANSPARENT) item, attribute = grid.GetTable().GetValue (row, col) if isinstance (ite...
DrawingUtilities.SetTextColorsAndFont (grid, attr, dc, isSelected) dc.SetBackgroundMode (wx.SOLID) dc.SetPen (wx.TRANSPARENT_PEN) dc.DrawRectangleRect(rect) dc.SetBackgroundMode (wx.TRANSPARENT) item, attribute = grid.GetTable().GetValue (row, col) if isinstance (item, ItemCollection.ItemCollection): def drawButton...
def Draw (self, grid, attr, dc, rect, row, col, isSelected): if not getattr (self, "InOnMouseEvents", False): DrawingUtilities.SetTextColorsAndFont (grid, attr, dc, isSelected) dc.SetBackgroundMode (wx.SOLID) dc.SetPen (wx.TRANSPARENT_PEN) dc.DrawRectangleRect(rect) dc.SetBackgroundMode (wx.TRANSPARENT) item, attrib...
if checked: imageSuffix = "Checked.png" else: imageSuffix = ".png" image = wx.GetApp().GetImage (imagePrefix + imageName + imageSuffix) if image is None: image = wx.GetApp().GetImage (imagePrefix + imageSuffix) if image is not None: imageRect = GetRectFromOffsets (rect, sidebar.buttonOffsets [name]) dc.DrawBitmap (i...
else: name = getattr (item, attribute) sidebar = Block.Block.findBlockByName ("Sidebar") textRect = GetRectFromOffsets (rect, sidebar.editRectOffsets) textRect.Inflate (-1, -1) dc.SetClippingRect (textRect) DrawingUtilities.DrawWrappedText (dc, name, textRect) dc.DestroyClippingRegion()
def drawButton (name): imagePrefix = "Sidebar" + name if row == getattr (grid, 'hoverImageRow', wx.NOT_FOUND): imagePrefix += "MouseOver" checked = grid.buttonState[name]['screenChecked'] else: checked = sidebar.getButtonState (name, item)
return item in self.checkedItems
if item in self.checkedItems: return 'Checked'
def getButtonState (self, buttonName, item): if buttonName == u'Icon': return item in self.checkedItems elif buttonName == u'SharingIcon': try: return Sharing.getShare(item).sharer.itsPath == "//userdata/me" except AttributeError: return False else: assert (False)
try: return Sharing.getShare(item).sharer.itsPath == "//userdata/me" except AttributeError: return False else: assert (False)
share = Sharing.getShare(item) if share is not None: if share.sharer.itsPath == "//userdata/me": return "Upload" else: return "Download" return ""
def getButtonState (self, buttonName, item): if buttonName == u'Icon': return item in self.checkedItems elif buttonName == u'SharingIcon': try: return Sharing.getShare(item).sharer.itsPath == "//userdata/me" except AttributeError: return False else: assert (False)
width = itemRect.width - self.textOffset.x - (self.textMargin + 10)
width = itemRect.width - self.textOffset.x - (self.textMargin)
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item if item.isDeleted(): return
if (timeHeight < itemRect.height/2):
if '__WXGTK__' in wx.PlatformInfo: timeBottomMargin = 1 else: timeBottomMargin = 3 availableSpace = timeHeight*2 + timeBottomMargin + \ self.textOffset.y*2 if (availableSpace < itemRect.height):
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item if item.isDeleted(): return
if '__WXGTK__' in wx.PlatformInfo: y += 1 else: y += 3
y += timeBottomMargin
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item if item.isDeleted(): return
indent = self.GetIndentLevel() * 5 width = dayWidth - self.GetMaxDepth() * 5
indent = self.GetIndentLevel() * 10 width = dayWidth - self.GetMaxDepth() * 10
def UpdateDrawingRects(self, startTime=None, endTime=None):
def dumpTestLogs(log, chandlerLog, FuncTestLog, errorCode=None):
def dumpTestLogs(log, chandlerLog, FuncTestLog, exitCode=0):
def dumpTestLogs(log, chandlerLog, FuncTestLog, errorCode=None): if FuncTestLog: log.write("FunctionalTestSuite.log:\n") try: CopyLog(FuncTestLog, log) except: pass log.write(separator) if chandlerLog: log.write("chandler.log:\n") try: CopyLog(chandlerLog, log) except: pass log.write(separator) if errorCode: log.writ...
if errorCode: log.write("exit code=%s\n" % e.args)
log.write("exit code=%s\n" % exitCode)
def dumpTestLogs(log, chandlerLog, FuncTestLog, errorCode=None): if FuncTestLog: log.write("FunctionalTestSuite.log:\n") try: CopyLog(FuncTestLog, log) except: pass log.write(separator) if chandlerLog: log.write("chandler.log:\n") try: CopyLog(chandlerLog, log) except: pass log.write(separator) if errorCode: log.writ...
reader, item.itsUUID, attribute,
reader.read(), item.itsUUID, attribute,
def _writeData(self, uuid, store, db):
SyncProgress.Show(wx.GetApp().mainFrame, view=self.view,
SyncProgress.Show(wx.GetApp().mainFrame, rv=self.view,
def OnManageDone(self, evt): self._saveClassFilterState()
self.ChangeWidgetIfNecessary(False, True)
if not self.ChangeWidgetIfNecessary(False, True): editor = self.lookupEditor() editor.EndControlEdit(self.getItem(), self.getAttributeName(), self.widget)
def onKeyUpFromWidget(self, event): if event.m_keyCode == wx.WXK_RETURN: self.ChangeWidgetIfNecessary(False, True) # Do the tab thing if we're not a multiline thing # @@@ Actually, don't; it doesn't mix well when one of the fields you'd # "enter" through is multiline - it clears the content. if False: try: isMultiLine...
if not uploadStaging: print "skipping rsync to staging area" log.write("skipping rsync to staging area") else: UploadToStaging(nowString, log, rsyncProgram, options.rsyncServer)
def main(): global buildscriptFile, buildDir, fromAddr, mailtoAddr, alertAddr, adminAddr, defaultDomain, defaultRsyncServer # this is a sane default - the "true" value is pulled from the module being built treeName = "Chandler" parser = OptionParser(usage="%prog [options] buildName", version="%prog 1.2") parser.add_o...
Check to see if we need to reorder the source list of the UnionCollection. The list is kept sorted by the order of the collections as they overlay one another in the Calendar. We don't bother to sort when we're looking up a collection that isn't
Check to see if we need to reorder collectionList. The list is kept sorted by the order of the collections as they overlay one another in the Calendar. We don't bother to reorder when we're looking up a collection that isn't
def _mapItemToCacheKeyItem(self, item, includeCheckedItems=True): 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 """ if includeCheckedItems: collectionList = [theItem for theItem in sidebar....
if sidebar.filterClass is not MissingClass: sidebar.setPreferredClass(stampClass)
sidebar.setPreferredClass(stampClass)
def onNewItemEvent(self, event): # Create a new Content Item allCollection = schema.ns('osaf.pim', self).allCollection sidebar = Block.findBlockByName("Sidebar") classParameter = event.classParameter
self.undocheck = wx.RadioButton(self, -1,
self.undoRepair = wx.RadioButton(self, -1,
def __init__(self, exception=None): # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI dialog using the Create # method. pre = wx.PreDialog() style = wx.CAPTION pre.Create(None, -1, _(u"Startup Options for Chandle...
sizer.Add(self.undocheck, flag=wx.ALL, border=5) self.undocheck.Bind(wx.EVT_LEFT_DCLICK, self.onButton)
sizer.Add(self.undoRepair, flag=wx.ALL, border=5) self.undoRepair.Bind(wx.EVT_LEFT_DCLICK, self.onButton)
def __init__(self, exception=None): # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI dialog using the Create # method. pre = wx.PreDialog() style = wx.CAPTION pre.Create(None, -1, _(u"Startup Options for Chandle...
elif hasattr(self, 'undocheck') and self.undocheck.GetValue(): Globals.options.undo = 'check'
elif hasattr(self, 'undoRepair') and self.undoRepair.GetValue(): Globals.options.undo = 'repair'
def onButton(self, event): buttonID = event.GetEventObject().GetId() if hasattr(self, 'create'): Globals.options.create = self.create.GetValue() if hasattr(self, 'refreshui') and self.refreshui.GetValue(): Globals.options.refreshui = True Globals.options.repair = True Globals.options.recover = True
testCollection._createIndex()
def testNumericIndex(self): k = KindCollection(view=self.view) k.kind = self.i.itsKind
testCollection._createIndex()
def testAttributeIndex(self): k = KindCollection(view = self.view) k.kind = self.i.itsKind
logger = TestOutput(stdout=True, debug=4)
logger = TestOutput(stdout=True, debug=0)
def run_tests(tests): """Method to execute cats tests, must be in Functional directory.""" logger = TestOutput(stdout=True, debug=4) #debug=0 (least output), debug=4(most output) logger.startSuite(name='ChandlerTestSuite') for paramSet in tests.split(','): try: filenameAndTest = paramSet.split(':') #dan added this as...
def readUnreadNeedsReplyState(read, needsReply):
def getCompareTuple(uuid): read, needsReply, triage, triageChanged = \ self.itsView.findValues(uuid, *self.findParams)
def compare(self, u1, u2): def readUnreadNeedsReplyState(read, needsReply): if not read: return 0 if needsReply: return 1 return 2
return 0 if needsReply: return 1 return 2 attrs = (('read', False), ('needsReply', False), ('triageStatus', pim.TriageEnum.done), ('triageStatusChanged', 0)) values1 = self.itsView.findValues(u1, *self.findParams) values2 = self.itsView.findValues(u2, *self.findParams) return (cmp(not values1[0], not values2[0]) or...
readUnreadNeedsReplyState = 0 elif needsReply: readUnreadNeedsReplyState = 1 else: readUnreadNeedsReplyState = 2 return (readUnreadNeedsReplyState, triage, triageChanged) return cmp(getCompareTuple(u1), getCompareTuple(u2))
def readUnreadNeedsReplyState(read, needsReply): if not read: return 0 if needsReply: return 1 return 2
class TriageAttributeEditor(attributeEditors.BaseAttributeEditor):
class TriageAttributeEditor(attributeEditors.IconAttributeEditor):
def GetTextToDraw(self, item, attributeName): prefix, theText, isSample = \ super(WhoAttributeEditor, self).GetTextToDraw(item, attributeName) if not isSample: # OVerride the prefix if we have one we recognize # (these are in order of how frequently I think they'll occur) # Note that there's a space at the end of each...
def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): item = RecurrenceDialog.getProxy(u'ui', item, createNew=False) value = getattr(item, self.editingAttribute or attributeName, '') label = (pim.getTriageStatusName(value).upper() if value else u'') backgroundColor = styles.cfg.get('summary', ...
def makeStates(self): states = [ BitmapInfo(stateName="Triage.%s" % s.lower(), normal="Triage%s" % s, selected="Triage%s" % s, rollover="Triage%sRollover" % s, rolloverselected="Triage%sRollover" % s, mousedown="Triage%sMousedown" % s, mousedownselected="Triage%sMousedown" % s) for s in "Now", "Later", "Done" ] retu...
def Draw (self, grid, dc, rect, (item, attributeName), isInSelection=False): # Get the value we'll draw, and its label item = RecurrenceDialog.getProxy(u'ui', item, createNew=False) value = getattr(item, self.editingAttribute or attributeName, '') label = (pim.getTriageStatusName(value).upper() if value else u'')
width = 40,
width = 42,
def makeColumnAndIndexes(colName, **kwargs): # Create an IndexDefinition that will be used later (when the user # clicks on the column header) to build the actual index. # By default, we always create index defs that will lazily create a # master index when the subindex is needed. indexName = kwargs['indexName'] attrib...
clipRect = wx.Rect(x,y,width,height)
clipRect = wx.Rect(cx,cy,cwidth,cheight)
def Draw(self, dc, boundingRect, styles, brushOffset, selected): item = self._item
except:
except Exception, e:
def main(): """ The details of unhandled exceptions are now handled by the logger, and logged to a file: chandler.log We are currently reraising the exception, so that wing can notice in the default exception handler. """ handler = logging.FileHandler('chandler.log') formatter = logging.Formatter('%(asctime)s %(leve...
mine = schema.ns('osaf.pim', self.itsView).mine
pim_ns = schema.ns('osaf.pim', self.itsView) mine = pim_ns.mine allCollection = pim_ns.allCollection
def onRemoveEvent(self, event): """ Permanently remove the collection - we eventually need a user confirmation here """
self.contents.remove(collection)
def deleteItem(collection):
hasLeftRounded = ((not isAllDay and Calendar.datetimeOp(item.startTime, '==', item.endTime)) or getattr(item, 'anyTime', False))
isAnyTime = getattr(item, 'anyTime', False) duration = getattr(item, 'duration', 0) hasLeftRounded = ((isAnyTime and not isAllDay) or not duration)
def Draw(self, dc, styles, brushOffset, selected, rightSideCutOff=False): # @@@ add a general cutoff parameter? item = self._item # recurring items, when deleted or stamped non-Calendar, are sometimes # passed to Draw before wxSynchronize is called, ignore those items if item.isDeleted() or not item.itsKind.isKindOf(Ca...
os.chdir(chanDir)
cvsChanges = {} for mod in cvsModules: cvsChanges[mod] = True
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...
doBuild(releaseMode, workingDir, log, clean='')
doBuild(releaseMode, workingDir, log, cvsChanges, clean='') for releaseMode in ('release', 'debug'):
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...
for releaseMode in ('release', 'debug'):
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...
os.chdir(chanDir)
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...