Exemplo n.º 1
0
	def removeAction(self, action):
		self._actions.remove(action)
		
		actions = [action]
		if isinstance(action, ActionGroup):
			actions = action.getActions()
			scripts.gui.action.changed.disconnect(self._updateActionGroup, sender=action)

		for a in actions:
			for b in self._actionbuttons[:]:
				if a == b.action:
					self.removeChild(b)
					self._actionbuttons.remove(b)
			
		self.adaptLayout(False)
Exemplo n.º 2
0
    def removeAction(self, action):
        self._actions.remove(action)

        actions = [action]
        if isinstance(action, ActionGroup):
            actions = action.getActions()
            scripts.gui.action.changed.disconnect(self._updateActionGroup,
                                                  sender=action)

        for a in actions:
            for b in self._actionbuttons[:]:
                if a == b.action:
                    self.removeChild(b)
                    self._actionbuttons.remove(b)

        self.adaptLayout(False)
Exemplo n.º 3
0
	def _insertButton(self, action, position):
		actions = [action]
		if isinstance(action, ActionGroup):
			actions = action.getActions()
			scripts.gui.action.changed.connect(self._updateActionGroup, sender=action)

		if position >= 0:
			actions = reversed(actions)
		
		# Action groups are counted as one action, add the hidde number of actions to position
		for i in range(position):
			if isinstance(self._actions[i], ActionGroup):
				position += len(self._actions[i].getActions()) - 1

		for a in actions:
			button = MenuButton(a, name=a.text)
			self.insertChild(button, position)
			self._actionbuttons.insert(position, button)
Exemplo n.º 4
0
    def _insertButton(self, action, position):
        actions = [action]
        if isinstance(action, ActionGroup):
            actions = action.getActions()
            scripts.gui.action.changed.connect(self._updateActionGroup,
                                               sender=action)

        if position >= 0:
            actions = reversed(actions)

        # Action groups are counted as one action, add the hidde number of actions to position
        for i in range(position):
            if isinstance(self._actions[i], ActionGroup):
                position += len(self._actions[i].getActions()) - 1

        for a in actions:
            button = MenuButton(a, name=a.text)
            self.insertChild(button, position)
            self._actionbuttons.insert(position, button)