def click(self, coord, double=False): # adjust coordinates if self.game_location: game_x, game_y, game_width, game_height = self.game_location #print('game_x: %d, game_y: %d, game_width: %d, game_height: %d' % (game_x, game_y, game_width, game_height)) x, y = tools.adjust_click_position(coord['x'], coord['y'], coord['width'], coord['height'], game_x, game_y, game_width, game_height) else: x, y = (coord['x'], coord['y']) # click self.debug('Click on x: %d, y: %d, double: %s' % (x, y, double), DebugLevel.High) tools.perform_click(x, y, double)
def on_simulate_resource_click_button_clicked(self, button): selected_row = self.map_data_listbox.listbox.get_selected_row() if selected_row: text = self.map_data_listbox.get_row_text(selected_row) data = maps.to_array(text) x, y, width, height, color = (data['x'], data['y'], data['width'], data['height'], data['color']) #print('x: %d, y: %d, width: %d, height: %d' % (x, y, width, height)) # adjust for game area if self.game_window and not self.game_window.is_destroyed() and self.game_window_location: game_x, game_y, game_width, game_height = self.game_window_location #print('game_x: %d, game_y: %d, game_width: %d, game_height: %d' % (game_x, game_y, game_width, game_height)) click_x, click_y = tools.adjust_click_position(x, y, width, height, game_x, game_y, game_width, game_height) else: click_x = x click_y = y # perform click self.debug('Simulate click on x: %d, y: %d' % (click_x, click_y)) tools.perform_click(click_x, click_y)
def on_simulate_click_button_clicked(self, button): # get click coordinates selected_row = self.tree_view.get_selected_row() x, y, width, height = (selected_row[1], selected_row[2], selected_row[3], selected_row[4]) #print('x: %d, y: %d, width: %d, height: %d' % (x, y, width, height)) # adjust for game area if self.parent.game_area: game_x, game_y, game_width, game_height = tools.get_widget_location( self.parent.game_area) #print('game_x: %d, game_y: %d, game_width: %d, game_height: %d' % (game_x, game_y, game_width, game_height)) click_x, click_y = tools.adjust_click_position( x, y, width, height, game_x, game_y, game_width, game_height) else: click_x = x click_y = y # perform click self.parent.debug('Click on x: %d, y: %d' % (click_x, click_y)) tools.perform_click(click_x, click_y)