当前位置: 首页>>代码示例>>Python>>正文


Python Pointer.click_object方法代码示例

本文整理汇总了Python中autopilot.input.Pointer.click_object方法的典型用法代码示例。如果您正苦于以下问题:Python Pointer.click_object方法的具体用法?Python Pointer.click_object怎么用?Python Pointer.click_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在autopilot.input.Pointer的用法示例。


在下文中一共展示了Pointer.click_object方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GtkRadioButton

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkRadioButton(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkRadioButton instance """
    def __init__(self, *args):
        super(GtkRadioButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    def click(self, ):
        """ Clicks a GtkRadioButton

        If the Radio button is not already active, click and wait for
        active to be true

        """
        if self.active == 1:
            logger.debug('Object already selected. Returning')
            return
        # now click it
        self.pointing_device.click_object(self)
        # now wait for state to change
        self.active.wait_for(1)
        logger.debug(
            'Object clicked and and selected. Active state changed '
            'successfully')

    def check(self, visible=True):
        expectThat(self.label).is_unicode()
        expectThat(self.label).not_equals(
            u'',
            msg="Expected {0} label to contain text, but its empty"
                .format(self.name))
        expectThat(self.visible).equals(
            visible,
            msg="Expected {0} label to be visible, but its wasn't"
                .format(self.name))
开发者ID:linuxmint,项目名称:ubiquity,代码行数:36,代码来源:gtkcontrols.py

示例2: GtkButtonAccessible

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkButtonAccessible(AutopilotGtkEmulatorBase):

    def __init__(self, *args):
        super(GtkButtonAccessible, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    def click(self, ):
        logger.debug('Clicking {0} item'.format(self.accessible_name))
        self.pointing_device.click_object(self)
开发者ID:GalliumOS,项目名称:ubiquity,代码行数:11,代码来源:gtkaccessible.py

示例3: GtkTextCellAccessible

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkTextCellAccessible(AutopilotGtkEmulatorBase):

    def __init__(self, *args):
        super(GtkTextCellAccessible, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    def click(self, ):
        logger.debug('Clicking tree item')
        self.pointing_device.click_object(self)
开发者ID:GalliumOS,项目名称:ubiquity,代码行数:11,代码来源:gtkaccessible.py

示例4: GtkTreeView

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkTreeView(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkTreeView instance """
    def __init__(self, *args):
        super(GtkTreeView, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    @log_action(logging.info)
    def click(self, ):
        """ This simply clicks a treeview object """
        self.pointing_device.click_object(self)
        assert self.is_focus == 1

    @log_action(logging.info) 
    def select_item(self, label_text):
        """ Selects an item in a GtkTreeView by its UI label text
            
            :param label_text: The label value of the tree item as seen on the UI
            :returns: An object of the requested treeitem
            
            e.g. If you want to click say an item displaying 'Home' in a treeview
            then it would be::
                
                >>> treeitem = treeview.select_item('Home')
                
            also see GtkFileChooserDialog.go_to_directory() for another example
            
            if for some reason this doesn't work then use the .click()
            function to get the treeviews focus
        """
        treeview = self._get_gail_treeview()
        # if we can't get the gail treeview lets try a full scan
        if treeview is None:
            root = self.get_root_instance()
            treeview_item = root.select_single('GtkCellTextAccessible',
                                               accessible_name=str(label_text))
            assert treeview_item is not None
            return treeview_item
        #and now select the item from within the GAILTreeView. 
        item = treeview.select_item(str(label_text))
        assert item is not None
        return item
    
    
    def _get_gail_treeview(self, ):
        """ Gets the GtkTreeViews corresponding GtkTreeViewAccessible object """
        # lets get a root instance
        root = self.get_root_instance()
        assert root is not None
        # As the treeview item is in the GAILWindow tree and not our current tree
        # We want to select the treeviewaccessible with the same globalRect as us
        treeviews = root.select_many('GtkTreeViewAccessible',
                                     globalRect=self.globalRect)
        # if the treeviews are nested they could potentially have the
        # same globalRect so lets pick out the one thats visible
        for treeview in treeviews:
            if treeview.visible == True:
                return treeview
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:59,代码来源:gtkcontrols.py

示例5: GtkSwitch

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkSwitch(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkSwitch instance """
    def __init__(self, *args):
        super(GtkSwitch, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    @log_action(logging.info)
    def click(self, ):
        #TODO: add checks to assert the switched changed state
        self.pointing_device.click_object(self)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:12,代码来源:gtkcontrols.py

示例6: GtkEntry

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkEntry(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkEntry widget """
    def __init__(self, *args):
        super(GtkEntry, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    def click(self, ):
        """ Click on GtkEntry """
        self.pointing_device.click_object(self)
开发者ID:linuxmint,项目名称:ubiquity,代码行数:12,代码来源:gtkcontrols.py

示例7: GtkLabel

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkLabel(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkLabel Instance"""
    def __init__(self, *args):
        super(GtkLabel, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    @log_action(logging.info)
    def click(self, ):
        """ Clicks on a GtkLabel """
        self.pointing_device.click_object(self)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:12,代码来源:gtkcontrols.py

示例8: GtkAlignment

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkAlignment(GtkContainers):
    """ Emulator class for a GtkAlignment instance """
    def __init__(self, *args):
        super(GtkAlignment, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    def enter_crypto_phrase(self, crypto_phrase):
        if self.name == 'stepPartCrypto':

            while True:
                self._enter_pass_phrase(crypto_phrase)
                match = self._check_crypto_phrase_match()

                if match:
                    break
        else:
            raise ValueError("enter_crypto_phrase() can only be called from "
                             "stepPartCrypto page object")

    def _enter_pass_phrase(self, phrase):

        pwd_entries = ['password', 'verified_password']
        for i in pwd_entries:
            entry = self.select_single(BuilderName=i)
            with self.kbd.focused_type(entry) as kb:
                kb.press_and_release('Ctrl+a')
                kb.press_and_release('Delete')
                expectThat(entry.text).equals(
                    u'',
                    msg='{0} entry text was not cleared properly'
                        .format(entry.name))
                kb.type(phrase)

    def _check_crypto_phrase_match(self, ):
        pwd1 = self.select_single(BuilderName='password').text
        pwd2 = self.select_single(BuilderName='verified_password').text
        if pwd1 == pwd2:
            return True
        else:
            return False

    def create_new_partition_table(self, ):
        if self.name == 'stepPartAdvanced':
            new_partition_button = self.select_single(
                BuilderName='partition_button_new_label')
            self.pointing_device.click_object(new_partition_button)
            time.sleep(5)
            self.kbd.press_and_release('Right')
            self.kbd.press_and_release('Enter')
            time.sleep(5)
        else:
            raise ValueError("create_new_partition_table() can only be called "
                             "from stepPartAdvanced page object")
开发者ID:hamonikr-root,项目名称:ubiquity,代码行数:56,代码来源:gtkcontainers.py

示例9: GtkComboBoxText

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkComboBoxText(AutopilotGtkEmulatorBase):

    def __init__(self, *args):
        super(GtkComboBoxText, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    @log_action(logging.info)
    def click(self, ):
        #TODO: setup state changes
        #get current state i.e is it already open?

        #now click it
        self.pointing_device.click_object(self)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:15,代码来源:gtkcontrols.py

示例10: GtkRadioButton

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkRadioButton(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkRadioButton instance """
    def __init__(self, *args):
        super(GtkRadioButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    @log_action(logging.info)
    def click(self, ):
        """ Clicks a GtkRadioButton, and waits for the active state (checked/notchecked)
            to change after being clicked """
        #get current state
        new_val = 0
        if self.active == 0:
            new_val = 1
        #now click it
        self.pointing_device.click_object(self)
        #now wait for state to change
        self.active.wait_for(new_val)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:20,代码来源:gtkcontrols.py

示例11: GtkButton

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkButton(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkButton Instance """
    def __init__(self, *args):
        super(GtkButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    @log_action(logging.info)
    def click(self,):
        """ Clicks a GtkButton widget
        
            On some occasions you may need to wait for a button to become sensitive. 
            So when calling this function if the sensitive property is 0 it will wait for 10 seconds
            for button to become sensitive before clicking
        """
        #sometimes we may need to wait for the button to become clickable
        # so lets wait for it if we do
        if self.sensitive == 0:
            self.sensitive.wait_for(1)
        self.pointing_device.click_object(self)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:21,代码来源:gtkcontrols.py

示例12: GtkLabel

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkLabel(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkLabel Instance"""
    def __init__(self, *args):
        super(GtkLabel, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    def click(self, ):
        """ Clicks on a GtkLabel """
        logger.debug('Clicking "{0}" label'.format(self.name))
        self.pointing_device.click_object(self)

    def check(self, visible=True):
        expectThat(self.label).is_unicode()
        expectThat(self.label).not_equals(
            u'',
            msg="Expected {0} label to contain text, but its empty"
                .format(self.name))
        expectThat(self.visible).equals(
            visible,
            msg="Expected {0} label to be visible, but its wasn't"
                .format(self.name))
开发者ID:linuxmint,项目名称:ubiquity,代码行数:23,代码来源:gtkcontrols.py

示例13: GtkEntry

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkEntry(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkEntry widget """
    def __init__(self, *args):
        super(GtkEntry, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()
    
    def click(self, ):
        """ Click on GtkEntry """
        self.pointing_device.click_object(self)
    
    @log_action(logging.info)
    def enter_text(self, text):
        """ Enters given text into a GtkEntry widget
        
            Does not require GtkEntry to be clicked first and will delete any text currently in the entry when called
        
            :param text: String of text to enter in the entry
        """
        self._get_focus()
        assert self.is_focus == 1
        # if the entry is not empty lets empty it first
        if self.text != '':
            self.kbd.press_and_release('Ctrl+a')
            self.kbd.press_and_release('Delete')
        assert self.text == ''
        self.kbd.type(text)
        if self.text != text:
            raise EmulatorTypoException(
                "Typo Found: The text was not entered correctly. \
                The GtkEntry contains: '{0}' but should have been: '{1}'. \
                Possible causes are: The entry did not clear correctly before \
                entering text, or the keyboard mistyped".format(self.text, text))

    
    def _get_focus(self, ):
        self.pointing_device.click_object(self)
        self.is_focus.wait_for(1)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:40,代码来源:gtkcontrols.py

示例14: GtkTextView

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkTextView(AutopilotGtkEmulatorBase):

    def __init__(self, *args):
        super(GtkTextView, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    @log_action(logging.info)
    def enter_text(self, text):
        """ Enter given text into a GtkTextView widget
        
            Function will delete any text currently in the buffer when called
        
            params:
                :text: String of text to enter in the entry
        """
        self._get_focus()
        assert self.is_focus == 1
        # if the entry is not empty lets empty it first
        if self.buffer != '':
            self.kbd.press_and_release('Ctrl+a')
            self.kbd.press_and_release('Delete')
        assert self.buffer == ''
        self.kbd.type(text)
        if self.buffer != text:
            raise EmulatorTypoException(
                "Typo Found: The text was not entered correctly. \
                The GtkTextView contains: '{0}' but should have been: '{1}'. \
                Possible causes are: The textview did not clear correctly before \
                entering text, or the keyboard mistyped".format(self.buffer, text))
        #TODO: would it be good to return the buffer?

    
    def _get_focus(self, ):
        self.pointing_device.click_object(self)
        self.is_focus.wait_for(1)
开发者ID:DanChapman1819,项目名称:autopilot-gtk-emulators,代码行数:38,代码来源:gtkcontrols.py

示例15: GtkToggleButton

# 需要导入模块: from autopilot.input import Pointer [as 别名]
# 或者: from autopilot.input.Pointer import click_object [as 别名]
class GtkToggleButton(AutopilotGtkEmulatorBase):
    """ Emulator for a GtkToggleButton instance """
    def __init__(self, *args):
        super(GtkToggleButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())

    def check(self, visible=True):
        expectThat(self.label).is_unicode()
        expectThat(self.label).not_equals(
            u'',
            msg="Expected {0} label to contain text, but its empty"
                .format(self.name))
        expectThat(self.visible).equals(
            visible,
            msg="Expected {0} label to be visible, but its wasn't"
                .format(self.name))

    def click(self, ):
        """ Clicks a GtkToggleButton,

        and waits for the active state (toggled/nottoggled)
        to change after being clicked

        """
        # get current state
        new_val = 0
        if self.active == 0:
            new_val = 1
        logger.debug('Objects current state is "{0}", '
                     'the state after clicking should be "{1}"'
                     .format(self.active, new_val))
        # now click it
        self.pointing_device.click_object(self)
        # now wait for state to change
        self.active.wait_for(new_val)
        logger.debug('Object clicked, state change successful')
开发者ID:linuxmint,项目名称:ubiquity,代码行数:38,代码来源:gtkcontrols.py


注:本文中的autopilot.input.Pointer.click_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。