mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Started implementation of community timelines
This commit is contained in:
parent
2a1d86f917
commit
b39ccb9f2c
@ -153,6 +153,7 @@ class Controller(object):
|
|||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.toggle_buffer_mute, self.view.mute_buffer)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.toggle_buffer_mute, self.view.mute_buffer)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_timeline, self.view.timeline)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_timeline, self.view.timeline)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_favs_timeline, self.view.favs)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_favs_timeline, self.view.favs)
|
||||||
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.new_community_buffer, self.view.new_community_buffer)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_conversation, menuitem=self.view.view_conversation)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.open_conversation, menuitem=self.view.view_conversation)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekLeft, menuitem=self.view.seekLeft)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekLeft, menuitem=self.view.seekLeft)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekRight, menuitem=self.view.seekRight)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.seekRight, menuitem=self.view.seekRight)
|
||||||
@ -1148,3 +1149,9 @@ class Controller(object):
|
|||||||
handler = self.get_handler(type=buffer.session.type)
|
handler = self.get_handler(type=buffer.session.type)
|
||||||
if handler and hasattr(handler, 'openFollowingTimeline'):
|
if handler and hasattr(handler, 'openFollowingTimeline'):
|
||||||
handler.openFollowingTimeline(self, buffer, user)
|
handler.openFollowingTimeline(self, buffer, user)
|
||||||
|
|
||||||
|
def new_community_buffer(self, *args, user=None):
|
||||||
|
buffer = self.get_best_buffer()
|
||||||
|
handler = self.get_handler(type=buffer.session.type)
|
||||||
|
if handler and hasattr(handler, 'new_community_buffer'):
|
||||||
|
handler.new_community_buffer(self, buffer)
|
||||||
|
@ -10,7 +10,7 @@ from wxUI.dialogs.mastodon import dialogs
|
|||||||
from wxUI.dialogs import userAliasDialogs
|
from wxUI.dialogs import userAliasDialogs
|
||||||
from wxUI import commonMessageDialogs
|
from wxUI import commonMessageDialogs
|
||||||
from wxUI.dialogs.mastodon import updateProfile as update_profile_dialogs
|
from wxUI.dialogs.mastodon import updateProfile as update_profile_dialogs
|
||||||
from wxUI.dialogs.mastodon import showUserProfile
|
from wxUI.dialogs.mastodon import showUserProfile, communityTimeline
|
||||||
from sessions.mastodon.utils import html_filter
|
from sessions.mastodon.utils import html_filter
|
||||||
from . import userActions, settings
|
from . import userActions, settings
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class Handler(object):
|
|||||||
details=_("Show user profile"),
|
details=_("Show user profile"),
|
||||||
favs=None,
|
favs=None,
|
||||||
# In buffer Menu.
|
# In buffer Menu.
|
||||||
trends=None,
|
new_community_buffer=_("New community buffer"),
|
||||||
filter=None,
|
filter=None,
|
||||||
manage_filters=None
|
manage_filters=None
|
||||||
)
|
)
|
||||||
@ -105,6 +105,8 @@ class Handler(object):
|
|||||||
searches_position =controller.view.search("searches", name)
|
searches_position =controller.view.search("searches", name)
|
||||||
for term in session.settings["other_buffers"]["post_searches"]:
|
for term in session.settings["other_buffers"]["post_searches"]:
|
||||||
pub.sendMessage("createBuffer", buffer_type="SearchBuffer", session_type=session.type, buffer_title=_("Search for {}").format(term), parent_tab=searches_position, start=True, kwargs=dict(parent=controller.view.nb, compose_func="compose_post", function="search", name="%s-searchterm" % (term,), sessionObject=session, account=session.get_name(), sound="search_updated.ogg", q=term, result_type="statuses"))
|
pub.sendMessage("createBuffer", buffer_type="SearchBuffer", session_type=session.type, buffer_title=_("Search for {}").format(term), parent_tab=searches_position, start=True, kwargs=dict(parent=controller.view.nb, compose_func="compose_post", function="search", name="%s-searchterm" % (term,), sessionObject=session, account=session.get_name(), sound="search_updated.ogg", q=term, result_type="statuses"))
|
||||||
|
pub.sendMessage("createBuffer", buffer_type="EmptyBuffer", session_type="base", buffer_title=_("Communities"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, name="communities", account=name))
|
||||||
|
communities_position =controller.view.search("communities", name)
|
||||||
# for i in session.settings["other_buffers"]["trending_topic_buffers"]:
|
# for i in session.settings["other_buffers"]["trending_topic_buffers"]:
|
||||||
# pub.sendMessage("createBuffer", buffer_type="TrendsBuffer", session_type=session.type, buffer_title=_("Trending topics for %s") % (i), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, name="%s_tt" % (i,), sessionObject=session, name, trendsFor=i, sound="trends_updated.ogg"))
|
# pub.sendMessage("createBuffer", buffer_type="TrendsBuffer", session_type=session.type, buffer_title=_("Trending topics for %s") % (i), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, name="%s_tt" % (i,), sessionObject=session, name, trendsFor=i, sound="trends_updated.ogg"))
|
||||||
|
|
||||||
@ -359,3 +361,16 @@ class Handler(object):
|
|||||||
user = buffer.session.api.account(selectedUser[-1])
|
user = buffer.session.api.account(selectedUser[-1])
|
||||||
dlg = showUserProfile.ShowUserProfile(user)
|
dlg = showUserProfile.ShowUserProfile(user)
|
||||||
dlg.ShowModal()
|
dlg.ShowModal()
|
||||||
|
|
||||||
|
def new_community_buffer(self, buffer, *args, **kwargs):
|
||||||
|
dlg = communityTimeline.CommunityTimeline()
|
||||||
|
if dlg.ShowModal() != wx.ID_OK:
|
||||||
|
return
|
||||||
|
url = dlg.url.GetValue()
|
||||||
|
bufftype = dlg.get_action()
|
||||||
|
dlg.Destroy()
|
||||||
|
tl_info = f"{bufftype}@{url}"
|
||||||
|
if tl_info in buffer.session.settings["other_buffers"]["communities"]:
|
||||||
|
return # buffer already exists.
|
||||||
|
buffer.session.settings["other_buffers"]["communities"].append(tl_info)
|
||||||
|
buffer.session.settings.write()
|
@ -30,6 +30,7 @@ indicate_img = boolean(default=True)
|
|||||||
[other_buffers]
|
[other_buffers]
|
||||||
timelines = list(default=list())
|
timelines = list(default=list())
|
||||||
searches = list(default=list())
|
searches = list(default=list())
|
||||||
|
communities = list(default=list())
|
||||||
lists = list(default=list())
|
lists = list(default=list())
|
||||||
followers_timelines = list(default=list())
|
followers_timelines = list(default=list())
|
||||||
following_timelines = list(default=list())
|
following_timelines = list(default=list())
|
||||||
|
38
src/wxUI/dialogs/mastodon/communityTimeline.py
Normal file
38
src/wxUI/dialogs/mastodon/communityTimeline.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import wx
|
||||||
|
|
||||||
|
class CommunityTimeline(wx.Dialog):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(CommunityTimeline, self).__init__(parent=None, *args, **kwargs)
|
||||||
|
panel = wx.Panel(self)
|
||||||
|
communitySizer = wx.BoxSizer()
|
||||||
|
self.SetTitle(_("Create community buffer"))
|
||||||
|
communityLabel = wx.StaticText(panel, -1, _("Community URL"))
|
||||||
|
self.url = wx.TextCtrl(panel, -1)
|
||||||
|
self.url.SetFocus()
|
||||||
|
communitySizer.Add(communityLabel, 0, wx.ALL, 5)
|
||||||
|
communitySizer.Add(self.url, 0, wx.ALL, 5)
|
||||||
|
actionSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
label2 = wx.StaticText(panel, -1, _(u"Buffer type"))
|
||||||
|
self.local= wx.RadioButton(panel, -1, _("Local timeline"), style=wx.RB_GROUP)
|
||||||
|
self.federated= wx.RadioButton(panel, -1, _("Federated Timeline"))
|
||||||
|
hSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
|
hSizer.Add(label2, 0, wx.ALL, 5)
|
||||||
|
actionSizer.Add(self.local, 0, wx.ALL, 5)
|
||||||
|
actionSizer.Add(self.federated, 0, wx.ALL, 5)
|
||||||
|
hSizer.Add(actionSizer, 0, wx.ALL, 5)
|
||||||
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
|
||||||
|
ok.SetDefault()
|
||||||
|
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
|
||||||
|
btnsizer = wx.BoxSizer()
|
||||||
|
btnsizer.Add(ok)
|
||||||
|
btnsizer.Add(cancel)
|
||||||
|
sizer.Add(communitySizer)
|
||||||
|
sizer.Add(hSizer, 0, wx.ALL, 5)
|
||||||
|
sizer.Add(btnsizer)
|
||||||
|
panel.SetSizer(sizer)
|
||||||
|
|
||||||
|
def get_action(self):
|
||||||
|
if self.local.GetValue() == True: return "local"
|
||||||
|
elif self.federated.GetValue() == True: return "federated"
|
@ -52,6 +52,7 @@ class mainFrame(wx.Frame):
|
|||||||
# buffer menu
|
# buffer menu
|
||||||
self.menubar_buffer = wx.Menu()
|
self.menubar_buffer = wx.Menu()
|
||||||
self.update_buffer = self.menubar_buffer.Append(wx.ID_ANY, _(u"&Update buffer"))
|
self.update_buffer = self.menubar_buffer.Append(wx.ID_ANY, _(u"&Update buffer"))
|
||||||
|
self.new_community_buffer= self.menubar_buffer.Append(wx.ID_ANY, _("New community buffer"))
|
||||||
self.trends = self.menubar_buffer.Append(wx.ID_ANY, _(u"New &trending topics buffer..."))
|
self.trends = self.menubar_buffer.Append(wx.ID_ANY, _(u"New &trending topics buffer..."))
|
||||||
self.filter = self.menubar_buffer.Append(wx.ID_ANY, _(u"Create a &filter"))
|
self.filter = self.menubar_buffer.Append(wx.ID_ANY, _(u"Create a &filter"))
|
||||||
self.manage_filters = self.menubar_buffer.Append(wx.ID_ANY, _(u"&Manage filters"))
|
self.manage_filters = self.menubar_buffer.Append(wx.ID_ANY, _(u"&Manage filters"))
|
||||||
|
Loading…
Reference in New Issue
Block a user