def on_linkedin(self): def updated(*largs): from modules.core.android_utils import Toast Toast('Linkedin profile updated') from widgets.linkedin import LinkedIn self.linkedin = LinkedIn(on_complete=updated) self.linkedin.do_login()
class FavDialog(ModalMenu): __events__ = ('on_mark_all', 'on_feedback', 'on_invite', 'on_notifications', 'on_rate', 'on_about', 'on_linkedin', 'on_exit') notify = BooleanProperty(True) def __init__(self, **kwargs): LogTestFairy('Favorite menu') super(FavDialog, self).__init__(**kwargs) @classmethod def open(cls, **kwargs): w = FavDialog(**kwargs) AutosizeModal(widget=w, **kwargs).open() def button_clicked(self, touch): action = touch.action LogTestFairy('Favorite menu pressed %s' % action) if self.is_event_type(action): self.dispatch(action) if action != 'on_about': self.dispatch('on_close') def on_mark_all(self): pass def on_feedback(self): FeedbackDialog.open( force_pos={'top': self.top}, background_color=(0, 0, 0, .6)) def on_invite(self): from modules.core. android_utils import ShareActivity from config import invite_url ShareActivity(invite_url, 'Send invite') def on_notifications(self): pass def on_rate(self): from modules.core. android_utils import OpenUrlActivity from config import rate_url OpenUrlActivity(rate_url) def on_about(self): AboutDialog.open(background_color=(0, 0, 0, .2)) def on_linkedin(self): def updated(*largs): from modules.core.android_utils import Toast Toast('Linkedin profile updated') from widgets.linkedin import LinkedIn self.linkedin = LinkedIn(on_complete=updated) self.linkedin.do_login() def on_exit(self): # Exit explicitly from kivy.base import stopTouchApp stopTouchApp()
def populate_slides(self): for file in sorted(listdir(tutorial_path)): self.carousel.add_widget( TutorialImage( source=join(tutorial_path, file))) if not user_authenticated(): linkedin = LinkedIn() linkedin.bind(on_complete=self._linkedin_login_completed) self.carousel.add_widget(linkedin) self.update_skip_button()
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