| 1 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
| 2 |
# Copyright 2013 Canonical Ltd. |
| 3 |
# |
| 4 |
# This program is free software: you can redistribute it and/or modify it |
| 5 |
# under the terms of the GNU General Public License version 3, as published |
| 6 |
# by the Free Software Foundation. |
| 7 |
|
| 8 |
from lomiri_gallery_app.emulators.gallery_utils import GalleryUtils |
| 9 |
|
| 10 |
|
| 11 |
class MediaSelector(GalleryUtils): |
| 12 |
"""A class that makes it easy to interact with the gallery app""" |
| 13 |
|
| 14 |
def __init__(self, app): |
| 15 |
self.app = app |
| 16 |
|
| 17 |
def get_media_selector(self): |
| 18 |
"""Return the media selector""" |
| 19 |
return self.app.wait_select_single("MediaSelector") |
| 20 |
|
| 21 |
def get_second_photo(self): |
| 22 |
"""Return the second photo item""" |
| 23 |
selector = self.get_media_selector() |
| 24 |
# get the first row in the selector |
| 25 |
events = self.app.select_many('OrganicMediaList') |
| 26 |
photos = events[0].select_many( 'QQuickItem', objectName='eventPhoto') |
| 27 |
# return the item itself |
| 28 |
return photos[0] |
| 29 |
|
| 30 |
def ensure_fully_open(self): |
| 31 |
"""Ensure media selector is fully open""" |
| 32 |
media_selector = self.get_media_selector() |
| 33 |
media_selector.opacity.wait_for(1.0) |