[units.wesnoth.org] only recoloror unit icons
This commit is contained in:
parent
d17cf18481
commit
17e6c8c481
2 changed files with 23 additions and 17 deletions
|
@ -64,7 +64,7 @@ class ImageCollector:
|
|||
if os.path.exists(ipath): return ipath, None
|
||||
return None, bases
|
||||
|
||||
def add_image_check(self, campaign, path):
|
||||
def add_image_check(self, campaign, path, no_tc = False):
|
||||
if (campaign, path) in self.notfound:
|
||||
return self.notfound[(campaign, path)], True
|
||||
ipath, error = self.find_image(path, campaign)
|
||||
|
@ -75,7 +75,7 @@ class ImageCollector:
|
|||
name += os.path.basename(path)
|
||||
self.id += 1
|
||||
|
||||
self.images[name] = ipath, path, campaign, error
|
||||
self.images[name] = ipath, path, campaign, error, no_tc
|
||||
if ipath:
|
||||
self.ipaths[ipath] = name
|
||||
return name, False
|
||||
|
@ -83,8 +83,8 @@ class ImageCollector:
|
|||
self.notfound[(campaign, path)] = name
|
||||
return name, True
|
||||
|
||||
def add_image(self, campaign, path):
|
||||
name, error = self.add_image_check(campaign, path)
|
||||
def add_image(self, campaign, path, no_tc = False):
|
||||
name, error = self.add_image_check(campaign, path, no_tc)
|
||||
return name
|
||||
|
||||
def copy_and_color_images(self, target_path):
|
||||
|
@ -95,15 +95,17 @@ class ImageCollector:
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
ipath, i, c, bases = self.images[iid]
|
||||
ipath, i, c, bases, no_tc = self.images[iid]
|
||||
if ipath and os.path.exists(ipath):
|
||||
#shutil.copy2(ipath, opath)
|
||||
# We assume TeamColorizer is in the same directory as the
|
||||
# helpers.py currently executing.
|
||||
command = os.path.join(os.path.dirname(__file__),
|
||||
"TeamColorizer")
|
||||
p = subprocess.Popen([command, ipath, opath])
|
||||
p.wait()
|
||||
if no_tc:
|
||||
shutil.copy2(ipath, opath)
|
||||
else:
|
||||
# We assume TeamColorizer is in the same directory as the
|
||||
# helpers.py currently executing.
|
||||
command = os.path.join(os.path.dirname(__file__),
|
||||
"TeamColorizer")
|
||||
p = subprocess.Popen([command, ipath, opath])
|
||||
p.wait()
|
||||
else:
|
||||
sys.stderr.write(
|
||||
"Warning: Required image %s: \"%s\" does not exist.\n" % (
|
||||
|
|
|
@ -407,7 +407,8 @@ class HTMLOutput:
|
|||
picname = image_collector.add_image(u.campaign, image)
|
||||
image = os.path.join("../pics", picname)
|
||||
if portrait:
|
||||
picname = image_collector.add_image(u.campaign, portrait)
|
||||
picname = image_collector.add_image(u.campaign, portrait,
|
||||
no_tc = True)
|
||||
portrait = os.path.join("../pics", picname)
|
||||
return image, portrait
|
||||
|
||||
|
@ -461,7 +462,7 @@ class HTMLOutput:
|
|||
write("</colgroup>")
|
||||
|
||||
pic = image_collector.add_image("mainline",
|
||||
"../../../images/misc/leader-crown.png")
|
||||
"../../../images/misc/leader-crown.png", no_tc = True)
|
||||
crownimage = os.path.join("../pics", pic)
|
||||
ms = None
|
||||
for row in range(len(rows)):
|
||||
|
@ -747,7 +748,8 @@ class HTMLOutput:
|
|||
if not icon:
|
||||
icon = "attacks/%s.png" % aid
|
||||
|
||||
picname, error = image_collector.add_image_check(unit.campaign, icon)
|
||||
picname, error = image_collector.add_image_check(
|
||||
unit.campaign, icon, no_tc = True)
|
||||
if error:
|
||||
error_message("Error: No attack icon '%s' found for '%s'.\n" % (
|
||||
icon, uid))
|
||||
|
@ -809,7 +811,8 @@ class HTMLOutput:
|
|||
rcell = "td"
|
||||
if special: rcell += ' class="special"'
|
||||
write("<tr>\n")
|
||||
picname = image_collector.add_image("mainline", ricon)
|
||||
picname = image_collector.add_image("mainline", ricon,
|
||||
no_tc = True)
|
||||
icon = os.path.join("../pics", picname)
|
||||
write("<td><img src=\"%s\"/></td>\n" % (icon, ))
|
||||
write("<th>%s</th><td>%s</td>\n" % (_(rid), r))
|
||||
|
@ -866,7 +869,8 @@ class HTMLOutput:
|
|||
d, uid))
|
||||
|
||||
write("<tr>\n")
|
||||
picname = image_collector.add_image("mainline", "terrain/" + ticon + ".png")
|
||||
picname = image_collector.add_image("mainline",
|
||||
"terrain/" + ticon + ".png", no_tc = True)
|
||||
icon = os.path.join("../pics", picname)
|
||||
write("<td><img src=\"%s\" height=\"36px\" /></td>\n" % (icon, ))
|
||||
write("<td>%s</td><%s>%s</td><%s>%s</td>\n" % (
|
||||
|
|
Loading…
Add table
Reference in a new issue