当前位置: 首页>>代码示例>>Python>>正文


Python Project.save方法代码示例

本文整理汇总了Python中oyProjectManager.models.project.Project.save方法的典型用法代码示例。如果您正苦于以下问题:Python Project.save方法的具体用法?Python Project.save怎么用?Python Project.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oyProjectManager.models.project.Project的用法示例。


在下文中一共展示了Project.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test__code_is_not_unique_for_the_different_project

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
 def test__code_is_not_unique_for_the_different_project(self):
     """testing if no IntegrityError will be raised when the _code attribute
     is not unique for to different projects
     """
     
     project1 = Project("CODE_TEST_PROJECT_1")
     project1.save()
     
     project2 = Project("CODE_TEST_PROJECT_2")
     project2.save()
     
     vbase1 = VersionableBase()
     vbase1._code = "Test"
     vbase1._project = project1
     
     db.session.add(vbase1)
     db.session.commit()
     
     vbase2 = VersionableBase()
     vbase2._code = "Test"
     vbase2._project = project2
     
     db.session.add(vbase2)
     
     # do not expect any IntegrityError
     db.session.commit()
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:28,代码来源:test_versionableBase.py

示例2: test_edit_shot_button_opens_up_shot_editor_with_the_given_shot

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    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')
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:29,代码来源:test_project_manager.py

示例3: test_save_as_sets_the_fps

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [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

示例4: test_sequences_comboBox_is_filled_with_sequences_from_the_current_project

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [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

示例5: test_code_argument_is_not_unique_for_same_project

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    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)
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:14,代码来源:test_sequence.py

示例6: test_code_argument_is_not_unique_for_different_projects

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    def test_code_argument_is_not_unique_for_different_projects(self):
        """testing if no code argument is unique for different projects will
        not raise IntegrityError
        """

        test_project1 = Project("Test Project for Name Uniqueness 1")
        test_project1.save()

        test_project2 = Project("Test Project for Name Uniqueness 2")
        test_project2.save()

        test_seq1 = Sequence(test_project1, "SEQ1A", "SEQ1A")
        test_seq1.save()

        test_seq2 = Sequence(test_project2, "SEQ1B", "SEQ1A")
        test_seq2.save()  # no Integrity Error
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:18,代码来源:test_sequence.py

示例7: test_deleting_a_sequence_will_also_delete_the_related_shots

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    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)
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:49,代码来源:test_sequence.py

示例8: test_add_shots_method_will_remove_the_shot_prefix_if_the_given_shot_starts_with_it

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    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)
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:19,代码来源:test_sequence.py

示例9: 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 save [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

示例10: test_add_shots_is_working_properly_for_projects_with_no_shot_number_prefix

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    def test_add_shots_is_working_properly_for_projects_with_no_shot_number_prefix(self):
        """testing if the add_shots method working properly for projects with
        no or empty shot_number_prefix
        """
        proj1 = Project("proj1", "proj1")
        proj1.shot_number_prefix = ""
        proj1.shot_number_padding = 0
        proj1.save()

        seq1 = Sequence(proj1, "seq91")
        seq1.save()

        shot_code = "VFX91-3"
        seq1.add_shots(shot_code)
        # should complete without any error

        shot = seq1.shots[0]
        self.assertEqual(shot.code, shot_code)
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:20,代码来源:test_sequence.py

示例11: test_shot_argument_is_a_shot_instance_will_fill_the_ui_with_shot_info

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
 def test_shot_argument_is_a_shot_instance_will_fill_the_ui_with_shot_info(self):
     """testing if the ui is filled with correct info coming from the given
     shot
     """
     
     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()
     
     dialog = shot_editor.MainDialog(shot=shot)
     
     # test if the "Editing Shot: SH001" is correctly updated
     self.assertEqual(
         shot.code,
         dialog.shot_name_label.text()
     )
     
     # test frame range info
     self.assertEqual(
         shot.start_frame,
         dialog.start_frame_spinBox.value()
     )
     
     self.assertEqual(
         shot.end_frame,
         dialog.end_frame_spinBox.value()
     )
     
     self.assertEqual(
         shot.handle_at_start,
         dialog.handle_at_start_spinBox.value()
     )
     
     self.assertEqual(
         shot.handle_at_end,
         dialog.handle_at_end_spinBox.value()
     )
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:46,代码来源:test_shot_editor.py

示例12: test_create_project_structure_pushButton_creates_project_structure

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
 def test_create_project_structure_pushButton_creates_project_structure(self):
     """testing if using the create_project_pushButton creates the project
     structure
     """
     
     # create a project
     proj = Project("Test Project")
     proj.save()
     
     # create a sequence
     seq = Sequence(proj, "Sequence")
     seq.save()
     
     # create a shot
     shot = Shot(seq, 1)
     shot.save()
     
     # check if there is no shot folder
     project_path = os.path.join(
         self.temp_projects_folder,
         "Test_Project/Shots/SH001"
     )
     
     self.assertFalse(
         os.path.exists(
             project_path
         )
     )
     
     # hit create_structure_pushButton
     dialog = project_manager.MainDialog()
     
     QTest.mouseClick(
         dialog.create_project_structure_pushButton,
         Qt.LeftButton
     )
     
     # check if the shot folder has been created
     self.assertTrue(
         os.path.exists(
             project_path
         )
     )
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:45,代码来源:test_project_manager.py

示例13: 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 save [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

示例14: test_reference_creates_references_to_Versions_in_other_workspaces_loaded

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [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

示例15: test_projects_comboBox_is_filled_with_projects_on_the_database

# 需要导入模块: from oyProjectManager.models.project import Project [as 别名]
# 或者: from oyProjectManager.models.project.Project import save [as 别名]
    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)
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:34,代码来源:test_project_manager.py


注:本文中的oyProjectManager.models.project.Project.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。