Example #1
0
    def _init_batteries(self):
        """Summary
        
        Returns:
            TYPE: Description
        """
        line = QtWidgets.QFrame()
        line.setGeometry(QtCore.QRect(320, 150, 118, 3))
        line.setFrameShape(QtWidgets.QFrame.HLine)
        line.setFrameShadow(QtWidgets.QFrame.Sunken)
        for battery in self.battery_checker_list:
            if not isinstance(battery, BaseBatteryCheck):
                raise Exception(
                    "This Battery: %s is not from a base class supported" %
                    type(battery))

            # Creating Layout Ui for each battery and appending rows widgets
            battery_layout = QtWidgets.QVBoxLayout()
            battery_layout.addWidget(line)
            battery_label = QtWidgets.QLabel(battery.name)
            battery_layout.addWidget(battery_label)
            for check in battery.checks:
                row_widget = BaseRowCheck(check)
                battery_layout.addWidget(row_widget)
                self.rows.append(row_widget)
            self.check_layout.addLayout(battery_layout)
Example #2
0
 def add_item_in_list(self, key):
     if key.startswith("P:bm2"):
         print "VERGA"
     listItem = QtWidgets.QListWidgetItem(key)
     listItem.setIcon(QtGui.QIcon(os.path.join(ICO_PATH, "question.png")))
     self.dependency_list.addItem(listItem)
     QtWidgets.QApplication.processEvents()
Example #3
0
    def context_menu_list(self):
        self.dependency_list.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)

        # Context Menu
        # Copy Action
        copy_action = QtWidgets.QAction("Copy rout", self)
        copy_action.triggered.connect(self.copy_selected_rout)
        self.dependency_list.addAction(copy_action)
Example #4
0
 def populateButtons(self):
     all_buttons = toolbar_config.TOOLS
     for button in all_buttons:
         button.setStyleSheet(widget_stylesheet(COLOR))
         self.flow_layout.addWidget(button)
     spacer = QtWidgets.QSpacerItem(100, 20, QtWidgets.QSizePolicy.Minimum,
                                    QtWidgets.QSizePolicy.Expanding)
     self.flow_layout.addItem(spacer)
Example #5
0
 def __populate_scenes(self, scenes_tree):
     self.__delete_tabs()
     for folder, scenes in scenes_tree.iteritems():
         scenes_list_widget = QtWidgets.QListWidget()
         scenes_list_widget.addItems(
             sorted(
                 [item for item in scenes.keys() if item.endswith(".ma")],
                 reverse=True))
         scenes_list_widget.itemClicked.connect(self.__scene_selected)
         self.scenesTW.addTab(scenes_list_widget, folder)
Example #6
0
 def __addTabs(self):
     batteriesChecks = checks_configuration.ALLBATTERIES
     for battery in batteriesChecks:
         scrollArea = QtWidgets.QScrollArea()
         scrollArea.setWidgetResizable(True)
         scrollWidget = QtWidgets.QWidget()
         scrollLayout = QtWidgets.QVBoxLayout()
         scrollLayout.setSpacing(0)
         scrollLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
         scrollLayout.setContentsMargins(0, 0, 0, 0)
         for check in battery.checks:
             checkWidget = CheckWidget(check, self)
             scrollLayout.addWidget(checkWidget)
         spacer = QtWidgets.QSpacerItem(100, 20,
                                        QtWidgets.QSizePolicy.Minimum,
                                        QtWidgets.QSizePolicy.Expanding)
         scrollLayout.addItem(spacer)
         scrollWidget.setLayout(scrollLayout)
         scrollArea.setWidget(scrollWidget)
         self.checksTab.addTab(scrollArea, battery.name)
    def __init__(self, title, level='INFO', msg=None):
        super(MessageWindow, self).__init__()
        set_style_sheet(self, os.path.join(get_css_path(), "dark_style1.qss"))
        self._state = False
        self.vertical_layout = QtWidgets.QVBoxLayout(self)
        self.horizontal_layout_btns = QtWidgets.QHBoxLayout()
        self.label_layout = QtWidgets.QHBoxLayout()

        title_font = QtGui.QFont()
        title_font.setPointSize(11)
        self.title_label = QtWidgets.QLabel()
        self.title_label.setText(title)
        self.title_label.setFont(title_font)

        level_font = QtGui.QFont()
        level_font.setPointSize(11)
        level_font.setBold(True)
        self.level_label = QtWidgets.QLabel()
        self.level_label.setFont(level_font)
        self.level_label.setText(level.upper())
        self.set_lvl_color(self.level_label, level)
        self.label_layout.addWidget(self.title_label)
        self.label_layout.addWidget(self.level_label)

        self.right_btn = QtWidgets.QPushButton()
        self.right_btn.setMinimumHeight(30)
        self.right_btn.setMinimumWidth(100)
        self.right_btn.setText(self.name_btn_right)
        self.right_btn.clicked.connect(self.on_right_btn)

        self.left_btn = QtWidgets.QPushButton()
        self.left_btn.setMinimumHeight(30)
        self.left_btn.setMinimumWidth(100)
        self.left_btn.setText(self.name_btn_left)
        self.left_btn.clicked.connect(self.on_left_btn)

        self.vertical_layout.addLayout(self.label_layout)

        if msg:
            self.text = QtWidgets.QTextEdit()
            self.text.setPlainText(msg)
            self.vertical_layout.addWidget(self.text)
            self.text.setReadOnly(True)

        self.horizontal_layout_btns.addWidget(self.left_btn)
        self.horizontal_layout_btns.addWidget(self.right_btn)

        self.vertical_layout.addLayout(self.horizontal_layout_btns)

        self.resize(100, 10)
        self.exec_()
