bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def translate_link(self, link): if self.base is None: return link else: return urlparse.urljoin(base, link)
def translate_link(self, link): if self.base is None: return link else: return urlparse.urljoin(self.base, link)
31,100
def start_book(self, name, title, link, base = None, **dummy): assert len(self.contents_stack) == 1
def start_book(self, name, title, link, base = None, **dummy): assert len(self.contents_stack) == 1
31,101
def __init__(self, spec): DevHelpBook.__init__(self)
def __init__(self, spec): DevHelpBook.__init__(self)
31,102
def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag == 'object': if attrs['type'] == 'text/sitemap': self.entry = Book.IndexEntry(None) elif tag == 'param': if self.entry: if attrs['name'] == 'Name': if self.entry.name is None: self.entry.name = attrs['value'].strip() elif attrs['name'] == 'Local': self.e...
def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag == 'object': if attrs['type'] == 'text/sitemap': self.entry = Book.IndexEntry(None) elif tag == 'param': if self.entry is not None: if attrs['name'] == 'Name': if self.entry.name is None: self.entry.name = attrs['value'].strip() elif attrs['name'] == 'Lo...
31,103
def handle_endtag(self, tag): if tag == 'object': if self.entry: self.book.index.append(self.entry) self.entry = None
def handle_endtag(self, tag): if tag == 'object': if self.entry is not None: self.book.index.append(self.entry) self.entry = None
31,104
def guess_type(path): base, ext = posixpath.splitext(path) if ext in mimetypes.types_map: return mimetypes.types_map[ext] else: return 'application/octet-stream'
def guess_type(path): base, ext = posixpath.splitext(path) if ext in mimetypes.types_map: return mimetypes.types_map[ext] else: return 'application/octet-stream'
31,105
def extract(path, content): """Extract the title and body of a document in plaintext.""" type = guess_type(path) if type == 'text/html': return extract_html(content) elif type == 'text/plain': return None, content else: return None, None
def extract(path, content): """Extract the title and body of a document in plaintext.""" type = guess_type(path) if type == 'text/html': return extract_html(content) elif type == 'text/plain': return None, content else: return None, None
31,106
def dump_contents_entries(entry, parent_number, cont = 0): number = parent_number + 1 for subentry in entry: name = subentry.name path, anchor = split_link(subentry.link) sys.stdout.write(cont and ',\n ' or '\n ') sys.stdout.write('(' + ', '.join(quote(literal('@book_id'), number, parent_number, name, path, anchor)) +...
def dump_contents_entries(entry, parent_number, cont = 0): number = parent_number + 1 for subentry in entry: name = subentry.name path, anchor = subentry.link is None and ('', '') or split_link(subentry.link) sys.stdout.write(cont and ',\n ' or '\n ') sys.stdout.write('(' + ', '.join(quote(literal('@book_id'), number,...
31,107
def OnLinkClicked(self, link): self.m_Frame.NotifyPageChanged()
def OnLinkClicked(self, link): self.m_Frame.NotifyPageChanged()
31,108
def AddBooks(self): import Generic book_factory = Generic.BookFactory() root = self.m_ContentsBox.AddRoot("Books") for name in book_factory.enumerate(): book = book_factory.book(name) self.AddBook(root, book)
def AddBooks(self): root = self.m_ContentsBox.AddRoot("Books") for name in book_factory.enumerate(): book = book_factory.book(name) self.AddBook(root, book)
31,109
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) h = book.page(link).read() self.m_HtmlWin.SetPage(h)
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location)
31,110
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
31,111
def filter(self, path): if path[:8] == '/sample/': return path[1:] else: return None
def filter(self, path): if path[:8] == '/sample/': return path[8:] else: return None
31,112
def handle_param(self, name, value): if name == 'Name': self.entry.name = value elif name == 'Local': self.entry.link = value
def handle_param(self, name, value): if name == 'Name': self.entry.name = value elif name == 'Local': self.entry.links.append(value)
31,113
def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag == 'ul': if len(self.contents_stack) == 0: node = self.book.contents else: assert self.node is not None node = self.node self.contents_stack.append(node) self.node = None elif tag == 'object': if attrs['type'] == 'text/sitemap': self.node = Book.Conten...
def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag == 'ul': if len(self.contents_stack) == 0: node = self.book.contents else: assert self.node is not None node = self.node self.contents_stack.append(node) self.node = None elif tag == 'object': if attrs['type'] == 'text/sitemap': self.node = Book.Conten...
31,114
def handle_endtag(self, tag): if tag == 'ul': self.contents_stack.pop() elif tag == 'object': if self.node: self.contents_stack[-1].append(self.node)
def handle_endtag(self, tag): if tag == 'ul': self.contents_stack.pop() elif tag == 'object': if self.node is not None: self.contents_stack[-1].append(self.node)
31,115
def html_entity_decode(s, encoding = 'iso-8859-1'): """Decode HTML entities in a string into Unicode.""" r = [] p = 0 mo = _html_entity_re.search(s, p) while mo: r.append(s[p:mo.start()].decode(encoding)) i = mo.lastindex e = mo.group(i) try: if i == 1: c = htmlentitydefs.name2codepoint[e] elif i == 2: c = int(e) el...
def html_entity_decode(s, encoding = 'iso-8859-1'): """Decode HTML entities in a string into Unicode.""" r = [] p = 0 mo = _html_entity_re.search(s, p) while mo: r.append(s[p:mo.start()].decode(encoding)) i = mo.lastindex e = mo.group(i) try: if i == 1: c = htmlentitydefs.name2codepoint[e] elif i == 2: c = int(e) el...
31,116
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,117
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,118
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,119
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,120
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,121
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,122
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,123
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,124
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,125
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,126
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,127
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
31,128
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
31,129
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
31,130
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
31,131
def _extract_callback(h, ui, base_path): if ui.path[:1] != '/': return chmlib.CHM_ENUMERATOR_CONTINUE path = os.path.join(base_path, ui.path[1:]) if ui.length != 0: print "--> %s" % ui.path try: fout = open(path, "wb") except IOError: return chmlib.CHM_ENUMERATOR_FAILURE offset = 0L remain = ui.length while remain: ...
def _extract_callback(h, ui, base_path): if ui.path[:1] != '/': return chmlib.CHM_ENUMERATOR_CONTINUE path = os.path.join(base_path, ui.path[1:]) if ui.length != 0: print "--> %s" % ui.path try: fout = open(path, "wb") except IOError: return chmlib.CHM_ENUMERATOR_FAILURE offset = 0L remain = ui.length while remain: ...
31,132
def seek(self, offset, whence): if self.n == 0 and whence == 0: whence = 2 elif whence < 0: whence = 1 self.n += 1
def seek(self, offset, whence): if self.n == 0 and whence == 0: whence = 2 elif whence < 0: whence = 1 self.n += 1
31,133
def seek(self, offset, whence): if self.n == 0 and whence == 0: whence = 2 elif whence < 0: whence = 1 self.n += 1
def seek(self, offset, whence): if self.n == 0 and whence == 0: whence = 2 elif whence < 0: whence = 1 self.n += 1
31,134
def CanOpen(self, location): return self.GetProtocol(location) == 'hh'
def CanOpen(self, location): return self.GetProtocol(location) == 'hh'
31,135
def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat...
def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) book = book_factory.book(name) anchor = self.GetAnchor(location) mimetype = s...
31,136
def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat...
def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat...
31,137
def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat...
def OpenFile(self, fs, location): if 0: name = self.GetLeftLocation(location) link = self.GetRightLocation(location) else: link = self.GetRightLocation(location) words = filter(None, link.split('/')) name = words[0] link = '/'.join(words[1:]) print name, link book = book_factory.book(name) anchor = self.GetAnchor(locat...
31,138
def __init__(self, frame, parent): wxHtmlWindow.__init__(self, parent) self.m_Frame = frame
def __init__(self, frame, parent): wxHtmlWindow.__init__(self, parent) self.m_Frame = frame
31,139
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,140
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,141
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,142
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,143
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,144
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,145
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,146
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,147
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,148
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
def __init__(self, parent, id, title, style = wxHF_DEFAULT_STYLE): wxFrame.__init__(self,parent,-4, title, style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)
31,149
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
def AddToolBarButtons(self, toolBar, style): wpanelBitmap = wxArtProvider_GetBitmap(wxART_HELP_SIDE_PANEL, wxART_HELP_BROWSER) wbackBitmap = wxArtProvider_GetBitmap(wxART_GO_BACK, wxART_HELP_BROWSER) wforwardBitmap = wxArtProvider_GetBitmap(wxART_GO_FORWARD, wxART_HELP_BROWSER) wupnodeBitmap = wxArtProvider_GetBitmap(w...
31,150
def AddBooks(self): root = self.m_ContentsBox.AddRoot("Books") for name in book_factory.enumerate(): book = book_factory.book(name) book.name = name self.AddBook(root, book)
def AddBooks(self): root = self.contentsTree.AddRoot("Books") for name in book_factory.enumerate(): book = book_factory.book(name) book.name = name self.AddBook(root, book)
31,151
def AddBook(self, node, book): child = self.m_ContentsBox.AppendItem(node, book.title()) self.m_ContentsBox.SetPyData(child, (book, book.link())) contents = book.contents() self.AddContents(child, book, contents)
def AddBook(self, node, book): child = self.m_ContentsBox.AppendItem(node, book.title()) self.m_ContentsBox.SetPyData(child, (book, book.link())) contents = book.contents() self.AddContents(child, book, contents)
31,152
def AddContents(self, node, book, contents): for entry in contents: if wxUSE_UNICODE: child = self.m_ContentsBox.AppendItem(node, entry.title()) else: child = self.m_ContentsBox.AppendItem(node, entry.title().encode('iso-8859-1', 'replace')) self.m_ContentsBox.SetPyData(child, (book, entry.link())) self.AddContents(chi...
def AddContents(self, node, book, contents): for entry in contents: if wxUSE_UNICODE: name = toc_child.name else: child = self.m_ContentsBox.AppendItem(node, entry.title().encode('iso-8859-1', 'replace')) self.m_ContentsBox.SetPyData(child, (book, entry.link())) self.AddContents(child, book, entry.childs())
31,153
def AddContents(self, node, book, contents): for entry in contents: if wxUSE_UNICODE: child = self.m_ContentsBox.AppendItem(node, entry.title()) else: child = self.m_ContentsBox.AppendItem(node, entry.title().encode('iso-8859-1', 'replace')) self.m_ContentsBox.SetPyData(child, (book, entry.link())) self.AddContents(chi...
def AddContents(self, node, book, contents): for entry in contents: if wxUSE_UNICODE: child = self.m_ContentsBox.AppendItem(node, entry.title()) else: name = toc_child.name.encode('iso-8859-1', 'replace') tree_child = self.contentsTree.AppendItem(tree_node, name) self.contentsTree.SetPyData(tree_child, (book, toc_child...
31,154
def Location(self, book, link): return 'hh:/%s/%s' % (book.name, link)
def Location(self, book, link): return 'book:/%s/%s' % (book.name, link)
31,155
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location)
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.contentsTree.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location)
31,156
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location)
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.get(link).read() self.htmlWindow.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location)
31,157
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) print location self.m_HtmlWin.LoadPage(location)
def OnContentsSel(self, event): item = event.GetItem() (book, link) = self.m_ContentsBox.GetPyData(item) if 0: html = book.page(link).read() self.m_HtmlWin.SetPage(html) else: location = self.Location(book, link) self.htmlWindow.LoadPage(location)
31,158
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
def OnToolbar(self, event): if event.GetId() == id_PANEL: if not (self.splitter and self.navigationPanel): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TRUE) s...
31,159
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
31,160
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
def OnToolbar(self, event): if event.GetId() == wxID_HTML_PANEL: if not (self.m_Splitter and self.m_NavigPan): return if self.m_Splitter.IsSplit(): self.sashpos = self.m_Splitter.GetSashPosition() self.m_Splitter.Unsplit(self.m_NavigPan); #m_Cfg.navig_on = FALSE else: self.m_NavigPan.Show(TRUE) self.m_HtmlWin.Show(TR...
31,161
def main(): app = wxPySimpleApp() frame = MyFrame(None, -1, "HTML Help Books") frame.Show(TRUE) app.MainLoop()
def main(): app = wxPySimpleApp() frame = BookFrame(None, -1, "HTML Help Books") frame.Show(TRUE) app.MainLoop()
31,162
def handle_entry(self, code, data): if code == 0: parser = HHCParser(self) parser.parse(self.book.archive[data]) elif code == 1: parser = HHKParser(self) parser.parse(self.book.archive[data]) elif code == 2: self.book.contents.link = data elif code == 3: self.book.contents.name = data
def handle_entry(self, code, data): if code == 0: parser = HHCParser(self.book) parser.parse(self.book.archive[data]) elif code == 1: parser = HHKParser(self) parser.parse(self.book.archive[data]) elif code == 2: self.book.contents.link = data elif code == 3: self.book.contents.name = data
31,163
def handle_entry(self, code, data): if code == 0: parser = HHCParser(self) parser.parse(self.book.archive[data]) elif code == 1: parser = HHKParser(self) parser.parse(self.book.archive[data]) elif code == 2: self.book.contents.link = data elif code == 3: self.book.contents.name = data
def handle_entry(self, code, data): if code == 0: parser = HHCParser(self) parser.parse(self.book.archive[data]) elif code == 1: parser = HHKParser(self.book) parser.parse(self.book.archive[data]) elif code == 2: self.book.contents.link = data elif code == 3: self.book.contents.name = data
31,164
def convertFromCode(self, value, item=None): if value=='now': return DateTime.now() elif not value: return else: logger.info(value) logger.info(self.format) # DateTime.strptime is not available on Windows return DateTime.DateTime(*time.strptime(value, self.format)[:6])
def convertFromCode(self, value, item=None): if value=='now': return DateTime.now() elif not value: return else: # DateTime.strptime is not available on Windows return DateTime.DateTime(*time.strptime(value, self.format)[:6])
31,165
def show(self, item, name, template_type, template_getter, global_namespace={}): value = getattr(item, name) subfields = [] for subname, field_type in self.fields: full_name = self._child_name(name, subname) proxied_item = self._Proxy(item, {full_name: value[subname]}) subfields.append(field_type.show(proxied_item, ful...
def show(self, item, name, template_type, template_getter, global_namespace={}): value = getattr(item, name) subfields = [] for subname, field_type in self.fields: full_name = self._child_name(formname, subname) proxied_item = self._Proxy(item, {full_name: value[subname]}) subfields.append(field_type.show(proxied_item,...
31,166
def getIndexLabel(self, value): views = [FOREIGN_DROP.getLabel(self, i) for i in value] return ', '.join(views)
def getIndexLabel(self, value): views = [FOREIGN_DROP.getLabel(self, i) for i in value] return ', '.join(views)
31,167
def __init__(self, config): self.__config = config
def __init__(self, config): self.__config = config
31,168
def __repr__(self): return repr(self.__config)
def __repr__(self): return repr(self.__config)
31,169
def __iter__(self): return iter(self.__config)
def __iter__(self): return iter(self.__config)
31,170
def __getitem__(self, name): return self.__config_dict[name]
def __getitem__(self, name): return self.__config_dict[name]
31,171
def iterkeys(self): return self.__config_dict.iterkeys()
def iterkeys(self): return self.__config_dict.iterkeys()
31,172
def external(self): return FieldDescriptions( [(fn, ft) for fn, ft in self.__config if hasattr(ft, 'store')])
def external(self): return FieldDescriptions( [(fn, ft) for fn, ft in self.__config if hasattr(ft, 'store')])
31,173
def main(self): return FieldDescriptions( [(fn, ft) for fn, ft in self.__config if not hasattr(ft, 'store')])
def main(self): return FieldDescriptions( [(fn, ft) for fn, ft in self.__config if not hasattr(ft, 'store')])
31,174
def convertFromForm(self, form, name, item=None): value = STRING.convertFromForm(self, form, name, item)
def convertFromForm(self, form, name, item=None): value = STRING.convertFromForm(self, form, name, item)
31,175
def getIndexLabel(self, value): views = [FOREIGN_DROP.getLabel(self, i) for i in value] return ', '.join(views)
def getIndexLabel(self, value): views = [FOREIGN_DROP.getLabel(self, i) for i in value] return ', '.join(views)
31,176
def do_delete(self, item): from FieldTypes import IMAGE from glob import glob for field_name, field_type in item.stream.itemExtFields.items(): if isinstance(field_type, IMAGE): image = getattr(item, field_name) for old_path in glob(image.pattern+'.*'): os.remove(old_path)
def do_delete(self, item): from qFieldTypes import IMAGE from glob import glob for field_name, field_type in item.stream.itemExtFields.items(): if isinstance(field_type, IMAGE): image = getattr(item, field_name) for old_path in glob(image.pattern+'.*'): os.remove(old_path)
31,177
def do_make(self, item): from FieldTypes import IMAGE from glob import glob for field_name, field_type in item.stream.itemExtFields.items(): if isinstance(field_type, IMAGE): image = getattr(item, field_name) if image: fp = self.writer.getFP(image.path) fp.write(open(field_type.editRoot+image.path).read()) fp.close() e...
def do_make(self, item): from qFieldTypes import IMAGE from glob import glob for field_name, field_type in item.stream.itemExtFields.items(): if isinstance(field_type, IMAGE): image = getattr(item, field_name) if image: fp = self.writer.getFP(image.path) fp.write(open(field_type.editRoot+image.path).read()) fp.close() ...
31,178
def convertFromForm(self, form, name, item): value = form.getlist(name) stream = self._retrieve_stream(item) return self.convertFromCode( [stream.fields.id.convertFromString(id, item) \ for id in value], item)
def convertFromForm(self, form, name, item): value = form.getlist(name) stream = self.itemField._retrieve_stream(item) return self.convertFromCode( [stream.fields.id.convertFromString(id, item) \ for id in value], item)
31,179
def parseaddr(addr): ''' decode header to unicode and aprse it ''' uni_addr = [] for chunk, charset in email.Header.decode_header(addr): if charset: uni_addr += unicode(chunk, charset) else: uni_addr += chunk uni_addr = u''.join(uni_addr) return email.Utils.parseaddr(uni_addr)
def getaddr(addr): ''' extract address from encoded header ''' uni_addr = [] for chunk, charset in email.Header.decode_header(addr): if charset: uni_addr += unicode(chunk, charset) else: uni_addr += chunk uni_addr = u''.join(uni_addr) return email.Utils.parseaddr(uni_addr)
31,180
def parseaddr(addr): ''' decode header to unicode and aprse it ''' uni_addr = [] for chunk, charset in email.Header.decode_header(addr): if charset: uni_addr += unicode(chunk, charset) else: uni_addr += chunk uni_addr = u''.join(uni_addr) return email.Utils.parseaddr(uni_addr)
def parseaddr(addr): ''' decode header to unicode and aprse it ''' uni_addr = [] for chunk, charset in email.Header.decode_header(addr): if charset: uni_addr += unicode(chunk, charset) else: uni_addr += chunk uni_addr = u''.join(uni_addr) return email.Utils.parseaddr(uni_addr)[1].encode('us-ascii')
31,181
def send(self, message): #addr = email.Utils.parseaddr(message['to'])[1] addr = parseaddr(message['to'])[1] logger.info('Sending mail to %s', addr)
def send(self, message): #addr = email.Utils.parseaddr(message['to'])[1] addr = getaddr(message['to']) logger.info('Sending mail to %s', addr)
31,182
def send(self, message): #addr = email.Utils.parseaddr(message['to'])[1] addr = parseaddr(message['to'])[1] logger.info('Sending mail to %s', addr)
def send(self, message): #addr = email.Utils.parseaddr(message['to'])[1] addr = getaddr(message['to']) logger.info('Sending mail to %s', addr)
31,183
def allowedFields(self, item): # assume item.type=='item' itemFieldsOrder = [] for field_name, field_type in item.fields.iteritems(): perms = self.user.getPermissions( self.isNew and field_type.createPermissions or field_type.permissions) if ('w' in perms or 'r' in perms) and \ not (self.isNew and field_type.omitForNew...
def allowedFields(self, item): # assume item.type=='item' itemFieldsOrder = [] for field_name, field_type in item.fields.iteritems(): if self.isNew: permissions = field_type.createPermissions else: permissions = field_type.permissions perms = self.user.getPermissions(permissions) if ('w' in perms or 'r' in perms) and \...
31,184
def showField(self, item, name): '''Return representation of field in editor interface''' field_type = item.fields[name] stream_perms = self.user.getPermissions(item.stream.permissions) perms = self.user.getPermissions(self.isNew and field_type.createPermissions or field_type.permissions) if 'w' in stream_perms and 'w'...
def showField(self, item, name): '''Return representation of field in editor interface''' field_type = item.fields[name] stream_perms = self.user.getPermissions(item.stream.permissions) if self.isNew: permissions = field_type.createPermissions else: permissions = field_type.permissions perms = self.user.getPermissions(...
31,185
def storableFields(self, item, user, isNew=0): itemFieldsOrder = [] id_field_name = item.fields.idFieldName for field_name, field_type in item.fields.iteritems(): if field_name!=id_field_name and \ user.checkPermission('w', isNew and field_type.createPermissions or field_type.permissions): itemFieldsOrder.append(field_...
def storableFields(self, item, user, isNew=0): itemFieldsOrder = [] id_field_name = item.fields.idFieldName for field_name, field_type in item.fields.iteritems(): if field_name!=id_field_name and \ user.checkPermission('w', permissions): itemFieldsOrder.append(field_name) return itemFieldsOrder
31,186
def path(self): if self.body: return self.pattern+'.'+self._image.format.lower() else: from glob import glob file_list = glob(self.field_type.editRoot+self.pattern+'.*') if file_list: file_name = file_list[0] return file_name[len(self.field_type.editRoot):]
def path(self): if self.body: return self.pattern+'.'+self._image.format.lower() else: from glob import glob file_list = glob(self.field_type.editRoot+self.pattern+'.*') if file_list: file_name = '/'.join(os.path.split(file_list[0])) return file_name[len(self.field_type.editRoot):]
31,187
def getAllowedFields(self, obj=None): if obj is None: obj = self.object # assume obj.type=='item' stream = obj.stream item_fields = stream.allItemFields itemFieldsOrder = [] for field_name in stream.itemFieldsOrder: field_type = item_fields[field_name] perms = self.edUser.getPermissions(field_type.permissions) if 'w' i...
def getAllowedFields(self, obj=None): if obj is None: obj = self.object # assume obj.type=='item' stream = obj.stream item_fields = stream.allItemFields itemFieldsOrder = [] for field_name in stream.itemFieldsOrder: field_type = item_fields[field_name] perms = self.edUser.getPermissions(field_type.permissions) if 'w' i...
31,188
def getAllowedIndexFields(self, obj=None): if obj is None: obj = self.object # assume obj.type=='stream': stream = obj item_fields = stream.allStreamFields itemFieldsOrder = [] if self.edUser.checkPermission('x', stream.permissions): for field_name in stream.itemFieldsOrder+\ getattr(stream, 'joinFields', {}).keys(): f...
def getAllowedIndexFields(self, obj=None): if obj is None: obj = self.object # assume obj.type=='stream': stream = obj item_fields = stream.allStreamFields itemFieldsOrder = [] if self.edUser.checkPermission('x', stream.permissions): for field_name in stream.itemFieldsOrder+\ getattr(stream, 'joinFields', {}).keys(): f...
31,189
def checkIfStreamUpdatable(self, obj=None): if obj is None: obj = self.object allowedIndexFields = self.allowedIndexFields else: allowedIndexFields = self.getAllowedIndexFields(obj) # assume obj.type=='stream': stream = obj if self.edUser.checkPermission('w', stream.permissions): item_fields = stream.allStreamFields fo...
def checkIfStreamUpdatable(self, obj=None): if obj is None: obj = self.object allowedIndexFields = self.allowedIndexFields else: allowedIndexFields = self.getAllowedIndexFields(obj) # assume obj.type=='stream': stream = obj if self.edUser.checkPermission('w', stream.permissions): item_fields = stream.allStreamFields fo...
31,190
def getUser(self, login=None): if login: table, fields, condition, group, order = self.constructQuery() condition = self.dbConn.join( [condition, Query('%s=' % self.loginField, Param(login))]) items = self.itemsByQuery(table, fields, condition, group=group) if items: return items[0] # return default "False" user return...
def getUser(self, login=None): if login: table, fields, condition, group, order = self.constructQuery() condition = self.dbConn.join( [condition, Query('%s=' % self.loginField, Param(login))]) items = self.itemsByQuery(table, fields, condition, group=group) if items: return items[0] # return default "False" user return...
31,191
def login(self, publisher, request, response, form): login, passwd, perm_login = [form.getfirst(name) for name in \ ('login', 'passwd', 'perm_login')] # crypt method used below only supports string types try: passwd = str(passwd) except UnicodeEncodeError: passwd = None
def login(self, publisher, request, response, form): login, passwd, perm_login = [form.getfirst(name) for name in \ ('login', 'passwd', 'perm_login')] # crypt method used below only supports string types try: passwd = str(passwd) except UnicodeEncodeError: passwd = None
31,192
def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = prefix self.s...
def __init__(self, templateStream, paramStream, paramName, format=None, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = ...
31,193
def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = prefix self.s...
def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if format is None: self.prefix = (prefix or paramStream)+'/' self.suffix = '' ...
31,194
def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix = prefix self.s...
def __init__(self, templateStream, paramStream, paramName, prefix=None, streamParams=None, titleTemplate=None): self.templateStream = templateStream self.paramStream = paramStream self.paramName = paramName self.titleTemplate = titleTemplate if prefix is None: self.prefix = paramStream else: self.prefix, self.suffix = ...
31,195
def match(self, site, stream_path, tag=None): parts = stream_path.split('/') if len(parts)>=2 and '/'.join(parts[:-1])==self.prefix: param_stream = site.retrieveStream(self.paramStream, tag=site.transmitTag(tag)) try: param_item_id = \ param_stream.fields.id.convertFromString(parts[-1]) except ValueError: return param_...
def match(self, site, stream_path, tag=None): if stream_path.startswith(self.prefix) and \ stream_path.endswith(self.suffix): param_item_id_str = stream_path[len(self.prefix):] if self.suffix: param_item_id_str = param_item_id_str[:-len(self.suffix)] param_stream = site.retrieveStream(self.paramStream, tag=site.transmi...
31,196
def match(self, site, stream_path, tag=None): parts = stream_path.split('/') if len(parts)>=2 and '/'.join(parts[:-1])==self.prefix: param_stream = site.retrieveStream(self.paramStream, tag=site.transmitTag(tag)) try: param_item_id = \ param_stream.fields.id.convertFromString(parts[-1]) except ValueError: return param_...
def match(self, site, stream_path, tag=None): parts = stream_path.split('/') if len(parts)>=2 and '/'.join(parts[:-1])==self.prefix: param_stream = site.retrieveStream(self.paramStream, tag=site.transmitTag(tag)) try: param_item_id = \ param_stream.fields.id.convertFromString(param_item_id_str) except ValueError: retur...
31,197
def constructId(self, param_item): id_str = param_item.fields.id.convertToString(param_item.id) return '%s/%s' % (self.prefix, id_str)
def constructId(self, param_item): id_str = param_item.fields.id.convertToString(param_item.id) return '%s/%s' % (self.prefix, id_str)
31,198
def __init__(self, **kwargs): FOREIGN_DROP.__init__(self, **kwargs) self.itemField = self.itemFieldClass(**kwargs)
def __init__(self, **kwargs): FieldType.__init__(self, **kwargs) self.itemField = self.itemFieldClass(**kwargs)
31,199