Beispiel #1
0
    def setup_ui(self):
        """Build the UI"""

        # Assets (left)
        asset_outliner = widgets.AssetOutliner()

        # Looks (right)
        looks_widget = QtWidgets.QWidget()
        looks_layout = QtWidgets.QVBoxLayout(looks_widget)

        look_outliner = widgets.LookOutliner()  # Database look overview

        assign_selected = QtWidgets.QCheckBox("Assign to selected only")
        assign_selected.setToolTip("Whether to assign only to selected nodes "
                                   "or to the full asset")
        remove_unused_btn = QtWidgets.QPushButton("Remove Unused Looks")

        looks_layout.addWidget(look_outliner)
        looks_layout.addWidget(assign_selected)
        looks_layout.addWidget(remove_unused_btn)

        # Footer
        status = QtWidgets.QStatusBar()
        status.setSizeGripEnabled(False)
        status.setFixedHeight(25)
        warn_layer = QtWidgets.QLabel("Current Layer is not "
                                      "defaultRenderLayer")
        warn_layer.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        warn_layer.setStyleSheet("color: #DD5555; font-weight: bold;")
        warn_layer.setFixedHeight(25)

        footer = QtWidgets.QHBoxLayout()
        footer.setContentsMargins(0, 0, 0, 0)
        footer.addWidget(status)
        footer.addWidget(warn_layer)

        # Build up widgets
        main_layout = QtWidgets.QVBoxLayout(self)
        main_layout.setSpacing(0)
        main_splitter = QtWidgets.QSplitter()
        main_splitter.setStyleSheet("QSplitter{ border: 0px; }")
        main_splitter.addWidget(asset_outliner)
        main_splitter.addWidget(looks_widget)
        main_splitter.setSizes([350, 200])
        main_layout.addWidget(main_splitter)
        main_layout.addLayout(footer)

        # Set column width
        asset_outliner.view.setColumnWidth(0, 200)
        look_outliner.view.setColumnWidth(0, 150)

        # Open widgets
        self.asset_outliner = asset_outliner
        self.look_outliner = look_outliner
        self.status = status
        self.warn_layer = warn_layer

        # Buttons
        self.remove_unused = remove_unused_btn
        self.assign_selected = assign_selected
Beispiel #2
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent=parent)
        self._db.install()

        self.setWindowTitle("Standalone Publish")
        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setStyleSheet(style.load_stylesheet())

        # Validators
        self.valid_parent = False

        # assets widget
        widget_assets = AssetWidget(dbcon=self._db, parent=self)

        # family widget
        widget_family = FamilyWidget(dbcon=self._db, parent=self)

        # components widget
        widget_components = ComponentsWidget(parent=self)

        # Body
        body = QtWidgets.QSplitter()
        body.setContentsMargins(0, 0, 0, 0)
        body.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Expanding)
        body.setOrientation(QtCore.Qt.Horizontal)
        body.addWidget(widget_assets)
        body.addWidget(widget_family)
        body.addWidget(widget_components)
        body.setStretchFactor(body.indexOf(widget_assets), 2)
        body.setStretchFactor(body.indexOf(widget_family), 3)
        body.setStretchFactor(body.indexOf(widget_components), 5)

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(body)

        self.resize(self.WIDTH, self.HEIGHT)

        # signals
        widget_assets.selection_changed.connect(self.on_asset_changed)
        widget_family.stateChanged.connect(self.set_valid_family)

        self.widget_assets = widget_assets
        self.widget_family = widget_family
        self.widget_components = widget_components

        # on start
        self.on_start()
