mirror of
https://github.com/ankitects/anki.git
synced 2025-12-14 15:20:58 -05:00
identify all temp files as anki, remove kanji occur, tools>actions again
This commit is contained in:
parent
857edcb54a
commit
96337615a5
4 changed files with 6 additions and 22 deletions
|
|
@ -643,7 +643,7 @@ class FactEdit(QTextEdit):
|
|||
return
|
||||
if source.hasImage():
|
||||
im = QImage(source.imageData())
|
||||
(fd, name) = tempfile.mkstemp(suffix=".jpg")
|
||||
(fd, name) = tempfile.mkstemp(prefix="anki", suffix=".jpg")
|
||||
uname = unicode(name, sys.getfilesystemencoding())
|
||||
im.save(uname, None, 95)
|
||||
self.parent._addPicture(uname, widget=self)
|
||||
|
|
@ -665,7 +665,7 @@ class FactEdit(QTextEdit):
|
|||
|
||||
def _retrieveURL(self, url, ext):
|
||||
filecontents = urllib2.urlopen(url).read()
|
||||
(fd, name) = tempfile.mkstemp(suffix=".%s" % ext.encode("ascii"))
|
||||
(fd, name) = tempfile.mkstemp(prefix="anki", suffix=".%s" % ext.encode("ascii"))
|
||||
file = os.fdopen(fd, "wb")
|
||||
file.write(filecontents)
|
||||
file.flush()
|
||||
|
|
|
|||
|
|
@ -777,7 +777,7 @@ To upgrade an old deck, download Anki 0.9.8.7."""))
|
|||
self.ensureSyncParams()
|
||||
if not self.saveAndClose(hideWelcome=True): return
|
||||
# we need a disk-backed file for syncing
|
||||
dir = unicode(tempfile.mkdtemp(), sys.getfilesystemencoding())
|
||||
dir = unicode(tempfile.mkdtemp(prefix="anki"), sys.getfilesystemencoding())
|
||||
path = os.path.join(dir, u"untitled.anki")
|
||||
self.onNew(path=path)
|
||||
# ensure all changes come to us
|
||||
|
|
@ -1237,22 +1237,6 @@ day = :d""", d=yesterday)
|
|||
else:
|
||||
ui.utils.showInfo(_("Please install python-matplotlib to access graphs."))
|
||||
|
||||
def onKanjiOccur(self):
|
||||
self.setStatus(_("Generating report (may take time)..."))
|
||||
self.app.processEvents()
|
||||
import tempfile
|
||||
(fd, name) = tempfile.mkstemp(suffix=".html")
|
||||
f = os.fdopen(fd, 'w')
|
||||
ko = anki.stats.KanjiOccurStats(self.deck)
|
||||
ko.reportFile(f)
|
||||
f.close()
|
||||
if sys.platform == "win32":
|
||||
url = "file:///"
|
||||
else:
|
||||
url = "file://"
|
||||
url += os.path.abspath(name)
|
||||
QDesktopServices.openUrl(QUrl(url))
|
||||
|
||||
# Marking, suspending and undoing
|
||||
##########################################################################
|
||||
|
||||
|
|
@ -1361,7 +1345,7 @@ day = :d""", d=yesterday)
|
|||
s = unicode(s)
|
||||
self.deck.save()
|
||||
# open tmp deck
|
||||
ndir = tempfile.mkdtemp(prefix="anki-cram")
|
||||
ndir = tempfile.mkdtemp(prefix="anki")
|
||||
path = os.path.join(ndir, "cram.anki")
|
||||
from anki.exporting import AnkiExporter
|
||||
e = AnkiExporter(self.deck)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class Updater(QThread):
|
|||
self.emit(SIGNAL("statusChanged"), msg, timeout)
|
||||
|
||||
def run(self):
|
||||
dir = tempfile.mkdtemp(prefix="anki-update")
|
||||
dir = tempfile.mkdtemp(prefix="anki")
|
||||
os.chdir(dir)
|
||||
filename = os.path.abspath(self.filename)
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@
|
|||
</widget>
|
||||
<widget class="QMenu" name="menuActions" >
|
||||
<property name="title" >
|
||||
<string>&Tools</string>
|
||||
<string>&Actions</string>
|
||||
</property>
|
||||
<addaction name="actionAddTag" />
|
||||
<addaction name="actionDeleteTag" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue