Unity 8
unity8.dash.GenericScopeView Class Reference

Inherits UbuntuUIToolkitCustomProxyObjectBase.

Public Member Functions

def open_preview
 
def click_scope_item
 
def get_applications (self, category)
 

Detailed Description

Autopilot helper for generic scopes.

Definition at line 192 of file dash.py.

Member Function Documentation

def unity8.dash.GenericScopeView.click_scope_item (   self,
  category,
  title,
  press_duration = 0.10 
)
Click an item from the scope.

:parameter category: The name of the category where the item is.
:parameter title: The title of the item.

Definition at line 219 of file dash.py.

219  def click_scope_item(self, category, title, press_duration=0.10):
220  """Click an item from the scope.
221 
222  :parameter category: The name of the category where the item is.
223  :parameter title: The title of the item.
224 
225  """
226  category_element = self._get_category_element(category)
227  icon = category_element.wait_select_single(
228  'AbstractButton', title=title)
229  list_view = self.select_single(
230  ListViewWithPageHeader, objectName='categoryListView')
231  list_view.swipe_child_into_view(icon)
232  self.pointing_device.click_object(icon, press_duration=press_duration)
233 
def _get_category_element(self, category)
Definition: dash.py:234
def unity8.dash.GenericScopeView.get_applications (   self,
  category 
)
Return the list of applications on a category.

:parameter category: The name of the category.

Definition at line 243 of file dash.py.

243  def get_applications(self, category):
244  """Return the list of applications on a category.
245 
246  :parameter category: The name of the category.
247 
248  """
249  category_element = self._get_category_element(category)
250  see_all = category_element.select_single(objectName='seeAll')
251  application_cards = category_element.select_many('AbstractButton')
252 
253  application_cards = sorted(
254  (card for card in application_cards
255  if card.globalRect.y < see_all.globalRect.y),
256  key=lambda card: (card.globalRect.y, card.globalRect.x))
257 
258  result = []
259  for card in application_cards:
260  if card.objectName not in ('cardToolCard', 'seeAll'):
261  result.append(card.title)
262  return result
263 
264 
def _get_category_element(self, category)
Definition: dash.py:234
def get_applications(self, category)
Definition: dash.py:243
def unity8.dash.GenericScopeView.open_preview (   self,
  category,
  app_name,
  press_duration = 0.10 
)
Open the preview of an application.

:parameter category: The name of the category where the application is.
:parameter app_name: The name of the application.
:return: The opened preview.

Definition at line 196 of file dash.py.

196  def open_preview(self, category, app_name, press_duration=0.10):
197  """Open the preview of an application.
198 
199  :parameter category: The name of the category where the application is.
200  :parameter app_name: The name of the application.
201  :return: The opened preview.
202 
203  """
204  # FIXME some categories need a long press in order to see the preview.
205  # Some categories do not show previews, like recent apps.
206  # --elopio - 2014-1-14
207  self.click_scope_item(category, app_name, press_duration)
208  preview_list = self.wait_select_single(
209  'QQuickLoader', objectName='subPageLoader')
210  preview_list.subPageShown.wait_for(True)
211  preview_list.x.wait_for(0)
212  self.get_root_instance().select_single(
213  objectName='processingIndicator').visible.wait_for(False)
214  return preview_list.select_single(
215  Preview, objectName='preview{}'.format(
216  preview_list.initialIndex))
217 

The documentation for this class was generated from the following file: