mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Updated spanish translation, basic lists support
This commit is contained in:
parent
f51c873324
commit
e7943cba50
@ -369,7 +369,7 @@ class baseBufferController(bufferController):
|
||||
answer = commonMessageDialogs.retweet_question(self.buffer)
|
||||
if answer == widgetUtils.YES:
|
||||
self._retweet_with_comment(tweet, id)
|
||||
else:
|
||||
elif answer == widgetUtils.NO:
|
||||
self._direct_retweet(id)
|
||||
elif self.session.settings["general"]["retweet_mode"] == "direct":
|
||||
self._direct_retweet(id)
|
||||
@ -471,6 +471,26 @@ class baseBufferController(bufferController):
|
||||
user.profileController(session=self.session, user=dlg.get_user())
|
||||
if hasattr(dlg, "destroy"): dlg.destroy()
|
||||
|
||||
class listBufferController(baseBufferController):
|
||||
def __init__(self, parent, function, name, sessionObject, account, sound=None, bufferType=None, list_id=None, *args, **kwargs):
|
||||
super(listBufferController, self).__init__(parent, function, name, sessionObject, account, sound=None, bufferType=None, *args, **kwargs)
|
||||
self.users = []
|
||||
self.list_id = list_id
|
||||
self.kwargs["list_id"] = list_id
|
||||
|
||||
def start_stream(self):
|
||||
self.get_user_ids()
|
||||
super(listBufferController, self).start_stream()
|
||||
|
||||
def get_user_ids(self):
|
||||
self.users = []
|
||||
next_cursor = -1
|
||||
while(next_cursor):
|
||||
users = self.session.twitter.twitter.get_list_members(list_id=self.list_id, cursor=next_cursor, include_entities=False, skip_status=True)
|
||||
for i in users['users']:
|
||||
self.users.append(i["id"])
|
||||
next_cursor = users["next_cursor"]
|
||||
|
||||
class eventsBufferController(bufferController):
|
||||
def __init__(self, parent, name, session, account, *args, **kwargs):
|
||||
super(eventsBufferController, self).__init__(parent, *args, **kwargs)
|
||||
@ -765,3 +785,4 @@ class conversationBufferController(searchBufferController):
|
||||
self.put_items_on_list(number_of_items)
|
||||
if number_of_items > 0:
|
||||
self.session.sound.play("search_updated.ogg")
|
||||
|
||||
|
@ -51,6 +51,8 @@ class listsController(object):
|
||||
mode = "private"
|
||||
try:
|
||||
self.session.twitter.twitter.update_list(list_id=list["id"], name=name, description=description, mode=mode)
|
||||
self.session.get_lists()
|
||||
self.dialog.populate_list(self.get_all_lists(), True)
|
||||
except TwythonError as e:
|
||||
output.speak("error %s: %s" % (e.error_code, e.msg))
|
||||
dialog.destroy()
|
||||
|
@ -16,7 +16,7 @@ if system == "Windows":
|
||||
from issueReporter import issueReporter
|
||||
elif system == "Linux":
|
||||
from gtkUI import (view, commonMessageDialogs)
|
||||
from twitter import utils
|
||||
from twitter import utils, compose
|
||||
from sessionmanager import manager, sessionManager
|
||||
|
||||
import buffersController
|
||||
@ -110,6 +110,7 @@ class Controller(object):
|
||||
pub.subscribe(self.manage_blocked_user, "blocked-user")
|
||||
pub.subscribe(self.manage_unblocked_user, "unblocked-user")
|
||||
pub.subscribe(self.manage_item_in_timeline, "item-in-timeline")
|
||||
pub.subscribe(self.manage_item_in_list, "item-in-list")
|
||||
widgetUtils.connect_event(self.view, widgetUtils.CLOSE_EVENT, self.exit_)
|
||||
|
||||
def bind_other_events(self):
|
||||
@ -125,7 +126,7 @@ class Controller(object):
|
||||
pub.subscribe(self.invisible_shorcuts_changed, "invisible-shorcuts-changed")
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.show_hide, menuitem=self.view.show_hide)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.search, menuitem=self.view.menuitem_search)
|
||||
# widgetUtils.connect_event(self.view, widgetUtils.MENU, self.list_manager, menuitem=self.view.lists)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.list_manager, menuitem=self.view.lists)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_trending_topics, menuitem=self.view.trends)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.accountConfiguration, menuitem=self.view.account_settings)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.configuration, menuitem=self.view.prefs)
|
||||
@ -330,6 +331,14 @@ class Controller(object):
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Favourites timeline for {}".format(i)), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
lists = buffersController.emptyPanel(self.view.nb, "lists", session.db["user_name"])
|
||||
self.buffers.append(lists)
|
||||
self.view.insert_buffer(lists.buffer , name=_(u"Lists"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
for i in session.settings["other_buffers"]["lists"]:
|
||||
tl = buffersController.listBufferController(self.view.nb, "get_list_statuses", "%s-list" % (i,), session, session.db["user_name"], bufferType=None, list_id=utils.find_list(i, session.db["lists"]))
|
||||
session.lists.append(tl)
|
||||
self.buffers.append(tl)
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"List for {}").format(i), pos=self.view.search("timelines", session.db["user_name"]))
|
||||
searches = buffersController.emptyPanel(self.view.nb, "searches", session.db["user_name"])
|
||||
self.buffers.append(searches)
|
||||
self.view.insert_buffer(searches.buffer , name=_(u"Searches"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
@ -430,8 +439,29 @@ class Controller(object):
|
||||
def view_user_lists(self, users):
|
||||
pass
|
||||
|
||||
def add_to_list(self, user):
|
||||
pass
|
||||
def add_to_list(self, *args, **kwargs):
|
||||
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.addUserListDialog()
|
||||
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.add_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"])
|
||||
buff.session.db["lists"].pop(older_list)
|
||||
buff.session.db["lists"].append(list)
|
||||
except TwythonError as e:
|
||||
output.speak("error %s: %s" % (e.error_code, e.msg))
|
||||
|
||||
def remove_from_list(self, user):
|
||||
pass
|
||||
@ -1099,6 +1129,14 @@ class Controller(object):
|
||||
output.speak(_(u"One tweet from %s") % (data["user"]["name"]))
|
||||
buffer.add_new_item(data)
|
||||
|
||||
def manage_item_in_list(self, data, user, where):
|
||||
buffer = self.search_buffer("%s" % (where,), user)
|
||||
play_sound = "tweet_timeline.ogg"
|
||||
if "%s" % (where,) not in buffer.session.settings["other_buffers"]["muted_buffers"]:
|
||||
self.notify(buffer.session, play_sound=play_sound)
|
||||
output.speak(_(u"One tweet from %s") % (data["user"]["name"]))
|
||||
buffer.add_new_item(data)
|
||||
|
||||
def start_buffers(self, session):
|
||||
log.debug("starting buffers... Session %s" % (session.session_id,))
|
||||
for i in self.buffers:
|
||||
|
@ -13,7 +13,7 @@ actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")),
|
||||
("limit", _(u"Boundary reached.")),
|
||||
("list_tweet", _(u"List updated.")),
|
||||
("max_length", _(u"Too many characters.")),
|
||||
("mention_received", _(u"Mension received.")),
|
||||
("mention_received", _(u"Mention received.")),
|
||||
("new_event", _(u"New event.")),
|
||||
("ready", _(unicode(application.name+" is ready."))),
|
||||
("reply_send", _(u"Mention sent.")),
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -94,6 +94,8 @@ class Session(object):
|
||||
self.db = {}
|
||||
self.reconnection_function_active = False
|
||||
self.counter = 0
|
||||
self.lists = []
|
||||
pub.subscribe(self.add_friends, "friends-receibed")
|
||||
|
||||
@property
|
||||
def is_logged(self):
|
||||
@ -308,10 +310,15 @@ class Session(object):
|
||||
ids = ""
|
||||
for i in self.settings["other_buffers"]["timelines"]:
|
||||
ids = ids + "%s, " % (self.db[i+"-timeline"][0]["user"]["id_str"])
|
||||
# if ids != "":
|
||||
for i in self.lists:
|
||||
for z in i.users:
|
||||
ids += str(z) + ", "
|
||||
if ids != "":
|
||||
stream_threaded(self.timelinesStream.statuses.filter, self.session_id, follow=ids)
|
||||
|
||||
def add_friends(self):
|
||||
self.timelinesStream.set_friends(self.main_stream.friends)
|
||||
|
||||
def listen_stream_error(self):
|
||||
if hasattr(self, "main_stream"):
|
||||
log.debug("Disconnecting the main stream...")
|
||||
|
@ -18,6 +18,7 @@ class timelinesStreamer(TwythonStreamer):
|
||||
auth = HTTPProxyAuth(config.app["proxy"]["user"], config.app["proxy"]["password"])
|
||||
args["auth"] = auth
|
||||
super(timelinesStreamer, self).__init__(app_key, app_secret, oauth_token, oauth_token_secret, timeout=60, retry_count=None, retry_in=180, client_args=args, handlers=None, chunk_size=1)
|
||||
self.lists = self.session.lists
|
||||
|
||||
def on_error(self, status_code, data):
|
||||
log.debug("%s: %s" % (status_code, data))
|
||||
@ -32,19 +33,27 @@ class timelinesStreamer(TwythonStreamer):
|
||||
if self.session.settings["general"]["reverse_timelines"] == False: self.session.db["%s-timeline" % (i,)].append(data)
|
||||
else: self.session.db["%s-timeline" % (i,)].insert(0, data)
|
||||
pub.sendMessage("item-in-timeline", data= data, user= self.session.db["user_name"], who= i)
|
||||
for i in self.session.lists:
|
||||
try:
|
||||
i.users.index(data["user"]["id"])
|
||||
usr = data["in_reply_to_user_id"]
|
||||
if (usr != None and usr in self.friends) or data.has_key("retweeted_status"):
|
||||
if self.session.settings["general"]["reverse_timelines"] == False: self.session.db["%s" % (i.name,)].append(data)
|
||||
else: self.session.db["%s" % (i,)].insert(0, data)
|
||||
pub.sendMessage("item-in-list", data= data, user= self.session.db["user_name"], where= i.name)
|
||||
elif usr == None:
|
||||
if self.session.settings["general"]["reverse_timelines"] == False: self.session.db["%s" % (i.name,)].append(data)
|
||||
else: self.session.db["%s" % (i,)].insert(0, data)
|
||||
pub.sendMessage("item-in-list", data= data, user= self.session.db["user_name"], where= i.name)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
def on_success(self, data):
|
||||
# try:
|
||||
if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
|
||||
self.check_tls(data)
|
||||
# except:
|
||||
# pass
|
||||
|
||||
class listsStreamer(timelinesStreamer):
|
||||
def set_friends(self, friends):
|
||||
self.friends = friends
|
||||
|
||||
def on_success(self, data):
|
||||
try:
|
||||
if "text" in data:
|
||||
pub.sendMessage("item-in-list", **{"data": data, "user": self.session.db["user_name"]})
|
||||
if "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
|
||||
self.check_tls(data)
|
||||
except:
|
||||
pass
|
@ -109,6 +109,7 @@ class streamer(TwythonStreamer):
|
||||
self.process_dm(data)
|
||||
elif "friends" in data:
|
||||
self.friends = data["friends"]
|
||||
pub.sendMessage("friends-receibed")
|
||||
elif "text" in data and utils.is_allowed(data, self.session.settings["twitter"]["ignored_clients"]) == True:
|
||||
if data["user"]["id"] in self.muted_users: return
|
||||
self.check_mentions(data)
|
||||
|
@ -6,4 +6,3 @@ class listPanel(basePanel):
|
||||
def __init__(self, parent, name):
|
||||
super(listPanel, self).__init__(parent, name)
|
||||
self.type = "list"
|
||||
self.users = []
|
||||
|
@ -32,13 +32,18 @@ class listViewer(widgetUtils.BaseDialog):
|
||||
btnSizer.Add(self.cancelBtn)
|
||||
panel.SetSizer(sizer)
|
||||
|
||||
def populate_list(self, lists):
|
||||
def populate_list(self, lists, clear=False):
|
||||
if clear == True:
|
||||
self.clear()
|
||||
for item in lists:
|
||||
self.lista.insert_item(False, *item)
|
||||
|
||||
def get_item(self):
|
||||
return self.lista.get_selected()
|
||||
|
||||
def clear(self):
|
||||
self.lista.clear()
|
||||
|
||||
class userListViewer(listViewer):
|
||||
def __init__(self, username, *args, **kwargs):
|
||||
self.username = username
|
||||
@ -102,12 +107,16 @@ class addUserListDialog(listViewer):
|
||||
self.SetTitle(_(u"Select a list to add the user"))
|
||||
self.createBtn.SetLabel(_(u"Add"))
|
||||
self.createBtn.SetDefault()
|
||||
self.createBtn.Bind(wx.EVT_BUTTON, self.ok)
|
||||
self.editBtn.Disable()
|
||||
self.view.Disable()
|
||||
# self.subscriptors.Disable()
|
||||
# self.members.Disable()
|
||||
self.deleteBtn.Disable()
|
||||
|
||||
def ok(self, *args, **kwargs):
|
||||
self.EndModal(wx.ID_OK)
|
||||
|
||||
class removeUserListDialog(listViewer):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(removeUserListDialog, self).__init__(*args, **kwargs)
|
||||
|
@ -18,7 +18,6 @@ class mainFrame(wx.Frame):
|
||||
self.menuitem_search = app.Append(wx.NewId(), _(u"&Search"))
|
||||
self.trends = app.Append(wx.NewId(), _(u"View &trending topics"))
|
||||
self.lists = app.Append(wx.NewId(), _(u"&Lists manager"))
|
||||
self.lists.Enable(False)
|
||||
self.keystroke_editor = app.Append(wx.NewId(), _(u"&Edit keystrokes"))
|
||||
self.account_settings = app.Append(wx.NewId(), _(u"Account se&ttings"))
|
||||
self.prefs = app.Append(wx.ID_PREFERENCES, _(u"&Global settings"))
|
||||
|
@ -5,7 +5,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2015-04-15 20:24+Hora de verano central (México)\n"
|
||||
"POT-Creation-Date: 2015-04-23 12:54+Hora de verano central (México)\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
579
tools/twblue.pot
579
tools/twblue.pot
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user