2023-10-31 10:53:49 +00:00
|
|
|
import logging
|
2023-08-04 18:27:03 +00:00
|
|
|
import typing
|
|
|
|
|
|
|
|
import allure
|
|
|
|
|
|
|
|
import driver
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.object import QObject
|
2023-08-04 18:27:03 +00:00
|
|
|
|
2023-10-31 10:53:49 +00:00
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
2023-08-04 18:27:03 +00:00
|
|
|
|
|
|
|
class Button(QObject):
|
|
|
|
|
|
|
|
@allure.step('Click {0}')
|
|
|
|
def click(
|
|
|
|
self,
|
|
|
|
x: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
|
|
|
|
y: typing.Union[int, driver.UiTypes.ScreenPoint] = None,
|
|
|
|
button: driver.MouseButton = None
|
|
|
|
):
|
|
|
|
if None not in (x, y, button):
|
|
|
|
getattr(self.object, 'clicked')()
|
2023-11-06 11:31:34 +00:00
|
|
|
_logger.info(f'{self}: clicked')
|
2023-08-04 18:27:03 +00:00
|
|
|
else:
|
|
|
|
super(Button, self).click(x, y, button)
|