Esempio n. 1
0
	def initUI(self):
		# color vars
		self.foregroundColor = QtGui.QColor(200,200,200)
		self.categoryColor = QtGui.QColor(75,75,75)
		self.openStateColor = QtGui.QColor(0,255,100)
		self.closeStateColor = QtGui.QColor(255,160,0)
		self.executeStateColor = QtGui.QColor(0,170,255)

		self.categoryIcon = icons.getIconByName("folder_16x16.png")
		self.toolIcon = icons.getIconByName("tool_16x16.png")
		self.toolOpenIcon = icons.getIconByName("tool-open_16x16.png")
		self.scriptIcon = icons.getIconByName("gear_16x16.png")

		# load UI file
		self.ui = ui.loadUiWidgetFromPyFile(__file__, parent=self)

		# layout
		self.setLayout(QtGui.QVBoxLayout())
		self.layout().addWidget(self.ui)
		self.layout().setSpacing(0)
		self.layout().setContentsMargins(2, 2, 2, 2)

		# fNewFont = QtGui.QFont("Courier",8,QtGui.QFont.Normal)
		# fNewFont.setLetterSpacing(QtGui.QFont.PercentageSpacing,0.0)

		# tree config
		self.ui.tr_toolsTree.setColumnCount(3)
		self.ui.tr_toolsTree.setHeaderLabels(["Name", "State", "h_FileName", "h_type"])
		self.ui.tr_toolsTree.setColumnHidden(2, True)
		self.ui.tr_toolsTree.setColumnHidden(3, True)
		self.ui.tr_toolsTree.header().setResizeMode(0, QtGui.QHeaderView.Stretch)
		self.ui.tr_toolsTree.header().setResizeMode(1, QtGui.QHeaderView.Fixed)
		self.ui.tr_toolsTree.setColumnWidth(1,73)
		# self.ui.tr_toolsTree.setTextAlignment(1, QtCore.Qt.AlignVCenter)

		# tree fill
		self.fillTree()

		# add signals to the ui elements
		self.ui.rb_filterAnd.clicked.connect(self.refresh)
		self.ui.rb_filterOr.clicked.connect(self.refresh)
		self.ui.le_filter.editingFinished.connect(self.refresh)
		self.ui.cb_showTools.clicked.connect(self.refresh)
		self.ui.cb_showScripts.clicked.connect(self.refresh)
		self.ui.pb_refresh.clicked.connect(self.refresh)
		self.ui.pb_closeAll.clicked.connect(self.closeAll)
		self.ui.tr_toolsTree.itemClicked.connect(self.clickTreeItemExecution)
		self.ui.tr_toolsTree.itemDoubleClicked.connect(self.doubleClickTreeItemExecution)

		self.ui.tr_toolsTree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
		self.ui.tr_toolsTree.customContextMenuRequested.connect(self.treeMenu)
