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


Python input.Pointer类代码示例

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


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

示例1: GtkRadioButton

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,代码行数:34,代码来源:gtkcontrols.py

示例2: GtkTreeView

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,代码行数:57,代码来源:gtkcontrols.py

示例3: test_hiding

    def test_hiding(self):
        """Verify that the keyboard remains hidden after being dismissed from
        a field that is no longer enabled.

        """
        qml = dedent("""
        import QtQuick 2.4
        import Ubuntu.Components 1.1
        import Ubuntu.Web 0.2

        Rectangle {
            id: window
            objectName: "windowRectangle"
            color: "lightgrey"

            WebView {
                anchors.fill: parent
                objectName: "webview"
                Component.onCompleted: {
                    loadHtml("
                        <html><body><div id='scroll' style='width: 100%;
                        height: 200%; position: absolute; background: green;
                        visibility: hidden;'></div><input id='input'
                        style='height: 50%; width: 100%' type='text'
                        onkeyup=\\\"if (event.keyCode == 13)
                        {document.getElementById('input').disabled=true;
                        document.getElementById('scroll').style.visibility=
                        'visible';}\\\" style='width: 100%%;
                        height: 100%%;' /></body></html>");
                }
            }
        }

        """)
        app = self._start_qml_script(qml)
        webview = app.select_single(objectName='webview')

        self.ensure_focus_on_input(webview)
        keyboard = Keyboard()
        self.addCleanup(keyboard.dismiss)

        keyboard.type('Test\n')

        keyboard.dismiss()

        pointer = Pointer(Touch.create())
        pointer.drag(
            webview.width / 2.0,
            webview.height / 2.0,
            webview.width / 2.0,
            webview.height / 2.0 + 100
        )

        self.assertThat(
            keyboard.is_available,
            Eventually(Equals(False))
        )
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:57,代码来源:test_keyboard.py

示例4: GtkButtonAccessible

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,代码行数:9,代码来源:gtkaccessible.py

示例5: GtkTextCellAccessible

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,代码行数:9,代码来源:gtkaccessible.py

示例6: GtkSwitch

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,代码行数:10,代码来源:gtkcontrols.py

示例7: GtkLabel

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,代码行数:10,代码来源:gtkcontrols.py

示例8: GtkEntry

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,代码行数:10,代码来源:gtkcontrols.py

示例9: GtkAlignment

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,代码行数:54,代码来源:gtkcontainers.py

示例10: _select_extended_key

    def _select_extended_key(self, key_rect, offset, pointer=None):
        if pointer is None:
            pointer = Pointer(Touch.create())

        gu = float(os.environ.get('GRID_UNIT_PX', 8))

        pointer.drag(
            key_rect.x + key_rect.w / 2.0,
            key_rect.y + key_rect.h / 2.0,
            key_rect.x + key_rect.w / 2.0 + offset,
            key_rect.y + key_rect.h / 2.0,
            rate=2.77 * gu, time_between_events=2)
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:12,代码来源:keyboard.py

示例11: GtkComboBoxText

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,代码行数:13,代码来源:gtkcontrols.py

示例12: __init__

    def __init__(self, pointer=None):
        try:
            self.keyboard = self.maliit.select_single(
                "QQuickItem",
                objectName="ubuntuKeyboard"
            )
        except ValueError as e:
            e.args += (
                "There was more than one Keyboard object found, aborting.",
            )
            raise
        except StateNotFoundError:
            logger.error(
                "Unable to find the Ubuntu Keyboard object within the "
                "maliit server, aborting."
            )
            raise

        self._keyboard_container = self.keyboard.select_single(
            "KeyboardContainer"
        )

        self._stored_active_keypad_name = None
        self._active_keypad = None

        self._keys_position = defaultdict(dict)
        self._keys_contained = defaultdict(dict)

        if pointer is None:
            self.pointer = Pointer(Touch.create())
        else:
            self.pointer = pointer
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:32,代码来源:keyboard.py

示例13: setUp

 def setUp(self):
     if model() == "Desktop":
         self.skipTest("Ubuntu Keyboard tests only run on device.")
     super(UbuntuKeyboardTests, self).setUp()
     self.set_test_settings()
     sleep(5)  # Have to give time for gsettings change to propogate
     self.pointer = Pointer(Touch.create())
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:7,代码来源:test_keyboard.py

示例14: 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()
开发者ID:fczuardi,项目名称:ubuntu-html5-theme,代码行数:7,代码来源:__init__.py

示例15: GtkSpinButton

class GtkSpinButton(AutopilotGtkEmulatorBase):
    """ Emulator class for a GtSpinButton instance"""
    def __init__(self, *args):
        super(GtkSpinButton, self).__init__(*args)
        self.pointing_device = Pointer(Mouse.create())
        self.kbd = Keyboard.create()

    def enter_value(self, value):
        self._select_entry()
        self.kbd.type(value)
        expectThat(self.text).equals(
            value,
            msg="Expected spinbutton value '{0}' to equal {1}"
                .format(self.text, value))

    def _select_entry(self, ):
        self.pointing_device.move_to_object(self)
        pos = self.pointing_device.position()
        x = pos[0]
        y = pos[1]
        x -= 15  # px
        self.pointing_device.move(x, y)
        self.pointing_device.click()
        self.kbd.press_and_release('Ctrl+a')
        self.kbd.press_and_release('Delete')
开发者ID:linuxmint,项目名称:ubiquity,代码行数:25,代码来源:gtkcontrols.py


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