some pep8 fixes, simplify if check lines, fix/add some help messages, unify line endings to be unix
This commit is contained in:
parent
b79ad84851
commit
02c5be2555
@ -329,7 +329,8 @@ class DominionTabs:
|
||||
x, coinHeight, 16, 16, preserveAspectRatio=True, mask='auto')
|
||||
if card.potcost:
|
||||
self.canvas.drawImage(os.path.join(self.filedir, 'images', 'potion.png'), x + 17,
|
||||
potHeight, potSize, potSize, preserveAspectRatio=True, mask=[255, 255, 255, 255, 255, 255])
|
||||
potHeight, potSize, potSize, preserveAspectRatio=True,
|
||||
mask=[255, 255, 255, 255, 255, 255])
|
||||
width += potSize
|
||||
|
||||
self.canvas.setFont('MinionPro-Bold', 12)
|
||||
@ -399,7 +400,6 @@ class DominionTabs:
|
||||
textInsetRight = 6
|
||||
if self.options.use_text_set_icon:
|
||||
setImageHeight = card.getType().getTabTextHeightOffset()
|
||||
#self.canvas.rect(self.tabLabelWidth - 20, setImageHeight, 20, 20, 1 )
|
||||
setText = card.setTextIcon()
|
||||
self.canvas.setFont('MinionPro-Oblique', 8)
|
||||
if setText is None:
|
||||
@ -450,7 +450,9 @@ class DominionTabs:
|
||||
h -= h / 2
|
||||
|
||||
words = line.split()
|
||||
if (not self.options.tab_name_align == "right") and (self.options.tab_name_align == "centre" or rightSide or not self.options.tab_name_align == "edge" ):
|
||||
if (not self.options.tab_name_align == "right") and (self.options.tab_name_align == "centre" or
|
||||
rightSide or
|
||||
not self.options.tab_name_align == "edge"):
|
||||
if self.options.tab_name_align == "centre":
|
||||
w = self.tabLabelWidth / 2 - self.nameWidth(line, fontSize) / 2
|
||||
else:
|
||||
@ -551,7 +553,7 @@ class DominionTabs:
|
||||
# figure out whether the tab should go on the right side or not
|
||||
if self.options.tab_side == "right":
|
||||
rightSide = useExtra
|
||||
elif self.options.tab_side == "left" or self.options.tab_side == "full":
|
||||
elif self.options.tab_side in ["left", "full"]:
|
||||
rightSide = not useExtra
|
||||
else:
|
||||
# alternate the cards
|
||||
@ -671,7 +673,7 @@ class DominionTabs:
|
||||
def read_card_defs(self, fname, fileobject=None):
|
||||
cards = []
|
||||
f = open(fname)
|
||||
carddef = re.compile("^\d+\t+(?P<name>[\w\-'/ ]+)\t+(?P<set>[\w ]+)\t+(?P<type>[-\w ]+)\t+\$(?P<cost>(\d+(\+|\*)?|\*))( (?P<potioncost>\d)+P)?\t+(?P<description>.*)",
|
||||
carddef = re.compile("^\d+\t+(?P<name>[\w\-'/ ]+)\t+(?P<set>[\w ]+)\t+(?P<type>[-\w ]+)\t+\$(?P<cost>(\d+(\+|\*)?|\*))( (?P<potioncost>\d)+P)?\t+(?P<description>.*)", # noqa
|
||||
re.UNICODE)
|
||||
currentCard = None
|
||||
for line in f:
|
||||
@ -758,7 +760,7 @@ class DominionTabs:
|
||||
cards = split(cards, self.numTabsVertical * self.numTabsHorizontal)
|
||||
|
||||
# Starting with tabs on the left or the right?
|
||||
if self.options.tab_side == "right-alternate" or self.options.tab_side == "right":
|
||||
if self.options.tab_side in ["right-alternate", "right"]:
|
||||
self.odd = True
|
||||
else:
|
||||
# left-alternate, left, full
|
||||
@ -829,12 +831,16 @@ class DominionTabs:
|
||||
" the name is less likely to be hidden by the tab in front"
|
||||
" (edge will revert to left when tab_side is full since there is no edge in that case);"
|
||||
" default:left")
|
||||
parser.add_option("--tab_side", type="choice", choices=["left", "right", "left-alternate", "right-alternate", "full"],
|
||||
parser.add_option("--tab_side", type="choice", choices=["left",
|
||||
"right",
|
||||
"left-alternate",
|
||||
"right-alternate",
|
||||
"full"],
|
||||
dest="tab_side", default="right-alternate",
|
||||
help="Alignment of tab. choices: left, right, left-alternate, right-alternate, full;"
|
||||
" left/right forces all tabs to left/right side;"
|
||||
" left-alternate will start on the left and then toggle between left and right for the tabs;"
|
||||
" right-alternate will start on the right and then toggle between right and left for the tabs;"
|
||||
" right-alternate will start on the right and then toggle between right and left for the tabs;" # noqa
|
||||
" full will force all label tabs to be full width of the divider"
|
||||
" default:right-alternate")
|
||||
parser.add_option("--tabwidth", type="float", default=4,
|
||||
@ -877,14 +883,13 @@ class DominionTabs:
|
||||
help='centre the tabs on expansion dividers')
|
||||
parser.add_option("--num_pages", type="int", default=-1,
|
||||
help="stop generating after this many pages, -1 for all")
|
||||
parser.add_option(
|
||||
"--language", default='en_us', help="language of card texts")
|
||||
parser.add_option("--language", default='en_us', help="language of card texts")
|
||||
parser.add_option("--include_blanks", action="store_true",
|
||||
help="include a few dividers with extra text")
|
||||
parser.add_option("--exclude_events", action="store_true",
|
||||
default=False, help="exclude individual dividers for events")
|
||||
parser.add_option("--exclude_card_groups", action="store_true",
|
||||
default=False, help="exclude individual dividers for events")
|
||||
parser.add_option("--special_card_groups", action="store_true",
|
||||
default=False, help="group some cards under special dividers (e.g. Shelters, Prizes)")
|
||||
parser.add_option("--exclude_prizes", action="store_true",
|
||||
default=False, help="exclude individual dividers for prizes (cornucopia)")
|
||||
parser.add_option("--cardlist", type="string", dest="cardlist", default=None,
|
||||
@ -968,7 +973,6 @@ class DominionTabs:
|
||||
for line in cardfile:
|
||||
self.cardlist.add(line.strip())
|
||||
|
||||
|
||||
if self.options.orientation == "vertical":
|
||||
self.tabWidth, self.tabBaseHeight = dominionCardHeight, dominionCardWidth
|
||||
else:
|
||||
@ -979,6 +983,7 @@ class DominionTabs:
|
||||
|
||||
if self.options.tab_side == "full" and self.options.tab_name_align == "edge":
|
||||
# This case does not make sense since there are two tab edges in this case. So picking left edge.
|
||||
print >>sys.stderr, "** Warning: Aligning card name as 'left' for 'full' tabs **"
|
||||
self.options.tab_name_align == "left"
|
||||
|
||||
fixedMargins = False
|
||||
@ -1113,9 +1118,12 @@ class DominionTabs:
|
||||
else:
|
||||
cards = [card for card in cards if not isBaseExpansionCard(card)]
|
||||
|
||||
if self.options.exclude_card_groups:
|
||||
# Load the card groupos file
|
||||
card_groups = self.read_card_groups(os.path.join(self.filedir, "card_db", options.language, "card_groups.txt"))
|
||||
if self.options.special_card_groups:
|
||||
# Load the card groups file
|
||||
card_groups = self.read_card_groups(os.path.join(self.filedir,
|
||||
"card_db",
|
||||
options.language,
|
||||
"card_groups.txt"))
|
||||
# pull out any cards which are a subcard, and rename the master card
|
||||
new_cards = []
|
||||
all_subcards = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user