Esempio n. 2
0
	def initUI(self):
		# color vars
		self.nodeset_color = QtGui.QColor(25,25,25)

		# Icons
		self.layersNewIcon = icons.getIconByName("layers_16x16.png")
		self.layersNewSelectionIcon = icons.getIconByName("layersNew_16x16.png")
		self.layersDuplicateIcon = icons.getIconByName("layersDuplicate_16x16.png")
		self.layersDeleteIcon = icons.getIconByName("layersDelete_16x16.png")
		self.layersAddIcon = icons.getIconByName("layersAdd_16x16.png")
		self.layersRemoveIcon = icons.getIconByName("layersRemove_16x16.png")
		self.layersClearIcon = icons.getIconByName("layersClear_16x16.png")
		self.layersSelectObjectsIcon = icons.getIconByName("layersSelectObjects_16x16.png")
		self.layersSelectIcon = icons.getIconByName("layersSelect_16x16.png")
		self.layersLoadIcon = icons.getIconByName("layersLoad_16x16.png")
		self.objectIcon = icons.getIconByName("3Dobject_16x16.png")

		self.containerIcon = icons.getIconByName("container_16x16.png")
		self.passTreeIcon = icons.getIconByName("passTree_16x16.png")
		self.passGroupIcon = icons.getIconByName("passGroup_16x16.png")
		self.passIcon = icons.getIconByName("pass_16x16.png")
		self.overridesetIcon = icons.getIconByName("overrideset_16x16.png")
		self.overrideIcon = icons.getIconByName("override_16x16.png")
		self.lightsetIcon = icons.getIconByName("lightset_16x16.png")
		self.objectsetIcon = icons.getIconByName("objectset_16x16.png")
		self.lodsetIcon = icons.getIconByName("lodset_16x16.png")
		self.nodesetIcon = icons.getIconByName("nodeset_16x16.png")

		# Load UI file
		self.ui = ui.loadUiWidgetFromPyFile(__file__, parent=self)
		
		# Layout
		self.setLayout(QtGui.QVBoxLayout())
		self.layout().addWidget(self.ui)
		self.layout().setSpacing(0)
		self.layout().setContentsMargins(2, 2, 2, 2)

		# Nodesets

		# Nodesets UI init
		self.nodesets_buttons_layout = self.ui.tab_all.widget(1).layout().children()[0]
		
		self.nodesets_buttons_layout.itemAt(0).widget().setIcon(self.layersNewIcon)
		self.nodesets_buttons_layout.itemAt(1).widget().setIcon(self.layersNewSelectionIcon)
		self.nodesets_buttons_layout.itemAt(2).widget().setIcon(self.layersDuplicateIcon)
		self.nodesets_buttons_layout.itemAt(3).widget().setIcon(self.layersDeleteIcon)

		self.nodesets_buttons_layout.itemAt(5).widget().setIcon(self.layersAddIcon)
		self.nodesets_buttons_layout.itemAt(6).widget().setIcon(self.layersRemoveIcon)
		self.nodesets_buttons_layout.itemAt(7).widget().setIcon(self.layersClearIcon)

		self.nodesets_buttons_layout.itemAt(9).widget().setIcon(self.layersSelectObjectsIcon)
		self.nodesets_buttons_layout.itemAt(10).widget().setIcon(self.layersSelectIcon)

		self.nodesets_buttons_layout.itemAt(12).widget().setIcon(self.layersLoadIcon)

		self.nodesets_tree = self.ui.tab_all.widget(1).layout().itemAt(0).widget()
		self.nodesets_tree.setColumnCount(1)
		self.nodesets_tree.setHeaderLabels(["Name"])
		# self.nodesets_tree.setColumnHidden(1, True)
		self.nodesets_tree.header().setResizeMode(0, QtGui.QHeaderView.Stretch)

		self.nodesets_name_edit = self.ui.tab_all.widget(1).layout().itemAt(2).widget()

		# Nodesets fill UI

		self.fill_nodesets_tree()

		# Nodesets UI signals

		self.nodesets_buttons_layout.itemAt(0).widget().clicked.connect(self.new_nodeset)
		self.nodesets_buttons_layout.itemAt(1).widget().clicked.connect(lambda: self.new_nodeset(selection=True))
		self.nodesets_buttons_layout.itemAt(2).widget().clicked.connect(self.duplicate_selected_nodesets)
		self.nodesets_buttons_layout.itemAt(3).widget().clicked.connect(self.remove_selected_nodesets)

		self.nodesets_buttons_layout.itemAt(5).widget().clicked.connect(self.add_selected_objects_to_nodesets)
		self.nodesets_buttons_layout.itemAt(6).widget().clicked.connect(self.remove_selected_objects_from_nodesets)
		self.nodesets_buttons_layout.itemAt(7).widget().clicked.connect(self.clear_nodesets)

		self.nodesets_buttons_layout.itemAt(9).widget().clicked.connect(self.select_nodests_objects)
		self.nodesets_buttons_layout.itemAt(10).widget().clicked.connect(self.select_objects_nodesets)

		self.nodesets_buttons_layout.itemAt(12).widget().clicked.connect(self.import_nodesets)

		self.nodesets_tree.itemSelectionChanged.connect(self.fix_nodesets_selection)
		self.nodesets_tree.itemSelectionChanged.connect(self.update_nodeset_name_edit)
		self.nodesets_tree.itemClicked.connect(self.select_nodesets_objects)

		self.nodesets_name_edit.returnPressed.connect(self.nodeset_rename)

		# Passes UI init
		# self.nodesets_buttons_layout = self.ui.tab_all.widget(1).layout().children()[0]
		
		self.tab_containers_spliter = self.ui.tab_all.widget(0).layout().itemAt(0).widget()
		self.tab_containers_spliter.setSizes([400,80])

		self.containers_buttons_layout = self.tab_containers_spliter.widget(0).layout().children()[0]
		
		self.containers_buttons_layout.itemAt(0).widget().setIcon(self.passTreeIcon)
		self.containers_buttons_layout.itemAt(1).widget().setIcon(self.passGroupIcon)
		self.containers_buttons_layout.itemAt(2).widget().setIcon(self.passIcon)

		self.containers_buttons_layout.itemAt(4).widget().setIcon(self.overrideIcon)
		self.containers_buttons_layout.itemAt(5).widget().setIcon(self.lightsetIcon)
		self.containers_buttons_layout.itemAt(6).widget().setIcon(self.objectsetIcon)
		self.containers_buttons_layout.itemAt(7).widget().setIcon(self.lodsetIcon)
		self.containers_buttons_layout.itemAt(8).widget().setIcon(self.nodesetIcon)

		self.containers_buttons_layout.itemAt(10).widget().setIcon(self.layersLoadIcon)

		self.containers_tree = self.tab_containers_spliter.widget(0).layout().itemAt(1).widget()
		self.containers_tree.setColumnCount(2)
		self.containers_tree.setHeaderLabels(["Name", "Info", "Type"])
		self.containers_tree.setColumnHidden(2, True)
		self.containers_tree.setColumnWidth(0,200)
		self.containers_tree.header().setResizeMode(1, QtGui.QHeaderView.Stretch)

		# self.containers_name_edit = self.ui.tab_all.widget(0).layout().itemAt(2).widget()

		# Passes fill Ui
		self.fill_containers_tree()

		# Passes UI signals

		self.containers_tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
		self.containers_tree.customContextMenuRequested.connect(self.pass_tree_menu)

		self.containers_buttons_layout.itemAt(0).widget().clicked.connect(lambda type="tree": self.new_container(type))
		self.containers_buttons_layout.itemAt(1).widget().clicked.connect(lambda type="group": self.new_container(type))
		self.containers_buttons_layout.itemAt(2).widget().clicked.connect(lambda type="pass": self.new_container(type))

		self.containers_buttons_layout.itemAt(4).widget().clicked.connect(lambda type="override": self.new_container(type))
		self.containers_buttons_layout.itemAt(5).widget().clicked.connect(lambda type="lightset": self.new_container(type))
		self.containers_buttons_layout.itemAt(6).widget().clicked.connect(lambda type="objectset": self.new_container(type))
		self.containers_buttons_layout.itemAt(7).widget().clicked.connect(lambda type="lodset": self.new_container(type))
		self.containers_buttons_layout.itemAt(8).widget().clicked.connect(lambda type="nodeset": self.new_container(type))

		self.containers_tree.itemSelectionChanged.connect(self.fix_containers_selection)
