Home | Trees | Indices | Help |
|
---|
|
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 """collection of helper functions""" 29 30 from PyQt4 import QtGui 31 from PyQt4 import QtCore 32 from PyQt4.QtCore import Qt 3334 -def createAction(parent, text, slot=None, shortcut='', actionicon='', tip='', 35 checkable=False, signal='triggered()', widgetaction=False):36 """ creates and returns a QAction object """ 37 38 action = QtGui.QWidgetAction(parent) if widgetaction \ 39 else QtGui.QAction(parent) 40 action.setText(text) 41 42 if actionicon: 43 action.setIcon(QtGui.QIcon(actionicon)) 44 if shortcut: 45 action.setShortcut(shortcut) 46 if tip: 47 action.setToolTip(tip) 48 action.setStatusTip(tip) 49 if slot: 50 parent.connect(action, QtCore.SIGNAL(signal), slot) 51 if checkable: 52 action.setCheckable(True) 53 return action5456 """add action objects to menus, menubars, and toolbars if action is None, add 57 a toolbar, however we must explicitly add separator actions in the case of 58 context menus. 59 """ 60 for action in actions: 61 if action is None: 62 target.addSeparator() 63 else: 64 target.addAction(action)65
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jan 31 18:50:02 2009 | http://epydoc.sourceforge.net |