當前位置: 首頁>>代碼示例>>Python>>正文


Python Project.create方法代碼示例

本文整理匯總了Python中oyProjectManager.models.project.Project.create方法的典型用法代碼示例。如果您正苦於以下問題:Python Project.create方法的具體用法?Python Project.create怎麽用?Python Project.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oyProjectManager.models.project.Project的用法示例。


在下文中一共展示了Project.create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_add_alternative_shot_is_working_properly

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    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")
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:35,代碼來源:test_sequence.py

示例2: test_database_simple_data

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    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)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:27,代碼來源:test_sequence.py

示例3: test_add_shots_method_creates_shots_based_on_the_given_range_formulat

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    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)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:60,代碼來源:test_sequence.py

示例4: test_UI_will_edit_the_given_Project_instance

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    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)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:59,代碼來源:test_project_properties.py

示例5: test_save_as_sets_the_fps

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
 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
     )
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:58,代碼來源:mayaEnv.py

示例6: test_code_lineEdit_is_disabled_when_an_existing_Project_is_passed

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
 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())
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:12,代碼來源:test_project_properties.py

示例7: test_sequences_comboBox_is_filled_with_sequences_from_the_current_project

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    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)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:57,代碼來源:test_project_manager.py

示例8: test_sequences_comboBox_caches_Sequence_instances_in_sequences_attribute

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    def test_sequences_comboBox_caches_Sequence_instances_in_sequences_attribute(self):
        """testing if the sequence_comboBox caches the Sequence instances in
        an attribute called Sequence
        """

        project1 = Project("Test Project 1")
        project1.create()

        project2 = Project("Test Project 2")
        project2.create()

        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()

        seq5 = Sequence(project2, "Test Sequence 5")
        seq5.save()

        dialog = project_manager.MainDialog()
        
        self.assertTrue(hasattr(dialog.sequences_comboBox, "sequences"))

        # set it to project1
        index = dialog.projects_comboBox.findText(project1.name)
        dialog.projects_comboBox.setCurrentIndex(index)

        # check if sequences_comboBox.sequences has 3 elements
        self.assertEqual(len(dialog.sequences_comboBox.sequences), 2)

        # check if all the sequences are there
        self.assertTrue(seq1 in dialog.sequences_comboBox.sequences)
        self.assertTrue(seq2 in dialog.sequences_comboBox.sequences)

        # set it to project2
        index = dialog.projects_comboBox.findText(project2.name)
        dialog.projects_comboBox.setCurrentIndex(index)

        # check if sequences_comboBox.sequences has 3 elements
        self.assertEqual(len(dialog.sequences_comboBox.sequences), 3)

        # check if all the sequences are there
        self.assertTrue(seq3 in dialog.sequences_comboBox.sequences)
        self.assertTrue(seq4 in dialog.sequences_comboBox.sequences)
        self.assertTrue(seq5 in dialog.sequences_comboBox.sequences)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:54,代碼來源:test_project_manager.py

示例9: test_calling_create_multiple_times

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    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()
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:19,代碼來源:test_sequence.py

示例10: test_save_as_references_to_a_version_in_same_workspace_are_replaced_with_abs_path_with_env_variable

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
 def test_save_as_references_to_a_version_in_same_workspace_are_replaced_with_abs_path_with_env_variable(self):
     """testing if the save_as method updates the references paths with an
     absolute path starting with conf.repository_env_key for references to
     a version in the same project thus the referenced path is relative
     """
     
     # create project
     proj1 = Project("Proj1")
     proj1.save()
     proj1.create()
     
     # create assets
     asset1 = Asset(proj1, "Asset 1")
     asset1.save()
     
     # create a version of asset vtype 
     vers1 = Version(asset1, asset1.code, self.asset_vtypes[0], self.user1)
     vers1.save()
     
     # save it
     self.mEnv.save_as(vers1)
     
     # new scene
     pm.newFile(force=True)
     
     # create another version with different type
     vers2 = Version(asset1, asset1.code, self.asset_vtypes[1], self.user1)
     vers2.save()
     
     # reference the other version
     self.mEnv.reference(vers1)
     
     # save it
     self.mEnv.save_as(vers2)
     
     # now check if the referenced vers1 starts with $REPO
     refs = pm.listReferences()
     
     # there should be only one ref
     self.assertTrue(len(refs)==1)
     
     # and the path should start with conf.repository_env_key
     self.assertTrue(
         refs[0].unresolvedPath().startswith("$" + conf.repository_env_key)
     )
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:47,代碼來源:mayaEnv.py

