Package Camelot :: Package camelot :: Package view :: Package controls :: Module actionsbox |
[frames] | no frames]

# Source Code for Module Camelot.camelot.view.controls.actionsbox

     1  #  ============================================================================
     2  #
     3  #  Copyright (C) 2007-2008 Conceptive Engineering bvba. All rights reserved.
     4  #  www.conceptive.be / project-camelot@conceptive.be
     5  #
     6  #  This file is part of the Camelot Library.
     7  #
     8  #  This file may be used under the terms of the GNU General Public
     9  #  License version 2.0 as published by the Free Software Foundation
    10  #  and appearing in the file LICENSE.GPL included in the packaging of
    11  #  this file.  Please review the following information to ensure GNU
    12  #  General Public Licensing requirements will be met:
    13  #  http://www.trolltech.com/products/qt/opensource.html
    14  #
    15  #  If you are unsure which license is appropriate for your use, please
    16  #  review the following information:
    17  #  http://www.trolltech.com/products/qt/licensing.html or contact
    18  #  project-camelot@conceptive.be.
    19  #
    20  #  This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    21  #  WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    22  #
    23  #  For use of this library in commercial applications, please contact
    24  #  project-camelot@conceptive.be
    25  #
    26  #  ============================================================================
    27
    28  """Actions box"""
    29
    30  import logging
    31  logger = logging.getLogger('controls.actionsbox')
    32
    33  from PyQt4 import QtGui
    34
    35  from camelot.core.utils import ugettext as _
    36
    37 -class ActionsBox(QtGui.QGroupBox):
    38      """A box containing actions to be applied to a view"""
    39
    40 -    def __init__(self, parent, *args, **kwargs):
    41          QtGui.QGroupBox.__init__(self, _('Actions'), parent)
    42          logger.debug('create actions box')
    43          self.args = args
    44          self.kwargs = kwargs
    45
    46 -    def setActions(self, actions):
    47          action_widgets = []
    48          logger.debug('setting actions')
    49          # keep action object alive to allow them to receive signals
    50          self.actions = actions
    51          layout = QtGui.QVBoxLayout()
    52          for action in actions:
    53              action_widget = action.render(self, *self.args)
    54              layout.addWidget(action_widget)
    55              action_widgets.append(action_widget)
    56          self.setLayout(layout)
    57          return action_widgets
    58