修复插件的金额格式化

pull/168/head
John Smith 7 months ago
parent 67a935866c
commit 87ec69a08d

@ -112,11 +112,14 @@ class RoomFrame(designer.ui_base.RoomFrameBase):
# #
def _on_super_chats_change(self, room: listener.Room, value: List[listener.SuperChatRecord], index, is_new): # noqa def _on_super_chats_change(self, room: listener.Room, value: List[listener.SuperChatRecord], index, is_new): # noqa
if room.room_key != self._room_key:
return
super_chat = value[index] super_chat = value[index]
col_texts = [ col_texts = [
self._format_time(super_chat.time), self._format_time(super_chat.time),
super_chat.author_name, super_chat.author_name,
str(super_chat.price), f'{super_chat.price:.1f}',
super_chat.content, super_chat.content,
] ]
self._update_list_ctrl(self.super_chat_list, index, is_new, col_texts) self._update_list_ctrl(self.super_chat_list, index, is_new, col_texts)
@ -155,19 +158,25 @@ class RoomFrame(designer.ui_base.RoomFrameBase):
list_ctrl.Focus(last_row_index) list_ctrl.Focus(last_row_index)
def _on_gifts_change(self, room: listener.Room, value: List[listener.GiftRecord], index, is_new): # noqa def _on_gifts_change(self, room: listener.Room, value: List[listener.GiftRecord], index, is_new): # noqa
if room.room_key != self._room_key:
return
gift = value[index] gift = value[index]
col_texts = [ col_texts = [
self._format_time(gift.time), self._format_time(gift.time),
gift.author_name, gift.author_name,
gift.gift_name, gift.gift_name,
str(gift.num), str(gift.num),
str(gift.price), f'{gift.price:.1f}',
] ]
self._update_list_ctrl(self.gift_list, index, is_new, col_texts) self._update_list_ctrl(self.gift_list, index, is_new, col_texts)
def _on_uid_paid_user_dict_change( def _on_uid_paid_user_dict_change(
self, room: listener.Room, value: Dict[str, listener.PaidUserRecord], index, is_new # noqa self, room: listener.Room, value: Dict[str, listener.PaidUserRecord], index, is_new # noqa
): ):
if room.room_key != self._room_key:
return
item_data = self._uid_to_paid_user_item_data.get(index, None) item_data = self._uid_to_paid_user_item_data.get(index, None)
if item_data is None: if item_data is None:
item_data = self._uid_to_paid_user_item_data[index] = self._next_paid_user_item_data item_data = self._uid_to_paid_user_item_data[index] = self._next_paid_user_item_data
@ -176,10 +185,13 @@ class RoomFrame(designer.ui_base.RoomFrameBase):
paid_user = value[index] paid_user = value[index]
col_texts = [ col_texts = [
paid_user.name, paid_user.name,
str(paid_user.price), f'{paid_user.price:.1f}',
] ]
self._update_list_ctrl(self.paid_user_list, item_data, is_new, col_texts) self._update_list_ctrl(self.paid_user_list, item_data, is_new, col_texts)
def _on_simple_statistics_change(self, room: listener.Room, value=None, index=None, is_new=None): # noqa def _on_simple_statistics_change(self, room: listener.Room, value=None, index=None, is_new=None): # noqa
text = f'总弹幕数:{room.danmaku_num} 互动用户数:{len(room.interact_uids)} 总付费:{room.total_paid_price}' if room.room_key != self._room_key:
return
text = f'总弹幕数:{room.danmaku_num} 互动用户数:{len(room.interact_uids)} 总付费:{room.total_paid_price:.1f}'
self.statistics_text.SetLabelText(text) self.statistics_text.SetLabelText(text)

@ -59,7 +59,7 @@ class AppConfig:
self.template_text = '{author_name} 说:{content}' self.template_text = '{author_name} 说:{content}'
# self.template_free_gift = '{author_name} 赠送了{num}个{gift_name},总价{total_coin}银瓜子' # self.template_free_gift = '{author_name} 赠送了{num}个{gift_name},总价{total_coin}银瓜子'
self.template_free_gift = '{author_name} 赠送了{num}{gift_name}' self.template_free_gift = '{author_name} 赠送了{num}{gift_name}'
self.template_paid_gift = '{author_name} 赠送了{num}{gift_name},总价{price}' self.template_paid_gift = '{author_name} 赠送了{num}{gift_name},总价{price:.1f}'
self.template_member = '{author_name} 购买了{num}{unit} {guard_name}' self.template_member = '{author_name} 购买了{num}{unit} {guard_name}'
self.template_super_chat = '{author_name} 发送了{price}元的醒目留言:{content}' self.template_super_chat = '{author_name} 发送了{price}元的醒目留言:{content}'

@ -18,7 +18,7 @@ template_text = {author_name} 说:{content}
# template_free_gift = {author_name} 赠送了{num}个{gift_name},总价{total_coin}银瓜子 # template_free_gift = {author_name} 赠送了{num}个{gift_name},总价{total_coin}银瓜子
template_free_gift = {author_name} 赠送了{num}个{gift_name} template_free_gift = {author_name} 赠送了{num}个{gift_name}
# 付费礼物 # 付费礼物
template_paid_gift = {author_name} 赠送了{num}个{gift_name},总价{price}元 template_paid_gift = {author_name} 赠送了{num}个{gift_name},总价{price:.1f}元
# 上舰 # 上舰
template_member = {author_name} 购买了{num}{unit} {guard_name} template_member = {author_name} 购买了{num}{unit} {guard_name}
# 醒目留言 # 醒目留言

Loading…
Cancel
Save