Author: johannes
Date: 2007-04-24 08:18:18 -0500 (Tue, 24 Apr 2007)
New Revision: 9508
Modified:
trunk/gnue-forms/src/uidrivers/qt3/widgets/toolbutton.py
Log:
Really made the toolbuttons work again
Modified: trunk/gnue-forms/src/uidrivers/qt3/widgets/toolbutton.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt3/widgets/toolbutton.py 2007-04-24 13:10:30 UTC (rev 9507)
+++ trunk/gnue-forms/src/uidrivers/qt3/widgets/toolbutton.py 2007-04-24 13:18:18 UTC (rev 9508)
@@ -67,8 +67,8 @@
widget.setTextLabel(label.replace('&', u''))
widget.setIconSet(image)
widget.setToggleButton(toggle)
+ widget.connect(widget, qt.SIGNAL('clicked()'), self.__on_tool)
- #wx.EVT_TOOL(event.container, widget.GetId(), self.__on_tool)
else:
widget = None
event.container.addSeparator()
@@ -85,7 +85,8 @@
# Events
# -------------------------------------------------------------------------
- def __on_tool(self, event):
+ def __on_tool(self):
+
self._gfObject._event_fire()
@@ -95,14 +96,12 @@
def _ui_switch_on_(self):
if self.__widget is not None:
- print self.__widget
self.__widget.setDown(True)
# -------------------------------------------------------------------------
def _ui_switch_off_(self):
if self.__widget is not None:
- print self.__widget
self.__widget.setDown(False)
@@ -120,61 +119,6 @@
if self.__widget is not None:
self.__widget.setEnabled(False)
-# =============================================================================
-# Action
-# =============================================================================
-
-class Action(qt.QAction):
- """
- Implementation of an action used within a toolbar
- """
-
- # -------------------------------------------------------------------------
- # Constructor
- # -------------------------------------------------------------------------
-
- def __init__(self, parent, name, user_action):
-
- qt.QAction.__init__(self, parent)
-
- self.parent = parent
- self.user_action = user_action
-
- iconloc = user_action.getIconLocation(size="24x24")
-
- # Set the action icon if available
- if iconloc:
- icon = _ICON_CACHE.setdefault(iconloc,
- qt.QIconSet(qt.QPixmap(iconloc)))
- self.setIconSet(icon)
- else:
- print u_("** WARNING: Cannot add '%s' to toolbar; no icon") \
- % user_action.event
-
- self.setText(name)
- if user_action.canToggle:
- self.setToggleAction(True)
-
- self.setToolTip(user_action.description or '')
-
- self.connect(self, qt.SIGNAL('activated()'), self.__activated)
-
- self.addTo(parent)
-
- # -------------------------------------------------------------------------
- # String representation
- # -------------------------------------------------------------------------
-
- def __repr__(self):
- return "<Action %s (%s)>" % (self.user_action.event,
- self.user_action.canToggle)
-
- # -------------------------------------------------------------------------
- # Slot Implementations
- # -------------------------------------------------------------------------
-
- def __activated(self):
- self.parent._fire(self.user_action, False)
# =============================================================================
# Configuration data
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.