Example #1
0
	def post_gen(self,post,basyo=0):
		if(config.searchMuteUser(post["user"]["id"])):
			return
		if(post["type"]=="repost"):
			if(config.searchMuteUser(post["post"]["user"]["id"])):
				return
		if(post.get("inReplyToPost")):
			if(config.searchMuteUser(post["inReplyToPost"]["user"]["id"])):
				return
		self.posts.append(post)
		orig_post=None
		if(post["type"]=="repost"):
			orig_post=post
			post=post["post"]
		self.listctrl.InsertStringItem(basyo,post["user"]["screenName"])
		if(post.get("text")):
			self.listctrl.SetStringItem(basyo,1,post["text"].replace("\r","").replace("\n"," "))
		# self.listctrl.SetItemData(basyo,post)
		if(orig_post):
			self.listctrl.SetItemBackgroundColour(basyo,wx.Colour(192,255,192))
		elif(post.get("inReplyToPost")):
			self.listctrl.SetItemBackgroundColour(basyo,wx.Colour(255,216,216))
		self.listctrl.SetItemData(basyo,len(self.posts))
		try:
			self.listctrl.SetItemImage(basyo,self.get_image_number(config.getTimelineUserURL(post["user"]["avatarUrl"])))
		except:
			return
		if(config.GetValue("gensun_download")):
			filemng.cacheAsync(post["user"]["avatarUrl"])
			if(post["files"]):
				for attr_file in post["files"]:
					filemng.cacheAsync(attr_file["url"])
		if(post["files"]):
			for attr_file in post["files"]:
				filemng.cacheAsync(config.getThumbnailURL(attr_file["url"]))
Example #2
0
	def post_cache(self,post):
		# RPかどうか確認
		if(post.get("post")):
			if(post["type"]=="repost"):
				filemng.cache(config.getRPUserURL(post["user"]["avatarUrl"]))
				post=post["post"]
		# リプライかどうか確認
		if(self.convShow and post.get("inReplyToPost")):
			if(post["type"]=="reply"):
				filemng.cache(config.getReplyUserURL(post["inReplyToPost"]["user"]["avatarUrl"]))
		# ユーザーアイコンキャッシュ
		filemng.cache(config.getUserURL(post["user"]["avatarUrl"]))
		filemng.cache(config.getTimelineUserURL(post["user"]["avatarUrl"]))
		if(post.get("files")):
			for _file in post["files"]:
				filemng.cache(config.getThumbnailURL(_file["url"]))
Example #3
0
	def select_post(self,post):
		self.spl_2.Show()
		if(post["type"]=="repost"):
			self.spl_2_rp_panel.Show()
			self.info_rp_name.SetLabel(post["user"]["name"])
			self.info_rp_time.SetLabel(config.dateStringConvert(post["createdAt"]))
			post=post["post"]
		else:
			self.spl_2_rp_panel.Hide()
		self.info_icon.SetBitmap(filemng.cacheBmp(config.getTimelineUserURL(post["user"]["avatarUrl"])))
		self.info_user_name.SetLabel(post["user"]["name"])
		self.info_post_time.SetLabel(config.dateStringConvert(post["createdAt"]))
		if(post.get("text")):
			self.info_text.Enable()
			self.info_text.SetValue(post["text"])
		else:
			self.info_text.Disable()
			self.info_text.SetValue("text is empty")
		if(post["isLiked"]):
			self.info_btn_fav.Disable()
		else:
			self.info_btn_fav.Enable()
		if(post["isReposted"] or post["user"]["id"]==config.meid):
			self.info_btn_rp.Disable()
		else:
			self.info_btn_rp.Enable()
		if(not post.get("inReplyToPostId")):
			self.info_btn_conv.Disable()
		else:
			self.info_btn_conv.Enable()
		for img in self.info_images:
			img.Hide()
			img.url=None
		if(post["files"]):
			for i in range(len(post["files"])):
				img=self.info_images[i]
				img.SetBitmap(filemng.cacheBmp(config.getThumbnailURL(post["files"][i]["url"])))
				img.url=post["files"][i]["url"]
				img.Show()
		self.spl_2.Layout()
		self.spl_2.Update()