def change_name(self, instance):
     """Applies the change_name dialogs input and hides it"""
     new_name = self.widgets['change_name'].collectData('new_name')
     self.widgets['change_name'].findChild(name='new_name').text = u''
     if not (len(new_name) == 0 or new_name.isspace()):
         RenameObject(instance, new_name).execute(self.session)
     self._hide_change_name_dialog()
Exemple #2
0
    def change_name(self, instance):
        """Applies the change_name dialogs input and hides it.
		If the new name has length 0 or only contains blanks, the old name is kept.
		"""
        new_name = self.widgets['change_name'].collectData('new_name')
        self.widgets['change_name'].findChild(name='new_name').text = u''
        if not new_name or not new_name.isspace():
            # different namedcomponent classes share the name
            RenameObject(instance.get_component_by_name(NamedComponent.NAME),
                         new_name).execute(self.session)
        self._hide_change_name_dialog()
Exemple #3
0
	def act(self, named_instance):
		"""Renames the instance that is returned by the dialog, if confirmed.

		Hitting Esc or the Cancel button will not trigger a rename.
		if no name was entered or the new name only consists of spaces, abort
		the renaming as well.
		"""
		if not named_instance:
			return

		new_name = self._gui.collectData('new_name')

		if new_name and not new_name.isspace():
			# different namedcomponent classes share the name
			namedcomp = named_instance.get_component_by_name(NamedComponent.NAME)
			RenameObject(namedcomp, new_name).execute(self._session)