-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslide.py
More file actions
24 lines (18 loc) · 718 Bytes
/
slide.py
File metadata and controls
24 lines (18 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class Slide(object):
def __init__(self, pic_a, pic_b=None):
self.pic_a = pic_a
self.pic_b = pic_b
self.tags = pic_a.tags
self.orientation = pic_a.orientation
if self.pic_b is not None:
self.tags.update(self.pic_b.tags)
def is_valid(self, pic_b=None):
if pic_b is None:
pic_b = self.pic_b
return (self.pic_a.orientation == 0 and pic_b is None) or \
(self.pic_a.orientation == 1 and pic_b is not None and pic_b.orientation == 1)
def add(self, pic_b):
assert self.pic_a.orientation == 1
assert pic_b.orientation == 1
self.pic_b = pic_b
self.tags = self.tags.union(pic_b.tags)