Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Commit

Permalink
install use tqdm as progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Apr 29, 2016
1 parent 95ee460 commit a07edbc
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
CHANGES
=======

* add doc about install
* add apk install support
* add timeout events
* add guesture recognize structure
* let search search image support insteresting
* fix click_image not support Pattern(offset) error, and add relevant tests
* sort ui blocks by bounds area
* add record to commands: python -matx record
* add ui hook demo. may be used in record
* add minitouch input
* update qiniucdn address
* add minicap device used for record
* check download response code should be 200
* handle android input events
* add python -matx iosdeveloper support. close #13
* add for remember
* add click image support, close #10
* update badge
Expand Down
35 changes: 34 additions & 1 deletion atx/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,40 @@
from atx.cmds import tkgui, minicap, tcpproxy, webide, run, iosdeveloper, install
import atx.androaxml as apkparse


def parser(name=None, debug=False):
return wrap


def make_parser(debug=False):
m = {}

def wrap(fn):
@functools.wraps(fn)
def _inner(*args, **kwargs):
try:
return fn(*args, **kwargs)
except Exception as e:
if debug:
raise
print 'ERROR: %s' % e
raise SystemExit(1)

m[fn.__name__] = _inner
return _inner
return (m, wrap)


funcs, wrap = make_parser(debug=True)


# serial, host, port, other args
# args: {serial: 'EFSF', host: '127.0.0.1', port: 5037, path: 'demo.apk'}
# name: gui
def parser_gui(serial, host, port, path):
pass


def _gui(args):
tkgui.main(args.serial, host=args.host)

Expand All @@ -36,7 +70,6 @@ def _apk_parse(args):


def _apk_install(args):
# print 'install ...', args
install.main(args)


Expand Down
5 changes: 4 additions & 1 deletion atx/cmds/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
import os

import tqdm
import atx.androaxml as apkparse

from atx import logutils
Expand All @@ -26,14 +27,16 @@ def clean(tmpdir):

def adb_pushfile(filepath, remote_path):
filesize = os.path.getsize(filepath)
pb = tqdm.tqdm(unit='B', unit_scale=True, total=filesize)
p = subprocess.Popen(['adb', 'push', filepath, remote_path],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)

while True:
try:
p.wait(0.5)
except subprocess.TimeoutExpired:
log.info("Progress %dM/%dM", get_file_size(remote_path) >>20, filesize >>20)
pb.update(get_file_size(remote_path))
# log.info("Progress %dM/%dM", get_file_size(remote_path) >>20, filesize >>20)
pass
except KeyboardInterrupt:
p.kill()
Expand Down

0 comments on commit a07edbc

Please sign in to comment.