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 191 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 218 of file dash.py.

218  def click_scope_item(self, category, title, press_duration=0.10):
219  """Click an item from the scope.
220 
221  :parameter category: The name of the category where the item is.
222  :parameter title: The title of the item.
223 
224  """
225  category_element = self._get_category_element(category)
226  icon = category_element.wait_select_single(
227  'UCAbstractButton', title=title)
228  list_view = self.select_single(
229  ListViewWithPageHeader, objectName='categoryListView')
230  list_view.swipe_child_into_view(icon)
231  self.pointing_device.click_object(icon, press_duration=press_duration)
232 
def _get_category_element(self, category)
Definition: dash.py:233
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 242 of file dash.py.

242  def get_applications(self, category):
243  """Return the list of applications on a category.
244 
245  :parameter category: The name of the category.
246 
247  """
248  category_element = self._get_category_element(category)
249  see_all = category_element.select_single(objectName='seeAll')
250  application_cards = category_element.select_many('UCAbstractButton')
251 
252  application_cards = sorted(
253  (card for card in application_cards
254  if card.globalRect.y < see_all.globalRect.y),
255  key=lambda card: (card.globalRect.y, card.globalRect.x))
256 
257  result = []
258  for card in application_cards:
259  if card.objectName not in ('cardToolCard', 'seeAll'):
260  result.append(card.title)
261  return result
262 
263 
def _get_category_element(self, category)
Definition: dash.py:233
def get_applications(self, category)
Definition: dash.py:242
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 195 of file dash.py.

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

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