Exemplo n.º 1
0
 def navigateWithPhotoId(self, photoId):
     analytics.log('ImageViewer_segue')
     if isinstance(self.postId, int):
         pass
     managers.shared().screensManager(
     ).showDetailPhotoViewControllerWithOwnerId_photoId_(
         args=[self.ownerId, photoId])
Exemplo n.º 2
0
 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])
Exemplo n.º 3
0
 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()
Exemplo n.º 4
0
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()
Exemplo n.º 5
0
 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])
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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
Exemplo n.º 10
0
 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();
Exemplo n.º 11
0
 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))
Exemplo n.º 12
0
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
Exemplo n.º 13
0
 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
Exemplo n.º 14
0
    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()
Exemplo n.º 15
0
    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()
Exemplo n.º 16
0
 def tappedOnAlbumWithId(self, albumId):
     analytics.log('PhotoAlbum_segue')
     managers.shared().screensManager().showGalleryViewControllerWithOwnerId_albumId_(args=[self.ownerId, albumId]);
Exemplo n.º 17
0
 def menuTapped(self):
     managers.shared().screensManager().showMenu()
Exemplo n.º 18
0
 def messageButtonTapped(self):
     analytics.log('Wall_message_button')
     managers.shared().screensManager().showDialogViewController_(args=[self.userId])
Exemplo n.º 19
0
 def addPostTapped(self):
     analytics.log('Wall_add_post')
     managers.shared().screensManager().presentAddPostViewController_(args=[self.userId])
Exemplo n.º 20
0
 def videosTapped(self):
     analytics.log('Wall_videos')
     managers.shared().screensManager().showVideosViewController_push_(args=[self.userId, True])
Exemplo n.º 21
0
 def groupsTapped(self):
     analytics.log('Wall_groups')
     managers.shared().screensManager().showGroupsViewController_push_(args=[self.userId, True])
Exemplo n.º 22
0
 def followersTapped(self):
     analytics.log('Wall_followers')
     managers.shared().screensManager().showFriendsViewController_usersListType_push_(args=[self.userId, UsersListTypes.FOLLOWERS, True])
Exemplo n.º 23
0
 def photosTapped(self):
     analytics.log('Wall_photos')
     managers.shared().screensManager().showPhotoAlbumsViewController_push_(args=[self.userId, True])
Exemplo n.º 24
0
 def showEula(self):
     managers.shared().screensManager().showEulaViewController()
Exemplo n.º 25
0
 def tappedOnPhotoWithId(self, photoId):
     analytics.log('Gallery_segue')
     managers.shared().screensManager(
     ).showImagesViewerViewControllerWithOwnerId_albumId_photoId_(
         args=[self.ownerId, self.albumId, photoId])
Exemplo n.º 26
0
 def tappedOnPhotoWithIndexmessageId(self, index, messageId):
     analytics.log('Dialog_photo_segue')
     managers.shared().screensManager().showImagesViewerViewControllerWithMessageId_index_(args=[messageId, index])
Exemplo n.º 27
0
 def tappedOnUserWithId(self, userId):
     analytics.log('Friends_segue')
     managers.shared().screensManager().showWallViewController_push_(
         args=[userId, True])
Exemplo n.º 28
0
 def blackListTapped(self):
     managers.shared().screensManager().showBlackListViewController();
Exemplo n.º 29
0
 def subscribtionsTapped(self):
     analytics.log('Wall_subscribtions')
     managers.shared().screensManager().showFriendsViewController_usersListType_push_(args=[self.userId, UsersListTypes.SUBSCRIPTIONS, True])
Exemplo n.º 30
0
 def tappedOnGroupWithId(self, groupId):
     print('tappedOnGroupWithId: ' + str(groupId))
     analytics.log('Groups_segue')
     managers.shared().screensManager().showWallViewController_push_(args=[groupId, True])