Beispiel #3
0
    def setup_ui(self):
        """Build the UI"""

        # Assets (left)
        asset_outliner = widgets.AssetOutliner()

        # Looks (right)
        looks_widget = QtWidgets.QWidget()
        looks_layout = QtWidgets.QVBoxLayout(looks_widget)
        # Sub widgets and layouts
        db_looks_widget = QtWidgets.QWidget()
        db_looks_layout = QtWidgets.QVBoxLayout(db_looks_widget)
        loaded_looks_widget = QtWidgets.QWidget()
        loaded_looks_layout = QtWidgets.QVBoxLayout(loaded_looks_widget)

        # Database look overview
        look_outliner = widgets.LookOutliner()
        # Scene look overview
        loaded_look_outliner = widgets.LoadedLookOutliner()
        # Button and checkBox
        overload_chk = QtWidgets.QCheckBox("Overload Looks")
        remove_unused_btn = QtWidgets.QPushButton("Remove Unused Looks")

        db_looks_layout.addWidget(look_outliner)
        db_looks_layout.addWidget(overload_chk)
        loaded_looks_layout.addWidget(loaded_look_outliner)

        # Look Splitter
        look_splitter = QtWidgets.QSplitter()
        look_splitter.setOrientation(QtCore.Qt.Vertical)
        look_splitter.setStyleSheet("QSplitter{ border: 0px; }")
        look_splitter.addWidget(db_looks_widget)
        look_splitter.addWidget(loaded_looks_widget)
        look_splitter.setSizes([200, 120])

        looks_layout.addWidget(look_splitter)
        looks_layout.addWidget(remove_unused_btn)

        # Footer
        status = QtWidgets.QStatusBar()
        status.setSizeGripEnabled(False)
        status.setFixedHeight(25)
        warn_layer = QtWidgets.QLabel("Current Layer is not "
                                      "defaultRenderLayer")
        warn_layer.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        warn_layer.setStyleSheet("color: #DD5555; font-weight: bold;")
        warn_layer.setFixedHeight(25)

        footer = QtWidgets.QHBoxLayout()
        footer.setContentsMargins(0, 0, 0, 0)
        footer.addWidget(status)
        footer.addWidget(warn_layer)

        # Build up widgets
        main_layout = QtWidgets.QVBoxLayout(self)
        main_layout.setSpacing(0)
        main_splitter = QtWidgets.QSplitter()
        main_splitter.setStyleSheet("QSplitter{ border: 0px; }")
        main_splitter.addWidget(asset_outliner)
        main_splitter.addWidget(looks_widget)
        main_splitter.setSizes([350, 280])
        main_layout.addWidget(main_splitter)
        main_layout.addLayout(footer)

        # Set column width
        asset_outliner.view.setColumnWidth(0, 200)
        look_outliner.view.setColumnWidth(0, 140)  # "label" column
        look_outliner.view.setColumnWidth(2, 50)  # "match" column

        loaded_look_outliner.view.setColumnWidth(0, 140)  # "label" column
        loaded_look_outliner.view.setColumnWidth(1, 60)  # "ident" column

        # Open widgets
        self.asset_outliner = asset_outliner
        self.look_outliner = look_outliner
        self.loaded_look_outliner = loaded_look_outliner
        self.status = status
        self.warn_layer = warn_layer

        # Buttons and CheckBoxes
        self.remove_unused = remove_unused_btn
        self.overload = overload_chk
