コード例 #1
0
ファイル: mocktwitter.py プロジェクト: knappador/kivy-twitter
 def _process_request(self):
     if not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     elif not self._auth_state == "authenticated":
         self._authenticate()
     else:
         self.request.process(self.request)
コード例 #2
0
 def _process_purchase(self):
     Logger.info('in purchase')
     if not netcheck.connection_available():
         Logger.info('no net avaiable')
         netcheck.ask_connect(self._connection_callback)
     elif not self.setup_complete:
         Logger.info('setup not complete')
         self._setup()
     else:
         Logger.info('doing the purchase')
         Logger.info(str(self.purchase_requested))
         if self.purchase_requested is not None:
             sku = self.purchasing = self.purchase_requested
         else:
             self.purchasing = self.purchase_requested = None
             Logger.info('returning for no good reason')
             return
         if sku not in self.skus:
             raise AttributeError(
                 'The sku is not in the skus you initialized with')
         Logger.info('Starting purchase workflow for ' + sku)
         c = cast('android.app.Activity', context)
         r = self.r_code
         p = _OnPurchaseFinishedListener(self._purchase_finished)
         _protect_callback(p)
         self.helper.launchPurchaseFlow(c, sku, r, p)
コード例 #3
0
 def _process_purchase(self):
     Logger.info('in purchase')
     if not netcheck.connection_available():
         Logger.info('no net avaiable')
         netcheck.ask_connect(self._connection_callback)
     elif not self.setup_complete:
         Logger.info('setup not complete')
         self._setup()
     else:
         Logger.info('doing the purchase')
         Logger.info(str(self.purchase_requested))
         if self.purchase_requested is not None:
             sku = self.purchasing = self.purchase_requested
         else:
             self.purchasing = self.purchase_requested = None
             Logger.info('returning for no good reason')
             return
         if sku not in self.skus:
             raise AttributeError('The sku is not in the skus you initialized with')
         Logger.info('Starting purchase workflow for ' + sku)
         c = cast('android.app.Activity', context)
         r = self.r_code
         p = _OnPurchaseFinishedListener(self._purchase_finished)
         _protect_callback(p)
         self.helper.launchPurchaseFlow(c, sku, r, p)
コード例 #4
0
 def _process_request(self):
     if not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     elif not self._auth_state == 'authenticated':
         self._authenticate()
     else:
         self.request.process(self.request)
コード例 #5
0
 def _process_request(self):
     if not self._tries > 0:
         self._fail()
     elif not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     elif not self._auth_state == 'authenticated':
         self._authenticate()
     else:
         self._toast('Tweet Started')
         self._run_async(partial(self.request.process, self.request))
コード例 #6
0
 def _try_request(self, r):
     if self._pending_request is not None:
         Logger.info('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     else:
         Logger.info('doing it now')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
コード例 #7
0
 def _try_request(self, r):
     if self._pending_request is not None:
         Logger.info('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     else:
         Logger.info('doing it now')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
コード例 #8
0
 def _try_request(self, r):
     if self._pending_request is not None:
         self._toast('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     elif not self.is_open:
         self._toast('will facebook shortly')
     else:
         self._toast('facebooking')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
コード例 #9
0
 def _try_request(self, r):
     if self._pending_request is not None:
         self._toast('request already in progress')
         return False
     elif not netcheck.connection_available():
         self._pending_request = r
         netcheck.ask_connect(self._connection_callback)
         return True
     elif not self.is_open:
         self._toast('will facebook shortly')
     else:
         self._toast('facebooking')
     self._pending_request = r
     # this is a pretty robust way to end up processing the request
     self._open()
     return True
コード例 #10
0
 def _process_purchase(self):
     sku = self.purchasing
     if not netcheck.connection_available():
         netcheck.ask_connect(self._connection_callback)
     else:
         def purchase_response(dt):
             if PURCHASE_SUCCESS:
                 c = self.consumed
                 if c.has_key(sku):
                     self.consumed[sku] += 1
                 else:
                     self.consumed[sku] = 1 
                 self.purchase_callback(True, '')
             else:
                 self._fail()
         Clock.schedule_once(purchase_response, 0.5)
コード例 #11
0
    def _process_purchase(self):
        sku = self.purchasing
        if not netcheck.connection_available():
            netcheck.ask_connect(self._connection_callback)
        else:

            def purchase_response(dt):
                if PURCHASE_SUCCESS:
                    c = self.consumed
                    if c.has_key(sku):
                        self.consumed[sku] += 1
                    else:
                        self.consumed[sku] = 1
                    self.purchase_callback(True, '')
                else:
                    self._fail()

            Clock.schedule_once(purchase_response, 0.5)