bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _get_library_books(self): ''' Populate a dict of paths from iTunes Library|Books ''' library_books = {}
def _get_library_books(self): ''' Populate a dict of paths from iTunes Library|Books ''' library_books = {}
451,400
def _update_device(self, msg='', wait=True): ''' Trigger a sync, wait for completion ''' if DEBUG: self.log.info("ITUNES:_update_device():\n %s" % msg)
def_update_device(self,msg='',wait=True):'''Triggerasync,waitforcompletion'''ifDEBUG:self.log.info("ITUNES:_update_device():\n%s"%msg)
451,401
def _update_device(self, msg='', wait=True): ''' Trigger a sync, wait for completion ''' if DEBUG: self.log.info("ITUNES:_update_device():\n %s" % msg)
def_update_device(self,msg='',wait=True):'''Triggerasync,waitforcompletion'''ifDEBUG:self.log.info("ITUNES:_update_device():\n%s"%msg)
451,402
def fset(self, val): self._formatted_date = val
def fset(self, val): self._formatted_date = val
451,403
def paint(self, painter, option, widget): x, y = 0, 0+self.height-self.descent if self.vdebug: painter.save() painter.setPen(QPen(Qt.yellow, 1, Qt.DotLine)) painter.drawRect(self.boundingRect()) painter.restore() painter.save() painter.setPen(QPen(Qt.NoPen)) for c in self.children(): painter.setBrush(c.brush) painter.d...
def paint(self, painter, option, widget): x, y = 0, 0+self.height-self.descent if self.vdebug: painter.save() painter.setPen(QPen(Qt.yellow, 1, Qt.DotLine)) painter.drawRect(self.boundingRect()) painter.restore() painter.save() painter.setPen(QPen(Qt.NoPen)) if hasattr(self, 'children'): for c in self.children(): paint...
451,404
def tags_to_string(cls, tags): return ', '.join(tags)
def tags_to_string(cls, tags): return ', '.join(tags)
451,405
def __init__(self, parent, db): QObject.__init__(self, parent) self.internet_connection_failed = False self._parent = parent self.recipe_model = RecipeModel(db) self.lock = QMutex(QMutex.Recursive) self.download_queue = set([])
def __init__(self, parent, db): QObject.__init__(self, parent) self.internet_connection_failed = False self._parent = parent self.recipe_model = RecipeModel(db) self.lock = QMutex(QMutex.Recursive) self.download_queue = set([])
451,406
def __init__(self, parent, db): QObject.__init__(self, parent) self.internet_connection_failed = False self._parent = parent self.recipe_model = RecipeModel(db) self.lock = QMutex(QMutex.Recursive) self.download_queue = set([])
def __init__(self, parent, db): QObject.__init__(self, parent) self.internet_connection_failed = False self._parent = parent self.recipe_model = RecipeModel(db) self.lock = QMutex(QMutex.Recursive) self.download_queue = set([])
451,407
def oldest_check(self): if self.oldest > 0: delta = timedelta(days=self.oldest) ids = self.recipe_model.db.tags_older_than(_('News'), delta) if ids: self.delete_old_news.emit(ids)
def oldest_check(self): if self.oldest > 0: delta = timedelta(days=self.oldest) ids = self.recipe_model.db.tags_older_than(_('News'), delta) if ids: self.delete_old_news.emit(ids)
451,408
def upload_cover(self, path, filename, metadata): coverdata = getattr(metadata, 'thumbnail', None) if coverdata and coverdata[2]: with open('%s_6090.t2b' % os.path.join(path, filename), 'wb') as t2bfile: t2b.write_t2b(t2bfile, coverdata[2])
def upload_cover(self, path, filename, metadata): coverdata = getattr(metadata, 'thumbnail', None) if coverdata and coverdata[2]: with open('%s_6090.t2b' % os.path.join(path, filename), 'wb') as t2bfile: t2b.write_t2b(t2bfile, coverdata[2])
451,409
def parse_pml(self, pml, file_name=''): pml = self.prepare_pml(pml) output = []
def parse_pml(self, pml, file_name=''): pml = self.prepare_pml(pml) output = []
451,410
def __init__(self, msg, only_msg=False): Exception.__init__(self, msg) self.only_msg = only_msg
def __init__(self, msg, only_msg=False): Exception.__init__(self, msg) self.only_msg = only_msg
451,411
def __getattribute__(self, attr): if attr == 'name': return object.__getattribute__(self, attr) fobject = object.__getattribute__(self, 'fobject') return getattr(fobject, attr)
def __getattribute__(self, attr): if attr in ('name', '__enter__', '__str__', '__unicode__', '__repr__'): return object.__getattribute__(self, attr) fobject = object.__getattribute__(self, 'fobject') return getattr(fobject, attr)
451,412
def run(self, opts): scripts = {} for x in ('console', 'gui'): for name in basenames[x]: if name in ('calibre-complete', 'calibre_postinstall'): continue scripts[name] = x
def run(self, opts): scripts = {} for x in ('console', 'gui'): for name in basenames[x]: if name in ('calibre-complete', 'calibre_postinstall'): continue scripts[name] = x
451,413
def _get_cover(soup, rdr): ans = None try: ans = soup.find('img', alt=re.compile('cover', flags=re.I))['src'] except TypeError: # meeehh, no handy alt-tag goodness, try some hackery # the basic idea behind this is that in general, the cover image # has a height:width ratio of ~1.25, whereas most of the nav # buttons ar...
def _get_cover(soup, rdr): ans = None try: ans = soup.find('img', alt=re.compile('cover', flags=re.I))['src'] except TypeError: # meeehh, no handy alt-tag goodness, try some hackery # the basic idea behind this is that in general, the cover image # has a height:width ratio of ~1.25, whereas most of the nav # buttons ar...
451,414
def get_printer(self): printer = get_pdf_printer() printer.setPaperSize(QSizeF(self.size[0] * 10, self.size[1] * 10), QPrinter.Millimeter) printer.setPageMargins(0, 0, 0, 0, QPrinter.Point) printer.setOrientation(orientation(self.opts.orientation)) printer.setOutputFormat(QPrinter.PdfFormat) printer.setFullPage(True) r...
def get_printer(self, set_horz_margins=False): printer = get_pdf_printer() printer.setPaperSize(QSizeF(self.size[0] * 10, self.size[1] * 10), QPrinter.Millimeter) printer.setPageMargins(0, 0, 0, 0, QPrinter.Point) printer.setOrientation(orientation(self.opts.orientation)) printer.setOutputFormat(QPrinter.PdfFormat) pri...
451,415
def get_printer(self): printer = get_pdf_printer() printer.setPaperSize(QSizeF(self.size[0] * 10, self.size[1] * 10), QPrinter.Millimeter) printer.setPageMargins(0, 0, 0, 0, QPrinter.Point) printer.setOrientation(orientation(self.opts.orientation)) printer.setOutputFormat(QPrinter.PdfFormat) printer.setFullPage(True) r...
def get_printer(self): printer = get_pdf_printer() printer.setPaperSize(QSizeF(self.size[0] * 10, self.size[1] * 10), QPrinter.Millimeter) if set_horz_margins: printer.setPageMargins(0., self.opts.margin_top, 0., self.opts.margin_bottom, QPrinter.Point) else: printer.setPageMargins(0, 0, 0, 0, QPrinter.Point) printer.s...
451,416
def get_printer(self): printer = get_pdf_printer() printer.setPaperSize(QSizeF(self.size[0] * 10, self.size[1] * 10), QPrinter.Millimeter) printer.setPageMargins(0, 0, 0, 0, QPrinter.Point) printer.setOrientation(orientation(self.opts.orientation)) printer.setOutputFormat(QPrinter.PdfFormat) printer.setFullPage(True) r...
def get_printer(self): printer = get_pdf_printer() printer.setPaperSize(QSizeF(self.size[0] * 10, self.size[1] * 10), QPrinter.Millimeter) printer.setPageMargins(0, 0, 0, 0, QPrinter.Point) printer.setOrientation(orientation(self.opts.orientation)) printer.setOutputFormat(QPrinter.PdfFormat) printer.setFullPage(not set...
451,417
def _render_html(self, ok): if ok: item_path = os.path.join(self.tmp_path, '%i.pdf' % len(self.combine_queue)) self.logger.debug('\tRendering item %s as %i' % (os.path.basename(str(self.view.url().toLocalFile())), len(self.combine_queue))) printer = self.get_printer() printer.setOutputFileName(item_path) self.view.prin...
def _render_html(self, ok): if ok: item_path = os.path.join(self.tmp_path, '%i.pdf' % len(self.combine_queue)) self.logger.debug('\tRendering item %s as %i' % (os.path.basename(str(self.view.url().toLocalFile())), len(self.combine_queue))) printer = self.get_printer(set_horz_margins=True) printer.setOutputFileName(item...
451,418
def sync_to_device(self, on_card, delete_from_library, specific_format=None, send_ids=None, do_auto_convert=True): ids = [self.library_view.model().id(r) \ for r in self.library_view.selectionModel().selectedRows()] \ if send_ids is None else send_ids if not self.device_manager or not ids or len(ids) == 0: return
def sync_to_device(self, on_card, delete_from_library, specific_format=None, send_ids=None, do_auto_convert=True): ids = [self.library_view.model().id(r) \ for r in self.library_view.selectionModel().selectedRows()] \ if send_ids is None else send_ids if not self.device_manager or not ids or len(ids) == 0: return
451,419
def __init__(self, book): Metadata.__init__(self, None, [])
def __init__(self, book): Metadata.__init__(self, None, [])
451,420
def __init__(self, book): Metadata.__init__(self, None, [])
def __init__(self, book): Metadata.__init__(self, None, [])
451,421
def __init__(self, book): Metadata.__init__(self, None, [])
def __init__(self, book): Metadata.__init__(self, None, [])
451,422
def __init__(self, book): Metadata.__init__(self, None, [])
def __init__(self, book): Metadata.__init__(self, None, [])
451,423
def decompress_text(self, number): if self.header_record.compression == 1: return self.section_data(number).decode('cp1252' if self.encoding is None else self.encoding) if self.header_record.compression == 2: from calibre.ebooks.compression.palmdoc import decompress_doc return decompress_doc(self.section_data(number))....
def decompress_text(self, number): if self.header_record.compression == 1: return self.section_data(number).decode('cp1252' if self.encoding is None else self.encoding) if self.header_record.compression == 2 or self.header_record.compression == 258: from calibre.ebooks.compression.palmdoc import decompress_doc return d...
451,424
def add_books_to_HTML_by_month(this_months_list, dtc): if len(this_months_list):
def add_books_to_HTML_by_month(this_months_list, dtc): if len(this_months_list):
451,425
def add_books_to_HTML_by_date_range(date_range_list, date_range, dtc): if len(date_range_list): pIndexTag = Tag(soup, "p") pIndexTag['class'] = "date_index" aTag = Tag(soup, "a") aTag['name'] = date_range.replace(' ','') pIndexTag.insert(0,aTag) pIndexTag.insert(1,NavigableString(date_range)) divTag.insert(dtc,pIndexTa...
def add_books_to_HTML_by_date_range(date_range_list, date_range, dtc): if len(date_range_list): pIndexTag = Tag(soup, "p") pIndexTag['class'] = "date_index" aTag = Tag(soup, "a") aTag['name'] = "bda_%s" % date_range.replace(' ','') pIndexTag.insert(0,aTag) pIndexTag.insert(1,NavigableString(date_range)) divTag.insert(d...
451,426
def add_to_master_date_range_list(current_titles_list): book_count = len(current_titles_list) current_titles_list = " • ".join(current_titles_list) current_titles_list = self.formatNCXText(current_titles_list, dest='description') master_date_range_list.append((current_titles_list, date_range, book_count))
def add_to_master_date_range_list(current_titles_list): book_count = len(current_titles_list) current_titles_list = " • ".join(current_titles_list) current_titles_list = self.formatNCXText(current_titles_list, dest='description') master_date_range_list.append((current_titles_list, date_range, book_count))
451,427
def add_to_master_date_range_list(current_titles_list): book_count = len(current_titles_list) current_titles_list = " • ".join(current_titles_list) current_titles_list = self.formatNCXText(current_titles_list, dest='description') master_date_range_list.append((current_titles_list, date_range, book_count))
def add_to_master_date_range_list(current_titles_list): book_count = len(current_titles_list) current_titles_list = " • ".join(current_titles_list) current_titles_list = self.formatNCXText(current_titles_list, dest='description') master_date_range_list.append((current_titles_list, date_range, book_count))
451,428
def add_to_master_date_range_list(current_titles_list): book_count = len(current_titles_list) current_titles_list = " • ".join(current_titles_list) current_titles_list = self.formatNCXText(current_titles_list, dest='description') master_date_range_list.append((current_titles_list, date_range, book_count))
def add_to_master_date_range_list(current_titles_list): book_count = len(current_titles_list) current_titles_list = " • ".join(current_titles_list) current_titles_list = self.formatNCXText(current_titles_list, dest='description') master_date_range_list.append((current_titles_list, date_range, book_count))
451,429
def link_clicked(self, url): path = os.path.abspath(unicode(url.toLocalFile())) frag = None if path in self.iterator.spine: self.history.add(self.pos.value()) path = self.iterator.spine[self.iterator.spine.index(path)] if url.hasFragment(): frag = unicode(url.fragment()) if path != self.current_page: self.pending_ancho...
def link_clicked(self, url): path = os.path.abspath(unicode(url.toLocalFile())) frag = None if path in self.iterator.spine: self.history.add(self.pos.value()) path = self.iterator.spine[self.iterator.spine.index(path)] if url.hasFragment(): frag = unicode(url.fragment()) if path != self.current_page: self.pending_ancho...
451,430
def __init__(self, msg, details, level): Exception.__init__(self, msg) self.level = level self.details = details self.msg = msg
def __init__(self, msg, details, level): Exception.__init__(self, msg) self.level = level self.details = details self.msg = msg
451,431
def makedmg(self, d, volname, destdir='dist', internet_enable=True, format='UDBZ'): ''' Copy a directory d into a dmg named volname ''' info('\nCreating dmg') sys.stdout.flush() if not os.path.exists(destdir): os.makedirs(destdir) dmg = os.path.join(destdir, volname+'.dmg') if os.path.exists(dmg): os.unlink(dmg) subpro...
def makedmg(self, d, volname, destdir='dist', internet_enable=True, format='UDBZ'): ''' Copy a directory d into a dmg named volname ''' info('\nCreating dmg') sys.stdout.flush() if not os.path.exists(destdir): os.makedirs(destdir) dmg = os.path.join(destdir, volname+'.dmg') if os.path.exists(dmg): os.unlink(dmg) tdir =...
451,432
def genesis(self): self.count_changed(0) self.qaction.triggered.connect(self.choose_library)
def genesis(self): self.count_changed(0) self.qaction.triggered.connect(self.choose_library)
451,433
def genesis(self): self.count_changed(0) self.qaction.triggered.connect(self.choose_library)
def genesis(self): self.count_changed(0) self.qaction.triggered.connect(self.choose_library)
451,434
def genesis(self): self.count_changed(0) self.qaction.triggered.connect(self.choose_library)
def genesis(self): self.count_changed(0) self.qaction.triggered.connect(self.choose_library)
451,435
def build_menus(self): db = self.gui.library_view.model().db locations = list(self.stats.locations(db)) for ac in self.switch_actions: ac.setVisible(False) self.quick_menu.clear() self.qs_locations = [i[1] for i in locations] for name, loc in locations: self.quick_menu.addAction(name, partial(self.switch_requested, loc...
def build_menus(self): db = self.gui.library_view.model().db locations = list(self.stats.locations(db)) for ac in self.switch_actions: ac.setVisible(False) self.quick_menu.clear() self.qs_locations = [i[1] for i in locations] for name, loc in locations: self.quick_menu.addAction(name, partial(self.switch_requested, loc...
451,436
def create_oebbook(self, htmlpath, basedir, opts, log, mi): from calibre.ebooks.conversion.plumber import create_oebbook from calibre.ebooks.oeb.base import DirContainer, \ rewrite_links, urlnormalize, urldefrag, BINARY_MIME, OEB_STYLES, \ xpath from calibre import guess_type import cssutils oeb = create_oebbook(log, N...
def create_oebbook(self, htmlpath, basedir, opts, log, mi): from calibre.ebooks.conversion.plumber import create_oebbook from calibre.ebooks.oeb.base import DirContainer, \ rewrite_links, urlnormalize, urldefrag, BINARY_MIME, OEB_STYLES, \ xpath from calibre import guess_type import cssutils oeb = create_oebbook(log, N...
451,437
def resource_adder(self, link_, base=None): link = self.urlnormalize(link_) link, frag = self.urldefrag(link) link = unquote(link).replace('/', os.sep) if not link.strip(): return link_ if base and not os.path.isabs(link): link = os.path.join(base, link) try: link = os.path.abspath(link) except: return link_ if not os....
def resource_adder(self, link_, base=None): link = self.urlnormalize(link_) link, frag = self.urldefrag(link) link = unquote(link).replace('/', os.sep) if not link.strip(): return link_ if base and not os.path.isabs(link): link = os.path.join(base, link) try: link = os.path.abspath(link) except: return link_ if not os....
451,438
def __init__(self, parent, db, duplicates, db_adder): QThread.__init__(self, parent) self.db, self.db_adder = db, db_adder self.duplicates = duplicates
def __init__(self, parent, db, duplicates, db_adder): QObject.__init__(self, parent) self.db, self.db_adder = db, db_adder self.duplicates = duplicates
451,439
def __init__(self, parent, db, duplicates, db_adder): QThread.__init__(self, parent) self.db, self.db_adder = db, db_adder self.duplicates = duplicates
def __init__(self, parent, db, duplicates, db_adder): QThread.__init__(self, parent) self.db, self.db_adder = db, db_adder self.duplicates = duplicates
451,440
def walk(self, root): self.books = [] for dirpath in os.walk(root): if self.canceled: return self.emit(SIGNAL('update(PyQt_PyObject)'), _('Searching in')+' '+dirpath[0]) self.books += list(self.db.find_books_in_directory(dirpath[0], self.single_book_per_directory))
def walk(self, root): self.books = [] for dirpath in os.walk(root): if self.canceled: return self.update.emit( _('Searching in')+' '+dirpath[0]) self.books += list(self.db.find_books_in_directory(dirpath[0], self.single_book_per_directory))
451,441
def run(self): root = os.path.abspath(self.path) try: self.walk(root) except: try: if isinstance(root, unicode): root = root.encode(filesystem_encoding) self.walk(root) except Exception, err: import traceback traceback.print_exc() try: msg = unicode(err) except: msg = repr(err) self.emit(SIGNAL('found(PyQt_PyObject)'),...
def run(self): root = os.path.abspath(self.path) try: self.walk(root) except: try: if isinstance(root, unicode): root = root.encode(filesystem_encoding) self.walk(root) except Exception, err: import traceback traceback.print_exc() try: msg = unicode(err) except: msg = repr(err) self.found.emit(msg) return
451,442
def run(self): root = os.path.abspath(self.path) try: self.walk(root) except: try: if isinstance(root, unicode): root = root.encode(filesystem_encoding) self.walk(root) except Exception, err: import traceback traceback.print_exc() try: msg = unicode(err) except: msg = repr(err) self.emit(SIGNAL('found(PyQt_PyObject)'),...
def run(self): root = os.path.abspath(self.path) try: self.walk(root) except: try: if isinstance(root, unicode): root = root.encode(filesystem_encoding) self.walk(root) except Exception, err: import traceback traceback.print_exc() try: msg = unicode(err) except: msg = repr(err) self.emit(SIGNAL('found(PyQt_PyObject)'),...
451,443
def run(self): root = os.path.abspath(self.path) try: self.walk(root) except: try: if isinstance(root, unicode): root = root.encode(filesystem_encoding) self.walk(root) except Exception, err: import traceback traceback.print_exc() try: msg = unicode(err) except: msg = repr(err) self.emit(SIGNAL('found(PyQt_PyObject)'),...
def run(self): root = os.path.abspath(self.path) try: self.walk(root) except: try: if isinstance(root, unicode): root = root.encode(filesystem_encoding) self.walk(root) except Exception, err: import traceback traceback.print_exc() try: msg = unicode(err) except: msg = repr(err) self.emit(SIGNAL('found(PyQt_PyObject)'),...
451,444
def __init__(self, db, ids, nmap): self.db, self.ids, self.nmap = db, dict(**ids), dict(**nmap) self.end = False self.critical = {} self.number_of_books_added = 0 self.duplicates = [] self.names, self.paths, self.infos = [], [], [] Thread.__init__(self) self.daemon = True self.input_queue = Queue() self.output_queue = ...
def __init__(self, db, ids, nmap): self.db, self.ids, self.nmap = db, dict(**ids), dict(**nmap) self.critical = {} self.number_of_books_added = 0 self.duplicates = [] self.names, self.paths, self.infos = [], [], [] Thread.__init__(self) self.daemon = True self.input_queue = Queue() self.output_queue = Queue() self.merg...
451,445
def __init__(self, db, ids, nmap): self.db, self.ids, self.nmap = db, dict(**ids), dict(**nmap) self.end = False self.critical = {} self.number_of_books_added = 0 self.duplicates = [] self.names, self.paths, self.infos = [], [], [] Thread.__init__(self) self.daemon = True self.input_queue = Queue() self.output_queue = ...
def __init__(self, db, ids, nmap): self.db, self.ids, self.nmap = db, dict(**ids), dict(**nmap) self.end = False self.critical = {} self.number_of_books_added = 0 self.duplicates = [] self.names, self.paths, self.infos = [], [], [] self.input_queue = Queue() self.output_queue = Queue() self.merged_books = set([])
451,446
def run(self): while not self.end: try: id, opf, cover = self.input_queue.get(True, 0.2) except Empty: continue name = self.nmap.pop(id) title = None try: title = self.add(id, opf, cover, name) except: import traceback self.critical[name] = traceback.format_exc() title = name self.output_queue.put(title)
def run(self): while not self.end: try: id, opf, cover = self.input_queue.get(True, 0.2) except Empty: continue name = self.nmap.pop(id) title = None try: title = self.add(id, opf, cover, name) except: import traceback self.critical[name] = traceback.format_exc() title = name self.output_queue.put(title)
451,447
def __init__(self, parent, db, callback, spare_server=None): QObject.__init__(self, parent) self.pd = ProgressDialog(_('Adding...'), parent=parent) self.spare_server = spare_server self.db = db self.pd.setModal(True) self.pd.show() self._parent = parent self.rfind = self.worker = self.timer = None self.callback = callb...
def __init__(self, parent, db, callback, spare_server=None): QObject.__init__(self, parent) self.pd = ProgressDialog(_('Adding...'), parent=parent) self.spare_server = spare_server self.db = db self.pd.setModal(True) self.pd.show() self._parent = parent self.rfind = self.worker = None self.callback = callback self.call...
451,448
def __init__(self, parent, db, callback, spare_server=None): QObject.__init__(self, parent) self.pd = ProgressDialog(_('Adding...'), parent=parent) self.spare_server = spare_server self.db = db self.pd.setModal(True) self.pd.show() self._parent = parent self.rfind = self.worker = self.timer = None self.callback = callb...
def __init__(self, parent, db, callback, spare_server=None): QObject.__init__(self, parent) self.pd = ProgressDialog(_('Adding...'), parent=parent) self.spare_server = spare_server self.db = db self.pd.setModal(True) self.pd.show() self._parent = parent self.rfind = self.worker = self.timer = None self.callback = callb...
451,449
def add_recursive(self, root, single=True): self.path = root self.pd.set_msg(_('Searching in all sub-directories...')) self.pd.set_min(0) self.pd.set_max(0) self.pd.value = 0 self.rfind = RecursiveFind(self, self.db, root, single) self.connect(self.rfind, SIGNAL('update(PyQt_PyObject)'), self.pd.set_msg, Qt.QueuedConne...
def add_recursive(self, root, single=True): self.path = root self.pd.set_msg(_('Searching in all sub-directories...')) self.pd.set_min(0) self.pd.set_max(0) self.pd.value = 0 self.rfind = RecursiveFind(self, self.db, root, single) self.rfind.update.connect(self.pd.set_msg, type=Qt.QueuedConnection) self.rfind.found.con...
451,450
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
451,451
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
451,452
def canceled(self): self.continue_updating = False if self.rfind is not None: self.rfind.canceled = True if self.worker is not None: self.worker.canceled = True if hasattr(self, 'db_adder'): self.db_adder.end = True self.pd.hide() if not self.callback_called: self.callback(self.paths, self.names, self.infos) self.callb...
def canceled(self): self.continue_updating = False if self.rfind is not None: self.rfind.canceled = True if self.worker is not None: self.worker.canceled = True if hasattr(self, 'db_adder'): self.db_adder.end() self.pd.hide() if not self.callback_called: self.callback(self.paths, self.names, self.infos) self.callback_c...
451,453
def duplicates_processed(self): self.db_adder.end = True if not self.callback_called: self.callback(self.paths, self.names, self.infos) self.callback_called = True if hasattr(self, '__p_d'): self.__p_d.hide()
def duplicates_processed(self): self.db_adder.end() if not self.callback_called: self.callback(self.paths, self.names, self.infos) self.callback_called = True if hasattr(self, '__p_d'): self.__p_d.hide()
451,454
def update(self): if self.entry_count <= 0: self.continue_updating = False self.pd.hide() self.process_duplicates() return
def update(self): if self.entry_count <= 0: self.continue_updating = False self.pd.hide() self.process_duplicates() return
451,455
def update(self): if self.entry_count <= 0: self.continue_updating = False self.pd.hide() self.process_duplicates() return
def update(self): if self.entry_count <= 0: self.continue_updating = False self.pd.hide() self.process_duplicates() return
451,456
def process_duplicates(self): duplicates = self.db_adder.duplicates if not duplicates: return self.duplicates_processed() self.pd.hide() files = [x[0].title for x in duplicates] if question_dialog(self._parent, _('Duplicates found!'), _('Books with the same title as the following already ' 'exist in the database. Add t...
def process_duplicates(self): duplicates = self.db_adder.duplicates if not duplicates: return self.duplicates_processed() self.pd.hide() files = [x[0].title for x in duplicates] if question_dialog(self._parent, _('Duplicates found!'), _('Books with the same title as the following already ' 'exist in the database. Add t...
451,457
def __init__(self, parent, db, callback, rows, path, opts, spare_server=None): QObject.__init__(self, parent) self.pd = ProgressDialog(_('Saving...'), parent=parent) self.spare_server = spare_server self.db = db self.opts = opts self.pd.setModal(True) self.pd.show() self.pd.set_min(0) self._parent = parent self.callbac...
def __init__(self, parent, db, callback, rows, path, opts, spare_server=None): QObject.__init__(self, parent) self.pd = ProgressDialog(_('Saving...'), parent=parent) self.spare_server = spare_server self.db = db self.opts = opts self.pd.setModal(True) self.pd.show() self.pd.set_min(0) self._parent = parent self.callbac...
451,458
def canceled(self): if self.timer is not None: self.timer.stop() if self.worker is not None: self.worker.canceled = True self.pd.hide() if not self.callback_called: self.callback(self.worker.path, self.failures, self.worker.error) self.callback_called = True
def canceled(self): self.continue_updating = False if self.worker is not None: self.worker.canceled = True self.pd.hide() if not self.callback_called: self.callback(self.worker.path, self.failures, self.worker.error) self.callback_called = True
451,459
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self....
def update(self): if not self.continue_updating: return if not self.worker.is_alive(): while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self.worker.joi...
451,460
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self....
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) if not self.ids: self.continue_updating = Fa...
451,461
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self....
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self...
451,462
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self....
def update(self): if not self.ids or not self.worker.is_alive(): self.timer.stop() self.pd.hide() while self.ids: before = len(self.ids) self.get_result() if before == len(self.ids): for i in list(self.ids): self.failures.add(('id:%d'%i, 'Unknown error')) self.ids.remove(i) break if not self.callback_called: try: self....
451,463
def run(self, pmlfile): import zipfile
def run(self, pmlfile): import zipfile
451,464
def AppendPlain(self, fileName, tdir): f = FileStream() f.attr = 0x41000000 f.fileSize = os.path.getsize(os.path.join(tdir,fileName)) f.fileBody = open(os.path.join(tdir,fileName), 'rb').read() f.fileName = fileName print f.fileSize self.files.append(f)
def AppendPlain(self, fileName, tdir): f = FileStream() f.attr = 0x41000000 f.fileSize = os.path.getsize(os.path.join(tdir,fileName)) f.fileBody = open(os.path.join(tdir,fileName), 'rb').read() f.fileName = fileName.replace(os.sep, '/') print f.fileSize self.files.append(f)
451,465
def AppendBinary(self, fileName, tdir): f = FileStream() f.attr = 0x01000000 f.fileSize = os.path.getsize(os.path.join(tdir,fileName)) f.fileBody = open(os.path.join(tdir,fileName), 'rb').read() f.fileName = fileName print f.fileSize self.files.append(f)
def AppendBinary(self, fileName, tdir): f = FileStream() f.attr = 0x01000000 f.fileSize = os.path.getsize(os.path.join(tdir,fileName)) f.fileBody = open(os.path.join(tdir,fileName), 'rb').read() f.fileName = fileName.replace(os.sep, '/') print f.fileSize self.files.append(f)
451,466
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
451,467
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
451,468
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
451,469
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
def _update_iTunes_metadata(self, metadata, db_added, lb_added, this_book): ''' ''' if DEBUG: self.log.info(" ITUNES._update_iTunes_metadata()")
451,470
def update(self, booklists, collections_attributes): debug_print('Starting update', collections_attributes) for i, booklist in booklists.items(): playlist_map = self.build_id_playlist_map(i) debug_print('Updating XML Cache:', i) root = self.record_roots[i] lpath_map = self.build_lpath_map(root) gtz_count = ltz_count = ...
def update(self, booklists, collections_attributes): debug_print('Starting update', collections_attributes) for i, booklist in booklists.items(): playlist_map = self.build_id_playlist_map(i) debug_print('Updating XML Cache:', i) root = self.record_roots[i] lpath_map = self.build_lpath_map(root) gtz_count = ltz_count = ...
451,471
def __init__(self, listener, opts, actions, parent=None): self.preferences_action, self.quit_action = actions self.spare_servers = [] MainWindow.__init__(self, opts, parent) # Initialize fontconfig in a separate thread as this can be a lengthy # process if run for the first time on this machine from calibre.utils.fonts...
def __init__(self, listener, opts, actions, parent=None): self.preferences_action, self.quit_action = actions self.spare_servers = [] MainWindow.__init__(self, opts, parent) # Initialize fontconfig in a separate thread as this can be a lengthy # process if run for the first time on this machine from calibre.utils.fonts...
451,472
def format_field_extended(self, key, series_with_index=True): from calibre.ebooks.metadata import authors_to_string ''' returns the tuple (field_name, formatted_value) ''' if key in self.custom_field_keys(): res = self.get(key, None) cmeta = self.get_user_metadata(key, make_copy=False) name = unicode(cmeta['name']) if ...
def format_field_extended(self, key, series_with_index=True): from calibre.ebooks.metadata import authors_to_string ''' returns the tuple (field_name, formatted_value) ''' if key in self.custom_field_keys(): res = self.get(key, None) cmeta = self.get_user_metadata(key, make_copy=False) name = unicode(cmeta['name']) if ...
451,473
def add_books_to_metadata(self, locations, metadata, booklists): metadata = iter(metadata) for i, location in enumerate(locations): self.report_progress((i+1) / float(len(locations)), _('Adding books to device metadata listing...')) info = metadata.next() blist = 2 if location[1] == 'cardb' else 1 if location[1] == 'ca...
def add_books_to_metadata(self, locations, metadata, booklists): metadata = iter(metadata) for i, location in enumerate(locations): self.report_progress((i+1) / float(len(locations)), _('Adding books to device metadata listing...')) info = metadata.next() blist = 2 if location[1] == 'cardb' else 1 if location[1] == 'ca...
451,474
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
451,475
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
451,476
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
451,477
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
451,478
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
451,479
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
def run(self, path_to_output, opts, db): from calibre.utils.logging import Log
451,480
def add(self, id, opf, cover, name): formats = self.ids.pop(id) if opf.endswith('.error'): mi = MetaInformation('', [_('Unknown')]) self.critical[name] = open(opf, 'rb').read().decode('utf-8', 'replace') else: try: mi = MetaInformation(OPF(opf)) except: import traceback mi = MetaInformation('', [_('Unknown')]) self.cri...
def add(self, id, opf, cover, name): formats = self.ids.pop(id) if opf.endswith('.error'): mi = MetaInformation('', [_('Unknown')]) self.critical[name] = open(opf, 'rb').read().decode('utf-8', 'replace') else: try: mi = MetaInformation(OPF(opf)) except: import traceback mi = MetaInformation('', [_('Unknown')]) self.cri...
451,481
def add_book(self, mi, name, size, ctime): """ Add a node into DOM tree representing a book """ book = self.book_by_path(name) if book is not None: self.remove_book(name) node = self.document.createElement(self.prefix + "text") mime = MIME_MAP[name[name.rfind(".")+1:].lower()] cid = self.max_id()+1 sourceid = str(self[...
def add_book(self, mi, name, size, ctime): """ Add a node into DOM tree representing a book """ book = self.book_by_path(name) if book is not None: self.remove_book(name) node = self.document.createElement(self.prefix + "text") mime = MIME_MAP[name[name.rfind(".")+1:].lower()] cid = self.max_id()+1 sourceid = str(self[...
451,482
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
451,483
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
451,484
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
def add(self, books): if isinstance(books, basestring): error_dialog(self.pd, _('Path error'), _('The specified directory could not be processed.'), det_msg=books, show=True) return self.canceled() if not books: info_dialog(self.pd, _('No books'), _('No books found'), show=True) return self.canceled() books = [[b] if i...
451,485
def canceled(self): if self.rfind is not None: self.rfind.canceled = True if self.timer is not None: self.timer.stop() if self.worker is not None: self.worker.canceled = True if hasattr(self, 'db_adder'): self.db_adder.end = True self.pd.hide() if not self.callback_called: self.callback(self.paths, self.names, self.inf...
def canceled(self): if self.rfind is not None: self.rfind.canceled = True if self.worker is not None: self.worker.canceled = True if hasattr(self, 'db_adder'): self.db_adder.end = True self.pd.hide() if not self.callback_called: self.callback(self.paths, self.names, self.infos) self.callback_called = True
451,486
def update(self): if self.entry_count <= 0: self.timer.stop() self.pd.hide() self.process_duplicates() return
def update(self): if self.entry_count <= 0: self.continue_updating = False self.pd.hide() self.process_duplicates() return
451,487
def update(self): if self.entry_count <= 0: self.timer.stop() self.pd.hide() self.process_duplicates() return
def update(self): if self.entry_count <= 0: self.continue_updating = False self.pd.hide() self.process_duplicates() return
451,488
def update(self): if self.entry_count <= 0: self.timer.stop() self.pd.hide() self.process_duplicates() return
def update(self): if self.entry_count <= 0: self.timer.stop() self.pd.hide() self.process_duplicates() return
451,489
def delete_books_by_id(self, ids): for id in ids: try: row = self.db.row(id) except: row = -1 if row > -1: self.beginRemoveRows(QModelIndex(), row, row) self.db.delete_book(id) if row > -1: self.endRemoveRows() self.count_changed() self.clear_caches()
def delete_books_by_id(self, ids): for id in ids: self.db.delete_book(id) if row > -1: self.endRemoveRows() self.count_changed() self.clear_caches()
451,490
def delete_books_by_id(self, ids): for id in ids: try: row = self.db.row(id) except: row = -1 if row > -1: self.beginRemoveRows(QModelIndex(), row, row) self.db.delete_book(id) if row > -1: self.endRemoveRows() self.count_changed() self.clear_caches()
def delete_books_by_id(self, ids): for id in ids: try: row = self.db.row(id) except: row = -1 if row > -1: self.beginRemoveRows(QModelIndex(), row, row) self.db.delete_book(id) self.count_changed() self.clear_caches()
451,491
def IsValid(self): if self.magic != SNBFile.MAGIC: return False if self.rev80 != SNBFile.REV80: return False if self.revA3 != SNBFile.REVA3: return False if self.revZ1 != SNBFile.REVZ1: return False if self.revZ2 != SNBFile.REVZ2: return False if self.vfatSize != len(self.vfat): return False if self.fileCount != len(se...
def IsValid(self): if self.magic != SNBFile.MAGIC: return False if self.rev80 != SNBFile.REV80: return False if self.revZ1 != SNBFile.REVZ1: return False if self.revZ2 != SNBFile.REVZ2: return False if self.vfatSize != len(self.vfat): return False if self.fileCount != len(self.files): return False if (self.binBlock +...
451,492
def write_prefix(prefix, listid): if prefix is not None and isinstance(booklists[listid], self.booklist_class): if not os.path.exists(prefix): os.makedirs(self.normalize_path(prefix)) js = [item.to_json() for item in booklists[listid] if hasattr(item, 'to_json')] with open(self.normalize_path(os.path.join(prefix, self....
def write_prefix(prefix, listid): if prefix is not None and isinstance(booklists[listid], self.booklist_class): if not os.path.exists(prefix): os.makedirs(self.normalize_path(prefix)) js = [item.to_json() for item in booklists[listid] if hasattr(item, 'to_json')] with open(self.normalize_path(os.path.join(prefix, self....
451,493
def delete_books(self, *args): ''' Delete selected books from device or library. ''' view = self.current_view() rows = view.selectionModel().selectedRows() if not rows or len(rows) == 0: return if self.stack.currentIndex() == 0: if not confirm('<p>'+_('The selected books will be ' '<b>permanently deleted</b> and the fi...
def delete_books(self, *args): ''' Delete selected books from device or library. ''' view = self.current_view() rows = view.selectionModel().selectedRows() if not rows or len(rows) == 0: return if self.stack.currentIndex() == 0: if not confirm('<p>'+_('The selected books will be ' '<b>permanently deleted</b> and the fi...
451,494
def __init__(self, book): Metadata.__init__(self, None, [])
def __init__(self, book): Metadata.__init__(self, None, [])
451,495
def tostring(e): if not hasattr(e, 'string'): return None ans = e.string if ans is not None: ans = unicode(ans).strip() if not ans: ans = None return ans
def tostring(e): if not hasattr(e, 'string'): return None ans = e.string if ans is not None: ans = unicode(ans).strip() if not ans: ans = None return ans
451,496
def tostring(e): if not hasattr(e, 'string'): return None ans = e.string if ans is not None: ans = unicode(ans).strip() if not ans: ans = None return ans
def tostring(e): if not hasattr(e, 'string'): return None ans = e.string if ans is not None: ans = unicode(ans).strip() if not ans: ans = None return ans
451,497
def tostring(e): if not hasattr(e, 'string'): return None ans = e.string if ans is not None: ans = unicode(ans).strip() if not ans: ans = None return ans
def tostring(e): if not hasattr(e, 'string'): return None ans = e.string if ans is not None: ans = unicode(ans).strip() if not ans: ans = None return ans
451,498
def writestr(self, zinfo_or_arcname, bytes, permissions=0600, compression=ZIP_DEFLATED, raw_bytes=False): """Write a file into the archive. The contents is the string 'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.""" assert not raw_bytes or (raw_bytes and isinstance(z...
def writestr(self, zinfo_or_arcname, bytes, permissions=0600, compression=ZIP_DEFLATED, raw_bytes=False): """Write a file into the archive. The contents is the string 'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.""" assert not raw_bytes or (raw_bytes and isinstance(z...
451,499