예제 #1
0
파일: JoinList.py 프로젝트: torpoker/app
    def join_table(self, table_id, bb):
        """
        Called when pressed "Join" button on table

        redirect to table as spectator when there's no account , but if not,
        display a popup/window (see attached) with min/max amount to join the table and an input number to type the amount
        :param bb:
        :param table_id: table id to join (int)
        :return:
        """
        self.ui.statusbar.clearMessage()
        self.bb = bb
        self.table_id = table_id
        if self.no_account:
            # if there's no account so user joins directly as spectator
            self.launch_poker_table(spectator=True)
        else:
            self.request_ = RequestThread.RequestThread(
                params=('POST /json/table/{table_id}/join', None, {
                    'table_id': self.table_id
                }),
                api_obj=self.api)
            self.request_.resp.connect(self.do_join_table)
            self.request_.complete.connect(self.close_thread)
            self.request_.error_signal.connect(
                partial(self.user_retry, 'join_table', (table_id, bb)))
            self.request_.moveToThread(self.request_thread)
            self.request_thread.started.connect(self.request_.run)
            self.request_thread.start()
            show_request_status(self)
예제 #2
0
파일: JoinList.py 프로젝트: torpoker/app
 def cash_out(self):
     """
     To logout or cashout and get back to home window
     :return:
     """
     self.request_ = RequestThread.RequestThread(
         ('GET /json/cashout', None, None), self.api)
     self.request_.resp.connect(self.do_cashout)
     self.request_.error_signal.connect(partial(self.user_retry, 'cashout'))
     self.request_.complete.connect(self.close_thread)
     self.request_.moveToThread(self.request_thread)
     self.request_thread.started.connect(self.request_.run)
     self.request_thread.start()
     show_request_status(self)
예제 #3
0
파일: JoinList.py 프로젝트: torpoker/app
    def prepare_captcha_post_data(self, input_args):
        self.captcha_dialog.close()
        btc_address = input_args[0]
        captcha_code = input_args[1]
        body_bytes = f"address={btc_address}&captcha={captcha_code}".encode(
            'ascii')
        self.request_ = RequestThread.RequestThread(
            ('POST /json/send', body_bytes, None), api_obj=self.api)

        self.request_.resp.connect(self.post_captcha)
        self.request_.error_signal.connect(
            partial(self.user_retry, 'post_captcha', (input_args, )))
        self.request_.complete.connect(self.close_thread)

        self.request_.moveToThread(self.request_thread)
        self.request_thread.started.connect(self.request_.run)
        self.request_thread.start()
        show_request_status(self)
예제 #4
0
파일: JoinList.py 프로젝트: torpoker/app
    def request_captcha(self):
        """
        called when user do not have an account, and user presses the PlayNow button
        :return:
        """
        params = ('GET /json/join', None, None)
        if not hasattr(self, 'request_thread'
                       ):  # don't spawn new thread if there's already one
            self.request_thread = QtCore.QThread()
            self.thread_pool.append(self.request_thread)
        self.request_ = RequestThread.RequestThread(params, self.api)
        self.request_.resp.connect(self.open_captcha_window)
        self.request_.error_signal.connect(
            partial(self.user_retry, 'get_captcha'))
        self.request_.complete.connect(self.close_thread)
        self.request_.moveToThread(self.request_thread)
        self.request_thread.started.connect(self.request_.run)
        self.request_thread.start()

        show_request_status(self)
예제 #5
0
파일: JoinList.py 프로젝트: torpoker/app
    def prepare_accept_amount_value(self, value: int):
        """
        If user did not have an account and user pressed Join button on table.
        And has entered an amount to join the table
        :param value:
        :return:
        """
        body_bytes = f"amount={value}".encode('ascii')
        self.request_ = RequestThread.RequestThread(
            ('POST /json/table/{table_id}/join/confirm', body_bytes, {
                'table_id': self.table_id
            }),
            api_obj=self.api)
        self.request_.resp.connect(self.confirm_join)
        self.request_.complete.connect(self.close_thread)
        self.request_.error_signal.connect(
            partial(self.user_retry, 'confirm_join', (value, )))

        self.request_.moveToThread(self.request_thread)
        self.request_thread.started.connect(self.request_.run)
        self.request_thread.start()

        show_request_status(self)