Esempio n. 3
0
    def initUI(self):
        """Initializes the widget UI"""

        # Color vars

        # Icons

        self.solutionNewIcon = icons.getIconByName("solutionNew_16x16.png")
        self.solutionRemoveIcon = icons.getIconByName("solutionRemove_16x16.png")

        self.solutionFitIcon = self.solution_manager.get_solution_goal_icon("fit")
        self.solutionDeformIcon = self.solution_manager.get_solution_goal_icon("deform")
        self.solutionAnimIcon = self.solution_manager.get_solution_goal_icon("anim")

        self.solutionImportIcon = icons.getIconByName("solutionImport_16x16.png")
        self.solutionExportIcon = icons.getIconByName("solutionExport_16x16.png")

        # Load UI file

        self.ui = ui.loadUiWidgetFromPyFile(__file__, parent=self)

        # Layout

        self.setLayout(QtGui.QVBoxLayout())
        self.layout().addWidget(self.ui)
        self.layout().setSpacing(0)
        self.layout().setContentsMargins(2, 2, 2, 2)

        # ------------------------------------------
        # SOLUTIONS TAB

        # Solutions UI init.

        self.tab_solutions_spliter = ui.get_child(self.ui, "sp_splitter")
        self.tab_solutions_spliter.setSizes([400, 250])

        ui.get_child(self.ui, "pb_solutions_new").setIcon(self.solutionNewIcon)
        ui.get_child(self.ui, "pb_solutions_delete").setIcon(self.solutionRemoveIcon)

        ui.get_child(self.ui, "pb_solutions_fit").setIcon(self.solutionFitIcon)
        ui.get_child(self.ui, "pb_solutions_deform").setIcon(self.solutionDeformIcon)
        ui.get_child(self.ui, "pb_solutions_anim").setIcon(self.solutionAnimIcon)

        ui.get_child(self.ui, "pb_solutions_import_preset").setIcon(self.solutionImportIcon)
        ui.get_child(self.ui, "pb_solutions_export_preset").setIcon(self.solutionExportIcon)

        self.solution_trees = ui.get_child(self.ui, "tr_solutions")

        self.header_labels = ["Name"] + self.solution_manager.get_solution_goals()
        self.solution_trees.setColumnCount(len(self.header_labels))
        self.solution_trees.setHeaderLabels(self.header_labels)
        # self.solution_trees.setColumnHidden(2, True)
        # self.solution_trees.setColumnWidth(0,200)
        self.solution_trees.header().setResizeMode(0, QtGui.QHeaderView.Stretch)

        self.solution_description = ui.get_child(self.ui, "lb_solution_desc")
        self.solution_widget_layout = ui.get_child(self.ui, "wi_solution_widget").layout()
        self.solution_channel_box_layout = ui.get_child(self.ui, "wi_channel_box").layout()

        # Fills the solution trees in the UI.
        self.fill_solution_trees()

        # Solutions UI signals.

        # self.solution_trees.itemSelectionChanged.connect(self.fix_solution_trees_selection)
        self.solution_trees.itemSelectionChanged.connect(self.select_solutions_nodes)
        self.solution_trees.itemSelectionChanged.connect(self.load_selected_solution_ui)

        self.solution_trees.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.solution_trees.customContextMenuRequested.connect(self.solution_trees_menu)
        # ------------------------------------------

        # ------------------------------------------
        # UTILS TAB

        # Utils UI init.

        self.dsp_joints_display_size = ui.get_child(self.ui, "dsp_joints_display_size")
        self.dsp_joints_display_size.setValue(pm.jointDisplayScale(q=True))

        # Utils UI signals.

        self.dsp_joints_display_size.valueChanged.connect(self.update_joints_display_size)