Example #8
0
    def _add_line(self):

        for index in range(self.vl_list.count()):
            widget = self.vl_list.itemAt(index)
            if widget.spacerItem():
                self.vl_list.removeItem(widget)

        w_container = QtWidgets.QWidget()
        w_container.setObjectName("container")
        hl_shader_name = QtWidgets.QHBoxLayout(w_container)
        hl_shader_name.setSpacing(2)

        lb_name = QtWidgets.QLabel(self.gb_list)
        lb_name.setText(self.s_base_name)
        hl_shader_name.addWidget(lb_name)

        le_description = QtWidgets.QLineEdit(self.gb_list)
        le_description.setMinimumSize(QtCore.QSize(155, 0))
        hl_shader_name.addWidget(le_description)


        pb_remove = QtWidgets.QPushButton(self.gb_list)
        pb_remove.setMinimumSize(QtCore.QSize(30, 30))
        pb_remove.setText("-")

        self.d_contents[pb_remove]=le_description
        pb_remove.clicked.connect(functools.partial(self._remove_selected, pb_remove))
        hl_shader_name.addWidget(pb_remove)


        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        hl_shader_name.addItem(spacerItem)

        self.vl_list.addWidget(w_container)
        self.__insert_spacer()
Example #9
0
def recursive_advance_tree(tree, data):
    '''
        {"value":{
            0:{"checked": None,
               "icon": spackage_ico_path,
               "value":"RIG"},
            1:{"checked": 2,
               "icon": download_ico_path,
               "text":"Load msg"},

            2:{"checked": 2,
               "icon": update_ico_path,
               "text":"text message"},

            3:{"checked": 2,
               "icon": upload_ico_path,
               "text":"text message"}
            },
    '''
    #     row = len(data.keys())
    for row, value_info in enumerate(data):
        tree_item = QtWidgets.QTreeWidgetItem(tree)
        #         tree_item = tree.topLevelItem(row)
        if isinstance(value_info["value"], str):
            tree_item.setText(0, value_info["value"])
        elif isinstance(value_info["value"], dict):
            for column, column_info in value_info["value"].iteritems():
                # Set text
                if "text" in column_info:
                    tree_item.setText(column, column_info["text"])
                # Set check box if exists
                if "checked" in column_info:
                    if isinstance(column_info["checked"], int):
                        tree_item.setCheckState(
                            column, get_qt_check_state(column_info["checked"]))
                # Set icon
                if "icon" in column_info:
                    if os.path.exists(column_info["icon"]):
                        tree_item.setIcon(column,
                                          (QtGui.QIcon(column_info["icon"])))
            if "children" in value_info:
                if isinstance(value_info["children"],
                              list) and value_info["children"]:
                    recursive_advance_tree(tree_item, value_info["children"])
        tree_item.setExpanded(True)
        if isinstance(tree, QtWidgets.QTreeWidget):
            tree.addTopLevelItem(tree_item)
        elif isinstance(tree, QtWidgets.QTreeWidgetItem):
            tree.addChild(tree_item)
    return tree
