comparison sat_frontends/bridge/pb.py @ 3066:2cc2f65379f7

core: added imageCheck and imageResize methods: imageCheck will give a report on image, notably it will tell if it's too big and needs to be resized before a transfer. imageResize will create a new image with the requested size and return a path to it.
author Goffi <goffi@goffi.org>
date Tue, 29 Oct 2019 20:38:39 +0100
parents 84bb63e1e4c4
children 130f9cb6e0ab
comparison
equal deleted inserted replaced
3065:f8e3789912d0 3066:2cc2f65379f7
373 d.addCallback(callback) 373 d.addCallback(callback)
374 if errback is None: 374 if errback is None:
375 errback = self._generic_errback 375 errback = self._generic_errback
376 d.addErrback(errback) 376 d.addErrback(errback)
377 377
378 def imageCheck(self, arg_0, callback=None, errback=None):
379 d = self.root.callRemote("imageCheck", arg_0)
380 if callback is not None:
381 d.addCallback(callback)
382 if errback is None:
383 errback = self._generic_errback
384 d.addErrback(errback)
385
386 def imageResize(self, image_path, width, height, callback=None, errback=None):
387 d = self.root.callRemote("imageResize", image_path, width, height)
388 if callback is not None:
389 d.addCallback(callback)
390 if errback is None:
391 errback = self._generic_errback
392 d.addErrback(errback)
393
378 def isConnected(self, profile_key="@DEFAULT@", callback=None, errback=None): 394 def isConnected(self, profile_key="@DEFAULT@", callback=None, errback=None):
379 d = self.root.callRemote("isConnected", profile_key) 395 d = self.root.callRemote("isConnected", profile_key)
380 if callback is not None: 396 if callback is not None:
381 d.addCallback(callback) 397 d.addCallback(callback)
382 if errback is None: 398 if errback is None:
771 def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"): 787 def historyGet(self, from_jid, to_jid, limit, between=True, filters='', profile="@NONE@"):
772 d = self.root.callRemote("historyGet", from_jid, to_jid, limit, between, filters, profile) 788 d = self.root.callRemote("historyGet", from_jid, to_jid, limit, between, filters, profile)
773 d.addErrback(self._errback) 789 d.addErrback(self._errback)
774 return d.asFuture(asyncio.get_event_loop()) 790 return d.asFuture(asyncio.get_event_loop())
775 791
792 def imageCheck(self, arg_0):
793 d = self.root.callRemote("imageCheck", arg_0)
794 d.addErrback(self._errback)
795 return d.asFuture(asyncio.get_event_loop())
796
797 def imageResize(self, image_path, width, height):
798 d = self.root.callRemote("imageResize", image_path, width, height)
799 d.addErrback(self._errback)
800 return d.asFuture(asyncio.get_event_loop())
801
776 def isConnected(self, profile_key="@DEFAULT@"): 802 def isConnected(self, profile_key="@DEFAULT@"):
777 d = self.root.callRemote("isConnected", profile_key) 803 d = self.root.callRemote("isConnected", profile_key)
778 d.addErrback(self._errback) 804 d.addErrback(self._errback)
779 return d.asFuture(asyncio.get_event_loop()) 805 return d.asFuture(asyncio.get_event_loop())
780 806