diff --git a/CHANGELOG b/CHANGELOG index 88db54a..9acc748 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,34 @@ CHANGES ======= +* opencv install add win amd64 easy install method +* add resolution for Pattern, close #3 +* depreciated sleep, use delay instead +* move all cli command to direcotry cmds +* fix instance bug +* watch object add func:do +* fix #1 +* update secure of travis + +1.0.6 +----- + +* Add desc how to install from source +* better uidump tkgui support +* UI detect update +* support ui dump in ide, which looks very nice +* add gui +* make tkgui save kindly +* add event listener +* update readme example resolution +* analysis all current screen size +* fix gui run code bug +* add parse ui node dump_nodes() function +* update desc +* add auto refresh support +* add screenshot button and d +* update change log + 1.0.5 ----- diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 513e298..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -recursive-include airtest/htmltemplate *.js *.html *.json *.css *.map -recursive-include airtest/binfiles air* *.apk -recursive-include airtest/androaxml *.zip -recursive-include airtest/webgui * diff --git a/TODO b/TODO.md similarity index 66% rename from TODO rename to TODO.md index 242b7d6..8a346c4 100644 --- a/TODO +++ b/TODO.md @@ -3,7 +3,3 @@ - bounds - region(left, right, top, bottom) -2. Patten - - - filename - - offset diff --git a/atx/__main__.py b/atx/__main__.py index 60c5835..f261c50 100644 --- a/atx/__main__.py +++ b/atx/__main__.py @@ -3,9 +3,10 @@ # USAGE # python -matx -s ESLKJXX gui +import functools import argparse -from atx.cmds import tkgui, minicap, tcpproxy +from atx.cmds import tkgui, minicap, tcpproxy, webide from atx.cmds import minicap def _gui(args): @@ -20,25 +21,35 @@ def _tcpproxy(args): tcpproxy.main(local_port=args.forward, listen_port=args.listen) +def _webide(args): + webide.main(open_browser=(not args.no_browser), port=args.web_port) + def main(): ap = argparse.ArgumentParser( - formatter_class=argparse.ArgumentDefaultsHelpFormatter) + formatter_class=argparse.ArgumentDefaultsHelpFormatter) ap.add_argument("-s", "--serial", required=False, help="Android SerialNo") ap.add_argument("-H", "--host", required=False, default='127.0.0.1', help="Adb host") ap.add_argument("-P", "--port", required=False, type=int, default=5037, help="Adb port") subparsers = ap.add_subparsers() - parser_gui = subparsers.add_parser('gui') + add_parser = functools.partial(subparsers.add_parser, + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_gui = add_parser('gui') parser_gui.set_defaults(func=_gui) - parser_minicap = subparsers.add_parser('minicap') + parser_minicap = add_parser('minicap') parser_minicap.set_defaults(func=_minicap) - parser_tcpproxy = subparsers.add_parser('tcpproxy') + parser_tcpproxy = add_parser('tcpproxy') parser_tcpproxy.add_argument('-l', '--listen', default=5555, type=int, help='Listen port') parser_tcpproxy.add_argument('-f', '--forward', default=26944, type=int, help='Forwarded port') parser_tcpproxy.set_defaults(func=_tcpproxy) + parser_webide = add_parser('webide') + parser_webide.add_argument('--no-browser', dest='no_browser', default=False, type=bool, help='Not open browser') + parser_webide.add_argument('--port', dest='web_port', default=None, type=int, help='web listen port') + parser_webide.set_defaults(func=_webide) + args = ap.parse_args() args.func(args) diff --git a/atx/cmds/static/index.html b/atx/cmds/static/index.html new file mode 100644 index 0000000..01712fc --- /dev/null +++ b/atx/cmds/static/index.html @@ -0,0 +1,3 @@ + +

Hello AirtestX

+ diff --git a/atx/cmds/webide.py b/atx/cmds/webide.py new file mode 100644 index 0000000..058b8a6 --- /dev/null +++ b/atx/cmds/webide.py @@ -0,0 +1,58 @@ +# coding: utf-8 + +import os +import logging +import webbrowser +import socket + +import tornado.ioloop +import tornado.web +from atx import logutils + +__dir__ = os.path.dirname(os.path.abspath(__file__)) + +log = logutils.getLogger("webide") +log.setLevel(logging.DEBUG) + + +def get_valid_port(): + for port in range(10010, 10100): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + result = sock.connect_ex(('127.0.0.1', port)) + if result != 0: + return port + + raise SystemError("Can not find a unused port, amazing!") + +class MainHandler(tornado.web.RequestHandler): + def get(self): + self.render('index.html') + + +def make_app(settings={}): + application = tornado.web.Application([ + (r"/", MainHandler), + ], **settings) + return application + + +def main(**kws): + application = make_app({ + 'static_path': os.path.join(__dir__, 'static'), + 'template_path': os.path.join(__dir__, 'static'), + }) + port = kws.get('port', None) + if not port: + port = get_valid_port() + + open_browser = kws.get('open_browser', True) + if open_browser: + url = 'http://127.0.0.1:{}'.format(port) + webbrowser.open(url, new=2) # 2: open new tab if possible + + application.listen(port) + log.info("Listening port on 127.0.0.1:{}".format(port)) + tornado.ioloop.IOLoop.instance().start() + +if __name__ == "__main__": + main()