Example #10
0
def recursive_tree(tree, data):
    '''
    Works for one header and with this kind of dictionaries
        data_example = [
        {"value":"rig",
         "checked":1,
         "children":[
             {"value":"geo",
              "checked":2,
              "children":[]
              },
             {"value":"expr",
              "checked":2,
              "children":[]
              }
             ]
         },
        {"value":"controller",
         "checked":1,
         "children":[
             {"value":"bones",
              "checked":2,
              "children":[]
              },
             {"value":"references",
              "checked":2,
              "children":[]
              }
             ]
         }
        ]
    '''
    #     row = len(data.keys())
    column = 0
    for row, value_info in enumerate(data):
        tree_item = QtWidgets.QTreeWidgetItem(tree)
        #         tree_item = tree.topLevelItem(row)
        tree_item.setText(0, value_info["value"])
        if "checked" in value_info:
            tree_item.setCheckState(column,
                                    get_qt_check_state(value_info["checked"]))
        if "children" in value_info:
            if isinstance(value_info["children"],
                          list) and value_info["children"]:
                recursive_tree(tree_item, value_info["children"])
        if isinstance(tree, QtWidgets.QTreeWidget):
            tree.addTopLevelItem(tree_item)
        elif isinstance(tree, QtWidgets.QTreeWidgetItem):
            tree.addChild(tree_item)
    return tree
Example #11
0
def get_default_container(widget,
                          name='APP NAME',
                          style=True,
                          simple_bar=True):
    dialog = QtWidgets.QDialog()
    dialog.setWindowTitle("Framework: [Miguel Molledo, Alberto Sierra]")
    # dialog.SetSizeContraint()
    main_layout = QtWidgets.QVBoxLayout()
    main_layout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
    if simple_bar:
        # Add a bar
        simple_bar_widget = SimpleBar(name)
        main_layout.addWidget(simple_bar_widget)
        main_layout.addWidget(widget)
    else:
        main_layout.addWidget(widget)
    dialog.setLayout(main_layout)
    # Set Style

    if style:
        ui.apply_resource_style(dialog)

    return dialog
Example #12
0
 def __insert_spacer(self):
     self.spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
     self.vl_list.addItem(self.spacerItem)
Example #13
0
def tree_widget(headers,
                elements=[],
                tree=None,
                elements_checked=0,
                children_checked=0):
    """
    NOTE: 
    KIND OF DEPRECATED BETTER USE FILL_TREE
    Method to fill a tree widget or create a new one with the headers and elements defined
    
    Args:
        tree (None, optional): QtWidget.QTreeWidget If its passed as argument it uses the parameter
        if its not create a new tree widget and return it at the end of the method 
        headers (list, str): with this flag creates the header/s with a string one header with a list 'N' headers
        elements (list, dict):
            list: it works with a list of elements or a list of lists do not support list or strings shuffled'
            In this case the order matters to insert them.
                Example:
                    [['Element1','Element2','Element3'],['Element1','Element2','Element3']]
                    or 
                    ['Element1','Element2','Element3']
            dict: It works having as a key argument the name of the columns where it inserts the data and within the corresponding data.
                example:
                    {
                        "ColumnName-1": ['Element1','Element2','Element3'],
                        or/and
                        "ColumnName-2": {
                                        "Element_02" : ["elemenet01","elemenet01","elemenet01","elemenet01"]
                                        }
                    }
        elements_checked (bool, optional): It generates a check box for each main element on the state defined (0,1,2)
        children_checked (int, optional): It generates a check box for each sub element on the state defined (0,1,2)
    
    Returns:
        TYPE: Description
    
    Raises:
        Exception: Description
    """
    # Check tree type

    if isinstance(tree, QtWidgets.QTreeWidget):
        tree = tree
    else:
        tree = QtWidgets.QTreeWidget()

        # Check Header Type
    if isinstance(headers, str):
        tree.setColumnCount(1)
        tree.setHeaderLabels(headers)
    elif isinstance(headers, list):
        tree.setColumnCount(len(headers))
        tree.setHeaderLabels(headers)
    else:
        raise Exception("Not supported type for headers try using Str or list")

    # Check element type
    # To work with lists
    if isinstance(elements, list):
        for column in range(0, len(headers)):
            element = elements[column]
            if isinstance(element, list):
                for row, element_child in enumerate(element):
                    tree_item = tree.topLevelItem(row)
                    if not tree_item:
                        tree_item = QtWidgets.QTreeWidgetItem(tree)
                    tree_item.setText(column, element_child)
                    if elements_checked:
                        tree_item.setCheckState(
                            column, get_qt_check_state(elements_checked))
                    tree.addTopLevelItem(tree_item)

            elif (isinstance(element, str) or isinstance(element, unicode)):
                tree_item = QtWidgets.QTreeWidgetItem(tree)
                tree_item.setText(0, element)
                tree.addTopLevelItem(tree_item)
    # To work with Dictionary
    elif isinstance(elements, dict):

        for key, values in elements.iteritems():
            if not key in headers: continue
            column = headers.index(key)
            if isinstance(values, list):
                for row, key_c in enumerate(values):
                    tree_item = tree.topLevelItem(row)
                    if not tree_item:
                        tree_item = QtWidgets.QTreeWidgetItem(tree)
                    tree_item.setText(column, key_c)
                    if elements_checked:
                        tree_item.setCheckState(
                            column, get_qt_check_state(elements_checked))
                    tree.addTopLevelItem(tree_item)
            elif isinstance(values, dict):
                row = 0
                for key_c, values_c in values.iteritems():
                    tree_item = tree.topLevelItem(row)
                    if not tree_item:
                        tree_item = QtWidgets.QTreeWidgetItem(tree)
                    tree_item.setText(column, key_c)
                    if elements_checked:
                        tree_item.setCheckState(
                            column, get_qt_check_state(elements_checked))
                    if isinstance(values_c, list):
                        for row_c, child in enumerate(values_c):
                            child_item = tree_item.child(row_c)
                            if not child_item:
                                child_item = QtWidgets.QTreeWidgetItem(
                                    tree_item)
                            child_item.setText(column, child)

                            if children_checked:
                                child_item.setCheckState(
                                    column,
                                    get_qt_check_state(children_checked))
                            tree_item.addChild(child_item)

                    tree.addTopLevelItem(tree_item)
                    row += 1
    return tree
