Skip to content

Commit 6d07cdc

Browse files
committed
iterate setup.py, internalize entry flows
1 parent a35d008 commit 6d07cdc

File tree

6 files changed

+48
-26
lines changed

6 files changed

+48
-26
lines changed

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
# exclude generated .pyc file
99
/tagui.pyc
1010

11-
# exclude entry flow log files
11+
# exclude entry flow and logs
12+
/tagui_python
1213
/tagui_python.log
1314
/tagui_python.raw
1415
/tagui_python.js
15-
/tagui_visual.log
16-
/tagui_visual.raw
17-
/tagui_visual.js
1816

1917
# exclude entry flow output file
2018
/tagui_python.txt

MANIFEST.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include LICENSE.txt
22
include README.md
3-
include tagui_python
4-
include tagui_visual
3+
include sample.py
54
include tagui_local.js

setup.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,24 @@
22

33
setup(
44
name='tagui',
5-
version='0.0.2',
5+
version='0.0.4',
6+
py_modules=['tagui'],
67
author='Tebel.Automation',
78
author_email='[email protected]',
9+
license='Apache License 2.0',
810
url='https://github.com/tebelorg/TagUI-Python',
9-
license='LICENSE.txt',
1011
description='Placeholder for TagUI Python package',
1112
long_description=open('README.md').read(),
13+
classifiers=[
14+
'Development Status :: 3 - Alpha',
15+
'Programming Language :: Python :: 2',
16+
'Programming Language :: Python :: 3',
17+
'License :: OSI Approved :: Apache Software License',
18+
'Intended Audience :: Developers',
19+
'Intended Audience :: Education',
20+
'Intended Audience :: Science/Research',
21+
'Operating System :: POSIX :: Linux',
22+
'Operating System :: MacOS :: MacOS X',
23+
'Operating System :: Microsoft :: Windows',
24+
],
1225
)

tagui.py

+30-11
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,35 @@ def _sdq(input_text = ''):
7777
# change identifier single quote ' to double quote "
7878
return input_text.replace("'",'"')
7979

80+
def _started():
81+
global _tagui_started; return _tagui_started
82+
8083
def coord(x_coordinate = None, y_coordinate = None):
8184
# function to form a coordinate string from x and y integers
8285
return '(' + str(x_coordinate) + ',' + str(y_coordinate) + ')'
8386

84-
def _started():
85-
global _tagui_started; return _tagui_started
86-
8787
def debug(on_off = None):
8888
# function to set debug mode, eg print debug info
8989
global _tagui_debug
9090
if on_off is not None: _tagui_debug = on_off
9191
return _tagui_debug
9292

93-
def init(debug_mode = False, visual_automation = False):
93+
def _python_flow():
94+
# function to create entry tagui flow without visual automation
95+
flow_text = '// NORMAL ENTRY FLOW FOR TAGUI PYTHON PACKAGE ~ TEBEL.ORG\r\n\r\nlive'
96+
flow_file = open('tagui_python', 'w')
97+
flow_file.write(flow_text)
98+
flow_file.close()
99+
100+
def _visual_flow():
101+
# function to create entry tagui flow with visual automation
102+
flow_text = '// VISUAL ENTRY FLOW FOR TAGUI PYTHON PACKAGE ~ TEBEL.ORG\r\n' + \
103+
'// mouse_xy() - dummy trigger for SikuliX integration\r\n\r\nlive'
104+
flow_file = open('tagui_python', 'w')
105+
flow_file.write(flow_text)
106+
flow_file.close()
107+
108+
def init(visual_automation = False):
94109
# connect to tagui process by checking tagui live mode readiness
95110

96111
global _process, _tagui_started, _tagui_id
@@ -99,17 +114,14 @@ def init(debug_mode = False, visual_automation = False):
99114
print('[TAGUI][ERROR] - use close() before using init() again')
100115
return False
101116

102-
# set debug mode, eg print debug info to output
103-
debug(debug_mode)
104-
105-
# set entry flow to launch SikuliX accordingly
117+
# create entry flow to launch SikuliX accordingly
106118
if visual_automation:
107-
tagui_flow = 'tagui_visual'
119+
_visual_flow()
108120
else:
109-
tagui_flow = 'tagui_python'
121+
_python_flow()
110122

111123
# entry command to invoke tagui process
112-
tagui_cmd = 'tagui ' + tagui_flow + ' chrome'
124+
tagui_cmd = 'tagui tagui_python chrome'
113125

114126
try:
115127
# launch tagui using subprocess
@@ -236,6 +248,13 @@ def close():
236248
# loop until tagui process has closed before returning control
237249
while _process.poll() is None: pass
238250

251+
# remove generated tagui flow and log files if not in debug mode
252+
if not debug():
253+
if os.path.isfile('tagui_python'): os.remove('tagui_python')
254+
if os.path.isfile('tagui_python.js'): os.remove('tagui_python.js')
255+
if os.path.isfile('tagui_python.raw'): os.remove('tagui_python.raw')
256+
if os.path.isfile('tagui_python.log'): os.remove('tagui_python.log')
257+
239258
_tagui_started = False
240259
return True
241260

tagui_python

-3
This file was deleted.

tagui_visual

-4
This file was deleted.

0 commit comments

Comments
 (0)