Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
word_path, dloader.base_name)
except:
# raise # Use this to debug an audio processor.
os.remove(word_path)
continue
# else:
# file_name = file_name
# We pass the file name around for this case.
retrieved_files_list.append((
source, dest, dloader.display_text,
file_name, item_hash, extras, dloader.site_icon))
try:
store_or_blacklist(
note, retrieved_files_list, show_skull_and_bones, hide_text)
except ValueError as ve:
tooltip(str(ve))
except RuntimeError as rte:
if not 'cancel' in str(rte):
raise
# else: quietly drop out on user cancel
if not editor or not editor.note:
return
word_ord, word, maps = inspect_note(editor.note)
flush = not editor.addMode
nomaps = True
for each in maps:
dict_unique = each.get('dict_unique', '').strip()
ignore = each.get('ignore', True)
if dict_unique and not ignore:
nomaps = False
break
if nomaps:
from ..gui import show_options
tooltip(_('PLS_SET_DICTIONARY_FIELDS'))
show_options(
editor.parentWindow,
editor.note.model()['id'],
query_from_editor_fields,
editor,
fields
)
else:
editor.setNote(editor.note)
query_all([editor.note], flush, fields)
editor.setNote(editor.note, focusTo=0)
editor.saveNow(lambda:None)
def show_message(title: str, message: str, prefix=""):
aqt.utils.tooltip(f"{prefix} {title}\n{message}", period=5000)
work_manager = QueryWorkerManager()
#work_manager.reset()
#progress.start(max=len(notes), min=0, immediate=True)
work_manager.flush = flush
work_manager.query_fields = fields
queue = work_manager.queue
for note in notes:
queue.put(note)
work_manager.start()
work_manager.join()
#progress.finish()
promot_choose_css(work_manager.missed_css)
tooltip(u'{0} {1} {2}, {3} {4}'.format(_('UPDATED'), work_manager.counter, _(
'CARDS'), work_manager.fields, _('FIELDS')))
#work_manager.clean()
service_pool.clean()
# start deleting notes
if self.deleted:
for term in self.deleted:
cardID = mw.col.findCards("term:" + term )
deckID = mw.col.decks.id(deckName)
for cid in cardID:
nid = mw.col.db.scalar("select nid from cards where id = ? and did = ?", cid, deckID)
if nid is not None:
mw.col.db.execute("delete from cards where id =?", cid)
mw.col.db.execute("delete from notes where id =?", nid)
mw.col.fixIntegrity()
mw.col.reset()
mw.reset()
tooltip('Added : ' + str(len(self.new)) + '<br><br>Deleted : ' + str(len(self.deleted)), period=3000)
work_manager = QueryWorkerManager()
#work_manager.reset()
#progress.start(max=len(notes), min=0, immediate=True)
work_manager.flush = flush
work_manager.query_fields = fields
queue = work_manager.queue
for note in notes:
queue.put(note)
work_manager.start()
work_manager.join()
#progress.finish()
promot_choose_css(work_manager.missed_css)
tooltip(u'{0} {1} {2}, {3} {4}'.format(_('UPDATED'), work_manager.counter, _(
'CARDS'), work_manager.fields, _('FIELDS')))
#work_manager.clean()
service_pool.clean()
def on_lookup_forvo_expression():
u"""Wrapper to look up the expression at Forvo and catch value errors."""
try:
lookup_forvo(expression_fields)
except ValueError as ve:
tooltip(str(ve))
except AttributeError:
tooltip(u'Error during lookup. (No note?)')
return
work_manager = QueryWorkerManager()
#work_manager.reset()
#progress.start(max=len(notes), min=0, immediate=True)
queue = work_manager.queue
for i, note in enumerate(notes):
queue.put(note)
work_manager.start()
work_manager.join()
#progress.finish()
promot_choose_css(work_manager.missed_css)
tooltip(u'{0} {1} {2}, {3} {4}'.format(_('UPDATED'), work_manager.counter, _('CARDS'), work_manager.fields, _('FIELDS')))
#work_manager.clean()
service_pool.clean()