Example #14
0
                method(item_widget, column, item_widget.checkState(column))
            children_count = item_widget.childCount()
            if not children_count:
                continue
            for child_row in range(0, children_count):
                child_item = item_widget.child(child_row)
                method(child_item, column, child_item.checkState(column))


if __name__ == "__main__":
    download_ico_path = os.path.join(ICO_PATH, "downloading.png")
    upload_ico_path = os.path.join(ICO_PATH, "warning.png")
    update_ico_path = os.path.join(ICO_PATH, "miguel.png")
    component_ico_path = os.path.join(ICO_PATH, "question.png")
    spackage_ico_path = os.path.join(ICO_PATH, "question.png")
    app = QtWidgets.QApplication(sys.argv)
    data_example = [{
        "value": {
            0: {
                "checked": None,
                "icon": spackage_ico_path,
                "text": "RIG"
            },
            1: {
                "checked": 2,
                "icon": download_ico_path,
                "text": "Load msg"
            },
            2: {
                "checked": 2,
                "icon": update_ico_path,
Example #15
0
 def __init__(self, title, level='ERROR', msg=None):
     self.name_btn_left = 'Copy Information'
     self.name_btn_right = 'Send Information'
     super(ReporterWindow, self).__init__(title, level, msg)
     self.vertical_layout = QtWidgets.QVBoxLayout(self)
Example #16
0
        if self.TRAPI == 1:
            self.fixable = False
            self.state = self.CHECK_PASSED
            self.output = "Check: %s PASSED" % self.name
            return True

    def fix(self):
        """Summary
        
        Returns:
            TYPE: Description
        """
        print "Starting Fix %s" % self.name
        self.TRAPI = 1
        self.execute()


if __name__ == "__main__":

    QtWidgets.QApplication(sys.argv)
    # # EXAMPLE BATTERY
    GENERAL_CHECKS_BATTERY = [CleanPlugins(), CheckSceneName()]

    general_batery_check = BaseBatteryCheck("General Checks",
                                            GENERAL_CHECKS_BATTERY)

    checker_widget = BaseChecksWidget([general_batery_check])

    maya_widget = gui_loader.get_maya_container(checker_widget)
    maya_widget.exec_()
Example #17
0
 def __set_accent_color(self):
     dialog = QtWidgets.QColorDialog()
     dialog.colorSelected.connect(self.__change_accent_color)
     dialog.exec_()