ralsina / aranduka

Automatically exported from code.google.com/p/aranduka
0 stars 1 forks source link

Add posibility to stop the OPDS catalog server #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We should add the posibility of stopping the OPDS catalog server without the 
need closing Aranduka.
One possibility would be to change the menu's action from "Publish catalog" to 
"Stop catalog server" or something like that.
But that raises the issue of how to implement that within the plugin structure.

Original issue reported on code.google.com by andresgattinoni on 4 Feb 2011 at 2:25

GoogleCodeExporter commented 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

GoogleCodeExporter commented 9 years ago
How do I make the action checkable?

Original comment by andresgattinoni on 4 Feb 2011 at 4:57

GoogleCodeExporter commented 9 years ago
using QAction.setCheckable(True) :-D

Original comment by roberto.alsina on 4 Feb 2011 at 5:01

GoogleCodeExporter commented 9 years ago
Sounds logic hehe

Original comment by andresgattinoni on 4 Feb 2011 at 5:04

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
remove the print, of course ;-)

Original comment by roberto.alsina on 6 Feb 2011 at 12:05

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 072fd2d40c.

Original comment by andresgattinoni on 6 Feb 2011 at 7:40