diff --git a/python/text_item.py b/python/text_item.py index 08c1536e..975878a1 100644 --- a/python/text_item.py +++ b/python/text_item.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2012-2018 by nils_2 +# Copyright (c) 2012-2019 by nils_2 # # add a plain text or evaluated content to item bar # @@ -17,6 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # +# 2019-05-23: FlashCode, (freenode.#weechat) +# 0.9 : fix eval_expression() for split windows +# # 2018-08-18: nils_2, (freenode.#weechat) # 0.8 : add new option "interval" # @@ -49,6 +52,13 @@ # Development is currently hosted at # https://github.com/weechatter/weechat-scripts +# TODO +# plugins.var.python.text_item..enabled +# plugins.var.python.text_item..type +# plugins.var.python.text_item..signal +# plugins.var.python.text_item..text +# plugins.var.python.text_item..interval + try: import weechat,re @@ -59,7 +69,7 @@ SCRIPT_NAME = "text_item" SCRIPT_AUTHOR = "nils_2 " -SCRIPT_VERSION = "0.8" +SCRIPT_VERSION = "0.9" SCRIPT_LICENSE = "GPL" SCRIPT_DESC = "add a plain text or evaluated content to item bar" @@ -72,7 +82,6 @@ settings = { 'interval': ('0', 'How often (in seconds) to force an update of all items. 0 means deactivated'), } - # ================================[ hooks ]=============================== def add_hook(signal, item): global hooks @@ -183,8 +192,7 @@ def bar_item_update_cb(signal, callback, callback_data): def substitute_colors(text,window): if int(version) >= 0x00040200: bufpointer = weechat.window_get_pointer(window,"buffer") - return weechat.string_eval_expression(text, {"buffer": bufpointer}, {}, {}) -# return weechat.string_eval_expression(text,{},{},{}) + return weechat.string_eval_expression(text, {"window": window, "buffer": bufpointer}, {}, {}) # substitute colors in output return re.sub(regex_color, lambda match: weechat.color(match.group(1)), text)