def item_click(self, item, touch=None): if isinstance(item, SystemPost): from widgets.linkedin import LinkedIn Logger.info('SystemPost: %s clicked' % item.key) action = item.data.get('action', '') if action == 'invite': from modules.core. android_utils import ShareActivity from config import invite_url ShareActivity(invite_url, 'Send invite') elif action == 'linkedin': if LinkedIn.isLinkedinProfileEmpty(): linkedin = LinkedIn() linkedin.do_login() def remove_sys_post(*largs): self.container.remove_widget(item) Clock.schedule_once(remove_sys_post, 3.0) else: self.dispatch('on_item_selected', item)
def item_click(self, item, touch=None): if isinstance(item, SystemPost): from widgets.linkedin import LinkedIn Logger.info('SystemPost: %s clicked' % item.key) action = item.data.get('action', '') if action == 'invite': from modules.core.android_utils import ShareActivity from config import invite_url ShareActivity(invite_url, 'Send invite') elif action == 'linkedin': if LinkedIn.isLinkedinProfileEmpty(): linkedin = LinkedIn() linkedin.do_login() def remove_sys_post(*largs): self.container.remove_widget(item) Clock.schedule_once(remove_sys_post, 3.0) else: self.dispatch('on_item_selected', item)
def _on_page_add_system_post(self): if self.sys_posts_count >= len(sys_posts_content): return None systempost = None for s in sys_posts_content: if s['when'] == 'once' and not user_authenticated_on_session_start: s['when'] = 'done' systempost = s self.sys_posts_count += 1 break if s['when'] == 'every': s['when'] = 'done' systempost = s self.sys_posts_count += 1 break from widgets.linkedin import LinkedIn if s['when'] == 'linkedin' and LinkedIn.isLinkedinProfileEmpty(): s['when'] = 'done' systempost = s self.sys_posts_count += 1 break if not systempost: self.sys_posts_count = len(sys_posts_content) return systempost
def _on_page_add_system_post(self): if self.sys_posts_count >= len(sys_posts_content): return None systempost = None for s in sys_posts_content: if s['when'] == 'once' and not user_authenticated_on_session_start: s['when'] = 'done' systempost = s self.sys_posts_count += 1 break if s['when'] == 'every': s['when'] = 'done' systempost = s self.sys_posts_count += 1 break from widgets.linkedin import LinkedIn if s['when'] == 'linkedin' and LinkedIn.isLinkedinProfileEmpty(): s['when'] = 'done' systempost = s self.sys_posts_count += 1 break if not systempost: self.sys_posts_count = len(sys_posts_content) return systempost