mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2026-03-06 09:27:33 +01:00
Título de converrsaciones
This commit is contained in:
@@ -290,9 +290,23 @@ class Handler:
|
|||||||
if not uri: return
|
if not uri: return
|
||||||
|
|
||||||
# Buffer Title
|
# Buffer Title
|
||||||
author = getattr(item, "author", None) or (item.get("post", {}).get("author") if isinstance(item, dict) else None)
|
handle = None
|
||||||
handle = getattr(author, "handle", "unknown") if author else "unknown"
|
display_name = None
|
||||||
title = _("Conversation with {0}").format(handle)
|
if hasattr(buffer, "get_selected_item_author_details"):
|
||||||
|
details = buffer.get_selected_item_author_details()
|
||||||
|
if details:
|
||||||
|
handle = details.get("handle")
|
||||||
|
if not handle:
|
||||||
|
def g(obj, key, default=None):
|
||||||
|
if isinstance(obj, dict):
|
||||||
|
return obj.get(key, default)
|
||||||
|
return getattr(obj, key, default)
|
||||||
|
author = g(item, "author") or g(g(item, "post"), "author")
|
||||||
|
if author:
|
||||||
|
handle = g(author, "handle")
|
||||||
|
display_name = g(author, "displayName") or g(author, "display_name")
|
||||||
|
label = handle or display_name or _("Unknown")
|
||||||
|
title = _("Conversation with {0}").format(label)
|
||||||
|
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
pub.sendMessage(
|
pub.sendMessage(
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from controller.buffers.base import base
|
|||||||
from controller.blueski import messages as blueski_messages
|
from controller.blueski import messages as blueski_messages
|
||||||
from sessions.blueski import compose
|
from sessions.blueski import compose
|
||||||
from wxUI.buffers.blueski import panels as BlueskiPanels
|
from wxUI.buffers.blueski import panels as BlueskiPanels
|
||||||
|
from wxUI import commonMessageDialogs
|
||||||
|
|
||||||
log = logging.getLogger("controller.buffers.blueski.base")
|
log = logging.getLogger("controller.buffers.blueski.base")
|
||||||
|
|
||||||
@@ -504,12 +505,10 @@ class BaseBuffer(base.Buffer):
|
|||||||
import application
|
import application
|
||||||
controller = application.app.controller
|
controller = application.app.controller
|
||||||
|
|
||||||
|
details = self.get_selected_item_author_details()
|
||||||
handle = "Unknown"
|
handle = "Unknown"
|
||||||
if isinstance(item, dict):
|
if details:
|
||||||
handle = item.get("author", {}).get("handle", "Unknown")
|
handle = details.get("handle") or "Unknown"
|
||||||
else:
|
|
||||||
handle = getattr(getattr(item, "author", None), "handle", "Unknown")
|
|
||||||
|
|
||||||
title = _("Conversation: {0}").format(handle)
|
title = _("Conversation: {0}").format(handle)
|
||||||
|
|
||||||
controller.create_buffer(
|
controller.create_buffer(
|
||||||
@@ -690,6 +689,10 @@ class BaseBuffer(base.Buffer):
|
|||||||
|
|
||||||
def remove_buffer(self, force=False):
|
def remove_buffer(self, force=False):
|
||||||
if self.type in ("conversation", "chat_messages") or self.name.lower().startswith("conversation"):
|
if self.type in ("conversation", "chat_messages") or self.name.lower().startswith("conversation"):
|
||||||
|
if not force:
|
||||||
|
dlg = commonMessageDialogs.remove_buffer()
|
||||||
|
if dlg != widgetUtils.YES:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
self.session.db.pop(self.name, None)
|
self.session.db.pop(self.name, None)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@@ -368,6 +368,12 @@ class SearchBuffer(BaseBuffer):
|
|||||||
|
|
||||||
def remove_buffer(self, force=False):
|
def remove_buffer(self, force=False):
|
||||||
"""Search buffers can always be removed."""
|
"""Search buffers can always be removed."""
|
||||||
|
if not force:
|
||||||
|
from wxUI import commonMessageDialogs
|
||||||
|
import widgetUtils
|
||||||
|
dlg = commonMessageDialogs.remove_buffer()
|
||||||
|
if dlg != widgetUtils.YES:
|
||||||
|
return False
|
||||||
try:
|
try:
|
||||||
self.session.db.pop(self.name, None)
|
self.session.db.pop(self.name, None)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user