Commit graph

2320 commits

Author SHA1 Message Date
Elvish_Hunter
ac31185083 wmllint-1.4: use 'with' statement when handling files 2015-09-16 21:03:33 +02:00
Elvish_Hunter
b8dfa190f2 wmllint-1.4: replaced a dict(map()) with dict comprehension 2015-09-12 22:59:18 +02:00
Elvish_Hunter
a12d99e98c wmllint-1.4: use 'x in line' instead of 'line.count(x)' 2015-09-12 21:49:03 +02:00
Elvish_Hunter
91f5bf16c2 wmllint-1.4: use Python 3 range()
That's the function known in Python 2 as xrange().
2015-09-12 21:49:03 +02:00
Elvish_Hunter
1d2944569c wmllint-1.4: open files as UTF-8 and use Unicode literals 2015-09-12 21:49:02 +02:00
Elvish_Hunter
ef559d0ffd GUI.pyw: allow binding tooltips to tagged elements of widgets 2015-09-12 21:49:02 +02:00
Elias Pschernig
f8fb04093a [units.wesnoth.org] fix some small issues 2015-09-10 18:10:16 -04:00
Charles Dang
4f078f26ef GUI.pyw: small label tweaks 2015-09-10 21:55:43 +11:00
Elias Pschernig
3ab3db3166 [units.wesnoth.org] Converted the script to Python 3.
Basically ran all .py files through 2to3. I made a copy of wmlparser2.py
called wmlparser3.py for the Python3 version, so as to not inconvenience anyone
who may be using it in their old Python2 scripts.
2015-09-09 22:52:23 -04:00
Elias Pschernig
00516dddbe [units.wesnoth.org] always clean up error log 2015-09-09 10:30:35 -04:00
Elias Pschernig
2cdcae6294 [wmlunits] fix typo 2015-09-08 21:19:42 -04:00
Elias Pschernig
225234b121 [wmlunits: log used memory for pre-pass] 2015-09-08 20:56:14 -04:00
Elias Pschernig
1961c43f16 [wmlunits] clear <config>/data/add-ons
Sometimes if the last run aborted in the wrong moment, add-ons may keep
left overs in there.
2015-09-08 20:15:37 -04:00
Elvish_Hunter
2e574252cb GUI.pyw: added more tooltips 2015-09-07 20:55:09 +02:00
Elvish_Hunter
814d9d1478 GUI.pyw: allow changing tooltip text at runtime 2015-09-07 20:55:09 +02:00
Elvish_Hunter
3cbbede271 GUI.pyw: use specific tooltip font 2015-09-07 20:55:09 +02:00
Elvish_Hunter
78e03f33f3 wmllint-1.4: removed tabs 2015-09-07 20:55:08 +02:00
Elvish_Hunter
cb3c5b9c45 GUI.pyw: focus doesn't follow the mouse any more
Done as per shadowm's suggestion.
2015-09-03 10:06:14 +02:00
Charles Dang
282cfe38be Added new default amla icon
The old icon (misc/icon-amla-default.png) remains for compatibility purposes,
but I added a wmllint rule to update the path.

