Esempio n. 1
0
        def create_name_textbox():
            name_textbox = QtWidgets.QLineEdit()

            # Replace spaces with underscores
            def name_fixup():
                old_cursor_pos = name_textbox.cursorPosition()
                name_textbox.setText(name_textbox.text().replace(" ", "_"))
                name_textbox.setCursorPosition(old_cursor_pos)

            name_textbox.setPlaceholderText("Name")
            # name_validator = QtGui.QRegExpValidator(QtCore.QRegExp("^[a-zA-Z][a-zA-Z\d#_ ]*"))
            # name_textbox.setValidator(name_validator)
            name_textbox.textChanged.connect(name_fixup)
            name_textbox.textChanged.connect(self.main_ctrl.name_changed)
            name_textbox.textChanged.connect(
                lambda: self.add_btn.setDisabled(self.model.add_btn_disabled))
            return name_textbox
Esempio n. 2
0
    def __init__(self, script_view, project_model, main_model):
        """

        Args:
            script_view (auri.views.script_module_view.ScriptModuleView):
            project_model (auri.models.project_model.ProjectModel):
            main_model (auri.models.main_model.MainModel):
        """
        self.script_view = script_view
        self.project_model = project_model
        self.main_model = main_model
        super(EditScriptView, self).__init__()
        self.setWindowTitle("Edit Script")
        self.setModal(1)
        self.setMinimumWidth(250)
        self.setMinimumHeight(150)
        self.main_layout = QtWidgets.QVBoxLayout()
        self.new_name = QtWidgets.QLineEdit()
        self.ok_btn = push_button("Ok", self.ok_pressed)
        self.cancel_btn = push_button("Cancel", self.cancel_pressed)
        self.message_box = None
        self.setup_ui()