Skip to content

Commit 565f307

Browse files
author
jsbain
committed
add new btn to top bar to exec script without clearing globals
1 parent 1cd2fd2 commit 565f307

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

apphack.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coding: utf-8
2-
import objc
3-
reload(objc)
4-
from objc import *
2+
3+
4+
from objc_util import *
55
import ui,console
66

77

@@ -12,19 +12,18 @@ def get_toolbar(view):
1212
#get main editor toolbar, by recursively walking the view
1313
sv=view.subviews()
1414

15-
for i in range(sv.count()-1):
16-
v=sv.objectAtIndex_(ns(i))
15+
for v in sv:
1716
if v._get_objc_classname()=='OMTabViewToolbar':
1817
return v
1918
tb= get_toolbar(v)
2019
if tb:
21-
return tb
20+
return tb
2221

2322
tb=get_toolbar(main_view)
2423
execbtn=ui.Button(frame=(tb.size().width-tb.rightItemsWidth()-40,22,40,40))
2524
execbtn.flex='R'
2625
execbtn.image=ui.Image.named('iow:ios7_play_32')
27-
execbtn_obj=ObjCInstance(execbtn._objc_ptr)
26+
execbtn_obj=ObjCInstance(execbtn)
2827
tb.addSubview_(execbtn_obj)
2928

3029
def run_script(sender):

0 commit comments

Comments
 (0)