- layout_options = [
- (self.m.marquise_small, 2),
- (self.m.marquise_small, 1),
- (self.m.marquise_big, 3),
- (self.m.marquise_xl, 4),
- (self.m.marquise_xl, None),
- ]
-
- # Trying all the layout options with decreasing scale.
- title_box = None
- title_scale = 1
- while title_box is None:
- for marquise_h, lines in layout_options:
- title_box_height = marquise_h - self.m.title_box_top - self.m.margin
- try:
- title_box = TitleBox(
- self,
- self.m.width - 2 * self.m.margin,
- title_box_height,
- lines,
- scale=title_scale
- )
- except DoesNotFit:
- continue
- else:
- break
- title_scale *= .99
-
- self.marquise_height = marquise_h
- marquise = Marquise(self, marquise_h)
-
- bg.apply(
- img,
- 0, marquise.edge_top,
- self.m.width, self.m.height - marquise.edge_top
- )
- self.set_color_scheme_from(
- img.crop((
+ bg = Background(self)
+ if self.square_variant:
+ layout_options = [
+ (self.m.marquise_small, 1),
+ (self.m.marquise_big, 2),
+ (self.m.marquise_big, 3),
+ (self.m.marquise_big, None),
+ ]
+ else:
+ layout_options = [
+ (self.m.marquise_small, 2),
+ (self.m.marquise_small, 1),
+ (self.m.marquise_big, 3),
+ (self.m.marquise_xl, 4),
+ (self.m.marquise_xl, None),
+ ]
+
+ # Trying all the layout options with decreasing scale.
+ title_box = None
+ title_scale = 1
+ while title_box is None:
+ for marquise_h, lines in layout_options:
+ title_box_height = marquise_h - self.m.title_box_top - self.m.margin
+ try:
+ title_box = TitleBox(
+ self,
+ self.m.width - 2 * self.m.margin,
+ title_box_height,
+ lines,
+ scale=title_scale
+ )
+ except DoesNotFit:
+ continue
+ else:
+ break
+ title_scale *= .99
+
+ self.marquise_height = marquise_h
+ marquise = Marquise(self, self.marquise_height)
+
+ bg.apply(
+ img,