def load_url(self):
def on_load_url(filelist, error=None):<EOL><INDENT>self.url_entry.props.secondary_icon_name = REFRESH_ICON<EOL>if timestamp != self.url_entry.timestamp:<EOL><INDENT>logger.debug('<STR_LIT>')<EOL>return<EOL><DEDENT>if error or not filelist:<EOL><INDENT>self.app.toast(<EOL>_('<STR_LIT>'))<EOL>logger.warn('<STR_LIT>' %<EOL>(self.curr_url, filelist, error))<EOL>self.has_next = False<EOL>return<EOL><DEDENT>state = self.select_all_button.get_active()<EOL>tree_iters = []<EOL>if filelist and self.dirname and self.dirname != '<STR_LIT:/>':<EOL><INDENT>parent_dirname = os.path.dirname(self.dirname)<EOL>pixbuf, type_ = self.app.mime.get(parent_dirname, True,<EOL>icon_size=ICON_SIZE)<EOL>large_pixbuf, type_ = self.app.mime.get(parent_dirname, True,<EOL>icon_size=LARGE_ICON_SIZE)<EOL>self.liststore.append([<EOL>state,<EOL>pixbuf,<EOL>large_pixbuf,<EOL>'<STR_LIT:..>',<EOL>parent_dirname,<EOL>True,<EOL><NUM_LIT:0>,<EOL>'<STR_LIT:0>',<EOL><NUM_LIT:0>,<EOL>'<STR_LIT>',<EOL>])<EOL><DEDENT>for file_ in filelist:<EOL><INDENT>isdir = file_['<STR_LIT>'] == '<STR_LIT:1>'<EOL>pixbuf, type_ = self.app.mime.get(file_['<STR_LIT:path>'], isdir,<EOL>icon_size=ICON_SIZE)<EOL>large_pixbuf, type_ = self.app.mime.get(file_['<STR_LIT:path>'], isdir,<EOL>icon_size=LARGE_ICON_SIZE)<EOL>size = int(file_.get('<STR_LIT:size>', <NUM_LIT:0>))<EOL>human_size = util.get_human_size(size)[<NUM_LIT:0>]<EOL>mtime = int(file_.get('<STR_LIT>', <NUM_LIT:0>))<EOL>human_mtime = time.ctime(mtime)<EOL>tree_iter = self.liststore.append([<EOL>state,<EOL>pixbuf,<EOL>large_pixbuf,<EOL>file_['<STR_LIT>'],<EOL>file_['<STR_LIT:path>'],<EOL>isdir,<EOL>size,<EOL>human_size,<EOL>mtime,<EOL>human_mtime,<EOL>])<EOL>tree_iters.append(tree_iter)<EOL><DEDENT>cache_path = Config.get_cache_path(self.app.profile['<STR_LIT:username>'])<EOL>gutil.async_call(gutil.update_share_image, self.liststore,<EOL>tree_iters, ICON_COL, LARGE_ICON_COL,<EOL>filelist, cache_path,<EOL>ICON_SIZE, LARGE_ICON_SIZE)<EOL><DEDENT>self.url_entry.props.secondary_icon_name = ABORT_ICON<EOL>if not self.uk or not self.shareid:<EOL><INDENT>self.app.toast(_('<STR_LIT>').format(self.curr_url))<EOL>self.has_next = False<EOL>self.url_entry.props.secondary_icon_name = REFRESH_ICON<EOL>return<EOL><DEDENT>timestamp = time.time()<EOL>self.url_entry.timestamp = timestamp<EOL>gutil.async_call(pcs.list_share_files, self.app.cookie, self.app.tokens,<EOL>self.uk, self.shareid, self.dirname, self.page,<EOL>callback=on_load_url)<EOL>
读取分享文件列表