Example #1
0
    def init_project(self):
        """
        When PROJECT selected in UI
        """

        # Show and set up PROPERTIES widget
        self.project_properties_ui.show()
        self.asset_properties_ui.hide()
        self.sequence_properties_ui.hide()
        self.shot_properties_ui.hide()

        # Setup data
        model_index = self.listProjects.currentIndex()  # .selectedIndexes()[0]
        project_id = model_index.data(QtCore.Qt.UserRole + 1)
        project = self.eve_data.get_project(project_id)
        self.eve_data.selected_project = project
        self.eve_data.get_project_assets(project)
        self.eve_data.get_project_sequences(project)

        # Clear SHOTS in UI
        self.listShots.setModel(Model([]))

        # Fill Project Properties widget
        project_root = build_project_root(project.name)
        self.project_properties_ui.project_ui.linProjectLocation.setText(
            project_root)
        self.project_properties_ui.project_ui.linProjectLocation.setEnabled(
            False)
        self.project_properties_ui.project_ui.linProjectName.setText(
            project.name)
        self.project_properties_ui.project_ui.linProjectName.setEnabled(False)
        self.project_properties_ui.project_ui.linHoudini.setText(
            project.houdini_build)
        self.project_properties_ui.project_ui.linProjectWidth.setText(
            str(project.width))
        self.project_properties_ui.project_ui.linProjectHeight.setText(
            str(project.height))
        self.project_properties_ui.project_ui.txtDescription.setText(
            project.description)

        # FILL ASSET and SEQUENCE WIDGETS
        self.model_assets = Model(self.eve_data.project_assets)
        self.listAssets.setModel(self.model_assets)

        self.model_sequences = Model(self.eve_data.project_sequences)
        self.listSequences.setModel(self.model_sequences)

        # Enable/disable UI buttons depending on project existence
        if os.path.exists(project_root):
            self.project_properties_ui.btnCreateProject.setText(
                self.btn_project_update)
            self.project_properties_ui.btnLaunchHoudini.setEnabled(True)
            self.project_properties_ui.btnLaunchNuke.setEnabled(True)
            self.project_properties_ui.btnOpenFolder.setEnabled(True)
        else:
            self.project_properties_ui.btnCreateProject.setText(
                self.btn_project_create)
            self.project_properties_ui.btnLaunchHoudini.setEnabled(False)
            self.project_properties_ui.btnLaunchNuke.setEnabled(False)
            self.project_properties_ui.btnOpenFolder.setEnabled(False)
Example #2
0
    def init_sequence(self):
        """
        When SEQUENCE selected in UI
        """

        # Show and set up PROPERTIES widget
        self.project_properties_ui.hide()
        self.asset_properties_ui.hide()
        self.sequence_properties_ui.show()
        self.shot_properties_ui.hide()

        # Setup data for sequence
        model_index = self.listSequences.currentIndex()
        sequence_id = model_index.data(QtCore.Qt.UserRole + 1)
        sequence = self.eve_data.get_sequence(sequence_id)
        self.eve_data.selected_sequence = sequence
        # and shot
        self.eve_data.get_sequence_shots(sequence.id)
        self.model_shots = Model(self.eve_data.sequence_shots)
        self.listShots.setModel(self.model_shots)

        # Fill SEQUENCE WIDGET
        self.sequence_properties_ui.sequence_ui.linSequenceName.setEnabled(
            False)
        self.sequence_properties_ui.sequence_ui.linProjectName.setText(
            self.eve_data.selected_project.name)
        self.sequence_properties_ui.sequence_ui.linSequenceName.setText(
            sequence.name)
        self.sequence_properties_ui.sequence_ui.txtDescription.setText(
            sequence.description)
Example #3
0
    def init_asset(self):
        """
        When ASSET selected in UI
        """

        # Show and set up PROPERTIES widget
        self.project_properties_ui.hide()
        self.asset_properties_ui.show()
        self.sequence_properties_ui.hide()
        self.shot_properties_ui.hide()

        # Setup data
        model_index = self.listAssets.currentIndex()
        asset_id = model_index.data(QtCore.Qt.UserRole + 1)
        asset = self.eve_data.get_asset(asset_id)
        self.eve_data.selected_asset = asset

        # Fill ASSET WIDGET
        self.asset_properties_ui.asset_ui.linAssetName.setEnabled(False)
        self.asset_properties_ui.asset_ui.linProjectName.setText(
            self.eve_data.selected_project.name)
        self.asset_properties_ui.asset_ui.linAssetName.setText(asset.name)

        model_asset_types = Model(self.eve_data.asset_types)
        self.asset_properties_ui.asset_ui.comAssetType.setModel(
            model_asset_types)
        # Find AssetType string by database index
        # !!! Probably wrong implementation of model data! and can be done via Model() !!!!!
        self.eve_data.get_asset_type_string(asset.type)
        self.asset_properties_ui.asset_ui.comAssetType.setCurrentText(
            self.eve_data.asset_type_string)
        self.asset_properties_ui.asset_ui.txtDescription.setText(
            asset.description)
Example #4
0
    def showEvent(self, event):
        """
        Executed when AddProject class is shown (AddProject.show())
        """

        # Clean UI
        self.asset_ui.linProjectName.setText(self.project.name)
        self.asset_ui.linAssetName.clear()
        self.asset_ui.txtDescription.clear()

        # Add asset types to ui
        self.model_asset_types = Model(self.asset_types)
        self.asset_ui.comAssetType.setModel(self.model_asset_types)
