Esempio n. 1
0
def main():
    with SmartDisplay(size=(640, 480), visible=0) as disp:
        with EasyProcess('gnumeric'):
#            time.sleep(2)
            img = disp.waitgrab(timeout=60)
            rectangles = active_rectangles()
            print( rectangles )

    img = draw_indexed_rect_list(img, rectangles)
    img = autocrop(img)

    # display results
    img.show()
Esempio n. 2
0
def discover_buttons(grid=30):
    '''
    try to get buttons by tab order
    '''
    tab_ls = tab_rectangles()

    if not len(tab_ls):
        log.debug('no tab order on window -> full hover test')
        # slow, no tab order
        return hover.active_rectangles(grid=grid)

    img_orig = focus_wnd()

    ls = []
    for x in tab_ls:
        bbox = hover.is_point_active(img_orig, x.center)
        if bbox:
            ls += [x]

    img_log_rects(img_orig, ls, 'img_orig')
    log.debug('buttons found:%s', ls)
    return ls
Esempio n. 3
0
 def test_gmessage(self):
     self.p = EasyProcess('gmessage -buttons x,y,z hi').start()
     self.wait()
     ls = active_rectangles()
     self.assertEquals(len(ls), 3)
Esempio n. 4
0
 def test_zenity(self):
     self.p = EasyProcess('zenity --warning').start()
     self.wait()
     ls = active_rectangles()
     self.assertEquals(len(ls), 1)