Closed GoogleCodeExporter closed 9 years ago
Make the action checkable, the plugin keeps a reference to the server process,
then kills it when it's unchecked?
Original comment by roberto.alsina
on 4 Feb 2011 at 4:54
How do I make the action checkable?
Original comment by andresgattinoni
on 4 Feb 2011 at 4:57
using QAction.setCheckable(True) :-D
Original comment by roberto.alsina
on 4 Feb 2011 at 5:01
Sounds logic hehe
Original comment by andresgattinoni
on 4 Feb 2011 at 5:04
Do I need to do anything else to make the action checkable? I added the
setCheckable(True), but nothing changed, and the handler function is always
called with checked=true.
Original comment by andresgattinoni
on 5 Feb 2011 at 2:44
The problem is we are recreating _action every time the Tools menu opens.
Something like this does the trick:
class Plugin(Tool):
_proc = None
_action = None
def action(self):
if self._action is None:
self._action = QtGui.QAction("Publish Catalog", None)
self._action.setCheckable(True)
print "ISC", self._action.isCheckable()
self._action.toggled.connect(self.publish)
return self._action
Original comment by roberto.alsina
on 6 Feb 2011 at 12:05
remove the print, of course ;-)
Original comment by roberto.alsina
on 6 Feb 2011 at 12:05
This issue was closed by revision 072fd2d40c.
Original comment by andresgattinoni
on 6 Feb 2011 at 7:40
Original issue reported on code.google.com by
andresgattinoni
on 4 Feb 2011 at 2:25