def get_values(self): """ values from windows """ #windows = findwindows.find_windows(parent = self.window)#, class_name = 'Edit') win_ctrl = {} for hwnd in self.child_windows: parent = handleprops.parent(hwnd) parent_text = handleprops.text(parent) ### picked tab if parent_text in ['Serial Bridge', 'Proxy']: if parent_text not in win_ctrl: win_ctrl[parent_text] = {} classname = handleprops.classname(hwnd) if classname in ['Edit']: text = handleprops.text(hwnd) rect = handleprops.rectangle(hwnd) #log.debug("%s,%s,%s - %s" % (parent, classname, text, parent_text)) #log.debug("(%s,%s)" % (rect.top, rect.left)) #val = (rect.top, rect.left) win_ctrl[parent_text][(rect.top, rect.left)] = text if len(win_ctrl) == 0: raise (NoDataException('no data found')) for key in win_ctrl: log.info(key) data = win_ctrl[key] log.info(data) ### sort by (top, left) #(y,x) vals = sorted(data.items(), key=lambda item: item[0]) #log.debug(vals) for i, item in enumerate(vals, 1): line = "%s:%s" % (i, item[1]) #log.debug(line) self.g.msg_queue.put(line)
def test_parent(self): """Make sure the parent method returns correct result""" self.assertEquals(0, parent(self.dlghandle)) self.assertEquals(self.dlghandle, parent(self.edit_handle))
def get_values(self): """ values from windows """ #windows = findwindows.find_windows(parent = self.window)#, class_name = 'Edit') win_ctrl = {} values = [] for hwnd in self.child_windows: parent = handleprops.parent(hwnd) parent_text = handleprops.text(parent) ### picked tab if parent_text in [ 'Serial Bridge', 'Proxy']: if parent_text not in win_ctrl: win_ctrl[parent_text] = {} classname = handleprops.classname(hwnd) if classname in ['Edit']: text = handleprops.text(hwnd) rect = handleprops.rectangle(hwnd) #log.debug("%s,%s,%s - %s" % (parent, classname, text, parent_text)) #log.debug("(%s,%s)" % (rect.top, rect.left)) #val = (rect.top, rect.left) win_ctrl[parent_text][(rect.top, rect.left)] = text if len(win_ctrl) == 0: raise(NoDataException('no data found')) for key in win_ctrl: log.info(key) data = win_ctrl[key] log.info(data) ### sort by (top, left) #(y,x) vals = sorted(data.items(),key=lambda item: item[0]) #log.debug(vals) fields = {} for i, item in enumerate(vals, 1): #line = "%s:%s" % (i, item[1]) #log.debug(line) fields[i] = item[1] log.debug(self.conf[self.channel]) """ sensu-monitoring-platform event: - action - occurrences [redis] - client -- name -- address -- timestamp - check -- name -- issued -- subscirbers [] -- handler -- history [] -- interval -- output -- command -- status """ ### msg values.append(fields) #log.debug('=='*20) return values
def test_parent(self): "Make sure the parent method returns correct result" self.assertEquals(0, parent(self.dlghandle)) self.assertEquals(self.dlghandle, parent(self.edit_handle))
def test_parent(self): """Make sure the parent method returns correct result""" self.assertEqual(None, parent(self.dlghandle)) self.assertEqual(self.dlghandle, parent(self.edit_handle)) self.assertEqual(None, parent(sys.maxsize)) self.assertEqual(None, parent(None))