mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-31 05:10:45 -06:00
Add and remove user to list are implemented in GUI
This commit is contained in:
parent
756a58e443
commit
158b48e4d5
@ -174,6 +174,8 @@ class Controller(object):
|
|||||||
widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
|
widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.report_error, self.view.reportError)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.report_error, self.view.reportError)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.view_documentation, self.view.doc)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.view_documentation, self.view.doc)
|
||||||
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.add_to_list, self.view.addToList)
|
||||||
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_from_list, self.view.removeFromList)
|
||||||
|
|
||||||
def set_systray_icon(self):
|
def set_systray_icon(self):
|
||||||
self.systrayIcon = sysTrayIcon.SysTrayIcon()
|
self.systrayIcon = sysTrayIcon.SysTrayIcon()
|
||||||
@ -496,8 +498,32 @@ class Controller(object):
|
|||||||
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 remove_from_list(self, user):
|
def remove_from_list(self, *args, **kwargs):
|
||||||
pass
|
buff = self.get_best_buffer()
|
||||||
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
|
tweet = buff.get_right_tweet()
|
||||||
|
if buff.type != "people":
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
|
else:
|
||||||
|
users = [tweet["screen_name"]]
|
||||||
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
|
user = dlg.get_user()
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
dlg = dialogs.lists.removeUserListDialog()
|
||||||
|
dlg.populate_list([compose.compose_list(item) for item in buff.session.db["lists"]])
|
||||||
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
|
try:
|
||||||
|
list = buff.session.twitter.twitter.delete_list_member(list_id=buff.session.db["lists"][dlg.get_item()]["id"], screen_name=user)
|
||||||
|
older_list = utils.find_item(buff.session.db["lists"][dlg.get_item()]["id"], buff.session.db["lists"])
|
||||||
|
listBuffer = self.search_buffer("%s-list" % (buff.session.db["lists"][dlg.get_item()]["name"].lower()), buff.session.db["user_name"])
|
||||||
|
if listBuffer != None: listBuffer.get_user_ids()
|
||||||
|
buff.session.db["lists"].pop(older_list)
|
||||||
|
buff.session.db["lists"].append(list)
|
||||||
|
if listBuffer != None: pub.sendMessage("restart-streams", streams=["timelinesStream"], session=buff.session)
|
||||||
|
except TwythonError as e:
|
||||||
|
output.speak("error %s: %s" % (e.error_code, e.msg))
|
||||||
|
|
||||||
def list_manager(self, *args, **kwargs):
|
def list_manager(self, *args, **kwargs):
|
||||||
s = self.get_best_buffer().session
|
s = self.get_best_buffer().session
|
||||||
|
@ -123,6 +123,7 @@ class removeUserListDialog(listViewer):
|
|||||||
self.SetTitle(_(u"Select a list to remove the user"))
|
self.SetTitle(_(u"Select a list to remove the user"))
|
||||||
self.createBtn.SetLabel(_(u"Remove"))
|
self.createBtn.SetLabel(_(u"Remove"))
|
||||||
self.createBtn.SetDefault()
|
self.createBtn.SetDefault()
|
||||||
|
self.createBtn.SetId(wx.ID_OK)
|
||||||
self.editBtn.Disable()
|
self.editBtn.Disable()
|
||||||
self.view.Disable()
|
self.view.Disable()
|
||||||
# self.subscriptors.Disable()
|
# self.subscriptors.Disable()
|
||||||
|
@ -41,7 +41,6 @@ class mainFrame(wx.Frame):
|
|||||||
self.dm = user.Append(wx.NewId(), _(u"Direct me&ssage"))
|
self.dm = user.Append(wx.NewId(), _(u"Direct me&ssage"))
|
||||||
self.addToList = user.Append(wx.NewId(), _(u"&Add to list"))
|
self.addToList = user.Append(wx.NewId(), _(u"&Add to list"))
|
||||||
self.removeFromList = user.Append(wx.NewId(), _(u"R&emove from list"))
|
self.removeFromList = user.Append(wx.NewId(), _(u"R&emove from list"))
|
||||||
self.removeFromList.Enable(False)
|
|
||||||
self.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
|
self.viewLists = user.Append(wx.NewId(), _(u"&View lists"))
|
||||||
self.viewLists.Enable(False)
|
self.viewLists.Enable(False)
|
||||||
self.details = user.Append(wx.NewId(), _(u"Show user &profile"))
|
self.details = user.Append(wx.NewId(), _(u"Show user &profile"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user