Beispiel #4
0
    def __init__(self, parent=None, context=None):
        super(Window, self).__init__(parent)
        self.context = context
        project_name = io.active_project()
        self.setWindowTitle("Asset creator ({0})".format(project_name))
        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

        # Validators
        self.valid_parent = False

        self.session = None

        # assets widget
        assets_widget = QtWidgets.QWidget()
        assets_widget.setContentsMargins(0, 0, 0, 0)
        assets_layout = QtWidgets.QVBoxLayout(assets_widget)
        assets = widget.AssetWidget()
        assets.view.setSelectionMode(assets.view.ExtendedSelection)
        assets_layout.addWidget(assets)

        # Outlink
        label_outlink = QtWidgets.QLabel("Outlink:")
        input_outlink = QtWidgets.QLineEdit()
        input_outlink.setReadOnly(True)
        input_outlink.setStyleSheet("background-color: #333333;")
        checkbox_outlink = QtWidgets.QCheckBox("Use outlink")
        # Parent
        label_parent = QtWidgets.QLabel("*Parent:")
        input_parent = QtWidgets.QLineEdit()
        input_parent.setReadOnly(True)
        input_parent.setStyleSheet("background-color: #333333;")

        # Name
        label_name = QtWidgets.QLabel("*Name:")
        input_name = QtWidgets.QLineEdit()
        input_name.setPlaceholderText("<asset name>")

        # Asset Build
        label_assetbuild = QtWidgets.QLabel("Asset Build:")
        combo_assetbuilt = QtWidgets.QComboBox()

        # Task template
        label_task_template = QtWidgets.QLabel("Task template:")
        combo_task_template = QtWidgets.QComboBox()

        # Info widget
        info_widget = QtWidgets.QWidget()
        info_widget.setContentsMargins(10, 10, 10, 10)
        info_layout = QtWidgets.QVBoxLayout(info_widget)

        # Inputs widget
        inputs_widget = QtWidgets.QWidget()
        inputs_widget.setContentsMargins(0, 0, 0, 0)

        inputs_layout = QtWidgets.QFormLayout(inputs_widget)
        inputs_layout.addRow(label_outlink, input_outlink)
        inputs_layout.addRow(None, checkbox_outlink)
        inputs_layout.addRow(label_parent, input_parent)
        inputs_layout.addRow(label_name, input_name)
        inputs_layout.addRow(label_assetbuild, combo_assetbuilt)
        inputs_layout.addRow(label_task_template, combo_task_template)

        # Add button
        btns_widget = QtWidgets.QWidget()
        btns_widget.setContentsMargins(0, 0, 0, 0)
        btn_layout = QtWidgets.QHBoxLayout(btns_widget)
        btn_create_asset = QtWidgets.QPushButton("Create asset")
        btn_create_asset.setToolTip(
            "Creates all neccessary components for asset"
        )
        checkbox_app = None
        if self.context is not None:
            checkbox_app = QtWidgets.QCheckBox("Open {}".format(
                self.context.capitalize())
            )
            btn_layout.addWidget(checkbox_app)
        btn_layout.addWidget(btn_create_asset)

        task_view = QtWidgets.QTreeView()
        task_view.setIndentation(0)
        task_model = model.TasksModel()
        task_view.setModel(task_model)

        info_layout.addWidget(inputs_widget)
        info_layout.addWidget(task_view)
        info_layout.addWidget(btns_widget)

        # Body
        body = QtWidgets.QSplitter()
        body.setContentsMargins(0, 0, 0, 0)
        body.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Expanding)
        body.setOrientation(QtCore.Qt.Horizontal)
        body.addWidget(assets_widget)
        body.addWidget(info_widget)
        body.setStretchFactor(0, 100)
        body.setStretchFactor(1, 150)

        # statusbar
        message = QtWidgets.QLabel()
        message.setFixedHeight(20)

        statusbar = QtWidgets.QWidget()
        layout = QtWidgets.QHBoxLayout(statusbar)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(message)

        layout = QtWidgets.QVBoxLayout(self)
        layout.addWidget(body)
        layout.addWidget(statusbar)

        self.data = {
            "label": {
                "message": message,
            },
            "view": {
                "tasks": task_view
            },
            "model": {
                "assets": assets,
                "tasks": task_model
            },
            "inputs": {
                "outlink": input_outlink,
                "outlink_cb": checkbox_outlink,
                "parent": input_parent,
                "name": input_name,
                "assetbuild": combo_assetbuilt,
                "tasktemplate": combo_task_template,
                "open_app": checkbox_app
            },
            "buttons": {
                "create_asset": btn_create_asset
            }
        }

        # signals
        btn_create_asset.clicked.connect(self.create_asset)
        assets.selection_changed.connect(self.on_asset_changed)
        input_name.textChanged.connect(self.on_asset_name_change)
        checkbox_outlink.toggled.connect(self.on_outlink_checkbox_change)
        combo_task_template.currentTextChanged.connect(
            self.on_task_template_changed
        )
        if self.context is not None:
            checkbox_app.toggled.connect(self.on_app_checkbox_change)
        # on start
        self.on_start()

        self.resize(600, 500)

        self.echo("Connected to project: {0}".format(project_name))
