Esempio n. 1
0
    def setup_menu_bar(self):
        """
        creates a menu bar for this main window
        :return: <bool> True for success.
        """
        menu_data = {}
        menu_bar = QtWidgets.QMenuBar()
        menu_data["options"] = menu_bar.addMenu("&Module Options")
        menu_data["blueprintOptions"] = menu_bar.addMenu("&Blueprint Options")
        menu_data["utilities"] = menu_bar.addMenu("&Utilities")

        # create utility
        menu_data["printData"] = QtWidgets.QAction("&Print Module Data")
        menu_data["reloadModules"] = QtWidgets.QAction("&Reload Rig Modules")

        # create regular option actions
        menu_data["updateModules"] = QtWidgets.QAction("Update Modules")
        menu_data["addModule"] = QtWidgets.QAction("Add Module")
        menu_data["clearModules"] = QtWidgets.QAction("Clear Modules")

        # create blueprint option actions
        menu_data["setBlueprintPath"] = QtWidgets.QAction(
            "S&et Blueprint Path")
        # menu_data["saveBlueprint"] = QtWidgets.QAction("Save &Blueprint")
        menu_data["saveNewBlueprint"] = QtWidgets.QAction(
            "Save &New Blueprint")
        menu_data["removeBlueprint"] = QtWidgets.QAction("&Remove Blueprint")
        menu_data["openBlueprintDir"] = QtWidgets.QAction(
            "&Open Blueprint Dir")
        menu_data["openBlueprintFile"] = QtWidgets.QAction(
            "Open Blueprint &File")

        # utility actions
        menu_data["utilities"].addAction(menu_data["printData"])
        menu_data["utilities"].addAction(menu_data["reloadModules"])

        # blueprint options
        menu_data["blueprintOptions"].addAction(menu_data["setBlueprintPath"])
        # menu_data["blueprintOptions"].addAction(menu_data["saveBlueprint"])
        menu_data["blueprintOptions"].addAction(menu_data["saveNewBlueprint"])
        menu_data["blueprintOptions"].addAction(menu_data["removeBlueprint"])
        menu_data["blueprintOptions"].addAction(menu_data["openBlueprintDir"])
        menu_data["blueprintOptions"].addAction(menu_data["openBlueprintFile"])

        # set actions
        menu_data["options"].addAction(menu_data["updateModules"])
        menu_data["options"].addAction(menu_data["addModule"])
        menu_data["options"].addAction(menu_data["clearModules"])
        self.setMenuBar(menu_bar)
        return menu_data
Esempio n. 2
0
 def add_menu_actions(self, widget):
     """
     adds menu actions.
     """
     actions = {}
     for mod in proper_modules:
         actions[mod] = QtWidgets.QAction(self)
         actions[mod].setText(mod)
         actions[mod].triggered.connect(partial(self.add_module, mod))
         widget.addAction(actions[mod])
     return actions
Esempio n. 3
0
    def add_actions(self, label):
        """
        executes a rename call.
        :param label:
        :return:
        """
        select = QtWidgets.QAction(label)
        select.setText("Select")

        rename = QtWidgets.QAction(label)
        rename.setText("Rename")

        remove = QtWidgets.QAction(label)
        remove.setText("Remove")

        label.setContextMenuPolicy(Qt.ActionsContextMenu)
        rename.triggered.connect(self.rename_call)
        remove.triggered.connect(self.remove_item_call)
        select.triggered.connect(self.select_call)
        label.addAction(rename)
        label.addAction(remove)
        label.addAction(select)