mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-08-25 17:39:23 +00:00
Compare commits
120 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
238607bbe7 | ||
0aa51d9529 | |||
3815ce0a67 | |||
5e91808b73 | |||
08259cdf16 | |||
0bbb3afde0 | |||
3c0110528f | |||
18b52e8909 | |||
037cfec91a | |||
695b35031e | |||
f9d869e824 | |||
c1c001ad96 | |||
d768afc329 | |||
![]() |
4186f1a3e6 | ||
![]() |
2eac158a39 | ||
1ee629d731 | |||
5590ab47ee | |||
b555ed736c | |||
da39f40048 | |||
b1cf1c5590 | |||
48232a6cf8 | |||
3bc92af55f | |||
![]() |
5e9218b072 | ||
![]() |
65f860ceef | ||
![]() |
b9b8145bca | ||
![]() |
7fab6bcf54 | ||
![]() |
7ad5e6fa37 | ||
![]() |
f6fec67d52 | ||
![]() |
b3cac85c4e | ||
![]() |
ff49bd2488 | ||
![]() |
45f23a4c8a | ||
![]() |
a67a5e6264 | ||
8988d63f33 | |||
2268619101 | |||
a312b7f63c | |||
92d803717f | |||
2124f6c60b | |||
29c87dbd3f | |||
1ea3c5d23b | |||
![]() |
547f9393b9 | ||
![]() |
16b34c827b | ||
![]() |
56f0f37f39 | ||
3e9143d607 | |||
da07859138 | |||
dfc2b605f5 | |||
8badd3987a | |||
7139a2bcb3 | |||
c4e2c3b57a | |||
ed95270d3b | |||
edd45a1adf | |||
f24d5fec4e | |||
a9b47bb1a4 | |||
8849ce9039 | |||
![]() |
8b4f16ef84 | ||
dbbe6c0600 | |||
3caef5fc81 | |||
7cd58708cc | |||
0814af3bf4 | |||
72ba5a74f5 | |||
cbc301141e | |||
f466516289 | |||
4eef236b1c | |||
![]() |
ce00083aa2 | ||
![]() |
f92e05ce72 | ||
c02a11f269 | |||
![]() |
c79e659b74 | ||
da8009aea0 | |||
2778d2e85d | |||
ce9a50903c | |||
9a7d39c125 | |||
89759e7d49 | |||
7ca9d42f5f | |||
![]() |
6a6bec880c | ||
7b22c7d0f8 | |||
058866831b | |||
229f698e72 | |||
32067d3171 | |||
a8f7477a1f | |||
9b6461e34e | |||
eed3f81cb8 | |||
e605c750b1 | |||
f49be6cfed | |||
696faed007 | |||
![]() |
70169a2a4a | ||
![]() |
46b46c4d6d | ||
![]() |
0875b7ef92 | ||
![]() |
9cdccca5ff | ||
![]() |
e3e4fa42db | ||
![]() |
6e0c6de0af | ||
![]() |
564bee3850 | ||
![]() |
79e723f740 | ||
![]() |
08a2eca98d | ||
![]() |
c830d4b5b4 | ||
112391afeb | |||
![]() |
39e0431b97 | ||
071d75926b | |||
56b64e5c6d | |||
b8cfd60c9e | |||
691a9ae17d | |||
214b9a8809 | |||
e85f54e15c | |||
![]() |
d2245c33ce | ||
ff6695bba3 | |||
cdcdc86627 | |||
b4addf9329 | |||
9d0c9cfdb5 | |||
0afba81c71 | |||
0882e4707d | |||
78079e142f | |||
00a4203e1a | |||
c4fae3b70b | |||
b8dfa4a5e8 | |||
1ca1862a08 | |||
ba76c74324 | |||
![]() |
dda37f0083 | ||
65c353450e | |||
2bfb53abe1 | |||
ab08eada81 | |||
![]() |
5fcc1de9a5 | ||
![]() |
baeb0f7ae8 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,4 +16,5 @@ src/Microsoft.VC90.CRT
|
||||
src/Microsoft.VC90.MFC
|
||||
src/launcher.bat
|
||||
src/sounds/iOs
|
||||
release-snapshot/
|
||||
release-snapshot/
|
||||
src/com_cache/
|
50
README.md
50
README.md
@@ -1,13 +1,12 @@
|
||||
TWBlue -
|
||||
TWBlue -
|
||||
======
|
||||
|
||||
Copyright (C) 2015. [Technow S.L.](https://www.technow.es)
|
||||
Copyright (C) 2016. [Technow S.L.](https://www.technow.es)
|
||||
|
||||
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,
|
||||
* Create, reply to, like, retweet and delete tweets,
|
||||
* Send and delete direct messages,
|
||||
* See your friends and followers,
|
||||
* Follow, unfollow, block and report users as spam,
|
||||
@@ -18,9 +17,9 @@ With this app you’ll have access to twitter features such as:
|
||||
|
||||
See [TWBlue's webpage](http://twblue.es) for more details.
|
||||
|
||||
## Using TWBlue from sources
|
||||
## Running TWBlue from source
|
||||
|
||||
This document describes how to run tw blue from source, and, after that, how to build a binary version, which doesn't need Python and the other dependencies to run.
|
||||
This document describes how to run tw blue from source and how to build a binary version which doesn't need Python and the other dependencies to run.
|
||||
|
||||
### Required dependencies.
|
||||
|
||||
@@ -32,12 +31,10 @@ Although most dependencies can be found in the windows-dependencies directory, w
|
||||
|
||||
#### Dependencies packaged in windows installers
|
||||
|
||||
* [Python,](http://python.org) version 2.7.10
|
||||
* [Python,](http://python.org) version 2.7.11
|
||||
If you want to build both x86 and x64 binaries, you can install python x86 to C:\python27 and python x64 to C:\python27x64, for example.
|
||||
* [wxPython](http://www.wxpython.org) for Python 2.7, version 3.0.2.0
|
||||
* [Python windows extensions (pywin32)](http://www.sourceforge.net/projects/pywin32/) for python 2.7, build 219
|
||||
* [Pycurl](http://pycurl.sourceforge.net) 7.19.5.1 for Python 2.7: [32-bit downloads,](https://pypi.python.org/pypi/pycurl/7.19.5.1) [64-bit downloads](http://www.lfd.uci.edu/~gohlke/pythonlibs/)
|
||||
Note: the x64 version is in wheel format instead of executable installer, so you have to install it using pip. For example: C:\python27x64\scripts\pip install pycurl-7.19.5.1-cp27-none-win_amd64.whl
|
||||
* [Python windows extensions (pywin32)](http://www.sourceforge.net/projects/pywin32/) for python 2.7, build 220
|
||||
* [PyEnchant,](http://pythonhosted.org/pyenchant/) version 1.6.6.
|
||||
x64 version has been built by TWBlue developers, so you only will find it in windows-dependencies folder
|
||||
|
||||
@@ -49,7 +46,7 @@ To build a binary version:
|
||||
|
||||
#### Dependencies that must be installed using easy_install
|
||||
|
||||
setuptools install a script, called easy_install. You can find it in the python scripts directory. To install packages using easy_install, you have to navigate to the scripts directory using a command prompt, for example:
|
||||
setuptools installs a script, called easy_install. You can find it in the python scripts directory. To install packages using easy_install, you have to navigate to the scripts directory using a command prompt, for example:
|
||||
|
||||
cd C:\python27x64\scripts
|
||||
|
||||
@@ -65,17 +62,18 @@ setuptools install a script, called easy_install. You can find it in the python
|
||||
* pypubsub
|
||||
* configobj
|
||||
* requests-oauthlib
|
||||
* requests-toolbelt
|
||||
* future
|
||||
* pygeocoder
|
||||
* suds
|
||||
* arrow
|
||||
* goslate
|
||||
* arrow==0.6
|
||||
* markdown
|
||||
* pocket
|
||||
* winpaths
|
||||
* microsofttranslator
|
||||
|
||||
easy_install will automatically get the additional libraries that these packages need to work properly.
|
||||
Run the following command to quickly install and upgrade all packages and their dependencies:
|
||||
easy_install -Z --upgrade six configobj goslate markdown future pocket suds requests oauthlib requests-oauthlib pypubsub pygeocoder arrow python-dateutil futures
|
||||
easy_install -Z --upgrade six configobj goslate markdown future suds requests oauthlib requests-oauthlib requests-toolbelt pypubsub pygeocoder arrow==0.6 python-dateutil futures markdown microsofttranslator winpaths
|
||||
|
||||
#### Other dependencies
|
||||
|
||||
@@ -90,6 +88,14 @@ This dependency has been built using pure basic 4.61. Its source can be found at
|
||||
|
||||
* [NSIS unicode,](http://www.scratchpaper.com/) version 2.46.5
|
||||
|
||||
#### Dependencies required to build the portableApps.com format archive
|
||||
|
||||
* [NSIS Unicode Portable,](http://portableapps.com/apps/development/nsis_portable) version 2.46.5 rev 3
|
||||
* [PortableApps.com Launcher,](http://portableapps.com/apps/development/portableapps.com_launcher) version 2.2
|
||||
* [PortableApps.com Installer,](http://portableapps.com/apps/development/portableapps.com_installer) version 3.1.3
|
||||
|
||||
Important! Install these 3 apps into the same folder, otherwise you won't be able to build the pa.c version. For example: D:\portableApps\NSISPortable, D:\PortableApps\PortableApps.com installer, ...
|
||||
|
||||
### 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 repo's src directory, and type the following command:
|
||||
@@ -117,7 +123,7 @@ To build it, run the following command from the src folder:
|
||||
|
||||
### Building an installer
|
||||
|
||||
If you want to install TWBlue in your computer, you must create the installer first. Follow these steps:
|
||||
If you want to install TWBlue on your computer, you must create the installer first. Follow these steps:
|
||||
|
||||
* Navigate to the src directory, and create a binary version for x86: C:\python27\python setup.py py2exe
|
||||
* Move the dist directory to the scripts folder in this repo, and rename it to twblue
|
||||
@@ -129,3 +135,15 @@ If you want to install TWBlue in your computer, you must create the installer fi
|
||||
### How to generate a translation template
|
||||
|
||||
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.
|
||||
|
||||
### How to build the portableApps.com archive
|
||||
|
||||
If you want to have TWBlue on your PortableApps.com platform, follow these steps:
|
||||
|
||||
* Navigate to the src directory, and create a binary version for x86: C:\python27\python setup.py py2exe
|
||||
* Move the dist directory to the misc\pa.c format\app folder in this repo, and rename it to twblue
|
||||
* Repeat these steps with Python for x64: C:\python27x64\python setup.py py2exe
|
||||
* Move the new dist directory to the misc\pa.c format\app folder, and rename it to twblue64
|
||||
* Run the PortableApps.com Launcher Generator, and follow the wizard. Choose the pa.c format folder and continue to generate the launcher. If the wizard is completed, you will see a file named TWBlue portable.exe inside the pa.c format folder.
|
||||
* Run the PortableApps.com Installer, and follow the wizard. As in the above step, choose the pa.c format folder. When it completes, you will see a file named TWBluePortable_x.y.paf.exe inside the misc folder, where x.y is the version number.
|
||||
|
||||
|
@@ -34,4 +34,12 @@ Holly Scott-Gardner
|
||||
Anibal Hernández
|
||||
Sussan Leiva
|
||||
Brian Hartgen
|
||||
PEDRO REINA COLOBON
|
||||
PEDRO REINA COLOBON
|
||||
Moora-Moora Arrilla
|
||||
Blake Oliver
|
||||
Steffen Schultz
|
||||
Riku
|
||||
Burak Yüksek
|
||||
florian Ionașcu
|
||||
Christian Leo Mameli
|
||||
Natalia Hedlund (Наталья Хедлунд)
|
@@ -2,6 +2,17 @@
|
||||
name = 'TWBlue'
|
||||
snapshot = False
|
||||
if snapshot == False:
|
||||
version = "0.80"
|
||||
version = "0.82"
|
||||
update_url = 'http://twblue.es/updates/twblue_ngen.json'
|
||||
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/stable.json'
|
||||
else:
|
||||
version = "7"
|
||||
version = "10.99"
|
||||
update_url = 'http://twblue.es/updates/snapshots_ngen.json'
|
||||
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/snapshots.json'
|
||||
author = u"Manuel Cortéz"
|
||||
authorEmail = "manuel@manuelcortez.net"
|
||||
copyright = u"Copyright (C) 2015, Technow S.L. \nCopyright (C) 2013-2015, Manuel cortéz."
|
||||
description = unicode(name+" 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"Juan Buño (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"
|
@@ -7,7 +7,7 @@ languageHandler.setLanguage("en")
|
||||
import strings
|
||||
|
||||
# the list of supported language codes of TW Blue
|
||||
languages = ["en", "es", "fr", "de", "it", "gl", "ja"]
|
||||
languages = ["en", "es", "fr", "de", "it", "gl", "ja", "ru"]
|
||||
#"eu", "ar", "ca", "es", "fi", "fr", "gl", "hu", "it", "pl", "pt", "ru", "tr"]
|
||||
|
||||
def generate_document(language):
|
||||
|
BIN
doc/locales/ru/lc_messages/twblue-documentation.mo
Normal file
BIN
doc/locales/ru/lc_messages/twblue-documentation.mo
Normal file
Binary file not shown.
1609
doc/locales/ru/lc_messages/twblue-documentation.po
Normal file
1609
doc/locales/ru/lc_messages/twblue-documentation.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
[Launch]
|
||||
ProgramExecutable=TWBlue\TWBlue.exe
|
||||
ProgramExecutable64=TWBlue64\TWBlue.exe
|
||||
CommandLineArguments=-p -d "%PAL:DataDir%"
|
||||
CommandLineArguments=-d "%PAL:DataDir%"
|
||||
SinglePortableAppInstance=true
|
||||
MinOS=XP
|
||||
SingleAppInstance=false
|
||||
|
@@ -1,11 +1,11 @@
|
||||
[Format]
|
||||
Type=PortableApps.comFormat
|
||||
Version=3.0
|
||||
Version=3.3
|
||||
|
||||
[Details]
|
||||
Name=TWBlue portable
|
||||
Name=tw blue portable
|
||||
AppID=TWBluePortable
|
||||
Publisher=jmdaweb & TWBlue & PortableApps.com
|
||||
Publisher=jmdaweb & TW blue & PortableApps.com
|
||||
Homepage=PortableApps.com/TWBluePortable
|
||||
Category=Internet
|
||||
Description=A portable, fast and accessible Twitter client with many options.
|
||||
@@ -20,8 +20,8 @@ CommercialUse=true
|
||||
EULAVersion=2
|
||||
|
||||
[Version]
|
||||
PackageVersion=0.80.0.0
|
||||
DisplayVersion=0.80
|
||||
PackageVersion=0.82.0.0
|
||||
DisplayVersion=0.82
|
||||
|
||||
[Control]
|
||||
Icons=1
|
||||
|
@@ -8,10 +8,14 @@ FINNISH=true
|
||||
FRENCH=true
|
||||
GALICIAN=true
|
||||
GERMAN=true
|
||||
CROATIAN=true
|
||||
HUNGARIAN=true
|
||||
ITALIAN=true
|
||||
JAPANESE=true
|
||||
POLISH=true
|
||||
PORTUGUESEBR=true
|
||||
ROMANIAN=true
|
||||
RUSSIAN=true
|
||||
SERBIAN=true
|
||||
SPANISHINTERNATIONAL=true
|
||||
TURKISH=true
|
||||
TURKISH=true
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>TWBlue Portable Help</title>
|
||||
<title>tw blue Portable Help</title>
|
||||
<link rel="alternate" href="http://portableapps.com/feeds/general" type="application/rss+xml" title="PortableApps.com">
|
||||
<link rel="shortcut icon" href="Other/Help/Images/Favicon.ico">
|
||||
<style type="text/css">
|
||||
@@ -125,13 +125,13 @@
|
||||
<body>
|
||||
<div class="logo"><a href="http://portableapps.com/"><img src="Other/Help/Images/Help_Logo_Top.png" alt="PortableApps.com - Your Digital Life, Anywhere"></a></div>
|
||||
<div class="content">
|
||||
<h1 class="hastagline">TWBlue Portable Help</h1>
|
||||
<h1 class="hastagline">tw blue Portable Help</h1>
|
||||
<h2 class="tagline">A powerful and accessible Twitter client</h2>
|
||||
<p>TWBlue Portable is the TWBlue whatever it is packaged with a PortableApps.com launcher as a <a href="http://portableapps.com/about/what_is_a_portable_app">portable app</a>, so you can view and send tweets on your iPod, USB flash drive, portable hard drive, etc. It has all the same features as TWBlue, plus, it leaves no personal information behind on the machine you run it on, so you can take it with you wherever you go. <a href="http://twblue.es">Learn more about TWBlue...</a></p>
|
||||
<p>tw blue Portable is the tw blue whatever it is packaged with a PortableApps.com launcher as a <a href="http://portableapps.com/about/what_is_a_portable_app">portable app</a>, so you can view and send tweets on your iPod, USB flash drive, portable hard drive, etc. It has all the same features as tw blue, plus, it leaves no personal information behind on the machine you run it on, so you can take it with you wherever you go. <a href="http://twblue.es">Learn more about tw blue...</a></p>
|
||||
|
||||
<p><a href="http://portableapps.com/donate"><img src="Other/Help/Images/Donation_Button.png" style="vertical-align:middle" alt="Make a Donation"></a> - Support PortableApps.com's Hosting and Development</p>
|
||||
|
||||
<p><a href="http://portableapps.com/node/*Node ID*">Go to the TWBlue Portable Homepage >></a></p>
|
||||
<p><a href="http://portableapps.com/node/*Node ID*">Go to the tw blue Portable Homepage >></a></p>
|
||||
<p><a href="http://portableapps.com/">Get more portable apps at PortableApps.com</a></p>
|
||||
|
||||
<p>This software is OSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source Initiative.</p>
|
||||
|
@@ -12,10 +12,10 @@ SetCompress auto
|
||||
SetCompressor /solid lzma
|
||||
SetDatablockOptimize on
|
||||
VIAddVersionKey ProductName "TWBlue"
|
||||
VIAddVersionKey LegalCopyright "Copyright 2015 Manuel Cortéz."
|
||||
VIAddVersionKey ProductVersion "0.80"
|
||||
VIAddVersionKey FileVersion "0.80"
|
||||
VIProductVersion "0.80.0.0"
|
||||
VIAddVersionKey LegalCopyright "Copyright 2016 Manuel Cortéz."
|
||||
VIAddVersionKey ProductVersion "0.82"
|
||||
VIAddVersionKey FileVersion "0.82"
|
||||
VIProductVersion "0.82.0.0"
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!define MUI_LICENSEPAGE_RADIOBUTTONS
|
||||
!insertmacro MUI_PAGE_LICENSE "license.txt"
|
||||
@@ -26,7 +26,6 @@ var StartMenuFolder
|
||||
!define MUI_FINISHPAGE_LINK "Visit TWBlue website"
|
||||
!define MUI_FINISHPAGE_LINK_LOCATION "http://twblue.es"
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR\TWBlue.exe"
|
||||
!define MUI_FINISHPAGE_RUN_PARAMETERS "-i"
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
@@ -48,6 +47,7 @@ var StartMenuFolder
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_RESERVEFILE_LANGDLL
|
||||
Section
|
||||
SetShellVarContext All
|
||||
@@ -57,10 +57,10 @@ File /r TWBlue64\*
|
||||
${Else}
|
||||
File /r TWBlue\*
|
||||
${EndIf}
|
||||
CreateShortCut "$DESKTOP\TWBlue.lnk" "$INSTDIR\TWBlue.exe" "-i"
|
||||
CreateShortCut "$DESKTOP\TWBlue.lnk" "$INSTDIR\TWBlue.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\TWBlue.lnk" "$INSTDIR\TWBlue.exe" "-i"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\TWBlue.lnk" "$INSTDIR\TWBlue.exe"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\TWBlue on the web.lnk" "http://twblue.es"
|
||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
@@ -69,10 +69,10 @@ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "D
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortéz"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "0.80"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "DisplayVersion" "0.82"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "URLInfoAbout" "http://twblue.es"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMajor" 0
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMinor" 80
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "VersionMinor" 82
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\twblue" "NoRepair" 1
|
||||
SectionEnd
|
||||
|
@@ -28,6 +28,8 @@ timelines = list(default=list())
|
||||
tweet_searches = list(default=list())
|
||||
lists = list(default=list())
|
||||
favourites_timelines = list(default=list())
|
||||
followers_timelines = list(default=list())
|
||||
friends_timelines = list(default=list())
|
||||
trending_topic_buffers = list(default=list())
|
||||
muted_buffers = list(default=list())
|
||||
autoread_buffers = list(default=list(mentions, direct_messages, events))
|
||||
@@ -37,6 +39,3 @@ spelling_language = string(default="")
|
||||
save_followers_in_autocompletion_db = boolean(default=False)
|
||||
save_friends_in_autocompletion_db = boolean(default=False)
|
||||
twishort_enabled = boolean(default=False)
|
||||
|
||||
[services]
|
||||
pocket_access_token = string(default="")
|
@@ -15,6 +15,7 @@ speak_ready_msg = boolean(default=True)
|
||||
log_level = string(default="error")
|
||||
load_keymap = string(default="default.keymap")
|
||||
donation_dialog_displayed = boolean(default=False)
|
||||
check_for_updates = boolean(default=True)
|
||||
|
||||
[proxy]
|
||||
server = string(default="")
|
||||
|
@@ -2,11 +2,13 @@
|
||||
name = 'TWBlue'
|
||||
snapshot = False
|
||||
if snapshot == False:
|
||||
version = "0.80"
|
||||
version = "0.82"
|
||||
update_url = 'http://twblue.es/updates/twblue_ngen.json'
|
||||
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/stable.json'
|
||||
else:
|
||||
version = "10.97"
|
||||
version = "10.99"
|
||||
update_url = 'http://twblue.es/updates/snapshots_ngen.json'
|
||||
mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/snapshots.json'
|
||||
author = u"Manuel Cortéz"
|
||||
authorEmail = "manuel@manuelcortez.net"
|
||||
copyright = u"Copyright (C) 2015, Technow S.L. \nCopyright (C) 2013-2015, Manuel cortéz."
|
||||
|
@@ -10,7 +10,7 @@ def convert_audioboom(url):
|
||||
audio_id = url.split('.com/')[-1]
|
||||
return 'https://audioboom.com/%s.mp3' % audio_id
|
||||
|
||||
@matches_url ('http://soundcloud.com/')
|
||||
@matches_url ('https://soundcloud.com/')
|
||||
def convert_soundcloud (url):
|
||||
client_id = "df8113ca95c157b6c9731f54b105b473"
|
||||
permalink = urllib.urlopen ('http://api.soundcloud.com/resolve.json?client_id=%s&url=%s' %(client_id, url))
|
||||
|
4966
src/cacert.pem
4966
src/cacert.pem
File diff suppressed because it is too large
Load Diff
@@ -6,13 +6,7 @@ import application
|
||||
log = logging.getLogger("commandlineLauncher")
|
||||
|
||||
parser = argparse.ArgumentParser(description=application.name+" command line launcher")
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument("-p", "--portable", help="Use " + application.name + " as a portable application.", action="store_true", default=True)
|
||||
group.add_argument("-i", "--installed", help="Use " + application.name + " 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 " + application.name + " saves userdata.")
|
||||
args = parser.parse_args()
|
||||
log.debug("Starting " + application.name + " with the following arguments: installed = %s, portable = %s and directory = %s" % (args.installed, args.portable, args.directory))
|
||||
if args.installed == True: paths.mode = "installed"
|
||||
elif args.portable == True:
|
||||
paths.mode = "portable"
|
||||
if args.directory != None: paths.directory = args.directory
|
||||
log.debug("Starting " + application.name + " with the following arguments: directory = %s" % (args.directory))
|
||||
if args.directory != None: paths.directory = args.directory
|
||||
|
@@ -3,6 +3,9 @@ from configobj import ConfigObj, ParseError
|
||||
from validate import Validator, ValidateError
|
||||
import os
|
||||
import string
|
||||
from logging import getLogger
|
||||
log = getLogger("config_utils")
|
||||
|
||||
class ConfigLoadError(Exception): pass
|
||||
|
||||
def load_config(config_path, configspec_path=None, *args, **kwargs):
|
||||
@@ -14,10 +17,12 @@ def load_config(config_path, configspec_path=None, *args, **kwargs):
|
||||
except ParseError:
|
||||
raise ConfigLoadError("Unable to load %r" % config_path)
|
||||
validator = Validator()
|
||||
validated = config.validate(validator, copy=True)
|
||||
validated = config.validate(validator, preserve_errors=False, copy=True)
|
||||
if validated == True:
|
||||
config.write()
|
||||
return config
|
||||
else:
|
||||
log.exception("Error in config file: {0}".format(validated,))
|
||||
|
||||
def is_blank(arg):
|
||||
"Check if a line is blank."
|
||||
@@ -25,6 +30,7 @@ def is_blank(arg):
|
||||
if c not in string.whitespace:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_keys(path):
|
||||
"Gets the keys of a configobj config file."
|
||||
res=[]
|
||||
|
38
src/controller/attach.py
Normal file
38
src/controller/attach.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import widgetUtils
|
||||
import logging
|
||||
from wxUI.dialogs import attach as gui
|
||||
log = logging.getLogger("controller.attach")
|
||||
|
||||
class attach(object):
|
||||
def __init__(self):
|
||||
self.attachments = list()
|
||||
self.dialog = gui.attachDialog()
|
||||
widgetUtils.connect_event(self.dialog.photo, widgetUtils.BUTTON_PRESSED, self.upload_image)
|
||||
widgetUtils.connect_event(self.dialog.remove, widgetUtils.BUTTON_PRESSED, self.remove_attachment)
|
||||
self.dialog.get_response()
|
||||
log.debug("Attachments controller started.")
|
||||
|
||||
def upload_image(self, *args, **kwargs):
|
||||
image, description = self.dialog.get_image()
|
||||
if image != None:
|
||||
imageInfo = {"type": "photo", "file": image, "description": description}
|
||||
log.debug("Image data to upload: %r" % (imageInfo,))
|
||||
self.attachments.append(imageInfo)
|
||||
info = [_(u"Photo"), description]
|
||||
self.dialog.attachments.insert_item(False, *info)
|
||||
self.dialog.remove.Enable(True)
|
||||
|
||||
def remove_attachment(self, *args, **kwargs):
|
||||
current_item = self.dialog.attachments.get_selected()
|
||||
log.debug("Removing item %d" % (current_item,))
|
||||
if current_item == -1: current_item = 0
|
||||
self.attachments.pop(current_item)
|
||||
self.dialog.attachments.remove_item(current_item)
|
||||
self.check_remove_status()
|
||||
log.debug("Removed")
|
||||
|
||||
def check_remove_status(self):
|
||||
if len(self.attachments) == 0 and self.dialog.attachments.get_count() == 0:
|
||||
self.dialog.remove.Enable(False)
|
@@ -49,6 +49,7 @@ class bufferController(object):
|
||||
|
||||
|
||||
def get_event(self, ev):
|
||||
""" Catches key presses in the WX interface and generate the corresponding event names."""
|
||||
if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "audio"
|
||||
elif ev.GetKeyCode() == wx.WXK_RETURN: event = "url"
|
||||
elif ev.GetKeyCode() == wx.WXK_F5: event = "volume_down"
|
||||
@@ -84,7 +85,9 @@ class bufferController(object):
|
||||
sound.URLPlayer.stream.volume = self.session.settings["sound"]["volume"]
|
||||
self.session.sound.play("volume_changed.ogg")
|
||||
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
if mandatory == True:
|
||||
output.speak(_(u"Unable to update this buffer."))
|
||||
pass
|
||||
|
||||
def get_more_items(self):
|
||||
@@ -134,16 +137,25 @@ class bufferController(object):
|
||||
self.session.settings["mysc"]["twishort_enabled"] = tweet.message.long_tweet.GetValue()
|
||||
text = tweet.message.get_text()
|
||||
if len(text) > 140 and tweet.message.get("long_tweet") == True:
|
||||
if tweet.image == None:
|
||||
if not hasattr(tweet, "attachments"):
|
||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text)
|
||||
else:
|
||||
text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text, 1)
|
||||
if tweet.image == None:
|
||||
if not hasattr(tweet, "attachments") or len(tweet.attachments) == 0:
|
||||
call_threaded(self.session.api_call, call_name="update_status", status=text)
|
||||
else:
|
||||
call_threaded(self.session.api_call, call_name="update_status_with_media", status=text, media=tweet.image)
|
||||
call_threaded(self.post_with_media, text=text, attachments=tweet.attachments)
|
||||
if hasattr(tweet.message, "destroy"): tweet.message.destroy()
|
||||
|
||||
def post_with_media(self, text, attachments):
|
||||
media_ids = []
|
||||
for i in attachments:
|
||||
photo = open(i["file"], "rb")
|
||||
img = self.session.twitter.twitter.upload_media(media=photo)
|
||||
self.session.twitter.twitter.set_description(media_id=img["media_id"], alt_text=dict(text=i["description"]))
|
||||
media_ids.append(img["media_id"])
|
||||
self.session.twitter.twitter.update_status(status=text, media_ids=media_ids)
|
||||
|
||||
def save_positions(self):
|
||||
try:
|
||||
self.session.db[self.name+"_pos"]=self.buffer.list.get_selected()
|
||||
@@ -198,7 +210,7 @@ class accountPanel(bufferController):
|
||||
|
||||
class emptyPanel(bufferController):
|
||||
def __init__(self, parent, name, account):
|
||||
super(emptyPanel, self).__init__(parent, None, name)
|
||||
super(emptyPanel, self).__init__(parent=parent)
|
||||
log.debug("Initializing buffer %s, account %s" % (name, account,))
|
||||
self.buffer = buffers.emptyPanel(parent, name)
|
||||
self.type = self.buffer.type
|
||||
@@ -240,11 +252,11 @@ class baseBufferController(bufferController):
|
||||
tweet = self.get_right_tweet()
|
||||
tweetsList = []
|
||||
tweet_id = tweet["id"]
|
||||
uri = None
|
||||
if tweet.has_key("long_uri"):
|
||||
uri = tweet["long_uri"]
|
||||
message = None
|
||||
if tweet.has_key("message"):
|
||||
message = tweet["message"]
|
||||
try:
|
||||
tweet = self.session.twitter.twitter.show_status(id=tweet_id)
|
||||
tweet = self.session.twitter.twitter.show_status(id=tweet_id, include_ext_alt_text=True)
|
||||
urls = utils.find_urls_in_text(tweet["text"])
|
||||
for url in range(0, len(urls)):
|
||||
try: tweet["text"] = tweet["text"].replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])
|
||||
@@ -252,14 +264,13 @@ class baseBufferController(bufferController):
|
||||
except TwythonError as e:
|
||||
utils.twitter_error(e)
|
||||
return
|
||||
if uri != None:
|
||||
tweet["text"] = twishort.get_full_text(uri)
|
||||
if message != None:
|
||||
tweet["message"] = message
|
||||
l = tweets.is_long(tweet)
|
||||
while l != False:
|
||||
tweetsList.append(tweet)
|
||||
id = tweets.get_id(l)
|
||||
try:
|
||||
tweet = self.session.twitter.twitter.show_status(id=id)
|
||||
tweet = self.session.twitter.twitter.show_status(id=l, include_ext_alt_text=True)
|
||||
urls = utils.find_urls_in_text(tweet["text"])
|
||||
for url in range(0, len(urls)):
|
||||
try: tweet["text"] = tweet["text"].replace(urls[url], tweet["entities"]["urls"][url]["expanded_url"])
|
||||
@@ -272,10 +283,10 @@ class baseBufferController(bufferController):
|
||||
tweetsList.append(tweet)
|
||||
return (tweet, tweetsList)
|
||||
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
# starts stream every 3 minutes.
|
||||
current_time = time.time()
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180:
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
|
||||
self.execution_time = current_time
|
||||
log.debug("Starting stream for buffer %s, account %s and type %s" % (self.name, self.account, self.type))
|
||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||
@@ -283,9 +294,9 @@ class baseBufferController(bufferController):
|
||||
number_of_items = self.session.order_buffer(self.name, val)
|
||||
log.debug("Number of items retrieved: %d" % (number_of_items,))
|
||||
self.put_items_on_list(number_of_items)
|
||||
if self.sound == None: return
|
||||
if number_of_items > 0 and self.name != "sent_tweets" and self.name != "sent_direct_messages":
|
||||
if number_of_items > 0 and self.name != "sent_tweets" and self.name != "sent_direct_messages" and self.sound != None:
|
||||
self.session.sound.play(self.sound)
|
||||
return number_of_items
|
||||
|
||||
def get_more_items(self):
|
||||
elements = []
|
||||
@@ -298,7 +309,9 @@ class baseBufferController(bufferController):
|
||||
except TwythonError as e:
|
||||
output.speak(e.message, True)
|
||||
for i in items:
|
||||
if utils.is_allowed(i, self.session.settings["twitter"]["ignored_clients"]) == True:
|
||||
if utils.is_allowed(i, self.session.settings["twitter"]["ignored_clients"]) == True and utils.find_item(i["id"], self.session.db[self.name]) == None:
|
||||
i = self.session.check_quoted_status(i)
|
||||
i = self.session.check_long_tweet(i)
|
||||
elements.append(i)
|
||||
if self.session.settings["general"]["reverse_timelines"] == False:
|
||||
self.session.db[self.name].insert(0, i)
|
||||
@@ -324,6 +337,7 @@ class baseBufferController(bufferController):
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-9] in self.session.settings["other_buffers"]["timelines"]:
|
||||
self.session.settings["other_buffers"]["timelines"].remove(self.name[:-9])
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
@@ -332,6 +346,7 @@ class baseBufferController(bufferController):
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-9] in self.session.settings["other_buffers"]["favourites_timelines"]:
|
||||
self.session.settings["other_buffers"]["favourites_timelines"].remove(self.name[:-9])
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
@@ -339,7 +354,15 @@ class baseBufferController(bufferController):
|
||||
output.speak(_(u"This buffer is not a timeline; it can't be deleted."), True)
|
||||
return False
|
||||
|
||||
def remove_tweet(self, id):
|
||||
if type(self.session.db[self.name]) == dict: return
|
||||
for i in xrange(0, len(self.session.db[self.name])):
|
||||
if self.session.db[self.name][i]["id"] == id:
|
||||
self.session.db[self.name].pop(i)
|
||||
self.remove_item(i)
|
||||
|
||||
def put_items_on_list(self, number_of_items):
|
||||
if number_of_items == 0: return
|
||||
log.debug("The list contains %d items " % (self.buffer.list.get_count(),))
|
||||
log.debug("Putting %d items on the list" % (number_of_items,))
|
||||
if self.buffer.list.get_count() == 0:
|
||||
@@ -349,11 +372,14 @@ class baseBufferController(bufferController):
|
||||
self.buffer.set_position(self.session.settings["general"]["reverse_timelines"])
|
||||
elif self.buffer.list.get_count() > 0:
|
||||
if self.session.settings["general"]["reverse_timelines"] == False:
|
||||
for i in self.session.db[self.name][:number_of_items]:
|
||||
items = self.session.db[self.name][len(self.session.db[self.name])-number_of_items:]
|
||||
for i in items:
|
||||
tweet = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"])
|
||||
self.buffer.list.insert_item(False, *tweet)
|
||||
else:
|
||||
for i in self.session.db[self.name][0:number_of_items]:
|
||||
items = self.session.db[self.name][0:number_of_items]
|
||||
items.reverse()
|
||||
for i in items:
|
||||
tweet = self.compose_function(i, self.session.db, self.session.settings["general"]["relative_times"])
|
||||
self.buffer.list.insert_item(True, *tweet)
|
||||
log.debug("Now the list contains %d items " % (self.buffer.list.get_count(),))
|
||||
@@ -481,7 +507,13 @@ class baseBufferController(bufferController):
|
||||
users = utils.get_all_users(tweet, self.session.db)
|
||||
dm = messages.dm(self.session, _(u"Direct message to %s") % (screen_name,), _(u"New direct message"), users)
|
||||
if dm.message.get_response() == widgetUtils.OK:
|
||||
call_threaded(self.session.api_call, call_name="send_direct_message", text=dm.message.get_text(), screen_name=dm.message.get("cb"))
|
||||
val = self.session.api_call(call_name="send_direct_message", text=dm.message.get_text(), screen_name=dm.message.get("cb"))
|
||||
if val != None:
|
||||
if self.session.settings["general"]["reverse_timelines"] == False:
|
||||
self.session.db["sent_direct_messages"].append(val)
|
||||
else:
|
||||
self.session.db["sent_direct_messages"].insert(0, val)
|
||||
pub.sendMessage("sent-dm", data=val, user=self.session.db["user_name"])
|
||||
if hasattr(dm.message, "destroy"): dm.message.destroy()
|
||||
|
||||
@_tweets_exist
|
||||
@@ -638,9 +670,9 @@ class listBufferController(baseBufferController):
|
||||
self.list_id = list_id
|
||||
self.kwargs["list_id"] = list_id
|
||||
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
self.get_user_ids()
|
||||
super(listBufferController, self).start_stream()
|
||||
super(listBufferController, self).start_stream(mandatory)
|
||||
|
||||
def get_user_ids(self):
|
||||
self.users = []
|
||||
@@ -656,6 +688,7 @@ class listBufferController(baseBufferController):
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-5] in self.session.settings["other_buffers"]["lists"]:
|
||||
self.session.settings["other_buffers"]["lists"].remove(self.name[:-5])
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
@@ -714,7 +747,7 @@ class eventsBufferController(bufferController):
|
||||
|
||||
class peopleBufferController(baseBufferController):
|
||||
def __init__(self, parent, function, name, sessionObject, account, bufferType=None, *args, **kwargs):
|
||||
super(peopleBufferController, self).__init__(parent, function, name, sessionObject, account, bufferType="peoplePanel")
|
||||
super(peopleBufferController, self).__init__(parent, function, name, sessionObject, account, bufferType="peoplePanel", *args, **kwargs)
|
||||
log.debug("Initializing buffer %s, account %s" % (name, account,))
|
||||
self.compose_function = compose.compose_followers_list
|
||||
log.debug("Compose_function: %s" % (self.compose_function,))
|
||||
@@ -722,7 +755,27 @@ class peopleBufferController(baseBufferController):
|
||||
self.url = self.interact
|
||||
|
||||
def remove_buffer(self):
|
||||
return False
|
||||
if "-followers" in self.name:
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-10] in self.session.settings["other_buffers"]["followers_timelines"]:
|
||||
self.session.settings["other_buffers"]["followers_timelines"].remove(self.name[:-10])
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
elif "-friends" in self.name:
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
if dlg == widgetUtils.YES:
|
||||
if self.name[:-8] in self.session.settings["other_buffers"]["friends_timelines"]:
|
||||
self.session.settings["other_buffers"]["friends_timelines"].remove(self.name[:-8])
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
else:
|
||||
output.speak(_(u"This buffer is not a timeline; it can't be deleted."), True)
|
||||
return False
|
||||
|
||||
def onFocus(self, ev):
|
||||
pass
|
||||
@@ -744,19 +797,20 @@ class peopleBufferController(baseBufferController):
|
||||
call_threaded(self.session.api_call, call_name="update_status_with_media", _sound="reply_send.ogg", status=message.message.get_text(), media=message.file)
|
||||
if hasattr(message.message, "destroy"): message.message.destroy()
|
||||
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
# starts stream every 3 minutes.
|
||||
current_time = time.time()
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180:
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
|
||||
self.execution_time = current_time
|
||||
log.debug("Starting stream for %s buffer, %s account" % (self.name, self.account,))
|
||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||
val = self.session.get_cursored_stream(self.name, self.function, *self.args, **self.kwargs)
|
||||
self.put_items_on_list(val)
|
||||
return val
|
||||
|
||||
def get_more_items(self):
|
||||
try:
|
||||
items = self.session.get_more_items(self.function, users=True, name=self.name, count=self.session.settings["general"]["max_tweets_per_call"], cursor=self.session.db[self.name]["cursor"])
|
||||
items = self.session.get_more_items(self.function, users=True, name=self.name, count=self.session.settings["general"]["max_tweets_per_call"], cursor=self.session.db[self.name]["cursor"], *self.args, **self.kwargs)
|
||||
except TwythonError as e:
|
||||
output.speak(e.message, True)
|
||||
return
|
||||
@@ -792,7 +846,7 @@ class peopleBufferController(baseBufferController):
|
||||
# self.buffer.set_list_position()
|
||||
elif self.buffer.list.get_count() > 0:
|
||||
if self.session.settings["general"]["reverse_timelines"] == False:
|
||||
for i in self.session.db[self.name]["items"][:number_of_items]:
|
||||
for i in self.session.db[self.name]["items"][len(self.session.db[self.name]["items"])-number_of_items:]:
|
||||
tweet = self.compose_function(i, self.session.db)
|
||||
self.buffer.list.insert_item(False, *tweet)
|
||||
else:
|
||||
@@ -841,10 +895,10 @@ class peopleBufferController(baseBufferController):
|
||||
pub.sendMessage("execute-action", action="user_details")
|
||||
|
||||
class searchBufferController(baseBufferController):
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
# starts stream every 3 minutes.
|
||||
current_time = time.time()
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180:
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
|
||||
self.execution_time = current_time
|
||||
log.debug("Starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||
@@ -857,6 +911,7 @@ class searchBufferController(baseBufferController):
|
||||
self.put_items_on_list(num)
|
||||
if num > 0:
|
||||
self.session.sound.play("search_updated.ogg")
|
||||
return num
|
||||
|
||||
def remove_buffer(self):
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
@@ -864,6 +919,7 @@ class searchBufferController(baseBufferController):
|
||||
if self.name[:-11] in self.session.settings["other_buffers"]["tweet_searches"]:
|
||||
self.session.settings["other_buffers"]["tweet_searches"].remove(self.name[:-11])
|
||||
self.timer.cancel()
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
@@ -879,10 +935,10 @@ class searchPeopleBufferController(peopleBufferController):
|
||||
self.kwargs = kwargs
|
||||
self.function = function
|
||||
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
# starts stream every 3 minutes.
|
||||
current_time = time.time()
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180:
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory==True:
|
||||
self.execution_time = current_time
|
||||
log.debug("starting stream for %s buffer, %s account and %s type" % (self.name, self.account, self.type))
|
||||
log.debug("args: %s, kwargs: %s" % (self.args, self.kwargs))
|
||||
@@ -896,6 +952,7 @@ class searchPeopleBufferController(peopleBufferController):
|
||||
self.put_items_on_list(number_of_items)
|
||||
if number_of_items > 0:
|
||||
self.session.sound.play("search_updated.ogg")
|
||||
return number_of_items
|
||||
|
||||
def remove_buffer(self):
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
@@ -903,6 +960,7 @@ class searchPeopleBufferController(peopleBufferController):
|
||||
if self.name[:-11] in self.session.settings["other_buffers"]["tweet_searches"]:
|
||||
self.session.settings["other_buffers"]["tweet_searches"].remove(self.name[:-11])
|
||||
self.timer.cancel()
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
@@ -926,10 +984,10 @@ class trendsBufferController(bufferController):
|
||||
self.get_formatted_message = self.get_message
|
||||
self.reply = self.search_topic
|
||||
|
||||
def start_stream(self):
|
||||
def start_stream(self, mandatory=False):
|
||||
# starts stream every 3 minutes.
|
||||
current_time = time.time()
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180:
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory == True:
|
||||
self.execution_time = current_time
|
||||
try:
|
||||
data = self.session.call_paged("get_place_trends", id=self.trendsFor)
|
||||
@@ -970,10 +1028,14 @@ class trendsBufferController(bufferController):
|
||||
if self.name[:-3] in self.session.settings["other_buffers"]["trending_topic_buffers"]:
|
||||
self.session.settings["other_buffers"]["trending_topic_buffers"].remove(self.name[:-3])
|
||||
self.timer.cancel()
|
||||
self.session.db.pop(self.name)
|
||||
return True
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
|
||||
def url(self, *args, **kwargs):
|
||||
self.tweet_about_this_trend()
|
||||
|
||||
def search_topic(self, *args, **kwargs):
|
||||
topic = self.trends[self.buffer.list.get_selected()]["name"]
|
||||
pub.sendMessage("search", term=topic)
|
||||
@@ -1023,10 +1085,10 @@ class trendsBufferController(bufferController):
|
||||
|
||||
class conversationBufferController(searchBufferController):
|
||||
|
||||
def start_stream(self, start=False):
|
||||
def start_stream(self, start=False, mandatory=False):
|
||||
# starts stream every 3 minutes.
|
||||
current_time = time.time()
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180:
|
||||
if self.execution_time == 0 or current_time-self.execution_time >= 180 or mandatory == True:
|
||||
self.execution_time = current_time
|
||||
if start == True:
|
||||
self.statuses = []
|
||||
@@ -1035,7 +1097,10 @@ class conversationBufferController(searchBufferController):
|
||||
self.ids.append(self.tweet["id"])
|
||||
tweet = self.tweet
|
||||
while tweet["in_reply_to_status_id"] != None:
|
||||
tweet = self.session.twitter.twitter.show_status(id=tweet["in_reply_to_status_id"])
|
||||
try:
|
||||
tweet = self.session.twitter.twitter.show_status(id=tweet["in_reply_to_status_id"])
|
||||
except TwythonError as err:
|
||||
break
|
||||
self.statuses.insert(0, tweet)
|
||||
self.ids.append(tweet["id"])
|
||||
if tweet["in_reply_to_status_id"] == None:
|
||||
@@ -1052,13 +1117,14 @@ class conversationBufferController(searchBufferController):
|
||||
self.put_items_on_list(number_of_items)
|
||||
if number_of_items > 0:
|
||||
self.session.sound.play("search_updated.ogg")
|
||||
return number_of_items
|
||||
|
||||
def remove_buffer(self):
|
||||
dlg = commonMessageDialogs.remove_buffer()
|
||||
if dlg == widgetUtils.YES:
|
||||
self.timer.cancel()
|
||||
return True
|
||||
elif dlg == WidgetUtils.NO:
|
||||
elif dlg == widgetUtils.NO:
|
||||
return False
|
||||
|
||||
class pocketBufferController(baseBufferController):
|
||||
|
@@ -118,6 +118,8 @@ class Controller(object):
|
||||
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")
|
||||
pub.subscribe(self.restart_streams_, "restart_streams")
|
||||
pub.subscribe(self.on_tweet_deleted, "tweet-deleted")
|
||||
widgetUtils.connect_event(self.view, widgetUtils.CLOSE_EVENT, self.exit_)
|
||||
|
||||
def bind_other_events(self):
|
||||
@@ -177,8 +179,10 @@ class Controller(object):
|
||||
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.view_documentation, self.view.doc)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.view_changelog, self.view.changelog)
|
||||
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)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.update_buffer, self.view.update_buffer)
|
||||
|
||||
def set_systray_icon(self):
|
||||
self.systrayIcon = sysTrayIcon.SysTrayIcon()
|
||||
@@ -188,6 +192,7 @@ class Controller(object):
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.MENU, self.update_profile, menuitem=self.systrayIcon.update_profile)
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.MENU, self.show_hide, menuitem=self.systrayIcon.show_hide)
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.MENU, self.check_for_updates, menuitem=self.systrayIcon.check_for_updates)
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.MENU, self.view_documentation, menuitem=self.systrayIcon.doc)
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.MENU, self.exit, menuitem=self.systrayIcon.exit)
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.TASKBAR_LEFT_CLICK, self.taskbar_left_click)
|
||||
widgetUtils.connect_event(self.systrayIcon, widgetUtils.TASKBAR_RIGHT_CLICK, self.taskbar_right_click)
|
||||
@@ -344,6 +349,24 @@ class Controller(object):
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Likes for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
followers_timelines = buffersController.emptyPanel(self.view.nb, "followers_timelines", session.db["user_name"])
|
||||
self.buffers.append(followers_timelines)
|
||||
self.view.insert_buffer(followers_timelines.buffer , name=_(u"Followers' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
for i in session.settings["other_buffers"]["followers_timelines"]:
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "%s-followers" % (i,), session, session.db["user_name"], screen_name=i)
|
||||
self.buffers.append(tl)
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Followers for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"]))
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
friends_timelines = buffersController.emptyPanel(self.view.nb, "friends_timelines", session.db["user_name"])
|
||||
self.buffers.append(friends_timelines)
|
||||
self.view.insert_buffer(friends_timelines.buffer , name=_(u"Friends' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
|
||||
for i in session.settings["other_buffers"]["friends_timelines"]:
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "%s-friends" % (i,), session, session.db["user_name"], screen_name=i)
|
||||
self.buffers.append(tl)
|
||||
self.view.insert_buffer(tl.buffer, name=_(u"Friends 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"]))
|
||||
@@ -410,13 +433,14 @@ class Controller(object):
|
||||
if dlg.get("tweets") == True:
|
||||
if term not in buffer.session.settings["other_buffers"]["tweet_searches"]:
|
||||
buffer.session.settings["other_buffers"]["tweet_searches"].append(term)
|
||||
search = buffersController.searchBufferController(self.view.nb, "search", "%s-searchterm" % (term,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", q=term, count=buffer.session.settings["general"]["max_tweets_per_call"])
|
||||
args = {"lang": dlg.get_language(), "result_type": dlg.get_result_type()}
|
||||
search = buffersController.searchBufferController(self.view.nb, "search", "%s-searchterm" % (term,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", q=term, count=buffer.session.settings["general"]["max_tweets_per_call"], **args)
|
||||
else:
|
||||
log.error("A buffer for the %s search term is already created. You can't create a duplicate buffer." % (term,))
|
||||
return
|
||||
elif dlg.get("users") == True:
|
||||
search = buffersController.searchPeopleBufferController(self.view.nb, "search_users", "%s-searchUser" % (term,), buffer.session, buffer.session.db["user_name"], bufferType=None, q=term)
|
||||
search.start_stream()
|
||||
search.start_stream(mandatory=True)
|
||||
pos=self.view.search("searches", buffer.session.db["user_name"])
|
||||
self.insert_buffer(search, pos)
|
||||
self.view.insert_buffer(search.buffer, name=_(u"Search for {}").format(term), pos=pos)
|
||||
@@ -759,7 +783,8 @@ class Controller(object):
|
||||
return
|
||||
answer = commonMessageDialogs.protected_user()
|
||||
if answer == widgetUtils.NO: return
|
||||
if dlg.get_action() == "tweets":
|
||||
tl_type = dlg.get_action()
|
||||
if tl_type == "tweets":
|
||||
if usr["statuses_count"] == 0:
|
||||
commonMessageDialogs.no_tweets()
|
||||
return
|
||||
@@ -775,7 +800,7 @@ class Controller(object):
|
||||
buff.session.settings["other_buffers"]["timelines"].append(dlg.get_user())
|
||||
pub.sendMessage("restart-streams", streams=["timelinesStream"], session=buff.session)
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
else:
|
||||
elif tl_type == "favourites":
|
||||
if usr["favourites_count"] == 0:
|
||||
commonMessageDialogs.no_favs()
|
||||
return
|
||||
@@ -792,6 +817,40 @@ class Controller(object):
|
||||
tl.timer.start()
|
||||
buff.session.settings["other_buffers"]["favourites_timelines"].append(dlg.get_user())
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
elif tl_type == "followers":
|
||||
if usr["followers_count"] == 0:
|
||||
commonMessageDialogs.no_followers()
|
||||
return
|
||||
if dlg.get_user() in buff.session.settings["other_buffers"]["followers_timelines"]:
|
||||
commonMessageDialogs.timeline_exist()
|
||||
return
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "%s-followers" % (dlg.get_user(),), buff.session, buff.session.db["user_name"], screen_name=dlg.get_user())
|
||||
pos=self.view.search("followers_timelines", buff.session.db["user_name"])
|
||||
self.insert_buffer(tl, pos+1)
|
||||
# self.buffers.insert(pos+1, tl)
|
||||
self.view.insert_buffer(buffer=tl.buffer, name=_(u"Followers for {}").format(dlg.get_user()), pos=pos)
|
||||
tl.start_stream()
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
buff.session.settings["other_buffers"]["followers_timelines"].append(dlg.get_user())
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
|
||||
elif tl_type == "friends":
|
||||
if usr["friends_count"] == 0:
|
||||
commonMessageDialogs.no_friends()
|
||||
return
|
||||
if dlg.get_user() in buff.session.settings["other_buffers"]["friends_timelines"]:
|
||||
commonMessageDialogs.timeline_exist()
|
||||
return
|
||||
tl = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "%s-friends" % (dlg.get_user(),), buff.session, buff.session.db["user_name"], screen_name=dlg.get_user())
|
||||
pos=self.view.search("friends_timelines", buff.session.db["user_name"])
|
||||
self.insert_buffer(tl, pos+1)
|
||||
self.view.insert_buffer(buffer=tl.buffer, name=_(u"Friends for {}").format(dlg.get_user()), pos=pos)
|
||||
tl.start_stream()
|
||||
tl.timer = RepeatingTimer(300, tl.start_stream)
|
||||
tl.timer.start()
|
||||
buff.session.settings["other_buffers"]["friends_timelines"].append(dlg.get_user())
|
||||
buff.session.sound.play("create_timeline.ogg")
|
||||
else:
|
||||
commonMessageDialogs.user_not_exist()
|
||||
|
||||
@@ -866,7 +925,7 @@ class Controller(object):
|
||||
x = tweet["coordinates"]["coordinates"][0]
|
||||
y = tweet["coordinates"]["coordinates"][1]
|
||||
address = geocoder.reverse_geocode(y, x)
|
||||
dlg = messages.viewTweet(address[0].__str__(), False)
|
||||
dlg = commonMessageDialogs.view_geodata(address[0].__str__())
|
||||
else:
|
||||
output.speak(_(u"There are no coordinates in this tweet"))
|
||||
except GeocoderError:
|
||||
@@ -1218,7 +1277,7 @@ class Controller(object):
|
||||
buffer = self.search_buffer("%s-timeline" % (who,), user)
|
||||
if buffer == None: return
|
||||
play_sound = "tweet_timeline.ogg"
|
||||
if "%s-timeline" % (who,) not in buffer.session.settings["other_buffers"]["muted_buffers"]:
|
||||
if "%s-timeline" % (who,) not in buffer.session.settings["other_buffers"]["muted_buffers"] and buffer.session.settings["sound"]["session_mute"] == False:
|
||||
self.notify(buffer.session, play_sound=play_sound)
|
||||
output.speak(_(u"One tweet from %s") % (data["user"]["name"]))
|
||||
buffer.add_new_item(data)
|
||||
@@ -1227,7 +1286,7 @@ class Controller(object):
|
||||
buffer = self.search_buffer("%s" % (where,), user)
|
||||
if buffer == None: return
|
||||
play_sound = "list_tweet.ogg"
|
||||
if "%s" % (where,) not in buffer.session.settings["other_buffers"]["muted_buffers"]:
|
||||
if "%s" % (where,) not in buffer.session.settings["other_buffers"]["muted_buffers"] and buffer.session.settings["sound"]["session_mute"] == False:
|
||||
self.notify(buffer.session, play_sound=play_sound)
|
||||
output.speak(_(u"One tweet from %s") % (data["user"]["name"]))
|
||||
buffer.add_new_item(data)
|
||||
@@ -1391,6 +1450,11 @@ class Controller(object):
|
||||
webbrowser.open("manual.html")
|
||||
os.chdir("../../")
|
||||
|
||||
def view_changelog(self, *args, **kwargs):
|
||||
os.chdir("documentation")
|
||||
webbrowser.open("changelog.html")
|
||||
os.chdir("../")
|
||||
|
||||
def insert_buffer(self, buffer, position):
|
||||
self.buffers.insert(position, buffer)
|
||||
|
||||
@@ -1405,5 +1469,27 @@ class Controller(object):
|
||||
if hasattr(self, action):
|
||||
getattr(self, action)()
|
||||
|
||||
def restart_streams_(self, session):
|
||||
for i in self.buffers:
|
||||
if i.session != None and i.session.session_id == session:
|
||||
i.start_stream()
|
||||
|
||||
def __del__(self):
|
||||
config.app.write()
|
||||
config.app.write()
|
||||
|
||||
def update_buffer(self, *args, **kwargs):
|
||||
bf = self.get_current_buffer()
|
||||
if not hasattr(bf, "start_stream"):
|
||||
output.speak(_(u"Unable to update this buffer."))
|
||||
return
|
||||
else:
|
||||
output.speak(_(u"Updating buffer..."))
|
||||
n = bf.start_stream(mandatory=True)
|
||||
if n != None:
|
||||
output.speak(_(u"{0} items retrieved").format(n,))
|
||||
|
||||
def on_tweet_deleted(self, data):
|
||||
id = data["delete"]["status"]["id"]
|
||||
for i in self.buffers:
|
||||
if hasattr(i, "remove_tweet") and hasattr(i, "name"):
|
||||
i.remove_tweet(id)
|
@@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import platform
|
||||
import attach
|
||||
system = platform.system()
|
||||
import widgetUtils
|
||||
import output
|
||||
@@ -31,11 +33,12 @@ class basicTweet(object):
|
||||
widgetUtils.connect_event(self.message.shortenButton, widgetUtils.BUTTON_PRESSED, self.shorten)
|
||||
widgetUtils.connect_event(self.message.unshortenButton, widgetUtils.BUTTON_PRESSED, self.unshorten)
|
||||
widgetUtils.connect_event(self.message.translateButton, widgetUtils.BUTTON_PRESSED, self.translate)
|
||||
self.attachments = []
|
||||
|
||||
def translate(self, event=None):
|
||||
dlg = translator.gui.translateDialog()
|
||||
if dlg.get_response() == widgetUtils.OK:
|
||||
text_to_translate = self.message.get_text().encode("utf-8")
|
||||
text_to_translate = self.message.get_text()
|
||||
source = [x[0] for x in translator.translator.available_languages()][dlg.get("source_lang")]
|
||||
dest = [x[0] for x in translator.translator.available_languages()][dlg.get("dest_lang")]
|
||||
msg = translator.translator.translate(text=text_to_translate, source=source, target=dest)
|
||||
@@ -101,7 +104,7 @@ class basicTweet(object):
|
||||
self.message.text_focus()
|
||||
|
||||
def attach(self, *args, **kwargs):
|
||||
def completed_callback():
|
||||
def completed_callback(dlg):
|
||||
url = dlg.uploaderFunction.get_url()
|
||||
pub.unsubscribe(dlg.uploaderDialog.update, "uploading")
|
||||
dlg.uploaderDialog.destroy()
|
||||
@@ -124,16 +127,9 @@ class tweet(basicTweet):
|
||||
except AttributeError: pass
|
||||
|
||||
def upload_image(self, *args, **kwargs):
|
||||
if self.message.get("upload_image") == _(u"Discard image"):
|
||||
del self.image
|
||||
self.image = None
|
||||
output.speak(_(u"Discarded"))
|
||||
self.message.set("upload_image", _(u"Upload a picture"))
|
||||
else:
|
||||
self.image = self.message.get_image()
|
||||
if self.image != None:
|
||||
self.message.set("upload_image", _(u"Discard image"))
|
||||
self.message.text_focus()
|
||||
a = attach.attach()
|
||||
if len(a.attachments) != 0:
|
||||
self.attachments = a.attachments
|
||||
|
||||
def autocomplete_users(self, *args, **kwargs):
|
||||
c = autocompletionUsers.completion.autocompletionUsers(self.message, self.session.session_id)
|
||||
@@ -164,23 +160,56 @@ class dm(basicTweet):
|
||||
|
||||
class viewTweet(basicTweet):
|
||||
def __init__(self, tweet, tweetList, is_tweet=True):
|
||||
""" This represents a tweet displayer. However it could be used for showing something wich is not a tweet, like a direct message or an event.
|
||||
param tweet: A dictionary that represents a full tweet or a string for non-tweets.
|
||||
param tweetList: If is_tweet is set to True, this could be a list of quoted tweets.
|
||||
param is_tweet: True or false, depending wether the passed object is a tweet or not."""
|
||||
if is_tweet == True:
|
||||
image_description = []
|
||||
text = ""
|
||||
for i in xrange(0, len(tweetList)):
|
||||
if tweetList[i].has_key("retweeted_status"):
|
||||
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"]["text"])
|
||||
# tweets with message keys are longer tweets, the message value is the full messaje taken from twishort.
|
||||
if tweetList[i].has_key("message") and tweetList[i]["is_quote_status"] == False:
|
||||
value = "message"
|
||||
else:
|
||||
text = text + "@%s: %s\n" % (tweetList[i]["user"]["screen_name"], tweetList[i]["text"])
|
||||
value = "text"
|
||||
if tweetList[i].has_key("retweeted_status") and tweetList[i]["is_quote_status"] == False:
|
||||
if tweetList[i].has_key("message") == False:
|
||||
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i]["retweeted_status"]["text"])
|
||||
else:
|
||||
text = text + "rt @%s: %s\n" % (tweetList[i]["retweeted_status"]["user"]["screen_name"], tweetList[i][value])
|
||||
else:
|
||||
text = text + " @%s: %s\n" % (tweetList[i]["user"]["screen_name"], tweetList[i][value])
|
||||
# tweets with extended_entities could include image descriptions.
|
||||
if tweetList[i].has_key("extended_entities") and tweetList[i]["extended_entities"].has_key("media"):
|
||||
for z in tweetList[i]["extended_entities"]["media"]:
|
||||
if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
|
||||
image_description.append(z["ext_alt_text"])
|
||||
# set rt and likes counters.
|
||||
rt_count = str(tweet["retweet_count"])
|
||||
favs_count = str(tweet["favorite_count"])
|
||||
# Gets the client from where this tweet was made.
|
||||
source = str(re.sub(r"(?s)<.*?>", "", tweet["source"].encode("utf-8")))
|
||||
if text == "":
|
||||
if tweet.has_key("retweeted_status"):
|
||||
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
|
||||
if tweet.has_key("message"):
|
||||
value = "message"
|
||||
else:
|
||||
text = tweet["text"]
|
||||
value = "text"
|
||||
if tweet.has_key("retweeted_status"):
|
||||
if tweet.has_key("message") == False:
|
||||
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
|
||||
else:
|
||||
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet[value])
|
||||
else:
|
||||
text = tweet[value]
|
||||
text = self.clear_text(text)
|
||||
self.message = message.viewTweet(text, rt_count, favs_count)
|
||||
if tweet.has_key("extended_entities") and tweet["extended_entities"].has_key("media"):
|
||||
for z in tweet["extended_entities"]["media"]:
|
||||
if z.has_key("ext_alt_text") and z["ext_alt_text"] != None:
|
||||
image_description.append(z["ext_alt_text"])
|
||||
self.message = message.viewTweet(text, rt_count, favs_count, source.decode("utf-8"))
|
||||
self.message.set_title(len(text))
|
||||
[self.message.set_image_description(i) for i in image_description]
|
||||
else:
|
||||
text = tweet
|
||||
self.message = message.viewNonTweet(text)
|
||||
@@ -200,5 +229,5 @@ class viewTweet(basicTweet):
|
||||
urls = utils.find_urls_in_text(text)
|
||||
for i in urls:
|
||||
if "https://twitter.com/" in i:
|
||||
text = text.replace(i, "")
|
||||
text = text.replace(i, "\n")
|
||||
return text
|
||||
|
@@ -64,11 +64,13 @@ class globalSettingsController(object):
|
||||
self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"])
|
||||
self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"])
|
||||
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
|
||||
self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"])
|
||||
self.dialog.create_proxy()
|
||||
self.dialog.set_value("proxy", "server", config.app["proxy"]["server"])
|
||||
self.dialog.set_value("proxy", "port", config.app["proxy"]["port"])
|
||||
self.dialog.set_value("proxy", "user", config.app["proxy"]["user"])
|
||||
self.dialog.set_value("proxy", "password", config.app["proxy"]["password"])
|
||||
|
||||
self.dialog.realize()
|
||||
self.response = self.dialog.get_response()
|
||||
|
||||
@@ -92,6 +94,7 @@ class globalSettingsController(object):
|
||||
config.app["app-settings"]["handle_longtweets"] = self.dialog.get_value("general", "handle_longtweets")
|
||||
config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound")
|
||||
config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg")
|
||||
config.app["app-settings"]["check_for_updates"] = self.dialog.get_value("general", "check_for_updates")
|
||||
if config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):
|
||||
if self.is_started == True:
|
||||
self.needs_restart = True
|
||||
@@ -261,24 +264,24 @@ class accountSettingsController(globalSettingsController):
|
||||
if change == True:
|
||||
self.dialog.buffers.change_selected_item()
|
||||
|
||||
def manage_pocket(self, *args, **kwargs):
|
||||
if self.dialog.services.get_pocket_status() == _(u"Connect your Pocket account"):
|
||||
self.connect_pocket()
|
||||
else:
|
||||
self.disconnect_pocket()
|
||||
# def manage_pocket(self, *args, **kwargs):
|
||||
# if self.dialog.services.get_pocket_status() == _(u"Connect your Pocket account"):
|
||||
# self.connect_pocket()
|
||||
# else:
|
||||
# self.disconnect_pocket()
|
||||
|
||||
def connect_pocket(self):
|
||||
dlg = self.dialog.services.show_pocket_dialog()
|
||||
if dlg == widgetUtils.YES:
|
||||
request_token = pocket.Pocket.get_request_token(consumer_key=keys.keyring.get("pocket_consumer_key"), redirect_uri="http://127.0.0.1:8080")
|
||||
auth_url = pocket.Pocket.get_auth_url(code=request_token, redirect_uri="http://127.0.0.1:8080")
|
||||
webbrowser.open_new_tab(auth_url)
|
||||
httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 8080), authorisationHandler.handler)
|
||||
while authorisationHandler.logged == False:
|
||||
httpd.handle_request()
|
||||
user_credentials = pocket.Pocket.get_credentials(consumer_key=keys.keyring.get("pocket_consumer_key"), code=request_token)
|
||||
self.dialog.services.set_pocket(True)
|
||||
self.config["services"]["pocket_access_token"] = user_credentials["access_token"]
|
||||
# def connect_pocket(self):
|
||||
# dlg = self.dialog.services.show_pocket_dialog()
|
||||
# if dlg == widgetUtils.YES:
|
||||
# request_token = pocket.Pocket.get_request_token(consumer_key=keys.keyring.get("pocket_consumer_key"), redirect_uri="http://127.0.0.1:8080")
|
||||
# auth_url = pocket.Pocket.get_auth_url(code=request_token, redirect_uri="http://127.0.0.1:8080")
|
||||
# webbrowser.open_new_tab(auth_url)
|
||||
# httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 8080), authorisationHandler.handler)
|
||||
# while authorisationHandler.logged == False:
|
||||
# httpd.handle_request()
|
||||
# user_credentials = pocket.Pocket.get_credentials(consumer_key=keys.keyring.get("pocket_consumer_key"), code=request_token)
|
||||
# self.dialog.services.set_pocket(True)
|
||||
# self.config["services"]["pocket_access_token"] = user_credentials["access_token"]
|
||||
|
||||
def disconnect_dropbox(self):
|
||||
self.config["services"]["pocket_access_token"] = ""
|
||||
|
@@ -31,6 +31,8 @@ class profileController(object):
|
||||
|
||||
def get_data(self, screen_name):
|
||||
self.data = self.session.twitter.twitter.show_user(screen_name=screen_name)
|
||||
if screen_name != self.session.db["user_name"]:
|
||||
self.friendship_status = self.session.twitter.twitter.show_friendship(source_screen_name=self.session.db["user_name"], target_screen_name=screen_name)
|
||||
|
||||
def fill_profile_fields(self):
|
||||
self.dialog.set_name(self.data["name"])
|
||||
@@ -90,6 +92,17 @@ class profileController(object):
|
||||
if self.data["protected"] == True: protected = _(u"Yes")
|
||||
else: protected = _(u"No")
|
||||
string = string+ _(u"Protected: %s\n") % (protected)
|
||||
if hasattr(self, "friendship_status"):
|
||||
relation = False
|
||||
friendship = "Relationship: "
|
||||
if self.friendship_status["relationship"]["target"]["followed_by"]:
|
||||
friendship += _(u"You follow {0}. ").format(self.data["name"],)
|
||||
relation = True
|
||||
if self.friendship_status["relationship"]["target"]["following"]:
|
||||
friendship += _(u"{0} is following you.").format(self.data["name"],)
|
||||
relation = True
|
||||
if relation == True:
|
||||
string = string+friendship+"\n"
|
||||
string = string+_(u"Followers: %s\n Friends: %s\n") % (self.data["followers_count"], self.data["friends_count"])
|
||||
if self.data["verified"] == True: verified = _(u"Yes")
|
||||
else: verified = _(u"No")
|
||||
|
@@ -57,18 +57,16 @@ class audioUploader(object):
|
||||
url = base_url + '?apikey=' + self.config['sound']['sndup_api_key']
|
||||
else:
|
||||
url = base_url
|
||||
self.uploaderFunction = transfer.Upload(field='file', url=url, filename=self.file, completed_callback=completed_callback)
|
||||
elif self.dialog.get("services") == "TwUp":
|
||||
url = "http://api.twup.me/post.json"
|
||||
self.uploaderFunction = transfer.Upload(field='file', url=url, filename=self.file, completed_callback=completed_callback)
|
||||
self.uploaderFunction = transfer.Upload(obj=self, field='file', url=url, filename=self.file, completed_callback=completed_callback)
|
||||
pub.subscribe(self.uploaderDialog.update, "uploading")
|
||||
self.uploaderDialog.get_response()
|
||||
self.uploaderFunction.perform_threaded()
|
||||
self.uploaderDialog.get_response(self.uploaderFunction.perform_threaded)
|
||||
|
||||
def get_available_services(self):
|
||||
services = []
|
||||
services.append("TwUp")
|
||||
services.append("SNDUp")
|
||||
services.append("TwUp")
|
||||
return services
|
||||
|
||||
def on_pause(self, *args, **kwargs):
|
||||
@@ -116,8 +114,9 @@ class audioUploader(object):
|
||||
if self.playing:
|
||||
self._stop()
|
||||
if self.recording != None:
|
||||
self.dialog.disable_control("attach")
|
||||
self.dialog.disable_control("play")
|
||||
self.cleanup()
|
||||
self.dialog.disable_control("attach")
|
||||
self.dialog.disable_control("play")
|
||||
self.file = None
|
||||
self.dialog.enable_control("record")
|
||||
self.dialog.enable_control("attach_exists")
|
||||
@@ -174,10 +173,6 @@ class audioUploader(object):
|
||||
os.remove(self.file)
|
||||
if hasattr(self, 'wav_file'):
|
||||
os.remove(self.wav_file)
|
||||
del(self.wav_file)
|
||||
if hasattr(self, 'wav_file') and os.path.exists(self.file):
|
||||
os.remove(self.file)
|
||||
|
||||
|
||||
def on_attach_exists(self, *args, **kwargs):
|
||||
self.file = self.dialog.get_file()
|
||||
|
@@ -1,106 +1,68 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pycurl
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import json
|
||||
import logging
|
||||
from utils import *
|
||||
from pubsub import pub
|
||||
|
||||
log = logging.getLogger("extra.AudioUploader.transfer")
|
||||
class Transfer(object):
|
||||
|
||||
def __init__(self, url=None, filename=None, follow_location=True, completed_callback=None, verbose=False, *args, **kwargs):
|
||||
self.url = url
|
||||
self.filename = filename
|
||||
log.debug("Uploading audio to %s, filename %s" % (url, filename))
|
||||
self.curl = pycurl.Curl()
|
||||
self.start_time = None
|
||||
self.completed_callback = completed_callback
|
||||
self.background_thread = None
|
||||
self.transfer_rate = 0
|
||||
self.curl.setopt(self.curl.PROGRESSFUNCTION, self.progress_callback)
|
||||
self.curl.setopt(self.curl.URL, url)
|
||||
self.curl.setopt(self.curl.NOPROGRESS, 0)
|
||||
self.curl.setopt(self.curl.HTTP_VERSION, self.curl.CURL_HTTP_VERSION_1_0)
|
||||
self.curl.setopt(self.curl.FOLLOWLOCATION, int(follow_location))
|
||||
self.curl.setopt(self.curl.VERBOSE, int(verbose))
|
||||
super(Transfer, self).__init__(*args, **kwargs)
|
||||
|
||||
def elapsed_time(self):
|
||||
if not self.start_time:
|
||||
return 0
|
||||
return time.time() - self.start_time
|
||||
|
||||
def progress_callback(self, down_total, down_current, up_total, up_current):
|
||||
progress = {}
|
||||
progress["total"] = up_total
|
||||
progress["current"] = up_current
|
||||
# else:
|
||||
# print "Killed function"
|
||||
# return
|
||||
if progress["current"] == 0:
|
||||
progress["percent"] = 0
|
||||
self.transfer_rate = 0
|
||||
else:
|
||||
progress["percent"] = int((float(progress["current"]) / progress["total"]) * 100)
|
||||
self.transfer_rate = progress["current"] / self.elapsed_time()
|
||||
progress["speed"] = '%s/s' % convert_bytes(self.transfer_rate)
|
||||
if self.transfer_rate:
|
||||
progress["eta"] = (progress["total"] - progress["current"]) / self.transfer_rate
|
||||
else:
|
||||
progress["eta"] = 0
|
||||
pub.sendMessage("uploading", data=progress)
|
||||
|
||||
def perform_transfer(self):
|
||||
log.debug("starting upload...")
|
||||
self.start_time = time.time()
|
||||
self.curl.perform()
|
||||
self.curl.close()
|
||||
log.debug("Upload finished.")
|
||||
self.complete_transfer()
|
||||
|
||||
def perform_threaded(self):
|
||||
self.background_thread = threading.Thread(target=self.perform_transfer)
|
||||
self.background_thread.daemon = True
|
||||
self.background_thread.start()
|
||||
|
||||
def complete_transfer(self):
|
||||
if callable(self.completed_callback):
|
||||
self.curl.close()
|
||||
self.completed_callback()
|
||||
|
||||
class Upload(Transfer):
|
||||
|
||||
def __init__(self, field=None, filename=None, *args, **kwargs):
|
||||
super(Upload, self).__init__(filename=filename, *args, **kwargs)
|
||||
self.response = dict()
|
||||
self.curl.setopt(self.curl.POST, 1)
|
||||
if isinstance(filename, unicode):
|
||||
local_filename = filename.encode(sys.getfilesystemencoding())
|
||||
else:
|
||||
local_filename = filename
|
||||
self.curl.setopt(self.curl.HTTPPOST, [(field, (self.curl.FORM_FILE, local_filename, self.curl.FORM_FILENAME, filename.encode("utf-8")))])
|
||||
self.curl.setopt(self.curl.HEADERFUNCTION, self.header_callback)
|
||||
self.curl.setopt(self.curl.WRITEFUNCTION, self.body_callback)
|
||||
|
||||
def header_callback(self, content):
|
||||
self.response['header'] = content
|
||||
|
||||
def body_callback(self, content):
|
||||
self.response['body'] = content
|
||||
|
||||
def get_url(self):
|
||||
return json.loads(self.response['body'])['url']
|
||||
|
||||
class Download(Transfer):
|
||||
|
||||
def __init__(self, follow_location=True, *args, **kwargs):
|
||||
super(Download, self).__init__(*args, **kwargs)
|
||||
self.download_file = open(self.filename, 'wb')
|
||||
self.curl.setopt(self.curl.WRITEFUNCTION, self.download_file.write)
|
||||
|
||||
def complete_transfer(self):
|
||||
self.download_file.close()
|
||||
super(DownloadDialog, self).complete_transfer()
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import logging
|
||||
from utils import convert_bytes
|
||||
from pubsub import pub
|
||||
log = logging.getLogger("extra.AudioUploader.transfer")
|
||||
from requests_toolbelt.multipart.encoder import MultipartEncoder, MultipartEncoderMonitor
|
||||
import requests
|
||||
import os
|
||||
class Upload(object):
|
||||
def __init__(self, field=None, obj=None, url=None, filename=None, follow_location=True, completed_callback=None, verbose=False, *args, **kwargs):
|
||||
super(Upload, self).__init__(*args, **kwargs)
|
||||
self.url=url
|
||||
self.filename=filename
|
||||
log.debug("Uploading audio to %s, filename %s" % (url, filename))
|
||||
self.start_time = None
|
||||
self.completed_callback = completed_callback
|
||||
self.background_thread = None
|
||||
self.transfer_rate = 0
|
||||
self.m = MultipartEncoder(fields={field:(os.path.basename(self.filename), open(self.filename, 'rb'), "application/octet-stream")})
|
||||
self.monitor = MultipartEncoderMonitor(self.m, self.progress_callback)
|
||||
self.response=None
|
||||
self.obj=obj
|
||||
self.follow_location=follow_location
|
||||
#the verbose parameter is deprecated and will be removed soon
|
||||
|
||||
def elapsed_time(self):
|
||||
if not self.start_time:
|
||||
return 0
|
||||
return time.time() - self.start_time
|
||||
|
||||
def progress_callback(self, monitor):
|
||||
progress = {}
|
||||
progress["total"] = monitor.len
|
||||
progress["current"] = monitor.bytes_read
|
||||
if progress["current"] == 0:
|
||||
progress["percent"] = 0
|
||||
self.transfer_rate = 0
|
||||
else:
|
||||
progress["percent"] = int((float(progress["current"]) / progress["total"]) * 100)
|
||||
self.transfer_rate = progress["current"] / self.elapsed_time()
|
||||
progress["speed"] = '%s/s' % convert_bytes(self.transfer_rate)
|
||||
if self.transfer_rate:
|
||||
progress["eta"] = (progress["total"] - progress["current"]) / self.transfer_rate
|
||||
else:
|
||||
progress["eta"] = 0
|
||||
pub.sendMessage("uploading", data=progress)
|
||||
|
||||
def perform_transfer(self):
|
||||
log.debug("starting upload...")
|
||||
self.start_time = time.time()
|
||||
self.response=requests.post(url=self.url, data=self.monitor, headers={"Content-Type":self.m.content_type}, allow_redirects=self.follow_location, stream=True)
|
||||
log.debug("Upload finished.")
|
||||
self.complete_transfer()
|
||||
|
||||
def perform_threaded(self, *args, **kwargs):
|
||||
self.background_thread = threading.Thread(target=self.perform_transfer)
|
||||
self.background_thread.daemon = True
|
||||
self.background_thread.start()
|
||||
|
||||
def complete_transfer(self):
|
||||
if callable(self.completed_callback):
|
||||
self.completed_callback(self.obj)
|
||||
|
||||
def get_url(self):
|
||||
return self.response.json()['url']
|
||||
|
@@ -3,10 +3,10 @@ import wx
|
||||
from utils import *
|
||||
import widgetUtils
|
||||
|
||||
class TransferDialog(widgetUtils.BaseDialog):
|
||||
class UploadDialog(widgetUtils.BaseDialog):
|
||||
|
||||
def __init__(self, filename, *args, **kwargs):
|
||||
super(TransferDialog, self).__init__(parent=None, id=wx.NewId(), *args, **kwargs)
|
||||
super(UploadDialog, self).__init__(parent=None, id=wx.NewId(), *args, **kwargs)
|
||||
self.pane = wx.Panel(self)
|
||||
self.progress_bar = wx.Gauge(parent=self.pane)
|
||||
fileBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
@@ -56,18 +56,6 @@ class TransferDialog(widgetUtils.BaseDialog):
|
||||
def create_buttons(self):
|
||||
self.cancel_button = wx.Button(parent=self.pane, id=wx.ID_CANCEL)
|
||||
|
||||
def get_response(self):
|
||||
self.Show()
|
||||
|
||||
def destroy(self):
|
||||
self.Destroy()
|
||||
|
||||
class UploadDialog(TransferDialog):
|
||||
|
||||
def __init__(self, filename=None, *args, **kwargs):
|
||||
super(UploadDialog, self).__init__(filename=filename, *args, **kwargs)
|
||||
|
||||
class DownloadDialog(TransferDialog):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Download, self).__init__(*args, **kwargs)
|
||||
def get_response(self, fn):
|
||||
wx.CallAfter(fn, 0.01)
|
||||
self.ShowModal()
|
||||
|
@@ -1,153 +1,10 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Copyright (C) 2013 Mesar Hameed <mhameed@src.gnome.org>
|
||||
# This file is covered by the GNU General Public License.
|
||||
# -*- coding: utf-8 -*-
|
||||
from microsofttranslator import Translator
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import threading
|
||||
from time import sleep
|
||||
from random import randint
|
||||
import logging
|
||||
log = logging.getLogger("translator")
|
||||
import urllib2
|
||||
def translate(text="", source="auto", target="en"):
|
||||
t = Translator("twblue", "4KZA26GYIfmVAqQA/z16Hlucbg64hVSDTIpRjT2FqIU=")
|
||||
return t.translate(text, target)
|
||||
|
||||
# Each group has to be a class of possible breaking points for the writing script.
|
||||
# Usually this is the major syntax marks, such as:
|
||||
# full stop, comma, exclaim, question, etc.
|
||||
arabicBreaks = u'[،؛؟]'
|
||||
# Thanks to Talori in the NVDA irc room:
|
||||
# U+3000 to U+303F, U+FE10 to U+FE1F, U+FE30 to U+FE6F, U+FF01 to U+FF60
|
||||
chineseBreaks = u'[ -〿︐-︰-!-⦆]'
|
||||
latinBreaks = r'[.,!?;:\n]'
|
||||
splitReg = re.compile(u"{arabic}|{chinese}|{latin}".format(arabic=arabicBreaks, chinese=chineseBreaks, latin=latinBreaks))
|
||||
|
||||
def translate(text, source="auto", target="en"):
|
||||
if source == "": source = "auto"
|
||||
t = Translator(lang_from=source, lang_to=target, text=text)
|
||||
t.start()
|
||||
while t.isAlive():
|
||||
sleep(0.1)
|
||||
t.join()
|
||||
return t.translation
|
||||
|
||||
def splitChunks(text, chunksize):
|
||||
pos = 0
|
||||
potentialPos = 0
|
||||
for splitMark in splitReg.finditer(text):
|
||||
if (splitMark.start() - pos +1) < chunksize:
|
||||
potentialPos = splitMark.start()
|
||||
continue
|
||||
else:
|
||||
yield text[pos:potentialPos+1]
|
||||
pos = potentialPos + 1
|
||||
potentialPos = splitMark.start()
|
||||
yield text[pos:]
|
||||
|
||||
class Translator(threading.Thread):
|
||||
|
||||
def __init__(self, lang_from, lang_to, text, lang_swap=None, chunksize=350, *args, **kwargs):
|
||||
super(Translator, self).__init__(*args, **kwargs)
|
||||
self._stop = threading.Event()
|
||||
self.text = text
|
||||
self.chunksize = chunksize
|
||||
self.lang_to = lang_to
|
||||
self.lang_from = lang_from
|
||||
self.lang_swap = lang_swap
|
||||
self.translation = ''
|
||||
self.lang_translated = ''
|
||||
self.firstChunk = True
|
||||
|
||||
def stop(self):
|
||||
self._stop.set()
|
||||
|
||||
def run(self):
|
||||
for chunk in splitChunks(self.text, self.chunksize):
|
||||
# Make sure we don't send requests to google too often.
|
||||
# Try to simulate a human.
|
||||
if not self.firstChunk:
|
||||
sleep(randint(1, 10))
|
||||
req = self.buildRequest(chunk, self.lang_from, self.lang_to)
|
||||
try:
|
||||
response = urllib2.urlopen(req)
|
||||
translation, lang_translated = self.parseData(response)
|
||||
if self.firstChunk and self.lang_from == "auto" and lang_translated == self.lang_to and self.lang_swap is not None:
|
||||
self.lang_to = self.lang_swap
|
||||
self.firstChunk = False
|
||||
req = self.buildRequest(chunk.encode('utf-8'), self.lang_from, self.lang_to)
|
||||
response = urllib2.urlopen(req)
|
||||
translation, lang_translated = self.parseData(response)
|
||||
except Exception as e:
|
||||
log.exception("Can not translate text '%s'" %chunk)
|
||||
# We have probably been blocked, so stop trying to translate.
|
||||
raise e
|
||||
self.translation += translation
|
||||
# some adjustment, better to do on full text
|
||||
self.translation = self.fixNewlines(self.translation)
|
||||
self.lang_translated = lang_translated
|
||||
|
||||
def buildRequest(self, text, lang_from, lang_to):
|
||||
"""Build POST request which will be sent to Google."""
|
||||
urlTemplate = 'http://translate.google.com/translate_a/single?client=t&sl={lang_from}&tl={lang_to}&ie=utf-8&oe=utf-8&dt=t&dt=bd&tk='
|
||||
url = urlTemplate.format(lang_from=lang_from, lang_to=lang_to)
|
||||
header = {'User-agent': 'Mozilla/5.0', 'Content-Type': 'application/x-www-form-urlencoded'}
|
||||
data = 'text=%s' %urllib2.quote(text)
|
||||
req = urllib2.Request(url, data, header)
|
||||
return req
|
||||
|
||||
def parseData(self, response):
|
||||
"""Parse unstructured response."""
|
||||
data = response.readlines()[0]
|
||||
# get segments with couples ["translation","original text"]
|
||||
l1, l2 = data.split(']],', 1)
|
||||
translation = l1[3:]
|
||||
if l2.startswith('[[\"'):
|
||||
# get list of synonyms
|
||||
syn = l2[l2.find(',[')+1:l2.find(']')].split(',')
|
||||
temp = ', '.join([x.replace('\"', '') for x in syn])
|
||||
else:
|
||||
# get a list with each couple as item
|
||||
sentences = translation.split('],[')
|
||||
temp = ''
|
||||
# get translation, removing first char (quote symbol)
|
||||
for item in sentences:
|
||||
item = item.split('\",\"', 1)[0][1:]
|
||||
# join all translations
|
||||
temp = ' '.join([temp, item])
|
||||
translation = temp.decode('string-escape').decode('utf-8')
|
||||
translation = self.fixPunctuation(translation)
|
||||
# get the language of original text
|
||||
tempLang = data.partition(']],,\"')[2]
|
||||
lang = tempLang[:tempLang.find('\"')]
|
||||
if lang == '':
|
||||
lang = _("unavailable")
|
||||
return translation, lang
|
||||
|
||||
def fixPunctuation(self, translation):
|
||||
"""Clean text from space before punctuation symbol."""
|
||||
# list of potentially positions of spaces to remove
|
||||
spacePos = []
|
||||
for puncMark in splitReg.finditer(translation):
|
||||
spacePos.append(puncMark.start()-1)
|
||||
if len(spacePos) == 0:
|
||||
return translation
|
||||
fixedTranslation = ''
|
||||
for n in xrange(0,len(translation)):
|
||||
temp = translation[n]
|
||||
if n in spacePos and temp == ' ':
|
||||
continue
|
||||
else:
|
||||
fixedTranslation += temp
|
||||
return fixedTranslation
|
||||
|
||||
def fixNewlines(self, translation):
|
||||
"""Adjust newlines and (subsequent or double) spaces."""
|
||||
fixes = [('\r\n ', '\r\n'), ('\n ', '\r\n'), (' ', ' ')]
|
||||
for fix in fixes:
|
||||
translation = translation.replace(fix[0], fix[1])
|
||||
# first char is a space, so...
|
||||
return translation[1:]
|
||||
|
||||
languages = {
|
||||
"af": _(u"Afrikaans"),
|
||||
@@ -244,8 +101,8 @@ languages = {
|
||||
}
|
||||
|
||||
def available_languages():
|
||||
l = languages.keys()
|
||||
d = languages.values()
|
||||
l.insert(0, '')
|
||||
d.insert(0, _(u"autodetect"))
|
||||
return sorted(zip(l, d))
|
||||
l = languages.keys()
|
||||
d = languages.values()
|
||||
l.insert(0, '')
|
||||
d.insert(0, _(u"autodetect"))
|
||||
return sorted(zip(l, d))
|
||||
|
@@ -4,9 +4,10 @@ import sys
|
||||
import fix_arrow # A few new locales for Three languages in arrow.
|
||||
import fix_urllib3_warnings # Avoiding some SSL warnings related to Twython.
|
||||
import fix_win32com
|
||||
|
||||
import fix_requests #fix cacert.pem location for TWBlue binary copies
|
||||
def setup():
|
||||
fix_arrow.fix()
|
||||
if hasattr(sys, "frozen"):
|
||||
fix_win32com.fix()
|
||||
fix_requests.fix()
|
||||
fix_urllib3_warnings.fix()
|
10
src/fixes/fix_requests.py
Normal file
10
src/fixes/fix_requests.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from requests import certs, utils, adapters
|
||||
import paths
|
||||
|
||||
def patched_where():
|
||||
return paths.app_path(u"cacert.pem")
|
||||
|
||||
def fix():
|
||||
certs.where=patched_where
|
||||
utils.DEFAULT_CA_BUNDLE_PATH=patched_where()
|
||||
adapters.DEFAULT_CA_BUNDLE_PATH=patched_where()
|
@@ -47,7 +47,7 @@ class reportBug(object):
|
||||
issue.project.name = application.name
|
||||
issue.project.id = 0
|
||||
issue.summary = self.dialog.get("summary"),
|
||||
issue.description = "Reported by @%s\n\n" % (self.user_name) + self.dialog.get("description")
|
||||
issue.description = "Reported by @%s on version %s (snapshot = %s)\n\n" % (self.user_name, application.version, application.snapshot) + self.dialog.get("description")
|
||||
# to do: Create getters for category, severity and reproducibility in wx_UI.
|
||||
issue.category = constants.categories[self.dialog.category.GetSelection()]
|
||||
issue.reproducibility.name = constants.reproducibilities[self.dialog.reproducibility.GetSelection()]
|
||||
|
@@ -17,7 +17,7 @@ send_dm = string(default="control+win+d")
|
||||
user_details = string(default="control+win+shift+u")
|
||||
exit = string(default="control+win+q")
|
||||
open_timeline = string(default="control+win+u")
|
||||
remove_buffer = string(default="control+win+backspace")
|
||||
remove_buffer = string(default="control+win+back")
|
||||
audio = string(default="control+win+return")
|
||||
url = string(default="control+win+b")
|
||||
go_home = string(default="control+win+home")
|
||||
@@ -28,7 +28,8 @@ repeat_item = string(default="control+win+space")
|
||||
copy_to_clipboard = string(default="control+win+shift+c")
|
||||
search = string(default="control+win+/")
|
||||
find = string(default="control+win+shift+/")
|
||||
check_for_updates = string(default="alt+win+u)
|
||||
check_for_updates = string(default="alt+win+u")
|
||||
list_manager = string(default="control+win+shift+l")
|
||||
configuration = string(default="control+win+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
update_buffer = string(default="control+win+shift+u")
|
@@ -50,4 +50,5 @@ get_trending_topics = string(default="control+win+shift+t")
|
||||
check_for_updates = string(default="control+win+u")
|
||||
list_manager = string(default="control+win+shift+l")
|
||||
configuration = string(default="control+win+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
update_buffer = string(default="control+win+shift+u")
|
@@ -30,8 +30,8 @@ volume_up = string(default="alt+win+shift+up")
|
||||
go_home = string(default="alt+win+home")
|
||||
volume_down = string(default="alt+win+shift+down")
|
||||
go_end = string(default="alt+win+end")
|
||||
go_page_up = string(default="alt+win+pageup")
|
||||
go_page_down = string(default="alt+win+pagedown")
|
||||
go_page_up = string(default="control+win+pageup")
|
||||
go_page_down = string(default="control+win+pagedown")
|
||||
update_profile = string(default="alt+win+p")
|
||||
delete = string(default="alt+win+delete")
|
||||
clear_buffer = string(default="alt+win+shift+delete")
|
||||
@@ -52,4 +52,5 @@ get_trending_topics = string(default="alt+win+t")
|
||||
check_for_updates = string(default="alt+win+u")
|
||||
list_manager = string(default="alt+win+shift+l")
|
||||
configuration = string(default="control+win+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
update_buffer = string(default="control+alt+shift+u")
|
@@ -53,4 +53,5 @@ get_trending_topics = string(default="control+win+t")
|
||||
check_for_updates = string(default="control+win+u")
|
||||
list_manager = string(default="control+win+shift+l")
|
||||
configuration = string(default="control+win+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
update_buffer = string(default="control+win+shift+u")
|
@@ -53,4 +53,5 @@ find = string(default="control+win+{")
|
||||
check_for_updates = string(default="control+win+u")
|
||||
list_manager = string(default="control+win+shift+l")
|
||||
configuration = string(default="control+win+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
accountConfiguration = string(default="control+win+shift+o")
|
||||
update_buffer = string(default="control+win+shift+u")
|
@@ -5,16 +5,16 @@ import exceptions
|
||||
from ctypes import c_char_p
|
||||
from libloader import load_library
|
||||
import paths
|
||||
if application.snapshot == True:
|
||||
if platform.architecture()[0][:2] == "32":
|
||||
lib = load_library("snapshot_api_keys32", x86_path=paths.app_path("keys/lib"))
|
||||
else:
|
||||
lib = load_library("snapshot_api_keys64", x64_path=paths.app_path("keys/lib"))
|
||||
#if application.snapshot == True:
|
||||
# if platform.architecture()[0][:2] == "32":
|
||||
# lib = load_library("snapshot_api_keys32", x86_path=paths.app_path("keys/lib"))
|
||||
# else:
|
||||
# lib = load_library("snapshot_api_keys64", x64_path=paths.app_path("keys/lib"))
|
||||
#else:
|
||||
if platform.architecture()[0][:2] == "32":
|
||||
lib = load_library("stable_api_keys32", x86_path=paths.app_path("keys/lib"))
|
||||
else:
|
||||
if platform.architecture()[0][:2] == "32":
|
||||
lib = load_library("stable_api_keys32", x86_path=paths.app_path("keys/lib"))
|
||||
else:
|
||||
lib = load_library("stable_api_keys64", x64_path=paths.app_path("keys/lib"))
|
||||
lib = load_library("stable_api_keys64", x64_path=paths.app_path("keys/lib"))
|
||||
|
||||
# import linuxKeys
|
||||
# lib = linuxKeys
|
||||
|
@@ -50,4 +50,6 @@ actions = {
|
||||
"lists_manager": _(u"Opens the list manager, which allows you to create, edit, delete and open lists in buffers."),
|
||||
"configuration": _(u"Opens the global settings dialogue"),
|
||||
"accountConfiguration": _(u"Opens the account settings dialogue"),
|
||||
"audio": _(u"Try to play an audio file"),
|
||||
"update_buffer": _(u"Updates the buffer and retrieves possible lost items there."),
|
||||
}
|
@@ -37,13 +37,10 @@ class KeystrokeEditor(object):
|
||||
|
||||
def get_edited_keystroke(self, dialog):
|
||||
keys = []
|
||||
if dialog.get("win") == False:
|
||||
wx_ui.no_win_message()
|
||||
return
|
||||
if dialog.get("control") == True:
|
||||
keys.append("control")
|
||||
# if dialog.get("win") == True:
|
||||
keys.append("win")
|
||||
if dialog.get("win") == True:
|
||||
keys.append("win")
|
||||
if dialog.get("alt") == True:
|
||||
keys.append("alt")
|
||||
if dialog.get("shift") == True:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
from pywintypes import com_error
|
||||
import win32com
|
||||
import paths
|
||||
win32com.__gen_path__=paths.data_path(u"com_cache")
|
||||
win32com.__gen_path__=paths.com_path()
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.join(win32com.__gen_path__, "."))
|
||||
|
@@ -32,7 +32,7 @@ def load_library(library, x86_path='.', x64_path='.', *args, **kwargs):
|
||||
loaded = _do_load(lib, *args, **kwargs)
|
||||
if loaded is not None:
|
||||
return loaded
|
||||
raise LibraryLoadError('unable to load %r. Provided library path: %r' % (library, path))
|
||||
raise LibraryLoadError('unable to load %r. Provided library path: %r' % (library, lib))
|
||||
|
||||
def _do_load(file, *args, **kwargs):
|
||||
loader = TYPES[platform.system()]['loader']
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -18,15 +18,10 @@
|
||||
############################################################
|
||||
from twitter import utils
|
||||
|
||||
def get_id(url):
|
||||
return url.split("/")[-1]
|
||||
|
||||
def is_long(tweet):
|
||||
long = False
|
||||
for url in range(0, len(tweet["entities"]["urls"])):
|
||||
if "twitter.com" in tweet["entities"]["urls"][url]["expanded_url"]:
|
||||
long = get_id(tweet["entities"]["urls"][url]["expanded_url"])
|
||||
return long
|
||||
if tweet.has_key("is_quote_status") and tweet["is_quote_status"] == True and tweet.has_key("quoted_status"):
|
||||
return tweet["quoted_status_id"]
|
||||
return False
|
||||
|
||||
def clear_url(tweet):
|
||||
urls = utils.find_urls_in_text(tweet["text"])
|
||||
|
@@ -51,5 +51,4 @@ def create_tweet(user_token, user_secret, text, media=0):
|
||||
"text": text.encode("utf-8"),
|
||||
"media": media}
|
||||
response = requests.post(url, data=data)
|
||||
# print response.json()
|
||||
return response.json()["text_to_tweet"]
|
@@ -14,6 +14,9 @@ if system == "Windows":
|
||||
sys.stderr = open(os.path.join(os.getenv("temp"), "stderr.log"), "w")
|
||||
import languageHandler
|
||||
import paths
|
||||
#check if TWBlue is installed (Windows only)
|
||||
if os.path.exists(paths.app_path(u"Uninstall.exe")):
|
||||
paths.mode="installed"
|
||||
import commandline
|
||||
import config
|
||||
import sound
|
||||
@@ -67,7 +70,8 @@ def setup():
|
||||
if system == "Windows":
|
||||
if config.app["app-settings"]["donation_dialog_displayed"] == False:
|
||||
donation()
|
||||
updater.do_update()
|
||||
if config.app['app-settings']['check_for_updates']:
|
||||
updater.do_update()
|
||||
sm = sessionManager.sessionManagerController()
|
||||
sm.fill_list()
|
||||
if len(sm.sessions) == 0: sm.show()
|
||||
|
20
src/paths.py
20
src/paths.py
@@ -7,7 +7,7 @@ from platform_utils import paths as paths_
|
||||
|
||||
from functools import wraps
|
||||
|
||||
mode = None
|
||||
mode = "portable"
|
||||
directory = None
|
||||
|
||||
log = logging.getLogger("paths")
|
||||
@@ -55,7 +55,8 @@ def data_path(app_name='TW blue'):
|
||||
# data_path = os.path.join(shlobj.SHGetFolderPath(0, shlobj.CSIDL_APPDATA), app_name)
|
||||
# else:
|
||||
if platform.system() == "Windows":
|
||||
data_path = os.path.join(os.getenv("AppData"), app_name)
|
||||
import winpaths
|
||||
data_path = os.path.join(winpaths.get_appdata(), app_name)
|
||||
else:
|
||||
data_path = os.path.join(os.environ['HOME'], ".%s" % app_name)
|
||||
if not os.path.exists(data_path):
|
||||
@@ -68,4 +69,17 @@ def locale_path():
|
||||
|
||||
@merge_paths
|
||||
def sound_path():
|
||||
return app_path(u"sounds")
|
||||
return app_path(u"sounds")
|
||||
|
||||
@merge_paths
|
||||
def com_path():
|
||||
global mode, directory
|
||||
if mode == "portable":
|
||||
if directory != None: path = os.path.join(directory, "com_cache")
|
||||
elif directory == None: path = app_path(u"com_cache")
|
||||
elif mode == "installed":
|
||||
path = data_path(u"com_cache")
|
||||
if not os.path.exists(path):
|
||||
log.debug("%s path does not exist, creating..." % (path,))
|
||||
os.mkdir(path)
|
||||
return path
|
||||
|
@@ -32,7 +32,7 @@ def load_library(library, x86_path='.', x64_path='.', *args, **kwargs):
|
||||
loaded = _do_load(lib, *args, **kwargs)
|
||||
if loaded is not None:
|
||||
return loaded
|
||||
raise LibraryLoadError('unable to load %r. Provided library path: %r' % (library, path))
|
||||
raise LibraryLoadError('unable to load %r. Provided library path: %r' % (library, lib))
|
||||
|
||||
def _do_load(file, *args, **kwargs):
|
||||
loader = TYPES[platform.system()]['loader']
|
||||
|
@@ -18,7 +18,7 @@ import os
|
||||
from mysc.thread_utils import stream_threaded
|
||||
from pubsub import pub
|
||||
log = logging.getLogger("sessionmanager.session")
|
||||
from long_tweets import tweets
|
||||
from long_tweets import tweets, twishort
|
||||
|
||||
sessions = {}
|
||||
|
||||
@@ -64,6 +64,7 @@ class Session(object):
|
||||
if utils.find_item(i["id"], self.db[name]) == None and utils.is_allowed(i, self.settings["twitter"]["ignored_clients"]) == True:
|
||||
try: i = self.check_quoted_status(i)
|
||||
except: pass
|
||||
i = self.check_long_tweet(i)
|
||||
if self.settings["general"]["reverse_timelines"] == False: self.db[name].append(i)
|
||||
else: self.db[name].insert(0, i)
|
||||
num = num+1
|
||||
@@ -194,6 +195,7 @@ class Session(object):
|
||||
if report_success:
|
||||
output.speak(_("%s succeeded.") % action)
|
||||
if _sound != None: self.sound.play(_sound)
|
||||
return val
|
||||
|
||||
def search(self, name, *args, **kwargs):
|
||||
tl = self.twitter.twitter.search(*args, **kwargs)
|
||||
@@ -278,8 +280,7 @@ class Session(object):
|
||||
tl = self.call_paged(function, sinze_id=last_id, *args, **kwargs)
|
||||
self.order_buffer(name, tl)
|
||||
|
||||
@_require_login
|
||||
def get_cursored_stream(self, name, function, items="users", *args, **kwargs):
|
||||
def get_cursored_stream(self, name, function, items="users", get_previous=False, *args, **kwargs):
|
||||
|
||||
""" Gets items for API calls that require using cursors to paginate the results.
|
||||
name str: Name to save it in the database.
|
||||
@@ -289,7 +290,7 @@ class Session(object):
|
||||
|
||||
items_ = []
|
||||
try:
|
||||
if self.db[name].has_key("cursor"):
|
||||
if self.db[name].has_key("cursor") and get_previous:
|
||||
cursor = self.db[name]["cursor"]
|
||||
else:
|
||||
cursor = -1
|
||||
@@ -352,7 +353,7 @@ class Session(object):
|
||||
self.logged = False
|
||||
self.twitter = twitter.twitter.twitter()
|
||||
self.login(False)
|
||||
# pub.sendMessage("streamError", session=self.session_id)
|
||||
pub.sendMessage("restart_streams", session=self.session_id)
|
||||
if self.reconnection_function_active == True: return
|
||||
self.reconnection_function_active = True
|
||||
if not hasattr(self, "main_stream"):
|
||||
@@ -425,19 +426,17 @@ class Session(object):
|
||||
def check_quoted_status(self, tweet):
|
||||
status = tweets.is_long(tweet)
|
||||
if status != False:
|
||||
tweet["quoted"] = 1
|
||||
tweet = self.get_quoted_tweet(tweet)
|
||||
return tweet
|
||||
|
||||
|
||||
|
||||
def get_quoted_tweet(self, tweet):
|
||||
quoted_tweet = self.twitter.twitter.show_status(id=tweet["id"])
|
||||
quoted_tweet = tweet
|
||||
urls = utils.find_urls_in_text(quoted_tweet["text"])
|
||||
for url in range(0, len(urls)):
|
||||
try: quoted_tweet["text"] = quoted_tweet["text"].replace(urls[url], quoted_tweet["entities"]["urls"][url]["expanded_url"])
|
||||
except IndexError: pass
|
||||
l = tweets.is_long(quoted_tweet)
|
||||
id = tweets.get_id(l)
|
||||
id = tweets.is_long(quoted_tweet)
|
||||
try: original_tweet = self.twitter.twitter.show_status(id=id)
|
||||
except: return quoted_tweet
|
||||
urls = utils.find_urls_in_text(original_tweet["text"])
|
||||
@@ -446,3 +445,8 @@ class Session(object):
|
||||
except IndexError: pass
|
||||
return compose.compose_quoted_tweet(quoted_tweet, original_tweet)
|
||||
|
||||
def check_long_tweet(self, tweet):
|
||||
long = twishort.is_long(tweet)
|
||||
if long != False:
|
||||
tweet["message"] = twishort.get_full_text(long)
|
||||
return tweet
|
@@ -2,6 +2,7 @@
|
||||
import shutil
|
||||
import widgetUtils
|
||||
import platform
|
||||
import output
|
||||
if platform.system() == "Windows":
|
||||
import wxUI as view
|
||||
from controller import settings
|
||||
@@ -43,6 +44,15 @@ class sessionManagerController(object):
|
||||
log.debug("Adding session %s" % (i,))
|
||||
strconfig = "%s/session.conf" % (paths.config_path(i))
|
||||
config_test = config_utils.load_config(strconfig)
|
||||
if len(config_test) == 0:
|
||||
try:
|
||||
log.debug("Deleting session %s" % (i,))
|
||||
shutil.rmtree(paths.config_path(i))
|
||||
continue
|
||||
except:
|
||||
output.speak("An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",True)
|
||||
os.exception("Exception thrown while removing malformed session")
|
||||
continue
|
||||
name = config_test["twitter"]["user_name"]
|
||||
if config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != "":
|
||||
sessionsList.append(name)
|
||||
|
@@ -4,7 +4,7 @@ from multiplatform_widgets import widgets
|
||||
import application
|
||||
class sessionManagerWindow(wx.Dialog):
|
||||
def __init__(self):
|
||||
super(sessionManagerWindow, self).__init__(parent=None, title="Session manager", size=wx.DefaultSize)
|
||||
super(sessionManagerWindow, self).__init__(parent=None, title=_(u"Session manager"), size=wx.DefaultSize)
|
||||
panel = wx.Panel(self)
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
label = wx.StaticText(panel, -1, _(u"Accounts list"), size=wx.DefaultSize)
|
||||
|
69
src/setup.py
69
src/setup.py
@@ -26,59 +26,60 @@ import application
|
||||
import platform
|
||||
from glob import glob
|
||||
import wx
|
||||
from requests import certs
|
||||
|
||||
def get_architecture_files():
|
||||
if platform.architecture()[0][:2] == "32":
|
||||
return [
|
||||
if platform.architecture()[0][:2] == "32":
|
||||
return [
|
||||
("", ["../windows-dependencies/x86/oggenc2.exe", "../windows-dependencies/x86/bootstrap.exe"]),
|
||||
("Microsoft.VC90.CRT", glob("../windows-dependencies/x86/Microsoft.VC90.CRT/*")),
|
||||
("Microsoft.VC90.MFC", glob("../windows-dependencies/x86/Microsoft.VC90.MFC/*")),]
|
||||
elif platform.architecture()[0][:2] == "64":
|
||||
return [
|
||||
elif platform.architecture()[0][:2] == "64":
|
||||
return [
|
||||
("", ["../windows-dependencies/x64/oggenc2.exe", "../windows-dependencies/x86/bootstrap.exe"]),
|
||||
("Microsoft.VC90.CRT", glob("../windows-dependencies/x64/Microsoft.VC90.CRT/*")),
|
||||
("Microsoft.VC90.MFC", glob("../windows-dependencies/x64/Microsoft.VC90.MFC/*")),]
|
||||
|
||||
def get_data():
|
||||
import accessible_output2
|
||||
import sound_lib
|
||||
import enchant
|
||||
return [
|
||||
import accessible_output2
|
||||
import sound_lib
|
||||
import enchant
|
||||
return [
|
||||
("", ["conf.defaults", "app-configuration.defaults", "icon.ico"]),
|
||||
("requests", ["cacert.pem"]),
|
||||
("", [certs.where()]),
|
||||
("accessible_output2/lib", glob("accessible_output2/lib/*.dll")),
|
||||
("keys/lib", glob("keys/lib/*.dll")),
|
||||
("keymaps", glob("keymaps/*.keymap")),
|
||||
]+get_sounds()+get_locales()+get_documentation()+sound_lib.find_datafiles()+accessible_output2.find_datafiles()+enchant.utils.win32_data_files()+get_architecture_files()+wx_files()
|
||||
|
||||
def get_documentation ():
|
||||
answer = []
|
||||
depth = 6
|
||||
for root, dirs, files in os.walk('documentation'):
|
||||
if depth == 0:
|
||||
break
|
||||
new = (root, glob(os.path.join(root, "*.html")))
|
||||
answer.append(new)
|
||||
depth -= 1
|
||||
return answer
|
||||
answer = [("documentation", ["documentation/license.txt"])]
|
||||
depth = 9
|
||||
for root, dirs, files in os.walk('documentation'):
|
||||
if depth == 0:
|
||||
break
|
||||
new = (root, glob(os.path.join(root, "*.html")))
|
||||
answer.append(new)
|
||||
depth -= 1
|
||||
return answer
|
||||
|
||||
def get_sounds():
|
||||
answer = []
|
||||
depth = 6
|
||||
for root, dirs, files in os.walk('sounds'):
|
||||
if depth == 0:
|
||||
break
|
||||
new = (root, glob(os.path.join(root, "*.ogg")))
|
||||
answer.append(new)
|
||||
depth -= 1
|
||||
return answer
|
||||
answer = []
|
||||
depth = 6
|
||||
for root, dirs, files in os.walk('sounds'):
|
||||
if depth == 0:
|
||||
break
|
||||
new = (root, glob(os.path.join(root, "*.ogg")))
|
||||
answer.append(new)
|
||||
depth -= 1
|
||||
return answer
|
||||
|
||||
def get_locales():
|
||||
answer = []
|
||||
for root, dirs, files in os.walk('locales'):
|
||||
new = (root, glob(os.path.join(root, '*.mo')))
|
||||
answer.append(new)
|
||||
return answer
|
||||
answer = []
|
||||
for root, dirs, files in os.walk('locales'):
|
||||
new = (root, glob(os.path.join(root, '*.mo')))
|
||||
answer.append(new)
|
||||
return answer
|
||||
|
||||
def wx_files():
|
||||
wxDir=wx.__path__[0]
|
||||
@@ -99,7 +100,7 @@ def wx_files():
|
||||
return list(localeMoFiles)
|
||||
|
||||
if __name__ == '__main__':
|
||||
setup(
|
||||
setup(
|
||||
name = application.name,
|
||||
author = application.author,
|
||||
author_email = application.authorEmail,
|
||||
@@ -112,7 +113,7 @@ options = {
|
||||
'optimize':2,
|
||||
'packages': ["pubsub", "pubsub.core", "pubsub.core.kwargs", "dbhash"],
|
||||
'dll_excludes': ["MPR.dll", "api-ms-win-core-apiquery-l1-1-0.dll", "api-ms-win-core-console-l1-1-0.dll", "api-ms-win-core-delayload-l1-1-1.dll", "api-ms-win-core-errorhandling-l1-1-1.dll", "api-ms-win-core-file-l1-2-0.dll", "api-ms-win-core-handle-l1-1-0.dll", "api-ms-win-core-heap-obsolete-l1-1-0.dll", "api-ms-win-core-libraryloader-l1-1-1.dll", "api-ms-win-core-localization-l1-2-0.dll", "api-ms-win-core-processenvironment-l1-2-0.dll", "api-ms-win-core-processthreads-l1-1-1.dll", "api-ms-win-core-profile-l1-1-0.dll", "api-ms-win-core-registry-l1-1-0.dll", "api-ms-win-core-synch-l1-2-0.dll", "api-ms-win-core-sysinfo-l1-2-0.dll", "api-ms-win-security-base-l1-2-0.dll", "api-ms-win-core-heap-l1-2-0.dll", "api-ms-win-core-interlocked-l1-2-0.dll", "api-ms-win-core-localization-obsolete-l1-1-0.dll", "api-ms-win-core-string-l1-1-0.dll", "api-ms-win-core-string-obsolete-l1-1-0.dll", "WLDAP32.dll", "MSVCP90.dll", "CRYPT32.dll", "mfc90.dll"],
|
||||
'skip_archive': True
|
||||
'compressed': True
|
||||
},
|
||||
},
|
||||
windows = [
|
||||
|
@@ -14,6 +14,8 @@ system = platform.system()
|
||||
from mysc.repeating_timer import RepeatingTimer
|
||||
from mysc.thread_utils import call_threaded
|
||||
import application
|
||||
import tempfile
|
||||
import glob
|
||||
URLPlayer = None
|
||||
|
||||
def setup():
|
||||
|
1
src/sound_lib/external/__init__.py
vendored
1
src/sound_lib/external/__init__.py
vendored
@@ -4,5 +4,6 @@ import platform
|
||||
if platform.system() != 'Darwin':
|
||||
import sound_lib.external.pybass_aac
|
||||
import sound_lib.external.pybass_alac
|
||||
import sound_lib.external.pybassopus
|
||||
import sound_lib.external.pybassflac
|
||||
import sound_lib.external.pybassmidi
|
||||
|
47
src/sound_lib/external/pybassopus.py
vendored
Normal file
47
src/sound_lib/external/pybassopus.py
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Copyright(c) Max Kolosov 2009 maxkolosov@inbox.ru
|
||||
# http://vosolok2008.narod.ru
|
||||
# BSD license
|
||||
|
||||
__version__ = '0.1'
|
||||
__versionTime__ = '2009-11-15'
|
||||
__author__ = 'Max Kolosov <maxkolosov@inbox.ru>'
|
||||
__doc__ = '''
|
||||
pybassflac.py - is ctypes python module for
|
||||
BASSFLAC - extension to the BASS audio library,
|
||||
enabling the playing of FLAC (Free Lossless Audio Codec) encoded files.
|
||||
'''
|
||||
|
||||
import os, sys, ctypes, pybass
|
||||
from paths import x86_path, x64_path
|
||||
import libloader
|
||||
|
||||
bassopus_module = libloader.load_library('bassopus', x86_path=x86_path, x64_path=x64_path)
|
||||
func_type = libloader.get_functype()
|
||||
#Register the plugin with the Bass plugin system.
|
||||
pybass.BASS_PluginLoad(libloader.find_library_path('bassopus', x86_path=x86_path, x64_path=x64_path), 0)
|
||||
|
||||
QWORD = pybass.QWORD
|
||||
HSTREAM = pybass.HSTREAM
|
||||
DOWNLOADPROC = pybass.DOWNLOADPROC
|
||||
BASS_FILEPROCS = pybass.BASS_FILEPROCS
|
||||
|
||||
# BASS_CHANNELINFO type
|
||||
BASS_CTYPE_STREAM_OPUS = 0x11200
|
||||
|
||||
|
||||
#HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
|
||||
BASS_OPUS_StreamCreateFile = func_type(HSTREAM, ctypes.c_byte, ctypes.c_void_p, QWORD, QWORD, ctypes.c_ulong)(('BASS_OPUS_StreamCreateFile', bassopus_module))
|
||||
#HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user);
|
||||
BASS_OPUS_StreamCreateURL = func_type(HSTREAM, ctypes.c_char_p, ctypes.c_ulong, ctypes.c_ulong, DOWNLOADPROC, ctypes.c_void_p)(('BASS_OPUS_StreamCreateURL', bassopus_module))
|
||||
#HSTREAM BASSFLACDEF(BASS_FLAC_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user);
|
||||
BASS_OPUS_StreamCreateFileUser = func_type(HSTREAM, ctypes.c_ulong, ctypes.c_ulong, ctypes.POINTER(BASS_FILEPROCS), ctypes.c_void_p)(('BASS_OPUS_StreamCreateFileUser', bassopus_module))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not pybass.BASS_Init(-1, 44100, 0, 0, 0):
|
||||
print 'BASS_Init error', pybass.get_error_description(pybass.BASS_ErrorGetCode())
|
||||
else:
|
||||
handle = BASS_OPUS_StreamCreateFile(False, 'test.opus', 0, 0, 0)
|
||||
pybass.play_handle(handle)
|
||||
if not pybass.BASS_Free():
|
||||
print 'BASS_Free error', pybass.get_error_description(pybass.BASS_ErrorGetCode())
|
BIN
src/sound_lib/lib/x64/bassopus.dll
Normal file
BIN
src/sound_lib/lib/x64/bassopus.dll
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x64/libbassopus.dylib
Normal file
BIN
src/sound_lib/lib/x64/libbassopus.dylib
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x64/libbassopus.so
Normal file
BIN
src/sound_lib/lib/x64/libbassopus.so
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x86/bassopus.dll
Normal file
BIN
src/sound_lib/lib/x86/bassopus.dll
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x86/libbassopus.dylib
Normal file
BIN
src/sound_lib/lib/x86/libbassopus.dylib
Normal file
Binary file not shown.
BIN
src/sound_lib/lib/x86/libbassopus.so
Normal file
BIN
src/sound_lib/lib/x86/libbassopus.so
Normal file
Binary file not shown.
@@ -5,14 +5,14 @@ from .channel import Channel
|
||||
class Music(Channel):
|
||||
|
||||
def __init__(self, mem=False, file=None, offset=0, length=0, flags=0, freq=0):
|
||||
handle = BASS_MusicLoad(mem, file, offset, length, flags, freq)
|
||||
handle = pybass.BASS_MusicLoad(mem, file, offset, length, flags, freq)
|
||||
super(Music, self).__init__(handle)
|
||||
self.add_attributes_to_mapping(
|
||||
music_amplify=pybass.BASS_ATTRIB_MUSIC_AMPLIFY,
|
||||
music_bpm = BASS_ATTRIB_MUSIC_BPM,
|
||||
music_pansep=BASS_ATTRIB_MUSIC_PANSEP,
|
||||
music_speed=BASS_ATTRIB_MUSIC_SPEED,
|
||||
music_vol_chan=BASS_ATTRIB_MUSIC_VOL_CHAN,
|
||||
music_vol_global=BASS_ATTRIB_MUSIC_VOL_GLOBAL,
|
||||
music_vol_inst=BASS_ATTRIB_MUSIC_VOL_INST,
|
||||
music_bpm = pybass.BASS_ATTRIB_MUSIC_BPM,
|
||||
music_pansep=pybass.BASS_ATTRIB_MUSIC_PANSEP,
|
||||
music_speed=pybass.BASS_ATTRIB_MUSIC_SPEED,
|
||||
music_vol_chan=pybass.BASS_ATTRIB_MUSIC_VOL_CHAN,
|
||||
music_vol_global=pybass.BASS_ATTRIB_MUSIC_VOL_GLOBAL,
|
||||
music_vol_inst=pybass.BASS_ATTRIB_MUSIC_VOL_INST,
|
||||
)
|
||||
|
BIN
src/sounds/FightingGames/audio.ogg
Normal file
BIN
src/sounds/FightingGames/audio.ogg
Normal file
Binary file not shown.
BIN
src/sounds/FightingGames/create_timeline.ogg
Normal file
BIN
src/sounds/FightingGames/create_timeline.ogg
Normal file
Binary file not shown.
BIN
src/sounds/FightingGames/delete_timeline.ogg
Normal file
BIN
src/sounds/FightingGames/delete_timeline.ogg
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user