Beispiel #5
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

        self.setWindowTitle("Project Manager")
        self.resize(1200, 800)

        self.projects = {}

        layout = QtWidgets.QVBoxLayout()

        # Main control
        ctrl_button_w = 30
        ctrl_button_h = 30

        # Calculate icon size
        icon_size = QtCore.QSize(ctrl_button_w - 4, ctrl_button_h - 4)

        main_control_layout = QtWidgets.QHBoxLayout()

        database_label = QtWidgets.QLabel()

        # Main buttons - create
        create_button = QtWidgets.QPushButton()
        create_icon = qta.icon("fa.plus-square", color=style.colors.light)

        create_button.setIconSize(icon_size)

        create_button.setFixedWidth(ctrl_button_w)
        create_button.setFixedHeight(ctrl_button_h)

        create_button.setIcon(create_icon)
        create_button.setStyleSheet(cbstyle.flat_button)

        # Main buttons - refresh
        refresh_button = QtWidgets.QPushButton()
        refresh_icon = qta.icon("fa.refresh", color=style.colors.light)

        refresh_button.setIconSize(icon_size)

        refresh_button.setFixedWidth(ctrl_button_w)
        refresh_button.setFixedHeight(ctrl_button_h)

        refresh_button.setIcon(refresh_icon)
        refresh_button.setStyleSheet(cbstyle.flat_button)

        # Project switch control
        projects_label = QtWidgets.QLabel("Project:")
        projects = QtWidgets.QComboBox()
        projects.insertItem(0, "<None>")

        # Add buttons to the main control layout
        main_control_layout.addWidget(create_button)
        main_control_layout.addStretch()
        main_control_layout.addWidget(database_label)
        main_control_layout.addWidget(projects_label)
        main_control_layout.addWidget(projects)
        main_control_layout.addWidget(refresh_button)

        # Splitter for tabwidget and preview / details widget
        split_widget = QtWidgets.QSplitter()

        # Widgets will be stored in a StackedWidget
        stacked_widget = QtWidgets.QStackedWidget()

        # Control widgets which make the tool
        manager_widget = ManageProjectWidget(parent=self)

        # Sub manager widgets
        overview = OverviewWidget()
        manager_widget.add_widget(overview)

        stacked_widget.insertWidget(manager_widget.order, manager_widget)

        # Navigation panel widget
        navigation_panel = Navigation()

        # Add buttons to navigation panel
        navigation_panel.add_button(manager_widget.label, manager_widget.order)

        # Add widgets to the SplitWidget
        split_widget.addWidget(navigation_panel)
        split_widget.addWidget(stacked_widget)
        split_widget.setHandleWidth(4)
        split_widget.setSizes([100, 700])

        layout.addLayout(main_control_layout)
        layout.addWidget(split_widget)

        self.setLayout(layout)

        # To connect widget store in self attribute
        self._navigation_panel = navigation_panel
        self._stacked_widget = stacked_widget

        self._database_label = database_label
        self._create_button = create_button
        self._projects = projects
        self._refresh_button = refresh_button

        self._overview = overview

        self.connect_signals()

        self.refresh()

        manager_widget.setFocus(True)
Beispiel #6
0
    def setup_ui(self):
        """Build the UI"""

        main_layout = QtWidgets.QHBoxLayout()
        splitter = QtWidgets.QSplitter()

        # Container overview
        container_widget = QtWidgets.QWidget()
        container_title = self._create_label("Assets")
        container_layout = QtWidgets.QVBoxLayout()

        container_model = models.ContainerModel()
        container_view = views.View()
        container_view.setModel(container_model)
        container_view.setContextMenuPolicy(QtCore.Qt.NoContextMenu)

        from_selection_btn = QtWidgets.QPushButton("Get Looks From Selection")
        from_all_asset_btn = QtWidgets.QPushButton("Get Looks From All Assets")

        container_layout.addWidget(container_title)
        container_layout.addWidget(from_selection_btn)
        container_layout.addWidget(from_all_asset_btn)
        container_layout.addWidget(container_view)

        # Add container view
        container_widget.setLayout(container_layout)
        splitter.addWidget(container_widget)

        # look manager layout
        look_views_widget = QtWidgets.QWidget()
        look_views_layout = QtWidgets.QVBoxLayout()
        look_views_layout.setSpacing(10)

        # Looks from database
        documents_title = self._create_label("Available looks")
        documents_title.setAlignment(QtCore.Qt.AlignCenter)
        document_model = models.FlatModel()
        document_view = views.View()
        document_view.setToolTip("Use right mouse button menu for direct actions")
        document_view.setModel(document_model)
        document_view.setMinimumHeight(230)

        look_views_layout.addWidget(documents_title)
        look_views_layout.addWidget(document_view)

        # Turn off queue at start, show this widget
        queue_off_message = QtWidgets.QLabel(
            "Queue is empty, add items to the queue to active it")
        queue_off_message.setAlignment(QtCore.Qt.AlignCenter)
        queue_off_message.setStyleSheet("font-size: 12px;")

        # Queue view
        queue_title = self._create_label("Queue")
        queue_title.setAlignment(QtCore.Qt.AlignCenter)
        queue_model = models.LookQueueModel()
        queue_view = views.View()
        queue_view.setModel(queue_model)

        queue_widgets = QtWidgets.QStackedWidget()
        queue_widgets.addWidget(queue_off_message)
        queue_widgets.addWidget(queue_view)

        look_views_layout.addWidget(queue_title)
        look_views_layout.addWidget(queue_widgets)

        # Method buttons
        method_buttons_layout = QtWidgets.QHBoxLayout()
        assign_to_selected_btn = QtWidgets.QPushButton("Process Selected Queue")
        assign_to_all_btn = QtWidgets.QPushButton("Process Queued Looks")
        remove_unused_btn = QtWidgets.QPushButton("Remove Unused Looks")
        method_buttons_layout.addWidget(assign_to_selected_btn)
        method_buttons_layout.addWidget(assign_to_all_btn)
        method_buttons_layout.addWidget(remove_unused_btn)

        load_save_buttons_layout = QtWidgets.QHBoxLayout()
        load_queue_btn = QtWidgets.QPushButton("Load Queue from File")
        save_queue_btn = QtWidgets.QPushButton("Save Queue to File")
        load_save_buttons_layout.addWidget(load_queue_btn)
        load_save_buttons_layout.addWidget(save_queue_btn)

        look_views_layout.addLayout(method_buttons_layout)
        look_views_layout.addLayout(load_save_buttons_layout)
        look_views_widget.setLayout(look_views_layout)
        splitter.addWidget(look_views_widget)

        main_layout.addWidget(splitter)

        container_view.setColumnWidth(0, 200)  # subset
        document_view.setColumnWidth(0, 200)
        queue_view.setColumnWidth(0, 200)

        self.from_selection_btn = from_selection_btn
        self.from_all_asset_btn = from_all_asset_btn

        self.assign_to_selected_btn = assign_to_selected_btn
        self.assign_to_all_btn = assign_to_all_btn
        self.remove_unused_btn = remove_unused_btn

        self.container_model = container_model
        self.container_view = container_view

        self.document_model = document_model
        self.document_view = document_view

        self.queue_widgets = queue_widgets
        self.queue_model = queue_model
        self.queue_view = queue_view

        self.save_queue = save_queue_btn
        self.load_queue = load_queue_btn

        self.setLayout(main_layout)
