def navigateWithPhotoId(self, photoId): analytics.log('ImageViewer_segue') if isinstance(self.postId, int): pass managers.shared().screensManager( ).showDetailPhotoViewControllerWithOwnerId_photoId_( args=[self.ownerId, photoId])
def tappedOnVideoWithIdownerIdrepresentation(self, videoId, ownerId, representation): analytics.log('Dialog_video_segue') cache = VideosDatabase() try: cache.update([representation]) except: pass cache.close() managers.shared().screensManager().showDetailVideoViewControllerWithOwnerId_videoId_(args=[ownerId, videoId])
def exitTapped(self): dialogsManager = PyDialogsManager() index, cancelled = dialogsManager.showRowsDialogWithTitles(['settings_exit']) if index == 0 and not cancelled: analytics.log('Settings_do_exit') settings.set('access_token', '') settings.set('user_id', 0) vk.setToken('') vk.setUserId(0) settings.write() managers.shared().screensManager().showAuthorizationViewController()
def launch(): objcbridge.send('{}') # first initialization message accessToken = settings.get('access_token') userId = settings.get('user_id') if isinstance(accessToken, str) and len(accessToken) > 0 and isinstance( userId, int): vk.setToken(accessToken) vk.setUserId(userId) screenshow.showScreenAfterAuthorization() return Managers.shared().screensManager().showAuthorizationViewController()
def tappedOnVideoWithIdownerIdrepresentation(self, videoId, ownerId, representation): analytics.log('Posts_tapped_on_video') #print('representation: ' + json.dumps(representation, indent=4)) try: cache = VideosDatabase() cache.update([representation]) cache.close() except Exception as e: print('tappedOnVideoWithIdownerIdrepresentation exception: ' + str(e)) managers.shared().screensManager( ).showDetailVideoViewControllerWithOwnerId_videoId_( args=[ownerId, videoId])
def createPost(self, text): results = self.createPostService.createPost(self.ownerId, text) postId = 0 try: postId = results['post_id'] except: pass if postId == 0: dialogsManager = PyDialogsManager() dialogsManager.showDialogWithMessage('error_create_post') else: managers.shared().screensManager( ).dismissCreatePostViewController_(args=[True]) return postId
def didReceiveRemoteNotification(self, userInfo): try: data = userInfo['data'] type = data['type'] if type == 'msg': context = data['context'] senderId = context['sender_id'] managers.shared().screensManager().showDialogViewController_( args=[senderId]) else: print('unknown push type: ' + str(type)) except Exception as e: print('parse incoming push exception: ' + str(e)) pass
def __init__(self, msg, callback): self.msg = msg self.callback = callback handler = PasswordDialogHandlerProtocol() handler.dialog = self self.dialog = managers.shared().createPasswordDialog() self.dialog.handler = handler
def __init__(self, msg, placeholder, callback): self.msg = msg self.placeholder = placeholder self.callback = callback handler = TextFieldDialogHandler() handler.dialog = self self.dialog = managers.shared().createTextFieldDialog() self.dialog.handler = handler
def __init__(self, parent, msg, callback): self.parent = parent self.callback = callback self.msg = msg handler = YesNoDialogHandlerProtocol() handler.dialog = self self.dialog = managers.shared().createYesNoDialog() self.dialog.handler = handler self.runLoop = runloop.shared();
def __init__(self, config, plugins, storage, daemon): BaseWizard.__init__(self, config, storage) print('Hello InstallWizard') self.daemon = daemon self.callback = None self.screensManager = Managers.shared().screensManager() self.config = config self.plugins = plugins self.storage = storage print('InstallWizard storage: ' + str(storage))
def showScreenAfterAuthorization(): #managers.shared().screensManager().showFriendsViewController_usersListType_push_(args=[vk.userId(), UsersListTypes.FRIENDS, False]) #managers.shared().screensManager().showChatListViewController() managers.shared().screensManager().showWallViewController() #managers.shared().screensManager().showWallViewController_(args=[-41315069]) # Вегетарианская сила #managers.shared().screensManager().showWallViewController_(args=[19649085]) # Andrei Vayavoda Second #managers.shared().screensManager().showWallViewController_(args=[82108968]) # Aleksandr Kruglov #managers.shared().screensManager().showPhotoAlbumsViewController_push_(args=[vk.userId(), False]) #managers.shared().screensManager().showNewsViewController() #managers.shared().screensManager().showAnswersViewController() #managers.shared().screensManager().showWallViewController_(args=[-166181313]) # Daddy Pasha #managers.shared().screensManager().showWallViewController_(args=[-63294313]) # Уроки Медитации [Публичная страница] #managers.shared().screensManager().showWallViewController_(args=[-20550925]) # Oum.Ru Здравый Образ Жизни #managers.shared().screensManager().showGroupsViewController_push_(args=[vk.userId(), False]) #managers.shared().screensManager().showBookmarksViewController() #managers.shared().screensManager().showVideosViewController_push_(args=[vk.userId(), False]) #managers.shared().screensManager().showDocumentsViewController_(args=[vk.userId()]) #managers.shared().screensManager().showSettingsViewController() #managers.shared().screensManager().showBlackListViewController() pass
def __call__(self, **method_args): self._method_args = method_args result = {} try: result = self._api.session.make_request(self) except VkAPIError as e: print('VkAPIError exception: ' + str(e)) if e.code == 5: if len(vk.token()) == 0: print('token missing. do nothing') raise settings.set('access_token', '') settings.set('user_id', 0) vk.setToken('') vk.setUserId(0) settings.write() managers.shared().screensManager( ).showAuthorizationViewController() raise return result
def __init__(self, parent, message, task, on_success=None, on_error=None): assert parent self.dialog = managers.shared().createWaitingDialog() self.dialog.showWaitingDialogWithMessage(message) def __task(): try: r = task() if on_success: self.dialog.waitingDialogClose() on_success(r) except Exception as e: if on_error: self.dialog.waitingDialogClose() on_error([False, e]) t = threading.Thread(target=__task) t.start() t.join()
def __init__(self, gui_object, wallet, callback): self.callback = callback self.daemon = gui_object.daemon self.initializeHandlers() self.tx_external_keypairs = {} self.is_max = False self.pay_from = False self.payment_request = None self.num_zeros = 2 self.config = config = gui_object.config self.decimal_point = config.get('decimal_point', 5) self.wallet = wallet self.invoices = wallet.invoices self.contacts = wallet.contacts self.historyList = HistoryList(self) self.network = gui_object.daemon.network self.fx = gui_object.daemon.fx self.screensManager = Managers.shared().screensManager() interests = ['updated', 'new_transaction', 'status', 'banner', 'verified', 'fee'] # To avoid leaking references to "self" that prevent the # window from being GC-ed when closed, callbacks should be # methods of this class only, and specifically not be # partials, lambdas or methods of subobjects. Hence... self.network.register_callback(self.on_network, interests) self.network.register_callback(self.on_quotes, ['on_quotes']) self.network.register_callback(self.on_history, ['on_history']) #self.need_update = threading.Event() self.tx_notifications = [] self.need_update = threading.Event() def timerAction(): if self.need_update.is_set(): self.need_update.clear() self.update_wallet() threading.Timer(1, timerAction).start() timerAction()
def tappedOnAlbumWithId(self, albumId): analytics.log('PhotoAlbum_segue') managers.shared().screensManager().showGalleryViewControllerWithOwnerId_albumId_(args=[self.ownerId, albumId]);
def menuTapped(self): managers.shared().screensManager().showMenu()
def messageButtonTapped(self): analytics.log('Wall_message_button') managers.shared().screensManager().showDialogViewController_(args=[self.userId])
def addPostTapped(self): analytics.log('Wall_add_post') managers.shared().screensManager().presentAddPostViewController_(args=[self.userId])
def videosTapped(self): analytics.log('Wall_videos') managers.shared().screensManager().showVideosViewController_push_(args=[self.userId, True])
def groupsTapped(self): analytics.log('Wall_groups') managers.shared().screensManager().showGroupsViewController_push_(args=[self.userId, True])
def followersTapped(self): analytics.log('Wall_followers') managers.shared().screensManager().showFriendsViewController_usersListType_push_(args=[self.userId, UsersListTypes.FOLLOWERS, True])
def photosTapped(self): analytics.log('Wall_photos') managers.shared().screensManager().showPhotoAlbumsViewController_push_(args=[self.userId, True])
def showEula(self): managers.shared().screensManager().showEulaViewController()
def tappedOnPhotoWithId(self, photoId): analytics.log('Gallery_segue') managers.shared().screensManager( ).showImagesViewerViewControllerWithOwnerId_albumId_photoId_( args=[self.ownerId, self.albumId, photoId])
def tappedOnPhotoWithIndexmessageId(self, index, messageId): analytics.log('Dialog_photo_segue') managers.shared().screensManager().showImagesViewerViewControllerWithMessageId_index_(args=[messageId, index])
def tappedOnUserWithId(self, userId): analytics.log('Friends_segue') managers.shared().screensManager().showWallViewController_push_( args=[userId, True])
def blackListTapped(self): managers.shared().screensManager().showBlackListViewController();
def subscribtionsTapped(self): analytics.log('Wall_subscribtions') managers.shared().screensManager().showFriendsViewController_usersListType_push_(args=[self.userId, UsersListTypes.SUBSCRIPTIONS, True])
def tappedOnGroupWithId(self, groupId): print('tappedOnGroupWithId: ' + str(groupId)) analytics.log('Groups_segue') managers.shared().screensManager().showWallViewController_push_(args=[groupId, True])