コード例 #1
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def setUp(self):
     self.atom = atom.Atom(type=self.type)
     self.child_atom = atom.Atom(type=self.child_type)
コード例 #2
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testDataIsNotEqual(self):
     self.atom.write(self.content)
     other = atom.Atom(type=self.type)
     
     self.assertNotEqual(other, self.atom)
コード例 #3
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testDataIsEqual(self):
     equal_atom = atom.Atom(type=self.type)
     self.assertEqual(equal_atom, self.atom)
コード例 #4
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testDataIsNotEqual(self):
     inequal_atom = atom.Atom(type='ftyp')
     self.assertNotEqual(inequal_atom, self.atom)
コード例 #5
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testGetChildrenOfType(self):
     loaded_atom = atom.Atom(self.atom_stream)
     children_of_type = loaded_atom.get_children_of_type(self.child_1_type)
     
     self.assertEqual(1, len(children_of_type))
     self.assertEqual(loaded_atom[0], children_of_type[0])
コード例 #6
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testContainerIsEqual(self):
     equal_atom = atom.Atom(type=self.type)
     self.assertEqual(equal_atom, self.atom)
コード例 #7
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testLoadedAtomIsCorrectlyStructured(self):
     loaded_atom = atom.Atom(self.atom_stream)
     self.assertEqual(2, len(loaded_atom))
     self.assertEqual(2, len(loaded_atom[0]))
     self.assertEqual(0, len(loaded_atom[1]))
コード例 #8
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testReadDataAtom(self):
     loaded_atom = atom.Atom(self.atom_stream)
     loaded_atom[0][0].seek(0)
     self.assertEqual(self.child_1_1_data, loaded_atom[0][0].read())
コード例 #9
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testAtomHasChild(self):
     loaded_atom = atom.Atom(self.atom_stream)
     self.assertEqual(1, len(loaded_atom))
コード例 #10
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testAtomCanLoad(self):
     loaded_atom = atom.Atom(self.atom_stream)
コード例 #11
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testSetItemOnlyAcceptsAtoms(self):
     self.atom.append(atom.Atom(type='free'))
     self.assertRaises(TypeError, self.atom.__setitem__, 0, None)
コード例 #12
0
ファイル: atomtest.py プロジェクト: vdudouyt/mp4-quicktime
 def testContainerIsNotEqual(self):
     child_atoms = [self.child_atom, self.second_child_atom]
     self.atom[0:] = child_atoms
     other = atom.Atom(type=self.type)
     
     self.assertNotEqual(other, self.atom)
コード例 #13
0
display_width = 900
display_height = 700

nucleon_radius = 5
electron_radius = 1

black = (0, 0, 0)
white = (255, 255, 255)
blue = (0, 0, 255)
red = (255, 0, 0)

prots = input("Protons: ")
neuts = input("Neutrons: ")
elecs = input("Electrons: ")

userAtom = atom.Atom(prots, elecs, neuts)

gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('Atomic Model')
clock = pygame.time.Clock()


def proton(prx, pry, prr, color=blue):
    pygame.draw.circle(gameDisplay, black, (int(prx), int(pry)), prr + 2, 2)
    pygame.draw.circle(gameDisplay, color, (int(prx), int(pry)), prr)


def electron(elecx, elecy, elecr, color=red):
    pygame.draw.circle(gameDisplay, black, (int(elecx), int(elecy)), elecr + 1,
                       1)
    pygame.draw.circle(gameDisplay, color, (int(elecx), int(elecy)), elecr)