def _get_view_device(self, device_id): """ Get device view for id Use existing view if available @param device id as int @return View """ from lollypop.view_device import DeviceView device = self.__devices[device_id] device_view = None # Search a device child with uri for child in self._stack.get_children(): if isinstance(child, DeviceView): if child.device.uri == device.uri: device_view = child break # If no view available, get a new one if device_view is None: files = DeviceView.get_files(device.uri) if files: device_view = DeviceView(device) self._stack.add_named(device_view, device.uri) else: device_view = MessageView(_("Please unlock your device")) self._stack.add(device_view) device_view.populate() device_view.show() return device_view
def _update_view_device(self, device_id): device = self._devices[device_id] if device and device.view: view = device.view else: view = DeviceView(device, self._progress, self._stack.get_allocated_width()/2) device.view = view view.show() start_new_thread(view.populate, ()) self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def _update_view_device(self, object_id): device = self._devices[object_id] if device and device.view: view = device.view else: view = DeviceView(device, self._progress, self._stack.get_allocated_width() / 2) device.view = view view.show() start_new_thread(view.populate, ()) self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def _update_view_device(self, device_id): """ Update current view with device view, Use existing view if available @param device id as int """ device = self._devices[device_id] child = self._stack.get_child_by_name(device.uri) if child is None: child = DeviceView(device, self._progress) self._stack.add_named(child, device.uri) child.show() child.populate() self._stack.set_visible_child(child) self._stack.clean_old_views(child)
def _update_view_device(self, device_id): """ Update current view with device view, Use existing view if available @param device id as int """ device = self._devices[device_id] child = self._stack.get_child_by_name(device.uri) if child is None: if DeviceView.get_files(device.uri): child = DeviceView(device, self._progress) self._stack.add_named(child, device.uri) else: child = DeviceLocked() self._stack.add(child) child.show() child.populate() self._stack.set_visible_child(child) self._stack.clean_old_views(child)
def _update_view_device(self, device_id): """ Update current view with device view, Use existing view if available @param device id as int """ device = self._devices[device_id] if device and device.view: view = device.view else: view = DeviceView(device, self._progress, self._stack.get_allocated_width()/2) device.view = view view.show() start_new_thread(view.populate, ()) self._stack.add(view) self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def _update_view_device(self, device_id): """ Update current view with device view, Use existing view if available @param device id as int """ device = self._devices[device_id] if device and device.view: view = device.view else: view = DeviceView(device, self._progress, self._stack.get_allocated_width()/2) device.view = view self._stack.add(view) view.show() view.populate() self._stack.set_visible_child(view) self._stack.clean_old_views(view)
def __update_view_device(self, device_id): """ Update current view with device view, Use existing view if available @param device id as int """ from lollypop.view_device import DeviceView, DeviceLocked self.__stop_current_view() device = self.__devices[device_id] child = self.__stack.get_child_by_name(device.uri) if child is None: files = DeviceView.get_files(device.uri) if files: if child is None: child = DeviceView(device) self.__stack.add_named(child, device.uri) else: child = DeviceLocked() self.__stack.add(child) child.show() child.populate() self.__stack.set_visible_child(child) self.__stack.clean_old_views(child)