mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Merge branch 'next-gen' of https://github.com/manuelcortez/TWBlue into next-gen
This commit is contained in:
commit
7cdda6806b
20
README.md
20
README.md
@ -4,11 +4,11 @@ TWBlue - Next generation
|
||||
Note
|
||||
======
|
||||
|
||||
Please note that this branch is a new generation of TWBlue, so the code is been written using the MVC design pattern and it is very unstable. This code does not works properly and it is not recommended its use, only you use this code for testing purposes. You may find some huge bugs, because we're written most of the source code from scratch.
|
||||
Please note that this branch is a new generation of TWBlue. The code has been rewritten using the MVC design pattern. It is very unstable. This code may not work properly and it's use is not recommended. Only use for testing purposes.
|
||||
|
||||
TWBlue, an accessible, open source and multiplatform twitter application.
|
||||
|
||||
TW Blue is an app designed to use Twitter in a simple and fast way and avoiding, as far as possible, the consumtion of excessive resources of the machine where it’s running. With this app you’ll have access to twitter features such as:
|
||||
TW Blue is an app designed to use Twitter simply and efficiently while using minimal system resources.
|
||||
With this app you’ll have access to twitter features such as:
|
||||
|
||||
* Create, reply to, retweet and delete tweets,
|
||||
* Add and remove tweets from favourites,
|
||||
@ -16,11 +16,11 @@ TW Blue is an app designed to use Twitter in a simple and fast way and avoiding,
|
||||
* See your friends and followers,
|
||||
* Follow, unfollow, block and report users as spam,
|
||||
* Open a user’s timeline, which will allow you to get that user’s tweets separately,
|
||||
* Open URL addresses when attached to a tweet or direct message,
|
||||
* Play various file and URL types which contain audio
|
||||
* Open URLs when attached to a tweet or direct message,
|
||||
* Play audio tweets
|
||||
* and more!
|
||||
|
||||
See the [TWBlue's webpage](http://twblue.es) for more details.
|
||||
See [TWBlue's webpage](http://twblue.es) for more details.
|
||||
|
||||
## Using TWBlue from sources
|
||||
|
||||
@ -92,15 +92,15 @@ This dependency has been built using pure basic 4.61. Its source can be found at
|
||||
|
||||
### Running TW Blue from source
|
||||
|
||||
Now that you have installed all these packages, you can run TW Blue from source using a command prompt. Navigate to the src directory into the repo, and type the following command:
|
||||
Now that you have installed all these packages, you can run TW Blue from source using a command prompt. Navigate to the repo's src directory, and type the following command:
|
||||
|
||||
python main.py
|
||||
|
||||
If necesary, change the first part of the command to reflect where is your python executable. You can run TW Blue using python x86 and x64
|
||||
If necessary, change the first part of the command to reflect the location of your python executable. You can run TW Blue using python x86 and x64
|
||||
|
||||
### Building a binary version
|
||||
|
||||
A binary version doesn't need python and the other dependencies to run, it's the same version that you will find in TW Blue website if you download the zip files.
|
||||
A binary version doesn't need python and the other dependencies to run, it's the same version that you will find on the TW Blue website if you download the zip files.
|
||||
|
||||
To build it, run the following command from the src folder:
|
||||
|
||||
@ -110,4 +110,4 @@ To build it, run the following command from the src folder:
|
||||
|
||||
### How to generate a translation template
|
||||
|
||||
You must run the gen_pot.bat file, located in the tools directory. Your python installation should be in your path environment variable. The pot file will appear in the tools directory too.
|
||||
Run the gen_pot.bat file, located in the tools directory. Your python installation must be in your path environment variable. The pot file will appear in the tools directory.
|
@ -1,4 +1,5 @@
|
||||
Manuel E. Cortéz
|
||||
Bill Dengler
|
||||
Johana Hidrobo
|
||||
Marcelo Sosa
|
||||
Isabel del Castillo
|
||||
|
@ -10,7 +10,7 @@ else:
|
||||
author = u"Manuel Cortéz"
|
||||
authorEmail = "manuel@manuelcortez.net"
|
||||
copyright = u"copyright (C) 2013-2015, Manuel cortéz"
|
||||
description = u"TW Blue is an app designed to use Twitter in a simple and fast way and avoiding, as far as possible, the consumtion of excessive resources of the machine where it’s running. With this app you’ll have access to most twitter features."
|
||||
translators = [u"Bryner Villalobos (English)", u"Mohammed Al Shara (Arabic)", u"Joan Rabat, Juan Carlos Rivilla (Catalan)", u"Manuel cortéz (Spanish)", u"Sukil Etxenike Arizaleta (Basque)", u"Jani Kinnunen (finnish)", u"Rémy Ruiz (French)", u"Alba Quinteiro (Galician)", u"Steffen Schultz (German)", u"Robert Osztolykan (Hungarian)", u"Paweł Masarczyk (Polish)", u"Odenilton Júnior Santos (Portuguese)", u"Alexander Jaszyn (Russian)", u"Burak (Turkish)"]
|
||||
description = u"TW Blue is an app designed to use Twitter simply and efficiently while using minimal system resources. This app provides access to most Twitter features."
|
||||
translators = [u"Bryner Villalobos, Bill Dengler (English)", u"Mohammed Al Shara (Arabic)", u"Joan Rabat, Juan Carlos Rivilla (Catalan)", u"Manuel cortéz (Spanish)", u"Sukil Etxenike Arizaleta (Basque)", u"Jani Kinnunen (finnish)", u"Rémy Ruiz (French)", u"Alba Quinteiro (Galician)", u"Steffen Schultz (German)", u"Robert Osztolykan (Hungarian)", u"Paweł Masarczyk (Polish)", u"Odenilton Júnior Santos (Portuguese)", u"Alexander Jaszyn (Russian)", u"Burak (Turkish)"]
|
||||
url = u"http://twblue.es"
|
||||
report_bugs_url = "http://twblue.es/bugs/api/soap/mantisconnect.php?wsdl"
|
||||
|
@ -6,9 +6,9 @@ log = logging.getLogger("commandlineLauncher")
|
||||
|
||||
parser = argparse.ArgumentParser(description="TW Blue command line launcher")
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument("-p", "--portable", help="Use TW Blue as a portable aplication", action="store_true", default=True)
|
||||
group.add_argument("-i", "--installed", help="Use TW Blue as an installed application. Config files will be saved on the user data directory", action="store_true")
|
||||
parser.add_argument("-d", "--data-directory", action="store", dest="directory", help="Specifies the directory where TW Blue saves the data files")
|
||||
group.add_argument("-p", "--portable", help="Use TW Blue as a portable application.", action="store_true", default=True)
|
||||
group.add_argument("-i", "--installed", help="Use TW Blue as an installed application. Config files will be saved in the user data directory", action="store_true")
|
||||
parser.add_argument("-d", "--data-directory", action="store", dest="directory", help="Specifies the directory where TW Blue saves userdata.")
|
||||
args = parser.parse_args()
|
||||
log.debug("Starting TWBlue with the following arguments: installed = %s, portable = %s and directory = %s" % (args.installed, args.portable, args.directory))
|
||||
if args.installed == True: paths.mode = "installed"
|
||||
|
11
src/extra/SoundsTutorial/reverse_sort.py
Normal file
11
src/extra/SoundsTutorial/reverse_sort.py
Normal file
@ -0,0 +1,11 @@
|
||||
#Reverse sort, by Bill Dengler <codeofdusk@gmail.com> for use in TWBlue http://twblue.es
|
||||
def invert_tuples(t):
|
||||
"Invert a list of tuples, so that the 0th element becomes the -1th, and the -1th becomes the 0th."
|
||||
res=[]
|
||||
for i in t:
|
||||
res.append(i[::-1])
|
||||
return res
|
||||
|
||||
def reverse_sort(t):
|
||||
"Sorts a list of tuples/lists by their last elements, not their first."
|
||||
return invert_tuples(sorted(invert_tuples(t)))
|
@ -4,6 +4,7 @@ import widgetUtils
|
||||
import os
|
||||
import paths
|
||||
import logging
|
||||
import reverse_sort
|
||||
log = logging.getLogger("extra.SoundsTutorial.soundsTutorial")
|
||||
import soundsTutorial_constants
|
||||
if platform.system() == "Windows":
|
||||
@ -22,6 +23,8 @@ class soundsTutorial(object):
|
||||
self.files = []
|
||||
log.debug("Searching sound files...")
|
||||
[self.files.append(i[0]) for i in soundsTutorial_constants.actions]
|
||||
log.debug("Alphabetizing actions...")
|
||||
actions=reverse_sort.reverse_sort(actions)
|
||||
log.debug("Creating dialog...")
|
||||
self.dialog = UI.soundsTutorialDialog(self.actions)
|
||||
widgetUtils.connect_event(self.dialog.play, widgetUtils.BUTTON_PRESSED, self.on_play)
|
||||
|
@ -1,25 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
actions = [ ("audio", _(u"The tweet may contain a playable audio")),
|
||||
("create_timeline", _(u"A timeline has been created")),
|
||||
("delete_timeline", _(u"A timeline has been deleted")),
|
||||
("dm_received", _(u"You've received a direct message")),
|
||||
("dm_sent", _(u"You've sent a direct message")),
|
||||
("error", _(u"A bug has happened")),
|
||||
("favourite", _(u"You've added a tweet to your favourites")),
|
||||
("favourites_timeline_updated", _(u"Someone's favourites have been updated")),
|
||||
("geo", _(u"The tweet has coordinates to determine its location")),
|
||||
("limit", _(u"There are no more tweets to read")),
|
||||
("list_tweet", _(u"A list has a new tweet")),
|
||||
("max_length", _(u"You can't add any more characters on the tweet")),
|
||||
("mention_received", _(u"You've been mentioned ")),
|
||||
("new_event", _(u"A new event has happened")),
|
||||
("ready", _(u"TW Blue is ready ")),
|
||||
("reply_send", _(u"You've replied")),
|
||||
("retweet_send", _(u"You've retweeted")),
|
||||
("search_updated", _(u"A search has been updated")),
|
||||
("tweet_received", _(u"There's a new tweet in the main buffer")),
|
||||
("tweet_send", _(u"You've sent a tweet")),
|
||||
("trends_updated", _(u"A trending topic buffer has been updated")),
|
||||
("tweet_timeline", _(u"There's a new tweet in a timeline")),
|
||||
("update_followers", _(u"You have a new follower")),
|
||||
("volume_changed", _(u"You've turned the volume up or down"))]
|
||||
actions = [ ("audio", _(u"Audio tweet.")),
|
||||
("create_timeline", _(u"User-defined buffer created.")),
|
||||
("delete_timeline", _(u"User-defined buffer destroied.")),
|
||||
("dm_received", _(u"Direct message received.")),
|
||||
("dm_sent", _(u"Direct message sent.")),
|
||||
("error", _(u"Error.")),
|
||||
("favourite", _(u"You favorited a tweet.")),
|
||||
("favourites_timeline_updated", _(u"Someone's favourites have been updated.")),
|
||||
("geo", _(u"Geotweet.")),
|
||||
("limit", _(u"Boundary reached.")),
|
||||
("list_tweet", _(u"List updated.")),
|
||||
("max_length", _(u"Too many characters.")),
|
||||
("mention_received", _(u"You've been mentioned.")),
|
||||
("new_event", _(u"New event.")),
|
||||
("ready", _(u"Application is ready.")),
|
||||
("reply_send", _(u"You've replied publicly.")),
|
||||
("retweet_send", _(u"You've retweeted.")),
|
||||
("search_updated", _(u"A search buffer has been updated.")),
|
||||
("tweet_received", _(u"New tweet in home buffer.")),
|
||||
("tweet_send", _(u"You've sent a tweet.")),
|
||||
("trends_updated", _(u"A trending topic buffer has been updated.")),
|
||||
("tweet_timeline", _(u"New tweet in user-defined buffer.")),
|
||||
("update_followers", _(u"New follower.")),
|
||||
("volume_changed", _(u"Volume changed."))]
|
@ -25,14 +25,14 @@ class Session(object):
|
||||
|
||||
def _require_login(fn):
|
||||
|
||||
""" Decorator for checking if the user is logged (a twitter object has credentials) on twitter.
|
||||
Some functions may need this to avoid make unneeded twitter API calls."""
|
||||
""" Decorator for checking if the user is logged in(a twitter object has credentials) on twitter.
|
||||
Some functions may need this to avoid making unneeded twitter API calls."""
|
||||
|
||||
def f(self, *args, **kwargs):
|
||||
if self.logged == True:
|
||||
fn(self, *args, **kwargs)
|
||||
else:
|
||||
raise Exceptions.NotLoggedSessionError("You are not logged yet.")
|
||||
raise Exceptions.NotLoggedSessionError("You are not logged in yet.")
|
||||
return f
|
||||
|
||||
def _require_configuration(fn):
|
||||
@ -48,10 +48,10 @@ class Session(object):
|
||||
|
||||
def order_buffer(self, name, data):
|
||||
|
||||
""" Put the new items on the local database.
|
||||
""" Put the new items in the local database.
|
||||
name str: The name for the buffer stored in the dictionary.
|
||||
data list: A list with tweets.
|
||||
returns the number of items that has been added in this execution"""
|
||||
returns the number of items that have been added in this execution"""
|
||||
|
||||
num = 0
|
||||
if self.db.has_key(name) == False:
|
||||
@ -68,7 +68,7 @@ class Session(object):
|
||||
""" Put the new items on the local database. Useful for cursored buffers (followers, friends, users of a list and searches)
|
||||
name str: The name for the buffer stored in the dictionary.
|
||||
data list: A list with items and some information about cursors.
|
||||
returns the number of items that has been added in this execution"""
|
||||
returns the number of items that have been added in this execution"""
|
||||
|
||||
num = 0
|
||||
if self.db.has_key(name) == False:
|
||||
@ -118,7 +118,7 @@ class Session(object):
|
||||
@_require_configuration
|
||||
def login(self, verify_credentials=True):
|
||||
|
||||
""" Login in to twitter using credentials from settings.
|
||||
""" Log into twitter using credentials from settings.
|
||||
if the user account isn't authorised, it needs to call self.authorise() before login."""
|
||||
|
||||
if self.settings["twitter"]["user_key"] != None and self.settings["twitter"]["user_secret"] != None:
|
||||
@ -134,7 +134,7 @@ class Session(object):
|
||||
@_require_configuration
|
||||
def authorise(self):
|
||||
|
||||
""" Authorises a Twitter account. This function needs to be called for each new session, after of self.get_configuration() and before of self.login()"""
|
||||
""" Authorises a Twitter account. This function needs to be called for each new session, after self.get_configuration() and before self.login()"""
|
||||
|
||||
if self.logged == True:
|
||||
raise Exceptions.AlreadyAuthorisedError("The authorisation process is not needed at this time.")
|
||||
@ -153,14 +153,14 @@ class Session(object):
|
||||
|
||||
def api_call(self, call_name, action="", _sound=None, report_success=False, report_failure=True, preexec_message="", *args, **kwargs):
|
||||
|
||||
""" Make a call to the Twitter API. If there is a connectionError or another exception not related to Twitter, It will call to the method at least 25 times, waiting a while between calls. Useful for post methods.
|
||||
If twitter returns an error, it will not call anymore the method.
|
||||
""" Make a call to the Twitter API. If there is a connectionError or another exception not related to Twitter, It will call the method again at least 25 times, waiting a while between calls. Useful for post methods.
|
||||
If twitter returns an error, it will not call the method anymore.
|
||||
call_name str: The method to call
|
||||
action str: The thing what you are doing on twitter, it will be reported to the user if report_success is set to True.
|
||||
action str: What you are doing on twitter, it will be reported to the user if report_success is set to True.
|
||||
for example "following @tw_blue2" will be reported as "following @tw_blue2 succeeded".
|
||||
_sound str: a sound to play if the call is executed properly.
|
||||
report_success and report_failure bool: These are self explanatory. True or false. It's all.
|
||||
preexec_message str: A message to speak to the user while the call is doing the work, example: "try to follow to x user"."""
|
||||
report_success and report_failure bool: These are self explanatory. True or False.
|
||||
preexec_message str: A message to speak to the user while the method is running, example: "trying to follow x user"."""
|
||||
|
||||
finished = False
|
||||
tries = 0
|
||||
@ -193,8 +193,8 @@ class Session(object):
|
||||
@_require_login
|
||||
def get_favourites_timeline(self, name, *args, **kwargs):
|
||||
|
||||
""" Gets favourites for the authenticated user or a friend or follower or somewhat.
|
||||
name str: Name for store all in the database."""
|
||||
""" Gets favourites for the authenticated user or a friend or follower.
|
||||
name str: Name for storage in the database."""
|
||||
|
||||
tl = self.call_paged(self.twitter.twitter.get_favorites, *args, **kwargs)
|
||||
return self.order_buffer(name, tl)
|
||||
@ -204,7 +204,7 @@ class Session(object):
|
||||
""" Makes a call to the Twitter API methods several times. Useful for get methods.
|
||||
this function is needed for retrieving more than 200 items.
|
||||
update_function str: The function to call. This function must be child of self.twitter.twitter
|
||||
return a list with all items retrieved."""
|
||||
returns a list with all items retrieved."""
|
||||
|
||||
max = int(self.settings["general"]["max_api_calls"])-1
|
||||
results = []
|
||||
@ -222,7 +222,6 @@ class Session(object):
|
||||
def get_user_info(self):
|
||||
|
||||
""" Retrieves some information required by TWBlue for setup."""
|
||||
|
||||
f = self.twitter.twitter.get_account_settings()
|
||||
sn = f["screen_name"]
|
||||
self.settings["twitter"]["user_name"] = sn
|
||||
@ -239,7 +238,7 @@ class Session(object):
|
||||
@_require_login
|
||||
def get_lists(self):
|
||||
|
||||
""" Gets the lists that the user is suscribed."""
|
||||
""" Gets the lists that the user is subscribed to and stores them in the database. Returns None."""
|
||||
|
||||
self.db["lists"] = self.twitter.twitter.show_lists(reverse=True)
|
||||
|
||||
@ -254,7 +253,7 @@ class Session(object):
|
||||
def get_stream(self, name, function, *args, **kwargs):
|
||||
|
||||
""" Retrieves the items for a regular stream.
|
||||
name str: Name to save items on the database.
|
||||
name str: Name to save items to the database.
|
||||
function str: A function to get the items."""
|
||||
|
||||
last_id = -1
|
||||
@ -272,11 +271,11 @@ class Session(object):
|
||||
@_require_login
|
||||
def get_cursored_stream(self, name, function, items="users", *args, **kwargs):
|
||||
|
||||
""" Gets items for API calls that requires using cursors to paginate the results.
|
||||
""" Gets items for API calls that require using cursors to paginate the results.
|
||||
name str: Name to save it in the database.
|
||||
function str: Function that provides the items.
|
||||
items: When the function returns the list with results, items will tell how the order function should be look.
|
||||
for example get_followers_list returns a list and users are under list["users"], here the items should be point to "users"."""
|
||||
for example get_followers_list returns a list and users are under list["users"], here the items should point to "users"."""
|
||||
|
||||
items_ = []
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user