Quickly generate Map cards from text files?

100 views
Skip to first unread message

lolil...@gmail.com

unread,
Oct 4, 2013, 4:15:28 AM10/4/13
to mnemosyne-...@googlegroups.com
Hello, everyone. I like the Map card type, but unfortunately there doesn't seem to be an easy way to import them. I seems to be impossible to import Map cards from tab-separated text files.
So I'm thinking of some script that takes a tab-separated text file, with lines of the simple form: locationmarked_imageblank_img, e.g.:

California	maps/USA/California.png	maps/USA/USA.png

and convert it to "openSM2sync" cards.xml representing a set of Map cards.

I don't need a proper plugin, just a (python) script that works. Your help will be appreciated. :)
Message has been deleted

Gnome

unread,
Oct 4, 2013, 6:56:22 AM10/4/13
to mnemosyne-...@googlegroups.com
Hello, it is possible to do this relatively quickly. You can mass the convert the cards from vocal cards to map by selecting them in the card browser, then right click and then choosing 'Convert to card type'. Then all your cards should be converted.

There is also an idea about this on uservoice, where you may vote for ideas for future development: http://mnemosyne.uservoice.com/forums/164265-general/suggestions/2920631-more-flexible-txt-based-import-card-type-tags-

Good luck with studies,

lolilolicon

unread,
Oct 4, 2013, 7:21:58 AM10/4/13
to mnemosyne-...@googlegroups.com
On Fri, Oct 4, 2013 at 6:56 PM, Gnome <jippi...@hotmail.com> wrote:
> Hello, it is possible to do this relatively quickly. You can mass the
> convert the cards from vocal cards to map by selecting them in the card
> browser, then right click and then choosing 'Convert to card type'. Then all
> your cards should be converted.

Good this works! Thank you, Gnome.

I think I've spotted a trivial bug here though: when I choose "Change
card type" and select "Map", then click "OK", the popup "Convert card
type data" window is very small, and I have to resize it to see the
options.

>
> There is also an idea about this on uservoice, where you may vote for ideas
> for future development:
> http://mnemosyne.uservoice.com/forums/164265-general/suggestions/2920631-more-flexible-txt-based-import-card-type-tags-

This is what I've wanted since I started to use Mnemosyne just recently.
I think we need a simple, yet powerful enough, well-defined syntax for
import files.
The tab-separated value format is simple, but is not powerful enough
sometimes, e.g., since it's line-based, we can't have multiline code
enclosed in a <pre> tag in the answer (IMO, this is bad); for the same
reason, we have to put <br> in the text file to introduce a newline,
which reduces the readability of the text file (relatively minor
issue).

>
> Good luck with studies,

You too, thank you.

Timothy Bourke

unread,
Oct 4, 2013, 7:32:33 AM10/4/13
to mnemosyne-...@googlegroups.com
* lolil...@gmail.com <lolil...@gmail.com> [2013-10-04 01:15 -0700]:
> So I'm thinking of some script that takes a tab-separated text file, with lines
> of the simple form: locationmarked_imageblank_img, e.g.:
>
> California maps/USA/California.png
> maps/USA/USA.png
>
> and convert it to "openSM2sync" cards.xml representing a set of Map cards.

With SVG maps, it is also possible to generate the individual images.

See, for instance,
http://www.tbrk.org/software/svgtoquiz.html

This software is not perfect--it was developed for Mnemosyne 1.x and
the user interface could be better (using Qt for instance)--but I
think the fundamental ideas are sound.

It was used to produce the USA states cards to be found at:
http://mnemosyne-proj.org/cards/us-states
amongst others.

Tim.

signature.asc

Gnome

unread,
Oct 4, 2013, 8:41:14 AM10/4/13
to mnemosyne-...@googlegroups.com
In addition to Tim's svgtoquiz, I would like to mention that for producing map cards with bitmap images I use a script.
Unfortunately it is not integrated in mnemosyne, so you still need to import as a text file, and it only works on the next version (2.3) of mnemosyne.
However, the files and demos of the end result may be found here:

