ldraw.py

Tue, 12 Dec 2017 11:50:18 +0200

author
Santeri Piippo
date
Tue, 12 Dec 2017 11:50:18 +0200
changeset 4
8eb83f200486
parent 3
1dc58f44d556
permissions
-rw-r--r--

color -> colour

4
8eb83f200486 color -> colour
Santeri Piippo
parents: 3
diff changeset
1 class Colour:
3
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
2 def __init__(self, index):
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
3 self.index = int(index, 0)
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
4 def __str__(self):
4
8eb83f200486 color -> colour
Santeri Piippo
parents: 3
diff changeset
5 if self.is_direct_colour():
8eb83f200486 color -> colour
Santeri Piippo
parents: 3
diff changeset
6 # write direct colours with hex codes
3
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
7 return '0x%07X' % self.index
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
8 else:
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
9 return str(self.index)
4
8eb83f200486 color -> colour
Santeri Piippo
parents: 3
diff changeset
10 def is_direct_colour(self):
3
1dc58f44d556 Can now write dat files, added direct color handling
Santeri Piippo
parents: 2
diff changeset
11 return self.index >= 0x2000000

mercurial