Beispiel #7
0
    def __init__(self, parent=None):
        QtWidgets.QDialog.__init__(self, parent)

        self.resize(640, 360)
        project = api.Session["AVALON_PROJECT"]
        self.setWindowTitle("Context Manager 1.0 - {}".format(project))
        self.setObjectName("contextManager")

        splitter = QtWidgets.QSplitter(self)
        main_layout = QtWidgets.QVBoxLayout()
        column_layout = QtWidgets.QHBoxLayout()

        accept_btn = QtWidgets.QPushButton("Accept")

        # Asset picker
        assets = AssetWidget()

        # Task picker
        tasks_widgets = QtWidgets.QWidget()
        tasks_widgets.setContentsMargins(0, 0, 0, 0)
        tasks_layout = QtWidgets.QVBoxLayout(tasks_widgets)
        task_view = QtWidgets.QTreeView()
        task_view.setIndentation(0)
        task_model = TasksModel()
        task_view.setModel(task_model)
        tasks_layout.addWidget(task_view)
        tasks_layout.addWidget(accept_btn)
        task_view.setColumnHidden(1, True)

        # region results
        result_widget = QtWidgets.QGroupBox("Current Context")
        result_layout = QtWidgets.QVBoxLayout()
        result_widget.setLayout(result_layout)

        project_label = QtWidgets.QLabel("Project: {}".format(project))
        asset_label = QtWidgets.QLabel()
        task_label = QtWidgets.QLabel()

        result_layout.addWidget(project_label)
        result_layout.addWidget(asset_label)
        result_layout.addWidget(task_label)
        result_layout.addStretch()
        # endregion results

        context_widget = QtWidgets.QWidget()
        column_layout.addWidget(assets)
        column_layout.addWidget(tasks_widgets)
        context_widget.setLayout(column_layout)

        splitter.addWidget(context_widget)
        splitter.addWidget(result_widget)
        splitter.setSizes([1, 0])

        main_layout.addWidget(splitter)

        # Enable for other functions
        self._last_selected_task = None
        self._task_view = task_view
        self._task_model = task_model
        self._assets = assets

        self._context_asset = asset_label
        self._context_task = task_label

        assets.selection_changed.connect(self.on_asset_changed)
        accept_btn.clicked.connect(self.on_accept_clicked)
        assets.refresh()

        self.select_asset(api.Session["AVALON_ASSET"])
        self.select_task(api.Session["AVALON_TASK"])

        self.setLayout(main_layout)

        # Enforce current context to be up-to-date
        self.refresh_context_view()