def request_data(self):
def on_tasks_received(info, error=None):<EOL><INDENT>if error or not info:<EOL><INDENT>logger.error('<STR_LIT>' %<EOL>(info, error))<EOL>return<EOL><DEDENT>if '<STR_LIT>' in info:<EOL><INDENT>tasks = info['<STR_LIT>']<EOL><DEDENT>elif '<STR_LIT>' in info:<EOL><INDENT>tasks = info['<STR_LIT>']['<STR_LIT>']<EOL>self.file_sha1 = info['<STR_LIT>']['<STR_LIT>']<EOL><DEDENT>elif '<STR_LIT>' in info:<EOL><INDENT>logger.error('<STR_LIT>' %<EOL>(info, error))<EOL>self.app.toast(info.get('<STR_LIT>', '<STR_LIT>'))<EOL>return<EOL><DEDENT>else:<EOL><INDENT>logger.error('<STR_LIT>' %<EOL>(info, error))<EOL>self.app.toast(_('<STR_LIT>') % info)<EOL>return<EOL><DEDENT>for task in tasks:<EOL><INDENT>size = int(task['<STR_LIT:size>'])<EOL>human_size = util.get_human_size(size)[<NUM_LIT:0>]<EOL>select = (size > MIN_SIZE_TO_CHECK or <EOL>task['<STR_LIT>'].endswith(CHECK_EXT))<EOL>self.liststore.append([<EOL>select,<EOL>task['<STR_LIT>'],<EOL>size,<EOL>human_size,<EOL>])<EOL><DEDENT><DEDENT>if self.source_url.startswith('<STR_LIT>'):<EOL><INDENT>gutil.async_call(pcs.cloud_query_magnetinfo, self.app.cookie,<EOL>self.app.tokens, self.source_url, self.save_path,<EOL>callback=on_tasks_received)<EOL><DEDENT>else:<EOL><INDENT>gutil.async_call(pcs.cloud_query_sinfo, self.app.cookie,<EOL>self.app.tokens, self.source_url,<EOL>callback=on_tasks_received)<EOL><DEDENT>
在调用dialog.run()之前先调用这个函数来获取数据