本文整理汇总了Python中autopilot.input.Mouse类的典型用法代码示例。如果您正苦于以下问题:Python Mouse类的具体用法?Python Mouse怎么用?Python Mouse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mouse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drag_window_to_screen
def drag_window_to_screen(window, screen):
"""Drags *window* to *screen*
:param autopilot.process.Window window: The window to drag
:param integer screen: The screen to drag the *window* to
:raises: **TypeError** if *window* is not a autopilot.process.Window
"""
if not isinstance(window, Window):
raise TypeError("Window must be a autopilot.process.Window")
if window.monitor == screen:
logger.debug("Window %r is already on screen %d." % (window.x_id, screen))
return
assert(not window.is_maximized)
(win_x, win_y, win_w, win_h) = window.geometry
(mx, my, mw, mh) = Display.create().get_screen_geometry(screen)
logger.debug("Dragging window %r to screen %d." % (window.x_id, screen))
mouse = Mouse.create()
keyboard = Keyboard.create()
mouse.move(win_x + win_w/2, win_y + win_h/2)
keyboard.press("Alt")
mouse.press()
keyboard.release("Alt")
# We do the movements in two steps, to reduce the risk of being
# blocked by the pointer barrier
target_x = mx + mw/2
target_y = my + mh/2
mouse.move(win_x, target_y, rate=20, time_between_events=0.005)
mouse.move(target_x, target_y, rate=20, time_between_events=0.005)
mouse.release()
示例2: setUp
def setUp(self):
self.setup_base_path()
self.pointer = Pointer(Mouse.create())
self.app = self.launch_test_application(self.BROWSER_QML_APP_LAUNCHER, self.get_browser_container_path())
self.webviewContainer = self.get_webviewContainer()
self.watcher = self.webviewContainer.watch_signal('resultUpdated(QString)')
super(UbuntuHTML5TestCaseBase, self).setUp()
示例3: activate
def activate(self, double_click=True):
tx = self.x + (self.width / 2)
ty = self.y + (self.height / 2)
m = Mouse.create()
m.move(tx, ty)
m.click(1)
if double_click:
m.click(1)
示例4: preview_key
def preview_key(self):
tx = self.x + (self.width / 2)
ty = self.y + (self.height / 2)
m = Mouse.create()
m.move(tx, ty)
k = Keyboard.create()
k.press_and_release('Menu')
示例5: setUp
def setUp(self):
super(EmulatorTest, self).setUp()
self.app = self.launch_test_application(FULL_PATH,
app_type='gtk',
emulator_base=AutopilotGtkEmulatorBase)
self.pointing_device = Pointer(Mouse.create())
self.assertThat(self.main_window.visible, Eventually(Equals(1)))
self.status_label = self.app.select_single(BuilderName='statuslabel')
示例6: ensure_collapsed
def ensure_collapsed(self):
"""Collapse the filter expander label, if it's not already"""
if self.expanded:
tx = self.x + self.width / 2
ty = self.y + self.height / 2
m = Mouse.create()
m.move(tx, ty)
m.click()
self.expanded.wait_for(False)
示例7: ensure_expanded
def ensure_expanded(self):
"""Expand the filter expander label, if it's not already"""
if not self.expanded:
tx = self.x + self.width / 2
ty = self.y + self.height / 2
m = Mouse.create()
m.move(tx, ty)
m.click()
self.expanded.wait_for(True)
示例8: execute_action_by_id
def execute_action_by_id(self, action_id):
"""Executes an action given by the id."""
action = self.get_action_by_id(action_id)
if action:
tx = action.x + (action.width / 2)
ty = action.y + (action.height / 2)
m = Mouse.create()
m.move(tx, ty)
m.click()
示例9: __init__
def __init__(self, *args, **kwargs):
super(Launcher, self).__init__(*args, **kwargs)
self.show_timeout = 1
self.hide_timeout = 1
self.in_keynav_mode = False
self.in_switcher_mode = False
self._mouse = Mouse.create()
self._display = Display.create()
示例10: navigate_right
def navigate_right(self, count=1):
"""Navigate preview right"""
navigator = self.get_right_navigator()
tx = navigator.button_x + (navigator.button_width / 2)
ty = navigator.button_y + (navigator.button_height / 2)
m = Mouse.create()
m.move(tx, ty)
old_preview_initiate_count = self.preview_initiate_count
for i in range(count):
self.navigate_right_enabled.wait_for(True)
m.click()
self.preview_initiate_count.wait_for(GreaterThan(old_preview_initiate_count))
old_preview_initiate_count = self.preview_initiate_count
示例11: setUp
def setUp(self):
super(UbiquityAutopilotTestCase, self).setUp()
self.app = self.launch_application()
self.pointing_device = Pointer(Mouse.create())
self.kbd = Keyboard.create()
self.current_page_title = ''
self.previous_page_title = ''
self.current_step = ''
self.step_before = ''
self.english_install = False
english_label_conf.generate_config()
self.english_config = configparser.ConfigParser()
self.english_config.read('/tmp/english_config.ini')
#delete config at end of test
self.addCleanup(os.remove, '/tmp/english_config.ini')
# always starts with 1 row ('/dev/sda')
self.part_table_rows = 1
self.total_number_partitions = 0
示例12: __init__
def __init__(self, *args, **kwargs):
super(WindowButton, self).__init__(*args, **kwargs)
self._mouse = Mouse.create()
示例13: __init__
def __init__(self, *args):
super(GtkContainers, self).__init__(*args)
self.pointing_device = Pointer(Mouse.create())
示例14: __init__
def __init__(self, *args):
super(GtkNoteBookPageAccessible, self).__init__(*args)
self.pointing_device = Pointer(Mouse.create())
示例15: __init__
def __init__(self, *args):
super(GtkSwitch, self).__init__(*args)
self.pointing_device = Pointer(Mouse.create())