mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-29 22:23:12 -06:00
Opening lists as a buffer is now possible from the list manager
This commit is contained in:
parent
f09ff43672
commit
83575b14b9
@ -4,6 +4,7 @@ import output
|
|||||||
from wxUI.dialogs import lists
|
from wxUI.dialogs import lists
|
||||||
from twython import TwythonError
|
from twython import TwythonError
|
||||||
from twitter import compose, utils
|
from twitter import compose, utils
|
||||||
|
from pubsub import pub
|
||||||
|
|
||||||
class listsController(object):
|
class listsController(object):
|
||||||
def __init__(self, session, user=None):
|
def __init__(self, session, user=None):
|
||||||
@ -14,6 +15,7 @@ class listsController(object):
|
|||||||
self.dialog.populate_list(self.get_all_lists())
|
self.dialog.populate_list(self.get_all_lists())
|
||||||
widgetUtils.connect_event(self.dialog.createBtn, widgetUtils.BUTTON_PRESSED, self.create_list)
|
widgetUtils.connect_event(self.dialog.createBtn, widgetUtils.BUTTON_PRESSED, self.create_list)
|
||||||
widgetUtils.connect_event(self.dialog.editBtn, widgetUtils.BUTTON_PRESSED, self.edit_list)
|
widgetUtils.connect_event(self.dialog.editBtn, widgetUtils.BUTTON_PRESSED, self.edit_list)
|
||||||
|
widgetUtils.connect_event(self.dialog.view, widgetUtils.BUTTON_PRESSED, self.open_list_as_buffer)
|
||||||
self.dialog.get_response()
|
self.dialog.get_response()
|
||||||
|
|
||||||
def get_all_lists(self):
|
def get_all_lists(self):
|
||||||
@ -67,3 +69,8 @@ class listsController(object):
|
|||||||
self.dialog.lista.remove_item(self.dialog.get_item())
|
self.dialog.lista.remove_item(self.dialog.get_item())
|
||||||
except TwythonError as e:
|
except TwythonError as e:
|
||||||
output.speak("error %s: %s" % (e.error_code, e.msg))
|
output.speak("error %s: %s" % (e.error_code, e.msg))
|
||||||
|
|
||||||
|
def open_list_as_buffer(self, *args, **kwargs):
|
||||||
|
if self.dialog.lista.get_count() == 0: return
|
||||||
|
list = self.session.db["lists"][self.dialog.get_item()]
|
||||||
|
pub.sendMessage("create-new-buffer", buffer="list", account=self.session.db["user_name"], create=list["slug"])
|
@ -1197,6 +1197,17 @@ class Controller(object):
|
|||||||
self.view.insert_buffer(events.buffer, name=_(u"Events"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"]))
|
self.view.insert_buffer(events.buffer, name=_(u"Events"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"]))
|
||||||
elif create == False:
|
elif create == False:
|
||||||
self.destroy_buffer(buffer, buff.session.db["user_name"])
|
self.destroy_buffer(buffer, buff.session.db["user_name"])
|
||||||
|
elif buffer == "list":
|
||||||
|
if create in buff.session.settings["other_buffers"]["lists"]:
|
||||||
|
output.speak(_(u"This list is already opened"), True)
|
||||||
|
return
|
||||||
|
tl = buffersController.listBufferController(self.view.nb, "get_list_statuses", create+"-list", buff.session, buff.session.db["user_name"], bufferType=None, list_id=utils.find_list(create, buff.session.db["lists"]))
|
||||||
|
buff.session.lists.append(tl)
|
||||||
|
self.buffers.append(tl)
|
||||||
|
self.view.insert_buffer(tl.buffer, name=_(u"List for {}").format(create), pos=self.view.search("lists", buff.session.db["user_name"]))
|
||||||
|
tl.start_stream()
|
||||||
|
buff.session.settings["other_buffers"]["lists"].append(create)
|
||||||
|
pub.sendMessage("restart-streams", streams=["timelinesStream"], session=buff.session)
|
||||||
|
|
||||||
def restart_streams(self, streams=[], session=None):
|
def restart_streams(self, streams=[], session=None):
|
||||||
for i in streams:
|
for i in streams:
|
||||||
|
Loading…
Reference in New Issue
Block a user