def __init__(self, parent=None, *args, **kwargs):
        super(LoadMarkerLayout, self).__init__(*args, **kwargs)
        self.setupUi(self)

        self.loadMode_model = QtCore.QStringListModel()
        self.loadMode_comboBox.setModel(self.loadMode_model)

        self.camera_model = uimodels.StringDataListModel()
        self.camera_comboBox.setModel(self.camera_model)

        self.markerGroup_model = uimodels.StringDataListModel()
        self.markerGroup_comboBox.setModel(self.markerGroup_model)

        self.distortionMode_model = QtCore.QStringListModel()
        self.distortionMode_comboBox.setModel(self.distortionMode_model)

        # Set default values
        self._file_info = None

        w, h = lib.get_default_image_resolution()
        self.imageResWidth_label.setEnabled(False)
        self.imageResWidth_spinBox.setValue(w)
        self.imageResWidth_spinBox.setEnabled(False)
        self.imageResWidth_spinBox.setMaximum(99999)
        self.imageResHeight_spinBox.setValue(h)
        self.imageResHeight_spinBox.setEnabled(False)
        self.imageResHeight_spinBox.setMaximum(99999)

        self.fileInfo_plainTextEdit.setReadOnly(True)

        value = const.LOAD_BUNDLE_POS_DEFAULT_VALUE
        self.loadBndPositions_checkBox.setChecked(value)

        # Get the file path from the clipboard.
        try:
            clippy = QtGui.QClipboard()
            text = str(clippy.text()).strip()
            if lib.is_valid_file_path(text):
                self.setFilePath(text)
        except Exception as e:
            msg = 'Could not get file path from clipboard.'
            LOG.warning(msg)
            LOG.info(str(e))

        # Set up callback connections
        self.loadMode_comboBox.currentIndexChanged[str].connect(lambda x: self.updateLoadMode())
        self.camera_comboBox.currentIndexChanged[str].connect(lambda x: self.markerGroupUpdateClicked())
        self.cameraUpdate_pushButton.clicked.connect(self.cameraUpdateClicked)
        self.markerGroupUpdate_pushButton.clicked.connect(self.markerGroupUpdateClicked)
        self.filepath_pushButton.clicked.connect(self.filePathBrowseClicked)
        self.filepath_lineEdit.editingFinished.connect(self.updateFilePathWidget)

        self.populateUi()
예제 #2
0
    def __init__(self, parent=None, *args, **kwargs):
        super(LoadMarkerLayout, self).__init__(*args, **kwargs)
        self.setupUi(self)

        # 'File Info' should be read-only.
        self.fileInfo_plainTextEdit.setReadOnly(True)

        # Camera combo box.
        self.camera_model = uimodels.StringDataListModel()
        self.camera_comboBox.setModel(self.camera_model)

        # Camera update.
        self.cameraUpdate_pushButton.clicked.connect(self.cameraUpdateClicked)

        # Set default image resolution values
        w, h = lib.get_default_image_resolution()
        self.imageResWidth_spinBox.setValue(w)
        self.imageResWidth_spinBox.setEnabled(False)
        self.imageResWidth_spinBox.setMaximum(99999)
        self.imageResHeight_spinBox.setValue(h)
        self.imageResHeight_spinBox.setEnabled(False)
        self.imageResHeight_spinBox.setMaximum(99999)

        # File path browse.
        self.filepath_pushButton.clicked.connect(self.filePathBrowseClicked)

        # Get the file path from the clipboard.
        try:
            clippy = QtGui.QClipboard()
            text = str(clippy.text()).strip()
            if lib.is_valid_file_path(text):
                self.setFilePath(text)
        except Exception as e:
            msg = 'Could not get file path from clipboard.'
            LOG.warning(msg)
            LOG.info(str(e))

        # Update the 'Image Resolution' enable state when the file
        # patch changes.
        self.filepath_lineEdit.editingFinished.connect(
            self.updateImageResEnabledState)

        # Update the 'File Info' when the file patch changes
        self.filepath_lineEdit.editingFinished.connect(self.updateFileInfoText)

        # Populate the UI with data
        self.populateUi()
예제 #3
0
    def populateUi(self):
        config = get_config()
        self._file_info = None

        w, h = lib.get_default_image_resolution()
        self.imageRes_label.setEnabled(False)
        self.imageResWidth_label.setEnabled(False)
        self.imageResWidth_spinBox.setValue(w)
        self.imageResWidth_spinBox.setEnabled(False)
        self.imageResHeight_label.setEnabled(False)
        self.imageResHeight_spinBox.setValue(h)
        self.imageResHeight_spinBox.setEnabled(False)

        self.fileInfo_plainTextEdit.setReadOnly(True)

        value = get_config_value(
            config,
            'data/load_bundle_position',
            const.LOAD_BUNDLE_POS_DEFAULT_VALUE)
        self.loadBndPositions_checkBox.setChecked(value)

        value = get_config_value(
            config,
            'data/use_overscan',
            const.USE_OVERSCAN_DEFAULT_VALUE)
        self.overscan_checkBox.setChecked(value)

        # Get the file path from the clipboard.
        try:
            clippy = QtGui.QClipboard()
            text = str(clippy.text()).strip()
            if lib.is_valid_file_path(text):
                self.setFilePath(text)
        except Exception as e:
            msg = 'Could not get file path from clipboard.'
            LOG.warning(msg)
            LOG.info(str(e))

        all_camera_nodes = lib.get_cameras()
        selected_cameras = lib.get_selected_cameras()
        active_camera = lib.get_active_viewport_camera()
        self.updateCameraList(
            self.camera_comboBox,
            self.camera_model,
            all_camera_nodes,
            selected_cameras,
            active_camera
        )
        active_camera = self.getCameraData()
        mkr_grp_nodes = lib.get_marker_groups(active_camera)
        active_mkr_grp = None
        self.updateMarkerGroupList(
            self.markerGroup_comboBox,
            self.markerGroup_model,
            active_mkr_grp,
            mkr_grp_nodes
        )

        value = get_config_value(
            config,
            "data/load_mode",
            const.LOAD_MODE_DEFAULT_VALUE
        )
        self.populateLoadModeModel(self.loadMode_model)
        index = self.loadMode_model.stringList().index(value)
        self.loadMode_comboBox.setCurrentIndex(index)

        value = get_config_value(
            config,
            "data/distortion_mode",
            const.DISTORTION_MODE_DEFAULT_VALUE
        )
        self.populateDistortionModeModel(self.distortionMode_model)
        index = self.distortionMode_model.stringList().index(value)
        self.distortionMode_comboBox.setCurrentIndex(index)
        return
예제 #4
0
 def copySnippet(self):
     text = 'StyleUtils.getIcon(\'{}\')'.format(self.label.text())
     QtGui.QClipboard().setText(text)