Example #5
0
    def showEvent(self, event):
        """
        Executed when AddProject class is shown (AddProject.show())
        """

        # Clean UI
        self.linShotName.setText(self.shot.name)
        # self.asset_ui.linAssetName.clear()
        # self.asset_ui.txtDescription.clear()
        #
        # Add assets to ui
        self.model_assets = Model(self.project_assets)
        self.listAssets.setModel(self.model_assets)
Example #6
0
    def init_shot(self):
        """
        When SHOT selected in UI
        """

        # Show and set up PROPERTIES widget
        self.project_properties_ui.hide()
        self.asset_properties_ui.hide()
        self.sequence_properties_ui.hide()
        self.shot_properties_ui.show()

        # Setup data
        model_index = self.listShots.currentIndex()
        shot_id = model_index.data(QtCore.Qt.UserRole + 1)
        shot = self.eve_data.get_shot(shot_id)
        self.eve_data.selected_shot = shot

        # FILL SHOT ASSETS WIDGET
        self.eve_data.get_shot_assets(shot_id)
        self.model_shot_assets = Model(self.eve_data.shot_assets)
        self.shot_properties_ui.shot_ui.listAssets.setModel(
            self.model_shot_assets)

        # Fill SHOT WIDGET
        self.shot_properties_ui.shot_ui.linShotName.setEnabled(False)
        self.shot_properties_ui.shot_ui.linProjectName.setText(
            self.eve_data.selected_project.name)
        self.shot_properties_ui.shot_ui.linSequenceName.setText(
            self.eve_data.selected_sequence.name)
        self.shot_properties_ui.shot_ui.linShotName.setText(
            self.eve_data.selected_shot.name)
        self.shot_properties_ui.shot_ui.linStartFrame.setText(
            str(shot.start_frame))
        self.shot_properties_ui.shot_ui.linEndFrame.setText(str(
            shot.end_frame))
        self.shot_properties_ui.shot_ui.linWidth.setText(str(shot.width))
        self.shot_properties_ui.shot_ui.linHeight.setText(str(shot.height))
        self.shot_properties_ui.shot_ui.txtDescription.setText(
            shot.description)
Example #7
0
    def __init__(self):
        super(ProjectManager, self).__init__()
        # SETUP UI
        self.setupUi(self)
        self.project_properties_ui = ProjectProperties()
        self.asset_properties_ui = AssetProperties()
        self.sequence_properties_ui = SequenceProperties()
        self.shot_properties_ui = ShotProperties()
        self.layoutProperties.addWidget(self.project_properties_ui)
        self.layoutProperties.addWidget(self.asset_properties_ui)
        self.layoutProperties.addWidget(self.sequence_properties_ui)
        self.layoutProperties.addWidget(self.shot_properties_ui)
        self.btn_project_create = 'Create Project'
        self.btn_project_update = 'Update Project'

        # SETUP ENVIRONMENT
        os.environ['EVE_ROOT'] = os.environ['EVE_ROOT'].replace('\\', '/')
        self.eve_root = os.environ['EVE_ROOT']  # E:/Eve/Eve

        # Load Eve DB
        # Create database file if not exists (first time Project Manager launch)
        self.SQL_FILE_PATH = settings.SQL_FILE_PATH.format(self.eve_root)
        if not os.path.exists(self.SQL_FILE_PATH):
            if not os.path.exists(os.path.dirname(self.SQL_FILE_PATH)):
                os.makedirs(os.path.dirname(self.SQL_FILE_PATH))
            self.create_database()
        self.eve_data = database.EveData(self.SQL_FILE_PATH)
        self.model_projects = Model(self.eve_data.projects)
        self.model_assets = None
        self.model_sequences = None
        self.model_shots = None
        self.model_shot_assets = None

        # Load ADD ENTITY classes
        self.AP = AddProject(self)
        self.AA = AddAsset(self)
        self.AE = AddSequence(self)
        self.AS = AddShot(self)
        self.LA = LinkAssets(self)

        # Fill UI with data from database
        self.init_pm()

        # Connect functions
        # Menu
        self.actionEveDocs.triggered.connect(self.docs)
        # Project section
        self.listProjects.clicked.connect(self.init_project)
        self.btnAddProject.clicked.connect(self.AP.exec_)
        self.btnDelProject.clicked.connect(self.del_project)
        # Asset section
        self.listAssets.clicked.connect(self.init_asset)
        self.btnAddAsset.clicked.connect(self.run_add_asset)
        self.btnDelAsset.clicked.connect(self.del_asset)
        # Sequence section
        self.listSequences.clicked.connect(self.init_sequence)
        self.btnAddSequence.clicked.connect(self.run_add_sequence)
        self.btnDelSequence.clicked.connect(self.del_sequence)
        # Shot section
        self.listShots.clicked.connect(self.init_shot)
        self.btnAddShot.clicked.connect(self.run_add_shot)
        self.btnDelShot.clicked.connect(self.del_shot)

        # Project properties
        self.project_properties_ui.btnCreateProject.clicked.connect(
            self.run_create_project)
        self.project_properties_ui.btnLaunchHoudini.clicked.connect(
            self.launch_houdini)

        # Asset properties
        self.asset_properties_ui.btnUpdateAsset.clicked.connect(
            self.update_asset)
        self.asset_properties_ui.btnCreateHoudiniFile.clicked.connect(
            self.create_asset_file)

        # Sequence properties
        self.sequence_properties_ui.btnUpdateSequence.clicked.connect(
            self.update_sequence)

        # Shot properties
        self.shot_properties_ui.btnUpdateShot.clicked.connect(self.update_shot)
        self.shot_properties_ui.shot_ui.btnLinkAsset.clicked.connect(
            self.run_link_assets)
        self.shot_properties_ui.shot_ui.btnUnlinkAsset.clicked.connect(
            self.run_unlink_assets)