[node-patches] Change in ovirt-node[master]: urwid: Work around watch_pipe
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Tue May 28 15:16:21 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: urwid: Work around watch_pipe
......................................................................
urwid: Work around watch_pipe
main_loop.watch_pipe() is only available in never urwid releases, a
workaround was added (using a custom pipe), because this is needed when
communicating with different threads.
Change-Id: I23148c8757164d3474799b03796a96ea5cf58acf
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=967923
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/ui/urwid_builder.py
1 file changed, 11 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/36/15136/1
diff --git a/src/ovirt/node/ui/urwid_builder.py b/src/ovirt/node/ui/urwid_builder.py
index c1a4237..a140be4 100644
--- a/src/ovirt/node/ui/urwid_builder.py
+++ b/src/ovirt/node/ui/urwid_builder.py
@@ -464,17 +464,17 @@
def __init_pipe(self):
self._pipe_q = []
- def cb_from_q(data):
- self.logger.debug("Data reading")
+ def cb_from_q(data=None):
+ #self.logger.debug("Data reading")
try:
while self._pipe_q:
cb = self._pipe_q.pop()
- self.logger.debug("Data run: %s" % cb)
+ self.logger.debug("Data on pipe, running: %s" % cb)
cb()
except Exception:
self.logger.debug("No callback")
- self._pipe_fd = self.__loop.watch_pipe(cb_from_q)
+ self._pipe_fd = self.watch_pipe(cb_from_q)
def thread_connection(self):
dst = self
@@ -640,7 +640,13 @@
def watch_pipe(self, cb):
"""Return a fd to be used as stdout, cb called for each line
"""
- return self.__loop.watch_pipe(cb)
+ if False and hasattr(self.__loop, "watch_pipe"):
+ return self.__loop.watch_pipe(cb)
+ else:
+ # For urwid-0.9.9
+ rfd, wfd = os.pipe()
+ self.__loop.watch_file(rfd, cb)
+ return wfd
def _convert_palette(self):
"""Convert our palette to the format urwid understands.
--
To view, visit http://gerrit.ovirt.org/15136
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I23148c8757164d3474799b03796a96ea5cf58acf
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list