def _on_exit(self): if self.xbmc_monitor.abortRequested(): del self.xbmc_monitor return # Clear our properties self.reset_properties() # Close video info dialog if window.is_visible(ID_VIDEOINFO): window.close(ID_VIDEOINFO) window.wait_until_active(ID_VIDEOINFO, invert=True, poll=0.1) # Close base window if window.is_visible(self.window_id): xbmc.executebuiltin('Action(Back)') window.wait_until_active(self.window_id, invert=True, poll=0.1) # If we don't have the return param then try to re-open original info if self.return_info and not self.params.get('return'): if window.wait_until_active(self.window_id, invert=True, poll=0.1, timeout=1): xbmc.executebuiltin('Action(Info)') # Clear our instance property because we left window.get_property(PREFIX_INSTANCE, clear_property=True)
def _on_change(self): # On first run the base window won't be open yet so don't check for it base_id = None if self.first_run else self.window_id # Close the info dialog first before doing anything if window.is_visible(ID_VIDEOINFO): window.close(ID_VIDEOINFO) # If we timeout or user forced back out of base window then we exit if not window.wait_until_active(ID_VIDEOINFO, base_id, invert=True): return self._call_exit() # On last position let's exit if self.position == 0: return self._call_exit(True) # On first run let's open our base window if self.first_run: window.activate(self.window_id) if not window.wait_until_active(self.window_id, poll=0.5): return self._call_exit() # Set our base window base_window = xbmcgui.Window(self.kodi_id) # Check that base window has correct control ID and clear it out control_list = base_window.getControl(CONTAINER_ID) if not control_list: kodi_log( u'SKIN ERROR!\nControl {} unavailable in Window {}'.format( CONTAINER_ID, self.window_id), 1) return self._call_exit() control_list.reset() # Wait for the container to update before doing anything if not window.wait_until_updated(container_id=CONTAINER_ID, instance_id=self.window_id): return self._call_exit() # Open the info dialog base_window.setFocus(control_list) xbmc.executebuiltin(u'SetFocus({},0,absolute)'.format(CONTAINER_ID)) xbmc.executebuiltin('Action(Info)') if not window.wait_until_active(ID_VIDEOINFO, self.window_id): return self._call_exit() # Set current_path to added_path because we've now updated everything # Set first_run to False because we've now finished our first run through self.current_path = self.added_path self.first_run = False