本文整理汇总了Python中oyProjectManager.models.project.Project类的典型用法代码示例。如果您正苦于以下问题:Python Project类的具体用法?Python Project怎么用?Python Project使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_alternative_shot_is_working_properly
def test_add_alternative_shot_is_working_properly(self):
"""testing if the add_alternative_shot method is working properly
"""
new_proj = Project("Test Project")
new_proj.create()
new_seq = Sequence(new_proj, "Test Sequence", "TEST_SEQ1")
new_seq.save()
new_shot = Shot(new_seq, 1)
new_shot.save()
# check if the sequence has only one shot
self.assertEqual(len(new_seq.shots), 1)
# now create an alternative to this shot
new_seq.add_alternative_shot(1)
# now check if the sequence has two shots
self.assertEqual(len(new_seq.shots), 2)
# and the second shots number is 1A
self.assertEqual(new_seq.shots[1].number, "1A")
# add a new alternative
new_seq.add_alternative_shot("1")
# check if there is three shots
self.assertEqual(len(new_seq.shots), 3)
# and the third shots number is 1B
self.assertEqual(new_seq.shots[2].number, "1B")
示例2: test_database_simple_data
def test_database_simple_data(self):
"""testing if the database file has the necessary information related to
the Sequence
"""
new_proj = Project(name="TEST_PROJECT")
new_proj.create()
test_seq_name = "TEST_SEQ1"
new_seq = Sequence(new_proj, test_seq_name)
new_seq.save()
new_seq.create()
# fill it with some non default values
description = new_seq.description = "Test description"
new_seq.save()
# now check if the database is created correctly
del new_seq
# create the seq from scratch and let it read the database
new_seq = db.session.query(Sequence).first()
# now check if it was able to get these data
self.assertEqual(description, new_seq.description)
示例3: test_edit_shot_button_opens_up_shot_editor_with_the_given_shot
def test_edit_shot_button_opens_up_shot_editor_with_the_given_shot(self):
"""testing if hitting the edit shot button opens up the shot_editor
dialog
"""
proj1 = Project('Test Project')
proj1.save()
seq1 = Sequence(proj1, 'Test Sequence')
seq1.save()
shot = Shot(seq1, 1, 2, 435)
shot.handle_at_start = 23
shot.handle_at_end = 12
shot.save()
dialog1 = project_manager.MainDialog()
# self.show_dialog(dialog1)
# hit to the edit shot button
# QTest.mouseClick(
# dialog1.edit_shot_pushButton,
# QtCore.Qt.LeftButton
# )
# check if the shot_editor dialog is opened
# HOW ????
self.fail('test is not finished yet')
示例4: test_projects_comboBox_is_filled_with_projects_on_the_database
def test_projects_comboBox_is_filled_with_projects_on_the_database(self):
"""testing if the projects_comboBox is filled with Project instances
from the database
"""
# create a couple of projects
project1 = Project("Test Project 1")
project2 = Project("Test Project 2")
project3 = Project("Test Project 3")
project3.active = False
project1.save()
project2.save()
project3.save()
# open UI
dialog = project_manager.MainDialog()
#self.show_dialog(dialog)
# check if the projects are listed there
self.assertEqual(dialog.projects_comboBox.count(), 3)
item_texts = []
for i in range(3):
dialog.projects_comboBox.setCurrentIndex(i)
item_texts.append(dialog.projects_comboBox.currentText())
self.assertTrue(project1.name in item_texts)
self.assertTrue(project2.name in item_texts)
self.assertTrue(project3.name in item_texts)
示例5: test_add_shots_method_creates_shots_based_on_the_given_range_formulat
def test_add_shots_method_creates_shots_based_on_the_given_range_formulat(self):
"""testing if the add_shots will create shots based on the
shot_range_formula argument
"""
new_proj = Project(name="Test Project")
new_proj.create()
new_seq1 = Sequence(new_proj, "Test Sequence 1", "TEST_SEQ1")
new_seq1.save()
expected_shot_numbers = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"10",
"12",
"13",
"14",
"15",
"304_SB_0403_0040",
]
# assert there is no shots in the sequence
self.assertTrue(len(new_seq1.shots) == 0)
# add a new shot
new_seq1.add_shots("1")
self.assertTrue(len(new_seq1.shots) == 1)
self.assertTrue(new_seq1.shots[0].number in expected_shot_numbers)
# add a couple of shots
new_seq1.add_shots("2,3,4")
self.assertTrue(len(new_seq1.shots) == 4)
self.assertTrue(new_seq1.shots[1].number in expected_shot_numbers)
self.assertTrue(new_seq1.shots[2].number in expected_shot_numbers)
self.assertTrue(new_seq1.shots[3].number in expected_shot_numbers)
# add a couple of more
# new_seq1.add_shots("5-8,10,12-15")
new_seq1.add_shots("5,6,7,8,10,12,13,14,15,304_sb_0403_0040")
self.assertTrue(len(new_seq1.shots) == 14)
self.assertIn(new_seq1.shots[4].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[5].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[6].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[7].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[8].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[9].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[10].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[11].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[12].number, expected_shot_numbers)
self.assertIn(new_seq1.shots[13].number, expected_shot_numbers)
示例6: test_UI_will_edit_the_given_Project_instance
def test_UI_will_edit_the_given_Project_instance(self):
"""testing if a Project instance is passed the interface will allow the
given Project instance to be edited
"""
new_client = Client(name='Test Client 1')
new_client.save()
new_project = Project("Test Project")
new_project.create()
dialog = project_properties.MainDialog(project=new_project)
# now edit the project from the UI
new_name = "Test Project New Name"
new_fps = 50
dialog.name_lineEdit.setText(new_name)
new_client_2_name = 'Test Client 2'
dialog.clients_comboBox.lineEdit().setText(new_client_2_name)
dialog.fps_spinBox.setValue(new_fps)
dialog.resolution_comboBox.setCurrentIndex(3)
preset_name = dialog.resolution_comboBox.currentText()
resolution_data = conf.resolution_presets[preset_name]
dialog.active_checkBox.setChecked(False)
dialog.shot_number_prefix_lineEdit.setText("PL")
dialog.shot_number_padding_spinBox.setValue(5)
dialog.revision_number_prefix_lineEdit.setText("rev")
dialog.revision_number_padding_spinBox.setValue(3)
dialog.version_number_prefix_lineEdit.setText("ver")
dialog.version_number_padding_spinBox.setValue(5)
new_structure = "This is the new structure\nwith three lines\n" + \
"and this is the third line"
dialog.structure_textEdit.setText(new_structure)
# hit ok
QTest.mouseClick(dialog.buttonBox.buttons()[0], Qt.LeftButton)
# now check the data
self.assertEqual(new_project.name, new_name)
self.assertEqual(new_project.client.name, new_client_2_name)
# check if a client is created with that name
new_client_2 = Client.query().filter(Client.name==new_client_2_name).first()
self.assertIsInstance(new_client_2, Client)
self.assertEqual(new_project.fps, new_fps)
self.assertEqual(new_project.width, resolution_data[0])
self.assertEqual(new_project.height, resolution_data[1])
self.assertEqual(new_project.pixel_aspect, resolution_data[2])
self.assertEqual(new_project.active, False)
self.assertEqual(new_project.shot_number_padding, 5)
self.assertEqual(new_project.shot_number_prefix, "PL")
self.assertEqual(new_project.rev_number_padding, 3)
self.assertEqual(new_project.rev_number_prefix, "rev")
self.assertEqual(new_project.ver_number_padding, 5)
self.assertEqual(new_project.ver_number_prefix, "ver")
self.assertEqual(new_project.structure, new_structure)
示例7: test_code_lineEdit_is_disabled_when_an_existing_Project_is_passed
def test_code_lineEdit_is_disabled_when_an_existing_Project_is_passed(self):
"""testing if the code_lineEdit is disabled when an existing Project
instance is passed to the UI
"""
new_project = Project("Test Project 1")
new_project.create()
dialog = project_properties.MainDialog(project=new_project)
self.assertFalse(dialog.code_lineEdit.isEnabled())
示例8: test_sequences_comboBox_is_filled_with_sequences_from_the_current_project
def test_sequences_comboBox_is_filled_with_sequences_from_the_current_project(self):
"""testing if the sequences_comboBox is filled with the correct
sequences from the currently chosen Project instance
"""
project1 = Project("Test Project 1")
project2 = Project("Test Project 2")
project1.create()
project2.create()
project1.save()
project2.save()
seq1 = Sequence(project1, "Test Sequence 1")
seq1.save()
seq2 = Sequence(project1, "Test Sequence 2")
seq2.save()
seq3 = Sequence(project2, "Test Sequence 3")
seq3.save()
seq4 = Sequence(project2, "Test Sequence 4")
seq4.save()
# create dialog
dialog = project_manager.MainDialog()
# self.show_dialog(dialog)
# set the project to project2
index = dialog.projects_comboBox.findText(project2.name)
dialog.projects_comboBox.setCurrentIndex(index)
# check if the sequences_comboBox is filled with correct data
self.assertEqual(dialog.sequences_comboBox.count(), 2)
item_texts = []
for i in range(2):
dialog.sequences_comboBox.setCurrentIndex(i)
item_texts.append(dialog.sequences_comboBox.currentText())
self.assertTrue(seq3.name in item_texts)
self.assertTrue(seq4.name in item_texts)
# set the project to project1
index = dialog.projects_comboBox.findText(project1.name)
dialog.projects_comboBox.setCurrentIndex(index)
# check if the sequences_comboBox is filled with correct data
self.assertEqual(dialog.sequences_comboBox.count(), 2)
item_texts = []
for i in range(2):
dialog.sequences_comboBox.setCurrentIndex(i)
item_texts.append(dialog.sequences_comboBox.currentText())
self.assertTrue(seq1.name in item_texts)
self.assertTrue(seq2.name in item_texts)
示例9: test_code_argument_is_not_unique_for_same_project
def test_code_argument_is_not_unique_for_same_project(self):
"""testing if the code argument is not unique raises IntegrityError
"""
test_project = Project("Test Project for Name Uniqueness")
test_project.save()
test_seq1 = Sequence(test_project, "Seq1A", "SEQ1")
test_seq1.save()
test_seq2 = Sequence(test_project, "Seq1B", "SEQ1")
self.assertRaises(IntegrityError, test_seq2.save)
示例10: setUp
def setUp(self):
"""setup the test settings with environment variables
"""
# -----------------------------------------------------------------
# start of the setUp
conf.database_url = "sqlite://"
# create the environment variable and point it to a temp directory
self.temp_config_folder = tempfile.mkdtemp()
self.temp_projects_folder = tempfile.mkdtemp()
os.environ["OYPROJECTMANAGER_PATH"] = self.temp_config_folder
os.environ[conf.repository_env_key] = self.temp_projects_folder
self.test_project = Project("TEST_PROJ1")
self.test_project.create()
self.test_project.save()
self.kwargs = {
# "project": self.test_project,
"name": "Test VType",
"code": "TVT",
"path": "{{project.full_path}}/Sequences/{{sequence.code}}/SHOTS/{{version.base_name}}/{{type.code}}",
"filename": "{{version.base_name}}_{{version.take_name}}_{{type.code}}_v{{'%03d'|format(version.version_number)}}_{{version.created_by.initials}}",
"environments": ["MAYA", "HOUDINI"],
"output_path": "SHOTS/{{version.base_name}}/{{type.code}}/OUTPUT/{{version.take_name}}",
"extra_folders": """{{version.path}}/exports
{{version.path}}/cache
""",
"type_for": "Shot",
}
self.test_versionType = VersionType(**self.kwargs)
self.test_versionType.save()
self._name_test_values = [
("base name", "Base_Name"),
("123123 base_name", "Base_Name"),
("123432!+!'^+Base_NAme323^+'^%&+%&324", "Base_NAme323324"),
(" ---base 9s_name", "Base_9s_Name"),
(" ---base 9s-name", "Base_9s_Name"),
(
" multiple spaces are converted to under scores",
"Multiple_Spaces_Are_Converted_To_Under_Scores",
),
("camelCase", "CamelCase"),
("CamelCase", "CamelCase"),
("_Project_Setup_", "Project_Setup"),
("_PROJECT_SETUP_", "PROJECT_SETUP"),
("FUL_3D", "FUL_3D"),
("BaseName", "BaseName"),
("baseName", "BaseName"),
(" baseName", "BaseName"),
(" base name", "Base_Name"),
(" 12base name", "Base_Name"),
(" 12 base name", "Base_Name"),
(" 12 base name 13", "Base_Name_13"),
(">£#>$#£½$ 12 base £#$£#$£½¾{½{ name 13", "Base_Name_13"),
("_base_name_", "Base_Name"),
]
示例11: _validate_name
def _validate_name(self, key, name):
"""validates the given name
"""
name = Project._condition_name(name)
return name
示例12: test_deleting_a_sequence_will_also_delete_the_related_shots
def test_deleting_a_sequence_will_also_delete_the_related_shots(self):
"""testing if deleting a sequence will also delete the related shots
"""
proj1 = Project("Test Project 1")
proj1.save()
seq1 = Sequence(proj1, "Seq1")
seq1.save()
seq2 = Sequence(proj1, "Seq2")
seq2.save()
shot1 = Shot(seq1, 1)
shot1.save()
shot2 = Shot(seq1, 2)
shot2.save()
shot3 = Shot(seq2, 1)
shot3.save()
shot4 = Shot(seq2, 2)
shot4.save()
# check if they are in session
self.assertIn(proj1, db.session)
self.assertIn(seq1, db.session)
self.assertIn(seq2, db.session)
self.assertIn(shot1, db.session)
self.assertIn(shot2, db.session)
self.assertIn(shot3, db.session)
self.assertIn(shot4, db.session)
# delete seq1
db.session.delete(seq1)
db.session.commit()
# check if all the objects which must be deleted are really deleted
self.assertNotIn(seq1, db.session)
self.assertNotIn(shot1, db.session)
self.assertNotIn(shot2, db.session)
# and others are in
self.assertIn(proj1, db.session)
self.assertIn(seq2, db.session)
self.assertIn(shot3, db.session)
self.assertIn(shot4, db.session)
示例13: test_calling_create_multiple_times
def test_calling_create_multiple_times(self):
"""testing if no error will be raised when calling Sequence.create
multiple times
"""
new_proj = Project(name="TEST_PROJECT")
new_proj.create()
new_seq = Sequence(new_proj, "TEST_SEQ")
new_seq.save()
# now call create multiple times
new_seq.create()
new_seq.create()
new_seq.create()
new_seq.create()
new_seq.create()
示例14: test_save_as_sets_the_fps
def test_save_as_sets_the_fps(self):
"""testing if the save_as method sets the fps value correctly
"""
# create two projects with different fps values
# first create a new scene and save it under the first project
# and then save it under the other project
# and check if the fps follows the project values
project1 = Project("FPS_TEST_PROJECT_1")
project1.fps = 24
project1.create()
project2 = Project("FPS_TEST_PROJECT_2")
project2.fps = 30
project2.save()
# create assets
asset1 = Asset(project1, "Test Asset 1")
asset1.save()
asset2 = Asset(project2, "Test Asset 2")
asset2.save()
# create versions
version1 = Version(
version_of=asset1,
base_name=asset1.code,
type=self.asset_vtypes[0],
created_by=self.user1
)
version2 = Version(
version_of=asset2,
base_name=asset2.code,
type=self.asset_vtypes[0],
created_by=self.user1
)
# save the current scene for asset1
self.mEnv.save_as(version1)
# check the fps value
self.assertEqual(
self.mEnv.get_fps(),
24
)
# now save it for asset2
self.mEnv.save_as(version2)
# check the fps value
self.assertEqual(
self.mEnv.get_fps(),
30
)
示例15: test_add_shots_method_will_remove_the_shot_prefix_if_the_given_shot_starts_with_it
def test_add_shots_method_will_remove_the_shot_prefix_if_the_given_shot_starts_with_it(self):
"""testing if the add_shots method will remove the shot prefix in the
given shot code if it starts with the shot prefix of the project
"""
proj1 = Project("Test Proj1")
proj1.save()
seq1 = Sequence(proj1, "Test Seq1")
seq1.save()
# now try to add a shot with the name SH001
seq1.add_shots(proj1.shot_number_prefix + "001")
# now check the first shot of the seq1 has a shot number of 1 and the
# code is SH001
self.assertEqual("1", seq1.shots[0].number)
self.assertEqual("SH001", seq1.shots[0].code)