lolilolicon

unread,
Oct 4, 2013, 9:24:47 AM10/4/13
to mnemosyne-...@googlegroups.com
On Fri, Oct 4, 2013 at 7:32 PM, Timothy Bourke <t...@tbrk.org> wrote:
> With SVG maps, it is also possible to generate the individual images.
>
> See, for instance,
> http://www.tbrk.org/software/svgtoquiz.html

Neat idea.
I had a rudimentary go for the same thing with a blank US SVG map[1].
It had state codes as element IDs, so I just slapped in some CSS style
at the front, e.g. for Alaska:

<style type="text/css">
#AK { fill:#ff0000; }
</style>

and save it to AK.svg. I was able to do it with sed, thanks to the
well written SVG file.

[1] http://upload.wikimedia.org/wikipedia/commons/3/32/Blank_US_Map.svg

>
> This software is not perfect--it was developed for Mnemosyne 1.x and
> the user interface could be better (using Qt for instance)--but I
> think the fundamental ideas are sound.

Would you update it for 2.x? Maybe break it down a little, so it can
be used to simply generate variations of the origianl image?
(Maybe you already did; since I haven't read your code, so...)

Gnome

unread,
Oct 4, 2013, 9:48:58 AM10/4/13
to mnemosyne-...@googlegroups.com


kl. 15:24:47 UTC+2 fredag 4. oktober 2013 skrev lolilolicon følgende:
On Fri, Oct 4, 2013 at 7:32 PM, Timothy Bourke <t...@tbrk.org> wrote:
> With SVG maps, it is also possible to generate the individual images.
>
> See, for instance,
>     http://www.tbrk.org/software/svgtoquiz.html

Neat idea.
I had a rudimentary go for the same thing with a blank US SVG map[1].
It had state codes as element IDs, so I just slapped in some CSS style
at the front, e.g. for Alaska:

<style type="text/css">
    #AK { fill:#ff0000; }
</style>

and save it to AK.svg. I was able to do it with sed, thanks to the
well written SVG file.


Have you got this to work in mnemosyne?
I have also tried this, I wanted the code to be in the card, but I only got it to work in firefox not chrome (webkit).

lolilolicon

unread,
Oct 4, 2013, 10:07:09 AM10/4/13
to mnemosyne-...@googlegroups.com
The idea of (live) overlay is interesting. However, to be honest, I
can't say I find your implementation meaningful. If I read the README
right, one still needs to manually cover every single image. I don't
see much time-saving here, compared to, say, editing the images in
GIMP. Also the image preparation requires Flash, which is an instant
turn-off.
OTOH I can see this may be helpful for some of the Windows users, I guess...

Rich JavaScript in Mnemosyne provokes possibilities of interactivity
that might improve the experience, which is exciting; yet, the
simplicity of Mnemosyne is its best strength.

Just my 2 cents.

lolilolicon

unread,
Oct 4, 2013, 10:14:16 AM10/4/13
to mnemosyne-...@googlegroups.com
What do you mean by "I wanted the code to be in the card"? What I did
was to put the css styles in the individual SVG files, which change
the rendered images. I import a file of tab-separated values like:

Alaska <img src="maps/US/AK.svg"> <img src="maps/US/US.svg">

and it's all good.

Gnome

unread,
Oct 4, 2013, 10:34:15 AM10/4/13
to mnemosyne-...@googlegroups.com
Thanks for the feedback. Unfortunately my python and QT knowledge is not that strong, but I hope to someday make a version of it where you may do this directly in mnemosyne.

Gnome

unread,
Oct 4, 2013, 11:18:50 AM10/4/13
to mnemosyne-...@googlegroups.com
I feel that the best way is to change the SVG image "live" using javascript since it reduces the space taken up by files, especially if you intend to use it on a mobile device or "stream" them over ie. 3g. For example with my overlayScript I have 367 map cards, and the image file size for these only takes 2 MB.

Gnome

unread,
Oct 4, 2013, 11:30:15 AM10/4/13
to mnemosyne-...@googlegroups.com
Also, the "live" approach is more dynamic since it allows you to edit the artwork on a later stage without remaking the cards.

Timothy Bourke

unread,
Oct 4, 2013, 11:43:26 AM10/4/13
to mnemosyne-...@googlegroups.com
* Gnome <jippi...@hotmail.com> [2013-10-04 08:18 -0700]:
> I feel that the best way is to change the SVG image "live" using javascript
> since it reduces the space taken up by files, especially if you intend to use
> it on a mobile device or "stream" them over ie. 3g. For example with my
> overlayScript I have 367 map cards, and the image file size for these only
> takes 2 MB.

I like lolilolicon's style trick. I didn't know that was possible.

I considered generating XSLT expressions from svgtoquiz. This would
allow for flexible editing and resolution-independent display and
zooming (which would be ideal for tablets). But at the time even svg
was not well supported by mobile browsers. The situation seems to be
improving, however, and Mnemogogo, for instance, now includes an
option for passing such files through unmodified rather than converted
into png files.

Tim.

signature.asc

Timothy Bourke

unread,
Oct 5, 2013, 4:56:45 PM10/5/13
to mnemosyne-...@googlegroups.com
* lolilolicon <lolil...@gmail.com> [2013-10-04 21:24 +0800]:
> On Fri, Oct 4, 2013 at 7:32 PM, Timothy Bourke <t...@tbrk.org> wrote:
> > This software is not perfect--it was developed for Mnemosyne 1.x and
> > the user interface could be better (using Qt for instance)--but I
> > think the fundamental ideas are sound.
>
> Would you update it for 2.x? Maybe break it down a little, so it can
> be used to simply generate variations of the origianl image?
> (Maybe you already did; since I haven't read your code, so...)

Sure:
http://www.tbrk.org/software/svgtoquiz.html#download

I also migrated the source repository to launchpad:
https://launchpad.net/svgtoquiz

From memory, this was one of my first Python programs; most of the
code hasn't been touched for 5 years. Many things could be improved,
but I think it is still quite useful.

Tim.

signature.asc

lolilolicon

unread,
Oct 6, 2013, 2:19:45 AM10/6/13
to mnemosyne-...@googlegroups.com
On Sun, Oct 6, 2013 at 4:56 AM, Timothy Bourke <t...@tbrk.org> wrote:
> * lolilolicon <lolil...@gmail.com> [2013-10-04 21:24 +0800]:
>> On Fri, Oct 4, 2013 at 7:32 PM, Timothy Bourke <t...@tbrk.org> wrote:
>> > This software is not perfect--it was developed for Mnemosyne 1.x and
>> > the user interface could be better (using Qt for instance)--but I
>> > think the fundamental ideas are sound.
>>
>> Would you update it for 2.x? Maybe break it down a little, so it can
>> be used to simply generate variations of the origianl image?
>> (Maybe you already did; since I haven't read your code, so...)
>
> Sure:
> http://www.tbrk.org/software/svgtoquiz.html#download
>

Thanks for the contribution.
There seems to be a packaging issue; svgtoquiz-2.0.0.tar.gz is missing
the export/ directory, among other things.

Timothy Bourke

unread,
Oct 6, 2013, 3:48:57 AM10/6/13
to mnemosyne-...@googlegroups.com
* lolilolicon <lolil...@gmail.com> [2013-10-06 14:19 +0800]:
> There seems to be a packaging issue; svgtoquiz-2.0.0.tar.gz is missing
> the export/ directory, among other things.

It seems that the setup tools no longer behave as they did. I've
updated the packages.

Tim.

signature.asc
Reply all
Reply to author
Forward
0 new messages