示例11: test_creating_two_different_sequences_and_calling_create

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    def test_creating_two_different_sequences_and_calling_create(self):
        """testing if no error will be raised when creating two different
        Sequences for the same Project and calling the Sequences.create()
        in mixed order
        """

        new_proj = Project(name="TEST_PROJECT")
        new_proj.create()

        new_seq1 = Sequence(new_proj, "TEST_SEQ1")
        new_seq2 = Sequence(new_proj, "TEST_SEQ2")

        new_seq1.save()
        new_seq2.save()

        #        print "calling new_seq1.create"
        new_seq1.create()
        #        print "calling new_seq2.create"
        new_seq2.create()
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:21,代碼來源:test_sequence.py

示例12: test_save_as_of_a_scene_with_two_references_to_the_same_version

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
 def test_save_as_of_a_scene_with_two_references_to_the_same_version(self):
     """testing if the case where the current maya scene has two references
     to the same file is gracefully handled by assigning the version only
     once
     """
     
     # create project
     proj1 = Project("Proj1")
     proj1.save()
     proj1.create()
     
     # create assets
     asset1 = Asset(proj1, "Asset 1")
     asset1.save()
     
     # create a version of asset vtype 
     vers1 = Version(asset1, asset1.code, self.asset_vtypes[0], self.user1)
     vers1.save()
     
     # save it
     self.mEnv.save_as(vers1)
     
     # new scene
     pm.newFile(force=True)
     
     # create another version with different type
     vers2 = Version(asset1, asset1.code, self.asset_vtypes[1], self.user1)
     vers2.save()
     
     # reference the other version twice
     self.mEnv.reference(vers1)
     self.mEnv.reference(vers1)
     
     # save it and expect no InvalidRequestError
     self.mEnv.save_as(vers2)
     
     self.mEnv.reference(vers1)
     vers3 = Version(asset1, asset1.code, self.asset_vtypes[1], self.user1)
     vers3.save()
     
     self.mEnv.save_as(vers3)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:43,代碼來源:mayaEnv.py

示例13: test_reference_creates_references_to_Versions_in_other_workspaces_loaded

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
 def test_reference_creates_references_to_Versions_in_other_workspaces_loaded(self):
     """testing if reference method creates references to Versions with
     different VersionType and the reference state will be loaded
     """
     
     proj1 = Project("Test Project 1")
     proj1.create()
     proj1.save()
 
     asset1 = Asset(proj1, "Test Asset 1")
     asset1.save()
 
     vers1 = Version(asset1, asset1.code, self.asset_vtypes[0], self.user1)
     vers1.save()
 
     vers2 = Version(asset1, asset1.code, self.asset_vtypes[1], self.user1)
     vers2.save()
 
     self.mEnv.save_as(vers1)
 
     pm.newFile(force=True)
 
     self.mEnv.save_as(vers2)
 
     # refence vers1 to vers2
     self.mEnv.reference(vers1)
 
     # now check if the referenced files unresolved path is already starting
     # with conf.repository_env_key
     
     refs = pm.listReferences()
 
     # there should be only one reference
     self.assertEqual(len(refs), 1)
 
     # the unresolved path should start with $REPO
     self.assertTrue(
         refs[0].unresolvedPath().startswith("$" + conf.repository_env_key)
     )
     
     self.assertTrue(refs[0].isLoaded())
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:43,代碼來源:mayaEnv.py

示例14: test_database_recreation_of_sequence_object

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    def test_database_recreation_of_sequence_object(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()

        description = new_seq.description

        # now check if the database is created correctly
        del new_seq

        # create the seq from scratch and let it read the database
        new_seq = Sequence(new_proj, test_seq_name)

        # now check if it was able to get these data
        self.assertEqual(new_seq.description, description)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:24,代碼來源:test_sequence.py

示例15: test___ne___operator

# 需要導入模塊: from oyProjectManager.models.project import Project [as 別名]
# 或者: from oyProjectManager.models.project.Project import create [as 別名]
    def test___ne___operator(self):
        """testing the __ne__ (not equal) operator
        """

        # create a new project and two sequence
        # then create three new sequence objects to compare each of them
        # with the other

        new_proj = Project("TEST_PROJECT_FOR_NE_TEST")
        new_proj.create()

        seq1 = Sequence(new_proj, "SEQ1")
        seq2 = Sequence(new_proj, "SEQ1")
        seq3 = Sequence(new_proj, "SEQ2")

        new_proj2 = Project("TEST_PROJECT2")
        new_proj2.create()
        seq4 = Sequence(new_proj2, "SEQ3")

        self.assertFalse(seq1 != seq2)
        self.assertTrue(seq1 != seq3)
        self.assertTrue(seq1 != seq4)
        self.assertTrue(seq3 != seq4)
開發者ID:dshlai,項目名稱:oyprojectmanager,代碼行數:25,代碼來源:test_sequence.py


注:本文中的oyProjectManager.models.project.Project.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。