The new image was created with https://openclipart.org/detail/29043/heart, which is
released under the public domain (CC-0).
2015-09-03 18:53:11 +11:00
Elvish_Hunter
dce1e7bdc1 GUI.pyw: added tooltips, finally! 2015-09-02 19:52:46 +02:00
Elvish_Hunter
b23e93a823 GUI.pyw: added exit confirmation dialog 2015-08-31 23:12:06 +02:00
Elvish_Hunter
8db92e9af3 wmllint-1.4: replaced backticks with repr() 2015-08-31 22:05:03 +02:00
Elvish_Hunter
2bc6aadd49 wmllint-1.4: map, str and dir are Python internal function
Added underscores to distinguish variable names.
2015-08-30 11:06:22 +02:00
Elvish_Hunter
e5bcb79ac8 wmllint-1.4: used Python 3 filter() and map() 2015-08-30 10:50:56 +02:00
Elvish_Hunter
b3a42b4c9b wmlscope: removed dependency from Pillow library
This was possible because the documentation of the PNG format is quite clear, and the code doesn't need to check JPG images.
2015-08-25 21:12:52 +02:00
Elvish_Hunter
def724816f wmllint: fixed an error when trying to check if a file is a savegame
The error was caused by the fact that opening a file with codecs.open() is much stricter than using open(mode=rb), and throws a UnicodeDecodeError if a file can't be read as UTF-8 - which is the case for binary files.
2015-08-25 14:07:26 +02:00
Ignacio R. Morelle
870987886c wmllint: Add plain-text substitution rule for [/advance] -> [/advancement]
I forgot these are plain-text substitutions, so of course we need a
matching rule for closing tags.
2015-08-23 21:54:34 -03:00
Ignacio R. Morelle
863fb3fd2d wmllint: Add plain-text substitution rule for [advance] -> [advancement] 2015-08-23 21:52:57 -03:00
Elvish_Hunter
512c7adb98 wmllint 1.4: used print function 2015-08-20 21:52:42 +02:00
Charles Dang
f07c67ec3e Improvement to the bundled GUI.py icon 2015-08-18 07:36:04 +11:00
Elvish_Hunter
5fd31c88a5 wml tools GUI: added a window icon 2015-08-17 17:02:00 +02:00
Elvish_Hunter
c5854e0299 wmllint: replaced a regexp check with a simpler function
From my tests, it seems like performances are pretty much the same; but this function is way more readable and maintainable than a regexp.
2015-08-15 14:34:10 +02:00
Elvish_Hunter
681d033bca wmllint: removed an instance of deprecated dict.has_key() 2015-08-15 14:34:10 +02:00
Elvish_Hunter
f099638b26 wmllint: replaced backticks with repr()
Backticks as shortcut for repr() are removed from Python 3. Although all their usages were already commented out, I fixed it anyway in case the code is uncommented.
2015-08-11 19:41:37 +02:00
Elvish_Hunter
d8478cbed1 wmllint: replaced map and string.strip with list comprehension
string.strip() isn't available on Python 3, because of its redundancy with the .strip() method available on any string.
2015-08-11 19:41:37 +02:00
Elvish_Hunter
7fa2943683 All main WML tools: replaced tabs with spaces 2015-08-11 19:41:36 +02:00
Elvish_Hunter
de64146e35 wmllint, wmltools and wmliterator: more Python 3 compatibility stuff
'raw_input' and 'xrange' in Python 3 are renamed respectively 'input' and 'range'.
2015-08-08 20:36:53 +02:00
Elvish_Hunter
b892f764a6 wmlscope: try to make the image size checks more useful 2015-08-08 20:36:53 +02:00
Elvish_Hunter
2559f97063 wmlscope: slightly improved percentage output when checking for untyped formals 2015-08-07 00:06:54 +02:00
Elvish_Hunter
63863d9f2f wmlscope: enabled image size checks
The undersized() function is supposed to warn if an image has a size below 60 x 60 pixels. I didn't manage to find any documentation about why it was commented out.
I also replaced the error message printed if the PIL library is missing with one more verbose and updated.
2015-08-07 00:04:34 +02:00
Elvish_Hunter
4d675c377f All main wml tools: used Python 3 floating point division
wmltools required integer division, so here the corresponding operator (//) is used
2015-08-06 23:49:40 +02:00
Elvish_Hunter
be62976d80 wmltools and wmlscope: fixed .keys() usages for Python 3
Most usages of the .keys() method were already safe, because they were either iterated only once, or they were wrapped in a call to sorted(), which casts them as lists
2015-08-06 23:40:48 +02:00
Elvish_Hunter
c407625ad3 wmllint: fixed .keys() usages for Python 3
In most cases, calls to the .keys() method were unnecessary, because they were used to test if a dictionary has a key; this can be done by simply using the 'in' operator on the dictionary itself.
2015-08-06 23:33:59 +02:00
Elvish_Hunter
032609e782 wmlscope: clearer message when checking for duplicated files
For now, I'm keeping the MD5 hashes in the message.
2015-08-06 23:21:20 +02:00
Elvish_Hunter
bb51399d26 wmltools: shorten code by using sorted() instead of .sort() 2015-08-06 23:16:48 +02:00
Elvish_Hunter
889eb5aa7b wmllint: fixed a bug in spellchecking caused by Python 3 map()
This bug prevented local spelling words from being added to the spellchecking dictionary, and it was caused by the fact that the map iterator was never iterated.
Replaced with an explicit for cycle.
2015-08-06 23:13:47 +02:00
Elvish_Hunter
6c4ceacb00 wmlscope: fixed a copy-pasting error 2015-08-05 22:13:10 +02:00
Elvish_Hunter
8c098c3264 wmlscope: refactored collision detection
This fixes the breakage caused by the Python 3 zip() function, which like all generators may be iterated only once; also, it finally returns a meaningful output, instead of the obscure list of filenames which was formerly returned
2015-08-05 20:38:49 +02:00
Elvish_Hunter
c1a783b038 all main wml tools: use filter(), map() and zip() from Python 3
The main difference is that these functions return generators instead of lists. This actually breaks wmlscope's collision detection, which will be fixed in my next commit.
2015-08-05 20:38:48 +02:00
Elvish_Hunter
6d67feff9f wmlscope and wmltools: removed calls to cmp() function
Just like the __cmp__ method, the cmp() function isn't available on Python 3
2015-08-05 20:38:48 +02:00