Compare commits
317 Commits
notificati
...
master
Author | SHA1 | Date | |
---|---|---|---|
1aa34ba4fa | |||
c90ff6a467 | |||
826631ba1b | |||
ea653f6c64 | |||
519dd23d91 | |||
2f298f4020 | |||
2cd9e25dd9 | |||
50aa4e9dc8 | |||
c8f968578e | |||
8acbea78ae | |||
f4eea98a4b | |||
d671854453 | |||
211673a821 | |||
cf68b524a8 | |||
99279a8dab | |||
198aa0c383 | |||
1aebd40a94 | |||
0e5859c659 | |||
80bad717b3 | |||
3010677b5a | |||
f003fde885 | |||
e9c45e3178 | |||
c7a57ff63f | |||
52a0410327 | |||
ad9793cc47 | |||
6a809d52f0 | |||
db8b0b581e | |||
716a83b009 | |||
3d41c3fc6b | |||
1be07728ae | |||
b76733f9b9 | |||
ae1674cb09 | |||
aa3e4fb9fc | |||
4174b18074 | |||
1e9994fa21 | |||
7e68b9a18a | |||
b8066adbca | |||
a1d9b27d67 | |||
e5c5c69d69 | |||
d12a934280 | |||
7cf935e3b2 | |||
b5ef428f5e | |||
b46634997e | |||
feca6ab0fb | |||
26c6fddf49 | |||
0c797689b9 | |||
7c9301117d | |||
62eb758157 | |||
e56ec19421 | |||
35c1a754f3 | |||
f1def25bb5 | |||
4bdba42eab | |||
5c02a67ac7 | |||
59133a08c5 | |||
3013f34c19 | |||
c6fd4c00eb | |||
684a6006f5 | |||
2e508a53a0 | |||
3afff7eba2 | |||
783d54b55f | |||
b86bad024e | |||
4d44af2fc0 | |||
5978a7749d | |||
0a0e2a4dd9 | |||
ea0f6ea1b3 | |||
44f6fbc883 | |||
f4ca895a27 | |||
01f08e98a2 | |||
f8e8a11f96 | |||
a59e7a9c53 | |||
ae53761d3a | |||
6bce7b956e | |||
aeade1cc2c | |||
58084592dd | |||
f8b0e36362 | |||
e23c6645f6 | |||
1d9e6f8074 | |||
197e649afb | |||
1f575f0311 | |||
273f25c24f | |||
b8ef10af3f | |||
48e599c14a | |||
a142c93ba3 | |||
9b48613db4 | |||
a53b333be0 | |||
1ef2cf46fc | |||
68350ce536 | |||
3a78a24599 | |||
9382597108 | |||
291334654c | |||
11b4b76eae | |||
035d1dabc6 | |||
94960952b9 | |||
87a9e49f2b | |||
af82dee097 | |||
79c0ea2225 | |||
996b0d1b15 | |||
99d08b31d2 | |||
d2507f42da | |||
dee65a5fbf | |||
59131b6929 | |||
9e5989863c | |||
47378cedbf | |||
5877fd4df5 | |||
a4a4257192 | |||
9c8f1978e2 | |||
95f925e5fd | |||
ce402549b6 | |||
6feee434d0 | |||
1782a92109 | |||
83874d73d0 | |||
7a6cd95c26 | |||
28ef94c963 | |||
b443819fd2 | |||
81d6395fb0 | |||
c7e79efc7a | |||
5f9b1513e4 | |||
fbb5c075e8 | |||
01c9c49fcf | |||
bd218fcc1a | |||
63f8eda381 | |||
8b1d2655c9 | |||
9519f87ec6 | |||
c9e52f8eaa | |||
fe69ff8cde | |||
acc8d80abc | |||
99aec73110 | |||
4215fb0910 | |||
464a9d66a4 | |||
00c355e0d9 | |||
30d49f3817 | |||
ed4567d800 | |||
387247ea3b | |||
9439a583b8 | |||
bdfa9791f3 | |||
6ed1257895 | |||
8f55d77074 | |||
50267bf5ea | |||
d931695394 | |||
204a74b936 | |||
9921ea4590 | |||
172af3c9ef | |||
0be4a3dcaf | |||
f1a8c34950 | |||
ac7759ed5a | |||
1eb1f1fb3c | |||
0342b7e0e1 | |||
96f15e746f | |||
|
21f34d07c5 | ||
9ac9281dd5 | |||
9cbe1071d1 | |||
355d25e560 | |||
5a53be9e7a | |||
d9ac57b9af | |||
fa778616f3 | |||
6ee18cb028 | |||
dd52a512d4 | |||
1468428689 | |||
fe577d75b4 | |||
2a2bea5780 | |||
008698e055 | |||
d618512210 | |||
faaf67987d | |||
6da84fae87 | |||
3ce699ceaf | |||
dd564dc17f | |||
19de0ac272 | |||
d6582e1b3e | |||
ee0af2fd2e | |||
78db9ef375 | |||
e8a4031a65 | |||
ef2ef76f0f | |||
7bf5cd8f7c | |||
6667a29869 | |||
d44e20ed10 | |||
c2dbb44a8a | |||
8b89fbd4e0 | |||
bbd730bb38 | |||
d855899cbd | |||
1f7f98cafa | |||
bc3dcd7333 | |||
a799f3d0d5 | |||
b305a3702c | |||
a838b1fa09 | |||
90d2aa7519 | |||
27f3d0847b | |||
02cbb5bdb9 | |||
40801da71e | |||
5fd2207ed4 | |||
376407e6fd | |||
f3a963b39f | |||
b0165952cb | |||
b5390de4b0 | |||
32756c6a92 | |||
4670ca3d0b | |||
67c6e54a2a | |||
d245d74acf | |||
c43de3e9e5 | |||
f56d46417a | |||
c1865b3ecd | |||
9520954347 | |||
cb084faf85 | |||
e3db177d1a | |||
f43e9ffccf | |||
45465b246f | |||
af33450835 | |||
7e978593d2 | |||
0466115a6d | |||
5168b9e7d8 | |||
329c84a65f | |||
7c5fa5dea7 | |||
3ed262bd61 | |||
f159889f5d | |||
e1f517595d | |||
6fbe6be74e | |||
d443b99f27 | |||
b977e2b2af | |||
3dda56688c | |||
4b62576a0a | |||
5c48f3ed70 | |||
8ebf5dedd2 | |||
1d181b61a3 | |||
c5b9f668b2 | |||
cc1be262d1 | |||
ae2288a982 | |||
7e1765c26b | |||
4955986c3e | |||
aacaa528fb | |||
dc4f9a30bd | |||
a2ea4dad11 | |||
725097392a | |||
f267161c29 | |||
794cc4f3dc | |||
9373b3db93 | |||
9dfb6dc916 | |||
98c35f6f9d | |||
2f488a5daf | |||
1622f864fc | |||
08d3201cee | |||
bc996df3d8 | |||
3f5c79dd05 | |||
296b4164a7 | |||
ed260b6b37 | |||
5f1604aece | |||
7ddca4aec7 | |||
d286674cee | |||
1d96a4807b | |||
02bedad2ed | |||
1876907bac | |||
07398456c1 | |||
58414affe8 | |||
1a89871aa9 | |||
10fcedf537 | |||
c4d89faa33 | |||
a912b4aeef | |||
0b5ca8ddb3 | |||
2932427ab0 | |||
3b4625961f | |||
46d5608dfe | |||
1b44f35967 | |||
ecd758220a | |||
28e03cbf8e | |||
e51601a8bd | |||
6667b9e4cb | |||
93fe11728a | |||
c83f7c8d94 | |||
1ef8c99c43 | |||
f4bb812fd4 | |||
81963979d1 | |||
da6d73d9bf | |||
d91c4f4cf2 | |||
f3aeb9f61b | |||
20dcb4a475 | |||
0bf0fd9f27 | |||
17bfa4b260 | |||
73f1a9c31f | |||
c74c6f6f5d | |||
28e2d3df08 | |||
62914b2dfd | |||
46c1beed88 | |||
9f499b8e8f | |||
33c15d2444 | |||
7116d5c805 | |||
c4ccb4f072 | |||
fe1ac8e324 | |||
6049531de5 | |||
ed52202017 | |||
b90eb1fc8f | |||
f9a1183993 | |||
63585661ae | |||
711ec58419 | |||
bbeb80600b | |||
15d4124d89 | |||
87acd01273 | |||
8d83e51947 | |||
b19032da9b | |||
b4b977ffc5 | |||
d82d07bf2c | |||
3a87d2957a | |||
8aa7f34fd2 | |||
79f3177a60 | |||
c468147db0 | |||
c19fbf40a0 | |||
55193a958d | |||
bb92a8a8d4 | |||
e0a3b6db70 | |||
c860834f17 | |||
8544fe806e | |||
a14f648cb3 | |||
56171f94cf | |||
2e08fa5745 | |||
0afcdcc1f6 | |||
e7d71e3607 | |||
2d068cfd79 | |||
ee0c22e37c | |||
925e82e5c5 | |||
0cdfc253d2 |
210
.gitlab-ci.yml
210
.gitlab-ci.yml
@ -1,111 +1,129 @@
|
|||||||
# Jobs to build the two channels in Socializer.
|
stages:
|
||||||
variables:
|
- generate_doc
|
||||||
PYTHON3: "C:\\python37\\python.exe"
|
- build
|
||||||
PYINSTALLER: "C:\\python37\\scripts\\pyinstaller.exe"
|
- generate_versions
|
||||||
PYTHON2: "C:\\python27\\python.exe"
|
- upload
|
||||||
NSIS: "C:\\nsis\\makensis.exe"
|
|
||||||
|
|
||||||
test_py3:
|
pages:
|
||||||
stage: test
|
image: python:latest
|
||||||
tags:
|
tags:
|
||||||
- windows10
|
- docker
|
||||||
before_script:
|
interruptible: true
|
||||||
- '%PYTHON3% -V'
|
|
||||||
- '%PYTHON3% -m pip install --upgrade pip'
|
|
||||||
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
|
|
||||||
only:
|
|
||||||
- schedules
|
|
||||||
script:
|
|
||||||
- cd src
|
|
||||||
- '%PYTHON3% -m coverage run run_tests.py'
|
|
||||||
- '%PYTHON3% -m coverage report --omit="test*"'
|
|
||||||
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
|
|
||||||
|
|
||||||
documentation:
|
|
||||||
type: deploy
|
|
||||||
tags:
|
|
||||||
- windows10
|
|
||||||
before_script:
|
|
||||||
- '%PYTHON3% -v'
|
|
||||||
script:
|
|
||||||
- copy changelog.md doc\changelog.md
|
|
||||||
- cd doc
|
|
||||||
- '%PYTHON2% documentation_importer.py'
|
|
||||||
- cd ..\src
|
|
||||||
- '%PYTHON2% ..\doc\generator.py'
|
|
||||||
- 'move documentation ..\'
|
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
stage: generate_doc
|
||||||
|
script:
|
||||||
|
- 'pip install --upgrade markdown babel'
|
||||||
|
- 'cp changelog.md doc/changelog.md'
|
||||||
|
- 'cd doc'
|
||||||
|
- 'python documentation_importer.py'
|
||||||
|
- 'python generator.py'
|
||||||
|
- 'mv -f documentation ../public'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
|
||||||
- documentation
|
|
||||||
name: socializer_documentation
|
|
||||||
expire_in: 1 day
|
expire_in: 1 day
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
|
||||||
alpha_python3:
|
socializer64:
|
||||||
type: deploy
|
stage: build
|
||||||
|
interruptible: true
|
||||||
|
variables:
|
||||||
|
PYTHON: "C:\\python37\\python.exe"
|
||||||
tags:
|
tags:
|
||||||
- windows10
|
- windows10
|
||||||
before_script:
|
|
||||||
- '%PYTHON3% -v'
|
|
||||||
- '%PYTHON3% -m pip install --upgrade pip'
|
|
||||||
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
|
|
||||||
- '%PYTHON3% -m pip uninstall enum34 -y'
|
|
||||||
script:
|
|
||||||
- copy changelog.md doc\changelog.md
|
|
||||||
- cd doc
|
|
||||||
- '%PYTHON2% documentation_importer.py'
|
|
||||||
- cd ..\src
|
|
||||||
- '%PYTHON2% ..\doc\generator.py'
|
|
||||||
- '%PYTHON3% write_version_data.py'
|
|
||||||
- '%PYINSTALLER% main.spec'
|
|
||||||
- cd ..
|
|
||||||
- cd scripts
|
|
||||||
- '%PYTHON3% prepare_zipversion.py'
|
|
||||||
- call genpot_interface.bat
|
|
||||||
- call genpot_doc.bat
|
|
||||||
- cd ..
|
|
||||||
- move src\socializer.zip socializer.zip
|
|
||||||
- move scripts\socializer.pot socializer.pot
|
|
||||||
- move scripts\socializer-documentation.pot socializer-documentation.pot
|
|
||||||
only:
|
only:
|
||||||
- schedules
|
- master
|
||||||
artifacts:
|
- tags
|
||||||
paths:
|
|
||||||
- socializer.zip
|
|
||||||
- socializer.pot
|
|
||||||
- socializer-documentation.pot
|
|
||||||
name: socializer_py3
|
|
||||||
expire_in: 1 day
|
|
||||||
|
|
||||||
stable:
|
|
||||||
type: deploy
|
|
||||||
tags:
|
|
||||||
- windows
|
|
||||||
before_script:
|
|
||||||
- '%PYTHON3% -v'
|
|
||||||
- '%PYTHON3% -m pip install --upgrade pip'
|
|
||||||
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
|
|
||||||
- '%PYTHON3% -m pip uninstall enum34 -y'
|
|
||||||
script:
|
script:
|
||||||
- copy changelog.md doc\changelog.md
|
- '&$env:PYTHON -V'
|
||||||
- cd doc
|
- '&$env:PYTHON -m venv env'
|
||||||
- '%PYTHON2% documentation_importer.py'
|
- 'env\Scripts\Activate.ps1'
|
||||||
- cd ..\src
|
- 'python -m pip install --upgrade pip'
|
||||||
- '%PYTHON2% ..\doc\generator.py'
|
- 'python -m pip install --upgrade -r requirements.txt'
|
||||||
- '%PYTHON3% write_version_data.py'
|
- 'python -m pip uninstall enum34 -y'
|
||||||
- '%PYINSTALLER% main.spec'
|
- 'cd src'
|
||||||
- '%NSIS% installer.nsi'
|
- 'python write_version_data.py'
|
||||||
- cd ..
|
- 'python -m nuitka --mingw64 --standalone --enable-plugin=anti-bloat --noinclude-pytest-mode=nofollow --noinclude-setuptools-mode=nofollow --nofollow-import-to=numpy --nofollow-import-to=babel --nofollow-import-to=cx_freeze --nofollow-import-to=pil --include-data-file=../windows-dependencies/x64/oggenc2.exe=oggenc2.exe --include-data-file=../windows-dependencies/x64/bootstrap.exe=bootstrap.exe --include-data-file=app-configuration.defaults=app-configuration.defaults --include-data-dir=locales=locales --include-data-dir=../public=documentation --include-data-dir=sounds=sounds --include-data-file=session.defaults=session.defaults --windows-disable-console --windows-file-description="Accessible VK Client for Windows" --windows-product-version=2021.12.14.0 --windows-file-version=2021.12.14.0 --windows-product-name="Socializer" --windows-company-name="MCV Software" --python-flag=no_site --assume-yes-for-downloads --remove-output "socializer.py"'
|
||||||
- move src\socializer* .
|
- 'python ..\scripts\copy_missing_files.py'
|
||||||
- cd scripts
|
- 'cd ..'
|
||||||
- '%PYTHON3% prepare_zipversion.py'
|
- 'mkdir artifacts'
|
||||||
- cd ..
|
- 'cd scripts'
|
||||||
- move src\socializer.zip socializer.zip
|
- 'python prepare_zipversion.py'
|
||||||
|
- 'cd ..'
|
||||||
|
- 'move src\socializer.zip artifacts\socializer_x64.zip'
|
||||||
|
- 'mv src/socializer.dist artifacts/program64'
|
||||||
|
- 'move src/installer.nsi artifacts'
|
||||||
|
- 'python scripts/generate_update_file.py'
|
||||||
|
- 'move *.json artifacts'
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 day
|
||||||
|
paths:
|
||||||
|
- artifacts
|
||||||
|
|
||||||
|
socializer32:
|
||||||
|
stage: build
|
||||||
|
interruptible: true
|
||||||
|
variables:
|
||||||
|
PYTHON: "C:\\python37-32\\python.exe"
|
||||||
|
tags:
|
||||||
|
- windows10
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- tags
|
||||||
|
script:
|
||||||
|
- '&$env:PYTHON -V'
|
||||||
|
- '&$env:PYTHON -m venv env'
|
||||||
|
- 'env\Scripts\Activate.ps1'
|
||||||
|
- 'python -m pip install --upgrade pip'
|
||||||
|
- 'python -m pip install --upgrade -r requirements.txt'
|
||||||
|
- 'python -m pip uninstall enum34 -y'
|
||||||
|
- 'cd src'
|
||||||
|
- 'python write_version_data.py'
|
||||||
|
- 'python -m nuitka --mingw64 --standalone --enable-plugin=anti-bloat --noinclude-pytest-mode=nofollow --noinclude-setuptools-mode=nofollow --nofollow-import-to=numpy --nofollow-import-to=babel --nofollow-import-to=cx_freeze --nofollow-import-to=pil --include-data-file=../windows-dependencies/x86/oggenc2.exe=oggenc2.exe --include-data-file=../windows-dependencies/x86/bootstrap.exe=bootstrap.exe --include-data-file=app-configuration.defaults=app-configuration.defaults --include-data-dir=locales=locales --include-data-dir=../public=documentation --include-data-dir=sounds=sounds --include-data-file=session.defaults=session.defaults --windows-disable-console --windows-file-description="Accessible VK Client for Windows" --windows-product-version=2021.12.14.0 --windows-file-version=2021.12.14.0 --windows-product-name="Socializer" --windows-company-name="MCV Software" --python-flag=no_site --assume-yes-for-downloads --remove-output "socializer.py"'
|
||||||
|
- 'python ..\scripts\copy_missing_files.py'
|
||||||
|
- 'cd ..'
|
||||||
|
- 'mkdir artifacts'
|
||||||
|
- 'cd scripts'
|
||||||
|
- 'python prepare_zipversion.py'
|
||||||
|
- 'cd ..'
|
||||||
|
- 'move src\socializer.zip artifacts\socializer_x86.zip'
|
||||||
|
- 'mv src/socializer.dist artifacts/program32'
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 day
|
||||||
|
paths:
|
||||||
|
- artifacts
|
||||||
|
|
||||||
|
make_installer:
|
||||||
|
stage: generate_versions
|
||||||
|
interruptible: true
|
||||||
|
tags:
|
||||||
|
- windows10
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
|
- schedule
|
||||||
|
- master
|
||||||
|
variables:
|
||||||
|
NSIS: "C:\\program files (x86)\\nsis\\makensis.exe"
|
||||||
|
before_script:
|
||||||
|
- 'choco upgrade all'
|
||||||
|
script:
|
||||||
|
- cd artifacts
|
||||||
|
- '&$env:NSIS installer.nsi'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- socializer.zip
|
- artifacts
|
||||||
- "socializer_*"
|
expire_in: 1 day
|
||||||
name: socializer
|
|
||||||
|
upload:
|
||||||
|
stage: upload
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
image: python
|
||||||
|
interruptible: true
|
||||||
|
script:
|
||||||
|
- cd artifacts
|
||||||
|
- python ../scripts/upload.py
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
- schedules
|
||||||
|
- master
|
86
README.md
86
README.md
@ -1,24 +1,90 @@
|
|||||||
# socializer
|
# socializer
|
||||||
|
|
||||||
[![pipeline status](https://code.manuelcortez.net/manuelcortez/socializer/badges/master/pipeline.svg)](https://code.manuelcortez.net/manuelcortez/socializer/commits/master)
|
[![pipeline status](https://gitlab.com/socializer1/socializer/badges/master/pipeline.svg)](https://gitlab.com/socializer1/socializer/commits/master)
|
||||||
|
|
||||||
> Note: this project has two different main repositories. [Here is the official repository, hosted in my Gitlab Instance,](https://code.manuelcortez.net/manuelcortez/socializer) [Here is a mirror repository hosted in GitHub.](https://github.com/manuelcortez/socializer) Github repository will accept pull requests and issues reported by github users, while Gitlab's repository will provide the wiki, documentation, and support for user reported issues.
|
> Note: this project has two different main repositories. [Here is the official repository, hosted in our GitLab instance,](https://gitlab.mcvsoftware.com/socializer/socializer) [Here is a mirror repository hosted in GitHub.](https://github.com/manuelcortez/socializer) Github repository will accept pull requests and issues reported by github users, while Gitlab's repository will provide the wiki, documentation, and support for user reported issues.
|
||||||
|
|
||||||
A desktop application for handling [vk.com](http://vk.com) in an easy way.
|
A desktop application for handling [vk.com](https://vk.com) in an easy way.
|
||||||
|
|
||||||
[See Socializer's website](http://socializer.su)
|
[See Socializer's website](https://socializer.su)
|
||||||
|
|
||||||
## dependencies not installed by PIP
|
> Note: this is the developer oriented documentation. If you want to read the user manual of socializer, [read the manual in the project's website](https://socializer.su/en/documentation)
|
||||||
|
|
||||||
For other dependencies, do pip install --upgrade -r requirements.txt
|
## running
|
||||||
|
|
||||||
* [Python,](http://python.org) version 3.7.2
|
This document describes how to run Socializer from source and how to build a binary version which doesn't need Python and the other dependencies to run.
|
||||||
|
|
||||||
## Documentation
|
### Required dependencies
|
||||||
|
|
||||||
I am trying to write an updated manual for socializer. It can be found in the documentation folder once the program zip file is uncompressed, or in the manual.md file (in markdown). The idea of this manual is to be updated as socializer receives new features or improvements.
|
Although most dependencies (except Python) can be found in the windows-dependencies directory, we provide links to their official websites.
|
||||||
|
|
||||||
A copy of the English version of the manual can be read here: [Manual in the socializer's wiki](https://code.manuelcortez.net/manuelcortez/socializer/wikis/manual)
|
* [Python,](http://python.org) version 3.7.9
|
||||||
|
|
||||||
|
#### Dependencies that must be installed using pip
|
||||||
|
|
||||||
|
Python installs a tool called Pip that allows to install packages in a simple way. You can find it in the python scripts directory. To install packages using Pip, you have to navigate to the scripts directory using a command prompt, for example:
|
||||||
|
cd C:\python37\scripts
|
||||||
|
|
||||||
|
You can also add the scripts folder to your path environment variable or choose the corresponding option when installing Python.
|
||||||
|
Pip is able to install packages listed in a special text file, called the requirements file. To install all remaining dependencies, perform the following command:
|
||||||
|
pip install -r requirements.txt
|
||||||
|
Note that if you perform the command from the path where Pip is located, you need to specify the path to your Socializer root folder where the requirements file is located, for example:
|
||||||
|
pip install -r D:\repos\socializer\requirements.txt
|
||||||
|
|
||||||
|
Pip will automatically get the additional libraries that the listed packages need to work properly.
|
||||||
|
|
||||||
|
If you need to update your dependencies, perform the following command:
|
||||||
|
|
||||||
|
pip install --upgrade -r requirements.txt
|
||||||
|
|
||||||
|
#### Other dependencies
|
||||||
|
|
||||||
|
These dependencies are located in the windows-dependencies directory. You don't need to install or modify them.
|
||||||
|
|
||||||
|
* Bootstrap 1.2.1: included in dependencies directory.
|
||||||
|
This dependency has been built using pure basic 4.61. Its source can be found at http://hg.q-continuum.net/updater
|
||||||
|
* [oggenc2.exe,](http://www.rarewares.org/ogg-oggenc.php) version 2.87
|
||||||
|
* Microsoft Visual c++ 2017 redistributable dlls.
|
||||||
|
|
||||||
|
#### Dependencies required to build the installer
|
||||||
|
|
||||||
|
* [NSIS,](http://nsis.sourceforge.net/) version 3.04
|
||||||
|
|
||||||
|
### Running Socializer from source
|
||||||
|
|
||||||
|
Now that you have installed all these packages, you can run Socializer from source using a command prompt. Navigate to the repo's `src` directory, and type the following command:
|
||||||
|
|
||||||
|
python main.py
|
||||||
|
|
||||||
|
If necessary, change the first part of the command to reflect the location of your python executable.
|
||||||
|
|
||||||
|
### Generating the documentation
|
||||||
|
|
||||||
|
To generate the documentation in html format, ensure you are in the doc folder inside this repo. After that, run these commands:
|
||||||
|
copy ..\changelog.md .
|
||||||
|
python document_importer.py
|
||||||
|
cd ..\src
|
||||||
|
python ..\doc\generator.py
|
||||||
|
|
||||||
|
The documentation will be generated, placing each language in a separate folder in the doc directory.
|
||||||
|
|
||||||
|
### Building a binary version
|
||||||
|
|
||||||
|
A binary version doesn't need python and the other dependencies to run, it's the same version that you will find on the Socializer's website if you download the zip files or the Alpha versions.
|
||||||
|
|
||||||
|
To build it, run the following command from the src folder:
|
||||||
|
|
||||||
|
python setup.py build
|
||||||
|
|
||||||
|
You will find the binaries in the dist directory.
|
||||||
|
|
||||||
|
### Building an installer
|
||||||
|
|
||||||
|
If you want to install Socializer on your computer, you must create the installer first. Follow these steps:
|
||||||
|
|
||||||
|
* Navigate to the src directory, and Write the latest alpha version in the application file, so this version will be able to check updates and get the alpha channel: c:\python37\python.exe write_version_data.py
|
||||||
|
* create a binary version: C:\python37\python setup.py build
|
||||||
|
* run the installer script: C:\nsis\makensis.exe installer.nsi
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
54
changelog.md
54
changelog.md
@ -1,7 +1,59 @@
|
|||||||
# Changelog
|
Changelog
|
||||||
|
|
||||||
## News in this version
|
## News in this version
|
||||||
|
|
||||||
|
### new additions
|
||||||
|
|
||||||
|
* Now socializer can load the list of members for a community. You have to use the context menu in the community in order to load all members. For community administrators and moderators, it will display also a new buffer with invites that have been sent to the group. You can use the context menu in those buffers to perform common actions to those user. Take into account, though, that available actions from those buffers depend in the focused user's privacy settings.
|
||||||
|
* Added an actions button that allows you to perform several tasks from the parts of the application where it appears. For now, the action button is shown in any displayed post or repost, and also in chat messages. When pressed, it opens a menu from where you can translate texts or do spelling correction on the message.
|
||||||
|
* It is now possible to read an article from a wall post. The article will be opened in a new dialog. This might work better in countries where VK is blocked as users no longer need to open the web browser. Unfortunately, as articles are mainly undocumented in the API, it is not possible to perform other actions besides reading them from Socializer.
|
||||||
|
* the spelling correction module is able to add words to the dictionary so it will learn which words should start to ignore.
|
||||||
|
* Added a new setting, in the preferences dialog, that allows you to turn on the debug logging feature. With this feature Enabled, Socializer will log more information regarding what is doing while an error occurs. This feature must be enabled when you want to report an issue and send us your logs.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* Now it is possible to select or unselect audios in a list by pressing space again. This was not possible earlier due to an unexpected issue when migrating to the latest version of socializer's components.
|
||||||
|
* Fixed an issue when focusing chat messages. Sometimes, socializer was not precise enough to focus the right message. Now all messages should be getting the focus as expected.
|
||||||
|
* Fixed a small issue that was making impossible to close the blacklist dialog by pressing escape.
|
||||||
|
* Now it is possible to perform authentication in accounts using two factor verification again. This issue was caused due to a recent change in the VK workflow for two factor verification processes.
|
||||||
|
* Users who have chosen to not show their online activity (specifically the last seen field in VK) will be added in people buffers. Before, those people were making socializer to raise an exception and the whole buffer was unable to be loaded.
|
||||||
|
* It is possible to translate texts again, thanks to the Google Translate implementation added in the application.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* The spelling correction module has been rewritten to take advantage of the newest enchant Python module which is more stable and can be added properly to the distribution, as opposed to the first enchant module we have tried.
|
||||||
|
* Better performance on Socializer should be noticed for users with many conversations opened. Before, socializer could freeze while loading all messages in conversations. Now that should work more efficiently and the application should not stop responding.
|
||||||
|
* Socializer now uses Google Translate services instead of yandex.translate.
|
||||||
|
* When displaying people buffers (such as those shown in the current user's account), socializer shows the buttons for sending private messages or post in user's wall only if the focused user has enabled those options.
|
||||||
|
|
||||||
|
## News in Version 0.24
|
||||||
|
|
||||||
|
### New additions
|
||||||
|
|
||||||
|
* Socializer will ask for confirmation before closing the application.
|
||||||
|
* In all audio buffers, there is a new item in the context menu that allows downloading of the audio directly from the buffer. If there are multiple audios selected, socializer will ask for a folder where all audios should be placed. When downloading multiple audios, socializer will name those automatically by following the template "song title - artist".
|
||||||
|
* In all audio buffers, there are two new menu items for selecting and deselecting all items in the buffer.
|
||||||
|
* Added displaying of articles as attachments in wall posts. When opened, Socializer will open the article in the web browser.
|
||||||
|
* Starting from Version 0.24, there will be an installer for the Alpha version of socializer, always available from our downloads page.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* Fixed an error that was making socializer unable to render correctly certain Links containing uppercase letters (such as yandex.disk shared links). Before, those links were giving 404 errors when pressed, now they should work normally. This error was present in wall posts, comments, topics and chat messages.
|
||||||
|
* Fixed an error related to chat notifications in Socializer. Before, the "online now" notification could break the Socializer interface, making it unable to load the chat in real time.
|
||||||
|
* Fixed a small inconsistency when marking a conversation as read. Before, if two messages were sent by the recipient, only the last message was marked as read and the previous was making the unread sound all the time. Now that issue should be handled properly.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* Socializer will not be marked as Virus by most antivirus softwares due to a new build tool which is cleaner and less prone to be flagged by antivirus.
|
||||||
|
* Socializer is distributed with the Microsoft C++ redistributable package, so everyone will be able to use the software without needing to install any extra package.
|
||||||
|
* Replaced the underlying library we were using for spelling correction as is no longer in development. Instead, we started to use a new approach in socializer, which, in theory, should allow us to switch language for spelling correction and other benefits a bit later. For now, available languages are Russian, Ukranian, English, Polish and Spanish, but more languages can be added by request.
|
||||||
|
* When downloading a file (such as an audio file or document), the download process should be relatively faster due to some optimizations made in the function.
|
||||||
|
* Socializer now uses just the first name of users in typing notifications.
|
||||||
|
* socializer should be able to inform users about common errors when sending chat messages (such as sending messages to people in the current user's blacklist or banned from VK). Later, more errors related to posts will be added.
|
||||||
|
* The application will load up to 100 audio albums instead of the default 10.
|
||||||
|
|
||||||
|
## Changes in Version 0.23 (11.11.2019)
|
||||||
|
|
||||||
### New additions
|
### New additions
|
||||||
|
|
||||||
* Socializer is now more tolerant to internet issues. When attempting to create a wall post, comment, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later.
|
* Socializer is now more tolerant to internet issues. When attempting to create a wall post, comment, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later.
|
||||||
|
289
doc/changelog.md
Normal file
289
doc/changelog.md
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## News in this version
|
||||||
|
|
||||||
|
## new additions
|
||||||
|
|
||||||
|
* the spelling correction module is able to add words to the dictionary so it will learn which words should start to ignore.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* Now it is possible to perform authentication in accounts using two factor verification again. This issue was caused due to a recent change in the VK workflow for two factor verification processes.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* The spelling correction module has been rewritten to take advantage of the newest enchant Python module which is more stable and can be added properly to the distribution, as opposed to the first enchant module we have tried.
|
||||||
|
* Better performance on Socializer should be noticed for users with many conversations opened. Before, socializer could freeze while loading all messages in conversations. Now that should work more efficiently and the application should not stop responding.
|
||||||
|
|
||||||
|
## News in Version 0.24
|
||||||
|
|
||||||
|
### New additions
|
||||||
|
|
||||||
|
* Socializer will ask for confirmation before closing the application.
|
||||||
|
* In all audio buffers, there is a new item in the context menu that allows downloading of the audio directly from the buffer. If there are multiple audios selected, socializer will ask for a folder where all audios should be placed. When downloading multiple audios, socializer will name those automatically by following the template "song title - artist".
|
||||||
|
* In all audio buffers, there are two new menu items for selecting and deselecting all items in the buffer.
|
||||||
|
* Added displaying of articles as attachments in wall posts. When opened, Socializer will open the article in the web browser.
|
||||||
|
* Starting from Version 0.24, there will be an installer for the Alpha version of socializer, always available from our downloads page.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* Fixed an error that was making socializer unable to render correctly certain Links containing uppercase letters (such as yandex.disk shared links). Before, those links were giving 404 errors when pressed, now they should work normally. This error was present in wall posts, comments, topics and chat messages.
|
||||||
|
* Fixed an error related to chat notifications in Socializer. Before, the "online now" notification could break the Socializer interface, making it unable to load the chat in real time.
|
||||||
|
* Fixed a small inconsistency when marking a conversation as read. Before, if two messages were sent by the recipient, only the last message was marked as read and the previous was making the unread sound all the time. Now that issue should be handled properly.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* Socializer will not be marked as Virus by most antivirus softwares due to a new build tool which is cleaner and less prone to be flagged by antivirus.
|
||||||
|
* Socializer is distributed with the Microsoft C++ redistributable package, so everyone will be able to use the software without needing to install any extra package.
|
||||||
|
* Replaced the underlying library we were using for spelling correction as is no longer in development. Instead, we started to use a new approach in socializer, which, in theory, should allow us to switch language for spelling correction and other benefits a bit later. For now, available languages are Russian, Ukranian, English, Polish and Spanish, but more languages can be added by request.
|
||||||
|
* When downloading a file (such as an audio file or document), the download process should be relatively faster due to some optimizations made in the function.
|
||||||
|
* Socializer now uses just the first name of users in typing notifications.
|
||||||
|
* socializer should be able to inform users about common errors when sending chat messages (such as sending messages to people in the current user's blacklist or banned from VK). Later, more errors related to posts will be added.
|
||||||
|
* The application will load up to 100 audio albums instead of the default 10.
|
||||||
|
|
||||||
|
## Changes in Version 0.23 (11.11.2019)
|
||||||
|
|
||||||
|
### New additions
|
||||||
|
|
||||||
|
* Socializer is now more tolerant to internet issues. When attempting to create a wall post, comment, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later.
|
||||||
|
* Switching accounts is now supported in socializer. In the application menu, there is an option called "manage accounts" which allows you to add or remove an account. Socializer will take changes after a restart of the application. In case of having multiple accounts, every time Socializer starts, you will see a dialog from where is possible to choose the account for logging in.
|
||||||
|
* when selecting multiple audio files in audio buffers, multiple actions can be performed in all items, these actions are present in the contextual menu of the buffer (namely play, add/remove from the library and move to a different playlist). This means you can select all the audios you want and Socializer will perform the selected options in all items, making it a bit easier to operate with multiple songs.
|
||||||
|
* Now it is possible to like and see who liked a comment when displaying it individually. This applies to comments in wall posts and topics.
|
||||||
|
* Now it is possible to choose how many items Socializer will load in conversation buffers, from the General tab in the preferences dialog. The default value is 50 items, and the maximum value is 200.
|
||||||
|
* There is a new tab called buffer settings, in the preferences dialog. Settings related to how many items should be loaded in certain buffer types have been moved to this tab, so it will separate better the configuration options in the application.
|
||||||
|
* Added management of the Blacklist on VK. Users can be blocked from people buffers (friends, online, or any buffer inside friend requests). You can access the blacklist from the application menu, located in the menu bar. From there, you can unblock any previously blocked user.
|
||||||
|
* In the new timeline dialog, it is possible to create video buffers by selecting the "video" radio button as buffer type.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* Fixed an error that was causing socializer to not update the "Online friends" buffer if chat notifications were disabled.
|
||||||
|
* Fixed an error that was making Socializer unable to attach audio files from the computer, if the file does not include correct ID3 TAGS.
|
||||||
|
* Fixed a traceback that was being logged when attempting to load an image but cancel the dialog for attaching it.
|
||||||
|
* Fixed an error that was making Socializer to fail when loading the newsfeed buffer, thus not loading any other buffers. This error was caused due to VK sending a new object type representing push subscriptions. The item is ignored by Socializer so it will not break the newsfeed buffer anymore.
|
||||||
|
* Fixed an error that was making the status bar to not fit the full size of the Window. This was cutting the messages placed on it, now, all messages are displayed properly again.
|
||||||
|
* fixed an unhandled condition when playing a song and voice message at the same time, that was potentially making Socializer to stop loading certain buffers.
|
||||||
|
* fixed an error that was making socializer unable to parse video data, thus video buffers were impossible to be loaded.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* Less confidential user data will be send to the logs, so it will be much safer to pass logs publicly.
|
||||||
|
* automatic update checks will be disabled if using socializer from the source code.
|
||||||
|
* it is possible to post in an user's wall by using the post button located next to the user, in people buffers. This applies only to online users and list of friends.
|
||||||
|
* When displaying a profile, information about mobile and home phone is displayed in the basic information tab.
|
||||||
|
* In wall posts, all comments, including replies, will be displayed in the same list. Before, you had to open a comment to read its replies. When a new comment is posted by the current user, the list of comments will be reloaded and new additions will be fetched and sorted properly.
|
||||||
|
|
||||||
|
## changes in Versions 0.21 and 0.22 (14.07.2019)
|
||||||
|
|
||||||
|
### New additions
|
||||||
|
|
||||||
|
* Added "post in groups" feature. In order to do so, you need to load the posts for the group where you want to send something. Once loaded, go to the post button in the group's wall and select whether you want to post in the group's behalf or as yourself.
|
||||||
|
* In all audio buffers, it is possible to select individual tracks to be played together. In order to do so, you need to press space to start the selection of items. When selected, the item will emit a sound to indicate the change. Press space in all items you want to select/unselect. When you're focusing an already selected item it will play a sound to indicate that it is already selected. Once you're done with your selection, pressing enter in the list of tracks will start the playback of the list of items you have selected. This is a very experimental feature. More actions can be supported based in this selection method if it proves to be useful.
|
||||||
|
* In conversation buffers, it is possible to display and open wall posts sent as attachments in messages.
|
||||||
|
* In people buffers, it is possible to create a new timeline by using the context menu while focusing an user. This method will create the buffer for the selected user, as opposed to creating the buffer from the menu bar, where you have to type the username or find it in a list.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* Fixed an error with two factor authentication in the recent socializer version. Now it works reliably again.
|
||||||
|
* Fixed an error when trying to attach a photo to a wall post. The error was fixed in the [vk_api](https://github.com/python273/vk_api) module and the fix was sent to the developer of the library, so he will be able to merge it in the next version. In the meantime, socializer already includes the fix for this method, so you can upload photos to wall posts normally.
|
||||||
|
* Fixed an error retrieving some group information for the current session.
|
||||||
|
* When posting in a topic, links will be posted properly.
|
||||||
|
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* the audio player module has received some improvements:
|
||||||
|
- When there is something being played, the label of the "play" button, located in all audio buffers, will change automatically to "pause". When pressed, it will pause the song instead of starting the playback again since the beginning.
|
||||||
|
- The last change will work also in the dialog for displaying audio information. Now it's possible to play and pause an audio from such dialog.
|
||||||
|
- When playing a voice message, if a song is playing already socializer will decrease the volume so you can hear the voice message well enough. Some seconds after the message has finished, the song's volume will be restored.
|
||||||
|
* In audio buffers, you will play the focused audio when pressing enter in the item, instead of opening the audio information dialog.
|
||||||
|
* Removed some old keystrokes in socializer buffers due to better alternatives. The reason for this change is that currently you don't need to be focusing an item in a buffer for being able to use the alternative keystrokes, which makes those a better implementation.
|
||||||
|
- Control+Enter and control+Shift+Enter: superseeded by Control+P for playing (and pausing) the currently focused audio.
|
||||||
|
- F5 and F6: superseeded by Alt+down and up arrows for modifying volume.
|
||||||
|
|
||||||
|
## changes in version 0.20 (25.04.2019)
|
||||||
|
|
||||||
|
### New additions
|
||||||
|
|
||||||
|
* For users with multiple soundcards, there is a new tab in the preferences dialogue of Socializer, called sound. From there, you can define which soundcard will be used for input and output. [#25,](https://code.manuelcortez.net/manuelcortez/socializer/issues/25)
|
||||||
|
* the audio player can seek positions in the currently playing track. You can use the menu items (located in the main menu) or use the new available keystrokes dedicated to the actions. Seeking will be made in 5 second intervals.
|
||||||
|
* Alt+Shift+Left arrow: Seek 5 seconds backwards.
|
||||||
|
* Alt+Shift+Right arrow: Seek 5 seconds forwards.
|
||||||
|
* it is possible to select the language used in socializer from the preferences dialog. When changing the language, the application must be restarted for the changes to take effect.
|
||||||
|
* A new option, called open in vk.com, has been added in the context menu for almost all objects (items in home timeline, walls, documents, people, group topics and in buffers for conversations). This option will open the selected item in the VK website.
|
||||||
|
* when opening the list of friends added by an user, you can display the context menu from an item on the list and view the user profile, open it in VK.com, among other actions. [#8,](https://code.manuelcortez.net/manuelcortez/socializer/issues/8)
|
||||||
|
* When displaying a post, if you press enter in the button indicating how many people liked or shared the post, Socializer will display the listt of people who have liked or shared it. You can use the context menu in the list to do certain actions. [#38,](https://code.manuelcortez.net/manuelcortez/socializer/issues/38)
|
||||||
|
* it is possible to retrieve more items for conversation buffers. Due to API limitations, it is possible to load up to the last 600 messages for every conversation. Take into account that the process of loading more items takes some time. You will hear a message when the process is done.
|
||||||
|
* It is possible to delete entire conversations from the buffer's tree, by using the menu key and selecting "delete conversation". The conversation will be removed from VK.
|
||||||
|
* When loading a topic in a group, socializer will display the latest 100 messages. In order to load more messages, you will find a button that will load the previous 100 messages present in the topic, or the amount of messages not loaded yet.
|
||||||
|
|
||||||
|
### bugfixes
|
||||||
|
|
||||||
|
* All spelling dictionaries are included by default for the following languages: Russian, English, German, French, italian, Polish, spanish and Turkish. Before, some dictionaries were missing and the spelling checker was failing.
|
||||||
|
* Fixed an error in the default configuration template used for new sessions in the application. This error was making Socializer to fail when loading any conversation buffer.
|
||||||
|
* Fixed an error in the algorithm to detect friends disconnecting from VK. This problem was interrupting the connection with the chat server every time it was happening, thus chat server's connection should be more reliable now.
|
||||||
|
* The audio player should behave better in situations where a song is interrupted. Before, if you pressed "next song" while the currently playing sound was interrupted due to internet connection issues, two or more songs were played at the same time.
|
||||||
|
* The bug reporting feature works normally again.
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
* Updated method for accessing audio files due to the latest changes on VK apps.
|
||||||
|
* When changing volume of the playing audio, it will decrease or increase the volume by 2% instead of 5%.
|
||||||
|
* Read confirmations will be sent to VK as soon as you read the message. Before, read confirmations were being sent every 3 minutes to the social network.
|
||||||
|
|
||||||
|
## Changes in version 0.19 (13.03.2019)
|
||||||
|
|
||||||
|
* Added a new buffer called documents. When loading the buffer, it will contain all documents owned by the current user. The context menu of any item will allow you to download the document to your computer or remove it from VK.
|
||||||
|
* A new buffer, called online, has been added in the friends section. It contains friends currently connected to VK. Items in this buffer will be added as soon as new friends are online in the social network, and will be removed when friends are offline. This buffer needs a lot of testing. Please report any possible inconsistency on this method.
|
||||||
|
* Added new options to open the config and logs folder, these options are located in the help menu and may be useful during error reporting.
|
||||||
|
* Added experimental support to "subscribers" buffer, inside frienship requests. This shows friend requests that have been declined by the current user.
|
||||||
|
* the message when an user is typing in conversation buffers will be announced only if the socializer window is focused.
|
||||||
|
* In "my audios" buffer, there is a button that allows a direct audio upload from your computer. The audio will be placed in your library.
|
||||||
|
* Added experimental support to user and community polls:
|
||||||
|
* If the poll is already closed or the user has send a vote to the poll previously, it will display only the results of the poll.
|
||||||
|
* Otherwise it will display a dialog from where the user can vote in the current poll.
|
||||||
|
* Fixed an error in Socializer that was making it unable to detect unread messages properly.
|
||||||
|
* Socializer should save all tracebacks directly to error.log instead of displaying an error message during exit. ([#27,](https://code.manuelcortez.net/manuelcortez/socializer/issues/27))
|
||||||
|
* When displaying user profiles, fixed an error where a married person without specifing relation partner would cause an error in the program. ([#29,](https://code.manuelcortez.net/manuelcortez/socializer/issues/29))
|
||||||
|
* Socializer will load all conversations during startup, not only conversations with unread messages.
|
||||||
|
* Added new global keystrokes, available in the main window.
|
||||||
|
* Alt + up/down arrows: Increase / decrease volume.
|
||||||
|
* Alt + Left/down arrows: Play previous and next song if playing an audios buffer.
|
||||||
|
* Control + P: Play/pause.
|
||||||
|
* control+Shift+P: Play all.
|
||||||
|
* Fixed an error in the audio player that was skipping the first track if you were in the last song and pressed "play next" in the menu bar or via the keystroke.
|
||||||
|
* Chats with unread messages will be placed at the top of the chats section. When a chat buffer receives a new message, socializer will move the buffer to the first position in the chats list. This should make easier for everyone to determine which chats contain unread items. ([#24,](https://code.manuelcortez.net/manuelcortez/socializer/issues/24))
|
||||||
|
* In dialogs for displaying posts and comments, and also in the two edit boxes present in chat buffers, it is possible to select all by pressing Control+A.
|
||||||
|
* Now it is possible to remove friends directly from the friends buffer. There is a new option for this purpose in the context menu for the focused friend. After being removed, the person will be placed in the subscribers buffer.
|
||||||
|
* Deleted posts will display an error message when trying to view details about those. Before, the dialog was created and left blank.
|
||||||
|
* Improvements in audio features present in Socializer:
|
||||||
|
* The audio search feature has received improvements: Now it is possible to indicate wether the search will be performed by title or artist, and select to sort the results by duration, popularity or date of addition to VK.
|
||||||
|
* Now it is possible to create and delete audio albums again.
|
||||||
|
* Fixed errors when moving songs to albums. Now everything works as expected.
|
||||||
|
* Added documents to the list of supported files when adding attachments to a wall post or private message.
|
||||||
|
* It is possible to enable or disable proxy from the preferences dialog. The application must be restarted for this change to take effect.
|
||||||
|
* Fixed an error that was making Socializer unable to display the changelog properly, when opened from the help menu. ([#21](https://code.manuelcortez.net/manuelcortez/socializer/issues/21))
|
||||||
|
* When receiving chat messages and in some other situations, socializer will display all characters properly. Before, usernames were rendered using the internal code VK uses for them, and some unicode characters were displaying their HTML representation.
|
||||||
|
* It is possible to retrieve previous items for the home buffer and walls (current user's wall and any other timeline):
|
||||||
|
* For the home buffer, only a limited amount of items (around 700) can be loaded, supposedly due to VK API limits.
|
||||||
|
* For walls, all posts should be possible to be loaded, however, testing with walls containing more than 2000 posts are not performed yet.
|
||||||
|
* Added improvements to groups:
|
||||||
|
* It is possible to load topics, audios, videos and documents for a group. In order to do so, you need to go to the group buffer and press the menu key, or right mouse click, in the tree item representing the group. New buffers will be created inside the current group's buffer.
|
||||||
|
* You can create or delete all buffers for groups by pressing the menu key or right mouse click in the "communities" buffer.
|
||||||
|
* There is support for group topics. When opening them, they will be displayed as a list of posts. You can like or reply to such posts, as well as adding new posts in the topic.
|
||||||
|
* Authentication errors should be handled gracefully by the application:
|
||||||
|
* When there is a password change, Socializer must be reauthorized again. An error message will indicate this if the user forgot to do that. After the error, the app will be restarted, prompting the user to introduce the new data for authorizing the application.
|
||||||
|
* If the user introduced incorrect or invalid data, Socializer will display an error and prompt the user again for valid information.
|
||||||
|
* If there is a connection problem when opening Socializer, it will display an error and inform the user about the issue.
|
||||||
|
|
||||||
|
## Changes in version 0.18 (21.01.2019)
|
||||||
|
|
||||||
|
* Changed authentication tokens in Socializer. It is mandatory to download a fresh copy of socializer and start a new configuration for your account.
|
||||||
|
* Stable versions of Socializer are built with Python 3. Previous versions are built with Python 2, however support for Python 2 will be dropped very soon.
|
||||||
|
* There is an installer file for Socializer, available in our downloads page. Installed version of Socializer will be more confortable for some people.
|
||||||
|
* For users from countries where VK is not allowed, Socializer includes a proxy to bypass country restrictions. The first time you start socializer, it will ask you whether you need a proxy or not. It is suggested to use a proxy only if you need it.
|
||||||
|
* Now it is possible to post in someone else's wall. When viewing a timeline of an user, the "post" button will post in his/her wall. To post in your own wall, you'll need to go to the newsfeed or your own wall and press the post button.
|
||||||
|
* If you are not allowed to post in someone's wall, the post button will not be visible.
|
||||||
|
* A new option for deleting wall posts has been added to the context menu in newsfeed and walls (current user's wall and timelines). This option will be visible only if the current user is allowed to delete the focused post.
|
||||||
|
* Socializer will be able to handle all users correctly. Before, if an user that was not present in the local storage system was needed, the program was displaying "no specified user". ([#17,](https://code.manuelcortez.net/manuelcortez/socializer/issues/17))
|
||||||
|
* It is possible to use user domains (short names for users) to create timelines. Just write @username and the program will create the needed timeline, regardless if the user is present in your friend list. ([#18,](https://code.manuelcortez.net/manuelcortez/socializer/issues/18))
|
||||||
|
* When displaying someone's profile, the dialog should be loaded dramatically faster than before. A message will be spoken when all data of the profile is loaded.
|
||||||
|
* When opening a timeline, if the current user is not allowed to do it, an error message should be displayed and the buffer will not be created. Before the buffer was partially created in the main window. ([#22.](https://code.manuelcortez.net/manuelcortez/socializer/issues/22))
|
||||||
|
* Added basic support to handle group chats. At the current moment it is possible to receive and reply to chat messages only. Chat groups will be placed inside the conversations section. ([#23.](https://code.manuelcortez.net/manuelcortez/socializer/issues/23))
|
||||||
|
* It is possible to delete a conversation buffer from the buffer menu. Deleting a conversation will only dismiss the buffer, no data is deleted at VK.
|
||||||
|
* During the first start of Socializer, an invitation will be shown to join the Socializer's group in case the current user is not already a member.
|
||||||
|
* It is possible to see how many people has read a wall post when showing it in the dialog. ([#28.](https://code.manuelcortez.net/manuelcortez/socializer/issues/28))
|
||||||
|
* A new tab has been added to the preferences dialog. From the new section, it is possible to control whether socializer should create buffers for the first 1000 audio albums, video albums and communities when starting.
|
||||||
|
* Added functionality regarding comments in wall posts:
|
||||||
|
* when reading a post, you can press enter in any comment to display a dialog from where it is possible to view attachments, translate, check spelling or reply to the thread. If there are replies made to this comment, these will be visible in a section called replies. Pressing enter in a reply will also open the same dialog.
|
||||||
|
* A new "replies" field has been added to the comments' list.
|
||||||
|
* When writing a comment, it is possible to do the same actions available for a post (translate, spell checking and adding attachments).
|
||||||
|
|
||||||
|
## Changes in version 0.17 (01.01.2019)
|
||||||
|
|
||||||
|
* Added support for Two factor authentication (2FA). ([#13,](https://code.manuelcortez.net/manuelcortez/socializer/issues/13))
|
||||||
|
* Added update channels in socializer. You can subscribe to the "stable" or "alpha" channel from the preferences dialog and you will receive updates published for those:
|
||||||
|
* The stable channel will have releases every month, approximately, and is the channel where the code will be more tested and with less bugs. All support and help will be provided for the stable versions only.
|
||||||
|
* The alpha channel will have releases every time a change is added to socializer, it may even include several releases in the same day, but we will try to release only a new version every day. Support will not be provided for alpha versions, as they will be used to test the latest code in the application.
|
||||||
|
* Now it is possible to send voice messages from socializer. Voice messages are available from the "add" button in any conversation buffer.
|
||||||
|
* tokens generated by socializer will never expire. ([#3,](https://code.manuelcortez.net/manuelcortez/socializer/issues/3))
|
||||||
|
* In order to use all methods available in VK, socializer will use tokens of kate mobile for Android. It means you may receive an email by saying that you've authorised Kate for accessing your account from an Android device.
|
||||||
|
* Audio albums are loaded correctly.
|
||||||
|
* It is possible to play audios added by friends appearing in the news feed.
|
||||||
|
* Adding and removing an audio file to your library works.
|
||||||
|
* Unread messages will play a sound when focused.
|
||||||
|
* Unread messages will be marked as read when user focuses them.
|
||||||
|
* Socializer will handle restricted audio tracks. Restricted songs are not allowed to be played in the user's country. Before, playing a restricted track was generating an exception and playback could not resume. Now, playing an audio track will display an error notification.
|
||||||
|
* Fixed an error when people were trying to open a post in an empty buffer, or accessing the menu when there are no posts in the buffer.
|
||||||
|
* Now Socializer will not send a notification every 5 minutes.
|
||||||
|
* the chat widget now is a multiline text control. It means it is possible to add a new line by pressing shift+Enter, and send the message by pressing enter.
|
||||||
|
* Socializer should handle connection errors when loading items in buffers and retry in 2 minutes. Also, connection errors in the chat server are handled and chat should be able to reconnect by itself.
|
||||||
|
* When trying to add an audio or video to an album, if the current user does not have any album, it will display an error instead of a traceback.
|
||||||
|
* Added popular and suggested songs. This will not work when using alternative tokens.
|
||||||
|
* Now it is possible to update the status message, located in your profile.
|
||||||
|
* Now it is possible to upload an audio from your computer when adding attachments in a wall post. When adding attachments to a post or message in a conversation, you will have two options: upload from your computer and add a file from your VK profile.
|
||||||
|
* Updated Russian translation: thanks to Дарья Ратникова.
|
||||||
|
* Fixed some conditions, especially when rendering items in feeds, that were making the client to crash.
|
||||||
|
* new versions will include documentation and changelog.
|
||||||
|
* A new option for reporting issues directly from the help menu has been added. Issues will be publicly available in the [Project Issues page](https://code.manuelcortez.net/manuelcortez/socializer/issues)
|
||||||
|
|
||||||
|
## Changes in version 0.16 (13.12.2018)
|
||||||
|
|
||||||
|
* Added two more buffers: "Pending requests" and "I follow", located in the people buffer, under "friendship requests".
|
||||||
|
* Added an experimental photo viewer. Will show options for displaying the next and previous photo if the current post contains multiple images. Fullscreen button still doesn't work.
|
||||||
|
* Improved the chat features present in the application. Read documentation to get a full understanding about how it works now.
|
||||||
|
* Added video management (my videos, video albums and video search). For playing videos, you will be redirected to a website in your browser due to the VK'S policy.
|
||||||
|
* Added a setting that allows you to specify if you want socializer to load images when you are opening posts. It could be useful for slow connections or those who don't want images to be loaded.
|
||||||
|
* Added basic tagging for users in posts and comments. You can tag only people in your friends buffer.
|
||||||
|
* Added a basic user profile viewer.
|
||||||
|
* Added support for listening voice messages in chats. Currently it is not possible to send them.
|
||||||
|
* Fixed an error that was making Socializer unable to display chat history properly. It was showing the first 200 items in a conversation instead the last 200 items. Now chat will be displayed accordingly.
|
||||||
|
* Changed the chat history widget from list of items to a read only text box, similar to how it was displayed in skype. Now the widget should be fully visible and messages will work in the same way.
|
||||||
|
* It is possible to play songs sent in a chat message by opening them from the attachments panel.
|
||||||
|
* Reimplemented most of the audio playback methods (audio albums buffer still not working).
|
||||||
|
* Added some notifications and chat notifications when friends are online and offline. Most notifications can be configured from settings.
|
||||||
|
|
||||||
|
## Changes in build 2016.07.08 (08/07/2016)
|
||||||
|
|
||||||
|
* Removed platform from "last seen" column in the friends list as it could cause some problems and it was being not so exact.
|
||||||
|
* Now deleted audios are not parsed and displayed as "audio removed from library". They are silently ignored.
|
||||||
|
* It's possible to open a friends timeline for others.
|
||||||
|
* Fixed some strange bugs in the built version.
|
||||||
|
* Deactivated accounts will not cause problems in friends lists. They will be displayed as deactivated, wich means that it'll be impossible to interact with those accounts.
|
||||||
|
* When opened, the client will set online for the user account, it'll inform VK that this user is currently online. This parameter will be updated every 15 minutes, as stated in the API documentation.
|
||||||
|
* When opened, socializer will try to create chat buffers for all unread messages.
|
||||||
|
* Update some information on certain posts when an item is selected. For example, update the date of a post.
|
||||||
|
* Read messages will be marked as read in the social network, so it'll cause that your friends could see that you have read the message and socializer will not load chat buffers with read messages at startup.
|
||||||
|
* Included a brief manual in the help menu. Currently available only in English.
|
||||||
|
* Included a context menu in list items. Currently there are functions not available. Menu for chat buffers is not implemented yet.
|
||||||
|
* Implemented audio album load (in the music buffer), creation (in the application menu) and deletion (in the application menu, too).
|
||||||
|
* audios can be moved to albums by pressing the menu key or doing a right click in the item, and selecting "move to album". Audios will be added to the album in the next update (there is a programmed update every 3 minutes), or you can update the buffer manually (from the buffer menu in the menu bar). This option will be available in audio buffers (searches, popular and recommended audio buffers, and audio timelines).
|
||||||
|
* Albums will be empty at startup. In order to get the album's audios, you'll have to navigate to the album and press the button "load". It'll load the needed information for displaying and playing the added songs
|
||||||
|
* If the config is invalid (for example you changed email or phone in the VK site and didn't changed that in Socializer, or just entered invalid credentials), the program will display an error with instructions for fixing the problem.
|
||||||
|
* Now is possible to press enter in the password or email/phone field and it'll do the action of the OK button.
|
||||||
|
* If you have set russian as the main language in the VK site, you'll see names in genitive and instrumental cases in certain phrases.
|
||||||
|
* Updated russian and spanish translations.
|
||||||
|
|
||||||
|
## Changes on build 2016.05.25
|
||||||
|
|
||||||
|
* Added grouped controls in the audio searches dialogue. It will be more accessible so screen readers could detect and read the label for radio buttons.
|
||||||
|
* Added documents to the list of supported attachments in the post viewer. The action for this kind of attachments is to open the default web browser, pointing to the URL address of that file.
|
||||||
|
* Now It's possible to add photos to the wall, by uploading files to the VK servers. Check the attachments button in the new post dialogue for this. Basically it is possible to add some photos and when the post is sent, photos will start to be uploaded before. At the moment it is not possible to add descriptions to photos. Take in to account that photos will be uploaded when the send button is pressed and the post could take some time before being posted.
|
||||||
|
* Added a new option to the menu bar: new timeline. It allows to create a special buffer for a selected user. This buffer could be an audio or wall buffer, when created, the buffer will be updated with items for the specified user or community.
|
||||||
|
* Added an user selection control. In dialogues where an user must be selected, there will be an edit box with a selected name. You need to start writing for changing this name, or just press the down arrow for looking in the users' database. You can start writing and then press the down arrow, so you will see the closest result to the name you was writing. For example if you want to write manuel, you could write m, a, n, u, and press the down arrow, and you will see the full name in the edit box. Take in to account that you have to make sure that you write a valid user name in the box, otherwise you will see an error.
|
||||||
|
* Posts from twitter are displayed in a better way (newline characters (\n) are handled properly instead being displayed).
|
||||||
|
* In the play all function, everything should be cleaned before start the new playback.
|
||||||
|
* Now links included in text of a comment are included as attachments (links are "untitled" because it isn't possible to retrieve information for every link without performance issues). This is especially useful when someone posts a link from Twitter.
|
||||||
|
* Chat support: There is a new kind of buffer, named chat buffer, wich allows you to have a conversation with someone of your friends. If you receive a message while socializer is opened it will create a chat buffer under chats with the last 200 messages between you and your friend. You can send a message by writing in the edit box and pressing send or enter. At the moment chats buffers can't be removed. Will be added this possibility in the near future.
|
||||||
|
* Added your friendlist as a buffer. You can create chats from there by using the send message button.
|
||||||
|
|
||||||
|
## Changes for build 2016.04.5 (5/04/2016)
|
||||||
|
|
||||||
|
* Updated russian and spanish translations.
|
||||||
|
* Fixed minor bugs in the likes button for posts.
|
||||||
|
* Now it's possible to open wall posts by pressing enter, as newsfeeds' posts.
|
||||||
|
* It's possible to see reposts in the news and wall buffers, and the post displayer (when you press enter in a post) shows the full post story.
|
||||||
|
* Added "load previous items" in the main menu. It should work for wall and news feed. This feature is not available in audio buffers due to API limits.
|
||||||
|
* Added more options in the search audio dialog. Now users could use more parameters and searches will be more precise.
|
||||||
|
* Added a new attachments' list. When a post is opened, this list will show up if there are attachments in the current post (attachments are audio, photos, video and links). You will be able to interact with the supported data (at the moment only photos, videos, audio and links are supported, more will be added in future).
|
||||||
|
* Added a changelog file which could be opened from the help menu.
|
||||||
|
* Added a preferences dialogue and a new application menu in the menu bar. From this dialogue you can change the number of items to be loaded for every buffer.
|
292
doc/changelog.py
Normal file
292
doc/changelog.py
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
documentation = [
|
||||||
|
_(u"""# Changelog"""),
|
||||||
|
"",
|
||||||
|
_(u"""## News in this version"""),
|
||||||
|
"",
|
||||||
|
_(u"""## new additions"""),
|
||||||
|
"",
|
||||||
|
_(u"""* the spelling correction module is able to add words to the dictionary so it will learn which words should start to ignore."""),
|
||||||
|
"",
|
||||||
|
_(u"""### bugfixes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Now it is possible to perform authentication in accounts using two factor verification again. This issue was caused due to a recent change in the VK workflow for two factor verification processes."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Changes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* The spelling correction module has been rewritten to take advantage of the newest enchant Python module which is more stable and can be added properly to the distribution, as opposed to the first enchant module we have tried."""),
|
||||||
|
_(u"""* Better performance on Socializer should be noticed for users with many conversations opened. Before, socializer could freeze while loading all messages in conversations. Now that should work more efficiently and the application should not stop responding."""),
|
||||||
|
"",
|
||||||
|
_(u"""## News in Version 0.24"""),
|
||||||
|
"",
|
||||||
|
_(u"""### New additions"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Socializer will ask for confirmation before closing the application."""),
|
||||||
|
_(u"""* In all audio buffers, there is a new item in the context menu that allows downloading of the audio directly from the buffer. If there are multiple audios selected, socializer will ask for a folder where all audios should be placed. When downloading multiple audios, socializer will name those automatically by following the template "song title - artist"."""),
|
||||||
|
_(u"""* In all audio buffers, there are two new menu items for selecting and deselecting all items in the buffer."""),
|
||||||
|
_(u"""* Added displaying of articles as attachments in wall posts. When opened, Socializer will open the article in the web browser."""),
|
||||||
|
_(u"""* Starting from Version 0.24, there will be an installer for the Alpha version of socializer, always available from our downloads page."""),
|
||||||
|
"",
|
||||||
|
_(u"""### bugfixes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Fixed an error that was making socializer unable to render correctly certain Links containing uppercase letters (such as yandex.disk shared links). Before, those links were giving 404 errors when pressed, now they should work normally. This error was present in wall posts, comments, topics and chat messages."""),
|
||||||
|
_(u"""* Fixed an error related to chat notifications in Socializer. Before, the "online now" notification could break the Socializer interface, making it unable to load the chat in real time."""),
|
||||||
|
_(u"""* Fixed a small inconsistency when marking a conversation as read. Before, if two messages were sent by the recipient, only the last message was marked as read and the previous was making the unread sound all the time. Now that issue should be handled properly."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Changes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Socializer will not be marked as Virus by most antivirus softwares due to a new build tool which is cleaner and less prone to be flagged by antivirus."""),
|
||||||
|
_(u"""* Socializer is distributed with the Microsoft C++ redistributable package, so everyone will be able to use the software without needing to install any extra package."""),
|
||||||
|
_(u"""* Replaced the underlying library we were using for spelling correction as is no longer in development. Instead, we started to use a new approach in socializer, which, in theory, should allow us to switch language for spelling correction and other benefits a bit later. For now, available languages are Russian, Ukranian, English, Polish and Spanish, but more languages can be added by request."""),
|
||||||
|
_(u"""* When downloading a file (such as an audio file or document), the download process should be relatively faster due to some optimizations made in the function."""),
|
||||||
|
_(u"""* Socializer now uses just the first name of users in typing notifications."""),
|
||||||
|
_(u"""* socializer should be able to inform users about common errors when sending chat messages (such as sending messages to people in the current user's blacklist or banned from VK). Later, more errors related to posts will be added."""),
|
||||||
|
_(u"""* The application will load up to 100 audio albums instead of the default 10."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes in Version 0.23 (11.11.2019)"""),
|
||||||
|
"",
|
||||||
|
_(u"""### New additions"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Socializer is now more tolerant to internet issues. When attempting to create a wall post, comment, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later."""),
|
||||||
|
_(u"""* Switching accounts is now supported in socializer. In the application menu, there is an option called "manage accounts" which allows you to add or remove an account. Socializer will take changes after a restart of the application. In case of having multiple accounts, every time Socializer starts, you will see a dialog from where is possible to choose the account for logging in."""),
|
||||||
|
_(u"""* when selecting multiple audio files in audio buffers, multiple actions can be performed in all items, these actions are present in the contextual menu of the buffer (namely play, add/remove from the library and move to a different playlist). This means you can select all the audios you want and Socializer will perform the selected options in all items, making it a bit easier to operate with multiple songs."""),
|
||||||
|
_(u"""* Now it is possible to like and see who liked a comment when displaying it individually. This applies to comments in wall posts and topics."""),
|
||||||
|
_(u"""* Now it is possible to choose how many items Socializer will load in conversation buffers, from the General tab in the preferences dialog. The default value is 50 items, and the maximum value is 200."""),
|
||||||
|
_(u"""* There is a new tab called buffer settings, in the preferences dialog. Settings related to how many items should be loaded in certain buffer types have been moved to this tab, so it will separate better the configuration options in the application."""),
|
||||||
|
_(u"""* Added management of the Blacklist on VK. Users can be blocked from people buffers (friends, online, or any buffer inside friend requests). You can access the blacklist from the application menu, located in the menu bar. From there, you can unblock any previously blocked user."""),
|
||||||
|
_(u"""* In the new timeline dialog, it is possible to create video buffers by selecting the "video" radio button as buffer type."""),
|
||||||
|
"",
|
||||||
|
_(u"""### bugfixes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Fixed an error that was causing socializer to not update the "Online friends" buffer if chat notifications were disabled."""),
|
||||||
|
_(u"""* Fixed an error that was making Socializer unable to attach audio files from the computer, if the file does not include correct ID3 TAGS."""),
|
||||||
|
_(u"""* Fixed a traceback that was being logged when attempting to load an image but cancel the dialog for attaching it."""),
|
||||||
|
_(u"""* Fixed an error that was making Socializer to fail when loading the newsfeed buffer, thus not loading any other buffers. This error was caused due to VK sending a new object type representing push subscriptions. The item is ignored by Socializer so it will not break the newsfeed buffer anymore."""),
|
||||||
|
_(u"""* Fixed an error that was making the status bar to not fit the full size of the Window. This was cutting the messages placed on it, now, all messages are displayed properly again."""),
|
||||||
|
_(u"""* fixed an unhandled condition when playing a song and voice message at the same time, that was potentially making Socializer to stop loading certain buffers."""),
|
||||||
|
_(u"""* fixed an error that was making socializer unable to parse video data, thus video buffers were impossible to be loaded."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Changes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Less confidential user data will be send to the logs, so it will be much safer to pass logs publicly."""),
|
||||||
|
_(u"""* automatic update checks will be disabled if using socializer from the source code."""),
|
||||||
|
_(u"""* it is possible to post in an user's wall by using the post button located next to the user, in people buffers. This applies only to online users and list of friends."""),
|
||||||
|
_(u"""* When displaying a profile, information about mobile and home phone is displayed in the basic information tab."""),
|
||||||
|
_(u"""* In wall posts, all comments, including replies, will be displayed in the same list. Before, you had to open a comment to read its replies. When a new comment is posted by the current user, the list of comments will be reloaded and new additions will be fetched and sorted properly."""),
|
||||||
|
"",
|
||||||
|
_(u"""## changes in Versions 0.21 and 0.22 (14.07.2019)"""),
|
||||||
|
"",
|
||||||
|
_(u"""### New additions"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Added "post in groups" feature. In order to do so, you need to load the posts for the group where you want to send something. Once loaded, go to the post button in the group's wall and select whether you want to post in the group's behalf or as yourself."""),
|
||||||
|
_(u"""* In all audio buffers, it is possible to select individual tracks to be played together. In order to do so, you need to press space to start the selection of items. When selected, the item will emit a sound to indicate the change. Press space in all items you want to select/unselect. When you're focusing an already selected item it will play a sound to indicate that it is already selected. Once you're done with your selection, pressing enter in the list of tracks will start the playback of the list of items you have selected. This is a very experimental feature. More actions can be supported based in this selection method if it proves to be useful."""),
|
||||||
|
_(u"""* In conversation buffers, it is possible to display and open wall posts sent as attachments in messages."""),
|
||||||
|
_(u"""* In people buffers, it is possible to create a new timeline by using the context menu while focusing an user. This method will create the buffer for the selected user, as opposed to creating the buffer from the menu bar, where you have to type the username or find it in a list."""),
|
||||||
|
"",
|
||||||
|
_(u"""### bugfixes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Fixed an error with two factor authentication in the recent socializer version. Now it works reliably again."""),
|
||||||
|
_(u"""* Fixed an error when trying to attach a photo to a wall post. The error was fixed in the [vk_api](https://github.com/python273/vk_api) module and the fix was sent to the developer of the library, so he will be able to merge it in the next version. In the meantime, socializer already includes the fix for this method, so you can upload photos to wall posts normally."""),
|
||||||
|
_(u"""* Fixed an error retrieving some group information for the current session."""),
|
||||||
|
_(u"""* When posting in a topic, links will be posted properly."""),
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
_(u"""### Changes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* the audio player module has received some improvements:"""),
|
||||||
|
_(u""" - When there is something being played, the label of the "play" button, located in all audio buffers, will change automatically to "pause". When pressed, it will pause the song instead of starting the playback again since the beginning."""),
|
||||||
|
_(u""" - The last change will work also in the dialog for displaying audio information. Now it's possible to play and pause an audio from such dialog."""),
|
||||||
|
_(u""" - When playing a voice message, if a song is playing already socializer will decrease the volume so you can hear the voice message well enough. Some seconds after the message has finished, the song's volume will be restored."""),
|
||||||
|
_(u"""* In audio buffers, you will play the focused audio when pressing enter in the item, instead of opening the audio information dialog."""),
|
||||||
|
_(u"""* Removed some old keystrokes in socializer buffers due to better alternatives. The reason for this change is that currently you don't need to be focusing an item in a buffer for being able to use the alternative keystrokes, which makes those a better implementation."""),
|
||||||
|
_(u""" - Control+Enter and control+Shift+Enter: superseeded by Control+P for playing (and pausing) the currently focused audio."""),
|
||||||
|
_(u""" - F5 and F6: superseeded by Alt+down and up arrows for modifying volume."""),
|
||||||
|
"",
|
||||||
|
_(u"""## changes in version 0.20 (25.04.2019)"""),
|
||||||
|
"",
|
||||||
|
_(u"""### New additions"""),
|
||||||
|
"",
|
||||||
|
_(u"""* For users with multiple soundcards, there is a new tab in the preferences dialogue of Socializer, called sound. From there, you can define which soundcard will be used for input and output. [#25,](https://code.manuelcortez.net/manuelcortez/socializer/issues/25)"""),
|
||||||
|
_(u"""* the audio player can seek positions in the currently playing track. You can use the menu items (located in the main menu) or use the new available keystrokes dedicated to the actions. Seeking will be made in 5 second intervals."""),
|
||||||
|
_(u""" * Alt+Shift+Left arrow: Seek 5 seconds backwards."""),
|
||||||
|
_(u""" * Alt+Shift+Right arrow: Seek 5 seconds forwards."""),
|
||||||
|
_(u"""* it is possible to select the language used in socializer from the preferences dialog. When changing the language, the application must be restarted for the changes to take effect."""),
|
||||||
|
_(u"""* A new option, called open in vk.com, has been added in the context menu for almost all objects (items in home timeline, walls, documents, people, group topics and in buffers for conversations). This option will open the selected item in the VK website."""),
|
||||||
|
_(u"""* when opening the list of friends added by an user, you can display the context menu from an item on the list and view the user profile, open it in VK.com, among other actions. [#8,](https://code.manuelcortez.net/manuelcortez/socializer/issues/8)"""),
|
||||||
|
_(u"""* When displaying a post, if you press enter in the button indicating how many people liked or shared the post, Socializer will display the listt of people who have liked or shared it. You can use the context menu in the list to do certain actions. [#38,](https://code.manuelcortez.net/manuelcortez/socializer/issues/38)"""),
|
||||||
|
_(u"""* it is possible to retrieve more items for conversation buffers. Due to API limitations, it is possible to load up to the last 600 messages for every conversation. Take into account that the process of loading more items takes some time. You will hear a message when the process is done."""),
|
||||||
|
_(u"""* It is possible to delete entire conversations from the buffer's tree, by using the menu key and selecting "delete conversation". The conversation will be removed from VK."""),
|
||||||
|
_(u"""* When loading a topic in a group, socializer will display the latest 100 messages. In order to load more messages, you will find a button that will load the previous 100 messages present in the topic, or the amount of messages not loaded yet."""),
|
||||||
|
"",
|
||||||
|
_(u"""### bugfixes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* All spelling dictionaries are included by default for the following languages: Russian, English, German, French, italian, Polish, spanish and Turkish. Before, some dictionaries were missing and the spelling checker was failing."""),
|
||||||
|
_(u"""* Fixed an error in the default configuration template used for new sessions in the application. This error was making Socializer to fail when loading any conversation buffer."""),
|
||||||
|
_(u"""* Fixed an error in the algorithm to detect friends disconnecting from VK. This problem was interrupting the connection with the chat server every time it was happening, thus chat server's connection should be more reliable now."""),
|
||||||
|
_(u"""* The audio player should behave better in situations where a song is interrupted. Before, if you pressed "next song" while the currently playing sound was interrupted due to internet connection issues, two or more songs were played at the same time."""),
|
||||||
|
_(u"""* The bug reporting feature works normally again."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Changes"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Updated method for accessing audio files due to the latest changes on VK apps."""),
|
||||||
|
_(u"""* When changing volume of the playing audio, it will decrease or increase the volume by 2% instead of 5%. """),
|
||||||
|
_(u"""* Read confirmations will be sent to VK as soon as you read the message. Before, read confirmations were being sent every 3 minutes to the social network."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes in version 0.19 (13.03.2019)"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Added a new buffer called documents. When loading the buffer, it will contain all documents owned by the current user. The context menu of any item will allow you to download the document to your computer or remove it from VK."""),
|
||||||
|
_(u"""* A new buffer, called online, has been added in the friends section. It contains friends currently connected to VK. Items in this buffer will be added as soon as new friends are online in the social network, and will be removed when friends are offline. This buffer needs a lot of testing. Please report any possible inconsistency on this method."""),
|
||||||
|
_(u"""* Added new options to open the config and logs folder, these options are located in the help menu and may be useful during error reporting."""),
|
||||||
|
_(u"""* Added experimental support to "subscribers" buffer, inside frienship requests. This shows friend requests that have been declined by the current user."""),
|
||||||
|
_(u"""* the message when an user is typing in conversation buffers will be announced only if the socializer window is focused."""),
|
||||||
|
_(u"""* In "my audios" buffer, there is a button that allows a direct audio upload from your computer. The audio will be placed in your library."""),
|
||||||
|
_(u"""* Added experimental support to user and community polls:"""),
|
||||||
|
_(u""" * If the poll is already closed or the user has send a vote to the poll previously, it will display only the results of the poll."""),
|
||||||
|
_(u""" * Otherwise it will display a dialog from where the user can vote in the current poll."""),
|
||||||
|
_(u"""* Fixed an error in Socializer that was making it unable to detect unread messages properly."""),
|
||||||
|
_(u"""* Socializer should save all tracebacks directly to error.log instead of displaying an error message during exit. ([#27,](https://code.manuelcortez.net/manuelcortez/socializer/issues/27))"""),
|
||||||
|
_(u"""* When displaying user profiles, fixed an error where a married person without specifing relation partner would cause an error in the program. ([#29,](https://code.manuelcortez.net/manuelcortez/socializer/issues/29))"""),
|
||||||
|
_(u"""* Socializer will load all conversations during startup, not only conversations with unread messages."""),
|
||||||
|
_(u"""* Added new global keystrokes, available in the main window."""),
|
||||||
|
_(u""" * Alt + up/down arrows: Increase / decrease volume."""),
|
||||||
|
_(u""" * Alt + Left/down arrows: Play previous and next song if playing an audios buffer."""),
|
||||||
|
_(u""" * Control + P: Play/pause."""),
|
||||||
|
_(u""" * control+Shift+P: Play all."""),
|
||||||
|
_(u"""* Fixed an error in the audio player that was skipping the first track if you were in the last song and pressed "play next" in the menu bar or via the keystroke."""),
|
||||||
|
_(u"""* Chats with unread messages will be placed at the top of the chats section. When a chat buffer receives a new message, socializer will move the buffer to the first position in the chats list. This should make easier for everyone to determine which chats contain unread items. ([#24,](https://code.manuelcortez.net/manuelcortez/socializer/issues/24))"""),
|
||||||
|
_(u"""* In dialogs for displaying posts and comments, and also in the two edit boxes present in chat buffers, it is possible to select all by pressing Control+A."""),
|
||||||
|
_(u"""* Now it is possible to remove friends directly from the friends buffer. There is a new option for this purpose in the context menu for the focused friend. After being removed, the person will be placed in the subscribers buffer."""),
|
||||||
|
_(u"""* Deleted posts will display an error message when trying to view details about those. Before, the dialog was created and left blank."""),
|
||||||
|
_(u"""* Improvements in audio features present in Socializer:"""),
|
||||||
|
_(u""" * The audio search feature has received improvements: Now it is possible to indicate wether the search will be performed by title or artist, and select to sort the results by duration, popularity or date of addition to VK."""),
|
||||||
|
_(u""" * Now it is possible to create and delete audio albums again."""),
|
||||||
|
_(u""" * Fixed errors when moving songs to albums. Now everything works as expected."""),
|
||||||
|
_(u"""* Added documents to the list of supported files when adding attachments to a wall post or private message."""),
|
||||||
|
_(u"""* It is possible to enable or disable proxy from the preferences dialog. The application must be restarted for this change to take effect."""),
|
||||||
|
_(u"""* Fixed an error that was making Socializer unable to display the changelog properly, when opened from the help menu. ([#21](https://code.manuelcortez.net/manuelcortez/socializer/issues/21))"""),
|
||||||
|
_(u"""* When receiving chat messages and in some other situations, socializer will display all characters properly. Before, usernames were rendered using the internal code VK uses for them, and some unicode characters were displaying their HTML representation."""),
|
||||||
|
_(u"""* It is possible to retrieve previous items for the home buffer and walls (current user's wall and any other timeline):"""),
|
||||||
|
_(u""" * For the home buffer, only a limited amount of items (around 700) can be loaded, supposedly due to VK API limits."""),
|
||||||
|
_(u""" * For walls, all posts should be possible to be loaded, however, testing with walls containing more than 2000 posts are not performed yet."""),
|
||||||
|
_(u"""* Added improvements to groups:"""),
|
||||||
|
_(u""" * It is possible to load topics, audios, videos and documents for a group. In order to do so, you need to go to the group buffer and press the menu key, or right mouse click, in the tree item representing the group. New buffers will be created inside the current group's buffer."""),
|
||||||
|
_(u""" * You can create or delete all buffers for groups by pressing the menu key or right mouse click in the "communities" buffer."""),
|
||||||
|
_(u""" * There is support for group topics. When opening them, they will be displayed as a list of posts. You can like or reply to such posts, as well as adding new posts in the topic."""),
|
||||||
|
_(u"""* Authentication errors should be handled gracefully by the application:"""),
|
||||||
|
_(u""" * When there is a password change, Socializer must be reauthorized again. An error message will indicate this if the user forgot to do that. After the error, the app will be restarted, prompting the user to introduce the new data for authorizing the application."""),
|
||||||
|
_(u""" * If the user introduced incorrect or invalid data, Socializer will display an error and prompt the user again for valid information."""),
|
||||||
|
_(u""" * If there is a connection problem when opening Socializer, it will display an error and inform the user about the issue."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes in version 0.18 (21.01.2019)"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Changed authentication tokens in Socializer. It is mandatory to download a fresh copy of socializer and start a new configuration for your account."""),
|
||||||
|
_(u"""* Stable versions of Socializer are built with Python 3. Previous versions are built with Python 2, however support for Python 2 will be dropped very soon."""),
|
||||||
|
_(u"""* There is an installer file for Socializer, available in our downloads page. Installed version of Socializer will be more confortable for some people."""),
|
||||||
|
_(u"""* For users from countries where VK is not allowed, Socializer includes a proxy to bypass country restrictions. The first time you start socializer, it will ask you whether you need a proxy or not. It is suggested to use a proxy only if you need it."""),
|
||||||
|
_(u"""* Now it is possible to post in someone else's wall. When viewing a timeline of an user, the "post" button will post in his/her wall. To post in your own wall, you'll need to go to the newsfeed or your own wall and press the post button."""),
|
||||||
|
_(u"""* If you are not allowed to post in someone's wall, the post button will not be visible."""),
|
||||||
|
_(u"""* A new option for deleting wall posts has been added to the context menu in newsfeed and walls (current user's wall and timelines). This option will be visible only if the current user is allowed to delete the focused post."""),
|
||||||
|
_(u"""* Socializer will be able to handle all users correctly. Before, if an user that was not present in the local storage system was needed, the program was displaying "no specified user". ([#17,](https://code.manuelcortez.net/manuelcortez/socializer/issues/17))"""),
|
||||||
|
_(u"""* It is possible to use user domains (short names for users) to create timelines. Just write @username and the program will create the needed timeline, regardless if the user is present in your friend list. ([#18,](https://code.manuelcortez.net/manuelcortez/socializer/issues/18))"""),
|
||||||
|
_(u"""* When displaying someone's profile, the dialog should be loaded dramatically faster than before. A message will be spoken when all data of the profile is loaded."""),
|
||||||
|
_(u"""* When opening a timeline, if the current user is not allowed to do it, an error message should be displayed and the buffer will not be created. Before the buffer was partially created in the main window. ([#22.](https://code.manuelcortez.net/manuelcortez/socializer/issues/22))"""),
|
||||||
|
_(u"""* Added basic support to handle group chats. At the current moment it is possible to receive and reply to chat messages only. Chat groups will be placed inside the conversations section. ([#23.](https://code.manuelcortez.net/manuelcortez/socializer/issues/23))"""),
|
||||||
|
_(u"""* It is possible to delete a conversation buffer from the buffer menu. Deleting a conversation will only dismiss the buffer, no data is deleted at VK."""),
|
||||||
|
_(u"""* During the first start of Socializer, an invitation will be shown to join the Socializer's group in case the current user is not already a member."""),
|
||||||
|
_(u"""* It is possible to see how many people has read a wall post when showing it in the dialog. ([#28.](https://code.manuelcortez.net/manuelcortez/socializer/issues/28))"""),
|
||||||
|
_(u"""* A new tab has been added to the preferences dialog. From the new section, it is possible to control whether socializer should create buffers for the first 1000 audio albums, video albums and communities when starting."""),
|
||||||
|
_(u"""* Added functionality regarding comments in wall posts:"""),
|
||||||
|
_(u""" * when reading a post, you can press enter in any comment to display a dialog from where it is possible to view attachments, translate, check spelling or reply to the thread. If there are replies made to this comment, these will be visible in a section called replies. Pressing enter in a reply will also open the same dialog."""),
|
||||||
|
_(u""" * A new "replies" field has been added to the comments' list."""),
|
||||||
|
_(u""" * When writing a comment, it is possible to do the same actions available for a post (translate, spell checking and adding attachments)."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes in version 0.17 (01.01.2019)"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Added support for Two factor authentication (2FA). ([#13,](https://code.manuelcortez.net/manuelcortez/socializer/issues/13))"""),
|
||||||
|
_(u"""* Added update channels in socializer. You can subscribe to the "stable" or "alpha" channel from the preferences dialog and you will receive updates published for those:"""),
|
||||||
|
_(u""" * The stable channel will have releases every month, approximately, and is the channel where the code will be more tested and with less bugs. All support and help will be provided for the stable versions only."""),
|
||||||
|
_(u""" * The alpha channel will have releases every time a change is added to socializer, it may even include several releases in the same day, but we will try to release only a new version every day. Support will not be provided for alpha versions, as they will be used to test the latest code in the application."""),
|
||||||
|
_(u"""* Now it is possible to send voice messages from socializer. Voice messages are available from the "add" button in any conversation buffer."""),
|
||||||
|
_(u"""* tokens generated by socializer will never expire. ([#3,](https://code.manuelcortez.net/manuelcortez/socializer/issues/3))"""),
|
||||||
|
_(u"""* In order to use all methods available in VK, socializer will use tokens of kate mobile for Android. It means you may receive an email by saying that you've authorised Kate for accessing your account from an Android device."""),
|
||||||
|
_(u"""* Audio albums are loaded correctly."""),
|
||||||
|
_(u"""* It is possible to play audios added by friends appearing in the news feed."""),
|
||||||
|
_(u"""* Adding and removing an audio file to your library works."""),
|
||||||
|
_(u"""* Unread messages will play a sound when focused."""),
|
||||||
|
_(u"""* Unread messages will be marked as read when user focuses them."""),
|
||||||
|
_(u"""* Socializer will handle restricted audio tracks. Restricted songs are not allowed to be played in the user's country. Before, playing a restricted track was generating an exception and playback could not resume. Now, playing an audio track will display an error notification."""),
|
||||||
|
_(u"""* Fixed an error when people were trying to open a post in an empty buffer, or accessing the menu when there are no posts in the buffer."""),
|
||||||
|
_(u"""* Now Socializer will not send a notification every 5 minutes."""),
|
||||||
|
_(u"""* the chat widget now is a multiline text control. It means it is possible to add a new line by pressing shift+Enter, and send the message by pressing enter."""),
|
||||||
|
_(u"""* Socializer should handle connection errors when loading items in buffers and retry in 2 minutes. Also, connection errors in the chat server are handled and chat should be able to reconnect by itself."""),
|
||||||
|
_(u"""* When trying to add an audio or video to an album, if the current user does not have any album, it will display an error instead of a traceback."""),
|
||||||
|
_(u"""* Added popular and suggested songs. This will not work when using alternative tokens."""),
|
||||||
|
_(u"""* Now it is possible to update the status message, located in your profile."""),
|
||||||
|
_(u"""* Now it is possible to upload an audio from your computer when adding attachments in a wall post. When adding attachments to a post or message in a conversation, you will have two options: upload from your computer and add a file from your VK profile."""),
|
||||||
|
_(u"""* Updated Russian translation: thanks to Дарья Ратникова."""),
|
||||||
|
_(u"""* Fixed some conditions, especially when rendering items in feeds, that were making the client to crash."""),
|
||||||
|
_(u"""* new versions will include documentation and changelog."""),
|
||||||
|
_(u"""* A new option for reporting issues directly from the help menu has been added. Issues will be publicly available in the [Project Issues page](https://code.manuelcortez.net/manuelcortez/socializer/issues)"""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes in version 0.16 (13.12.2018)"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Added two more buffers: "Pending requests" and "I follow", located in the people buffer, under "friendship requests"."""),
|
||||||
|
_(u"""* Added an experimental photo viewer. Will show options for displaying the next and previous photo if the current post contains multiple images. Fullscreen button still doesn't work."""),
|
||||||
|
_(u"""* Improved the chat features present in the application. Read documentation to get a full understanding about how it works now."""),
|
||||||
|
_(u"""* Added video management (my videos, video albums and video search). For playing videos, you will be redirected to a website in your browser due to the VK'S policy."""),
|
||||||
|
_(u"""* Added a setting that allows you to specify if you want socializer to load images when you are opening posts. It could be useful for slow connections or those who don't want images to be loaded."""),
|
||||||
|
_(u"""* Added basic tagging for users in posts and comments. You can tag only people in your friends buffer."""),
|
||||||
|
_(u"""* Added a basic user profile viewer."""),
|
||||||
|
_(u"""* Added support for listening voice messages in chats. Currently it is not possible to send them."""),
|
||||||
|
_(u"""* Fixed an error that was making Socializer unable to display chat history properly. It was showing the first 200 items in a conversation instead the last 200 items. Now chat will be displayed accordingly."""),
|
||||||
|
_(u"""* Changed the chat history widget from list of items to a read only text box, similar to how it was displayed in skype. Now the widget should be fully visible and messages will work in the same way."""),
|
||||||
|
_(u"""* It is possible to play songs sent in a chat message by opening them from the attachments panel."""),
|
||||||
|
_(u"""* Reimplemented most of the audio playback methods (audio albums buffer still not working)."""),
|
||||||
|
_(u"""* Added some notifications and chat notifications when friends are online and offline. Most notifications can be configured from settings."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes in build 2016.07.08 (08/07/2016)"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Removed platform from "last seen" column in the friends list as it could cause some problems and it was being not so exact."""),
|
||||||
|
_(u"""* Now deleted audios are not parsed and displayed as "audio removed from library". They are silently ignored."""),
|
||||||
|
_(u"""* It's possible to open a friends timeline for others."""),
|
||||||
|
_(u"""* Fixed some strange bugs in the built version."""),
|
||||||
|
_(u"""* Deactivated accounts will not cause problems in friends lists. They will be displayed as deactivated, wich means that it'll be impossible to interact with those accounts."""),
|
||||||
|
_(u"""* When opened, the client will set online for the user account, it'll inform VK that this user is currently online. This parameter will be updated every 15 minutes, as stated in the API documentation."""),
|
||||||
|
_(u"""* When opened, socializer will try to create chat buffers for all unread messages."""),
|
||||||
|
_(u"""* Update some information on certain posts when an item is selected. For example, update the date of a post."""),
|
||||||
|
_(u"""* Read messages will be marked as read in the social network, so it'll cause that your friends could see that you have read the message and socializer will not load chat buffers with read messages at startup."""),
|
||||||
|
_(u"""* Included a brief manual in the help menu. Currently available only in English."""),
|
||||||
|
_(u"""* Included a context menu in list items. Currently there are functions not available. Menu for chat buffers is not implemented yet."""),
|
||||||
|
_(u"""* Implemented audio album load (in the music buffer), creation (in the application menu) and deletion (in the application menu, too)."""),
|
||||||
|
_(u"""* audios can be moved to albums by pressing the menu key or doing a right click in the item, and selecting "move to album". Audios will be added to the album in the next update (there is a programmed update every 3 minutes), or you can update the buffer manually (from the buffer menu in the menu bar). This option will be available in audio buffers (searches, popular and recommended audio buffers, and audio timelines)."""),
|
||||||
|
_(u"""* Albums will be empty at startup. In order to get the album's audios, you'll have to navigate to the album and press the button "load". It'll load the needed information for displaying and playing the added songs """),
|
||||||
|
_(u"""* If the config is invalid (for example you changed email or phone in the VK site and didn't changed that in Socializer, or just entered invalid credentials), the program will display an error with instructions for fixing the problem."""),
|
||||||
|
_(u"""* Now is possible to press enter in the password or email/phone field and it'll do the action of the OK button."""),
|
||||||
|
_(u"""* If you have set russian as the main language in the VK site, you'll see names in genitive and instrumental cases in certain phrases."""),
|
||||||
|
_(u"""* Updated russian and spanish translations."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes on build 2016.05.25"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Added grouped controls in the audio searches dialogue. It will be more accessible so screen readers could detect and read the label for radio buttons."""),
|
||||||
|
_(u"""* Added documents to the list of supported attachments in the post viewer. The action for this kind of attachments is to open the default web browser, pointing to the URL address of that file."""),
|
||||||
|
_(u"""* Now It's possible to add photos to the wall, by uploading files to the VK servers. Check the attachments button in the new post dialogue for this. Basically it is possible to add some photos and when the post is sent, photos will start to be uploaded before. At the moment it is not possible to add descriptions to photos. Take in to account that photos will be uploaded when the send button is pressed and the post could take some time before being posted."""),
|
||||||
|
_(u"""* Added a new option to the menu bar: new timeline. It allows to create a special buffer for a selected user. This buffer could be an audio or wall buffer, when created, the buffer will be updated with items for the specified user or community."""),
|
||||||
|
_(u"""* Added an user selection control. In dialogues where an user must be selected, there will be an edit box with a selected name. You need to start writing for changing this name, or just press the down arrow for looking in the users' database. You can start writing and then press the down arrow, so you will see the closest result to the name you was writing. For example if you want to write manuel, you could write m, a, n, u, and press the down arrow, and you will see the full name in the edit box. Take in to account that you have to make sure that you write a valid user name in the box, otherwise you will see an error."""),
|
||||||
|
_(u"""* Posts from twitter are displayed in a better way (newline characters (\n) are handled properly instead being displayed)."""),
|
||||||
|
_(u"""* In the play all function, everything should be cleaned before start the new playback."""),
|
||||||
|
_(u"""* Now links included in text of a comment are included as attachments (links are "untitled" because it isn't possible to retrieve information for every link without performance issues). This is especially useful when someone posts a link from Twitter."""),
|
||||||
|
_(u"""* Chat support: There is a new kind of buffer, named chat buffer, wich allows you to have a conversation with someone of your friends. If you receive a message while socializer is opened it will create a chat buffer under chats with the last 200 messages between you and your friend. You can send a message by writing in the edit box and pressing send or enter. At the moment chats buffers can't be removed. Will be added this possibility in the near future."""),
|
||||||
|
_(u"""* Added your friendlist as a buffer. You can create chats from there by using the send message button."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Changes for build 2016.04.5 (5/04/2016)"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Updated russian and spanish translations."""),
|
||||||
|
_(u"""* Fixed minor bugs in the likes button for posts."""),
|
||||||
|
_(u"""* Now it's possible to open wall posts by pressing enter, as newsfeeds' posts."""),
|
||||||
|
_(u"""* It's possible to see reposts in the news and wall buffers, and the post displayer (when you press enter in a post) shows the full post story."""),
|
||||||
|
_(u"""* Added "load previous items" in the main menu. It should work for wall and news feed. This feature is not available in audio buffers due to API limits."""),
|
||||||
|
_(u"""* Added more options in the search audio dialog. Now users could use more parameters and searches will be more precise."""),
|
||||||
|
_(u"""* Added a new attachments' list. When a post is opened, this list will show up if there are attachments in the current post (attachments are audio, photos, video and links). You will be able to interact with the supported data (at the moment only photos, videos, audio and links are supported, more will be added in future)."""),
|
||||||
|
_(u"""* Added a changelog file which could be opened from the help menu."""),
|
||||||
|
_(u"""* Added a preferences dialogue and a new application menu in the menu bar. From this dialogue you can change the number of items to be loaded for every buffer."""),
|
||||||
|
]
|
@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from codecs import open
|
||||||
""" This script converts the hold documentation (saved in markdown files) in a python file with a list of strings to translate it using gettext."""
|
""" This script converts the hold documentation (saved in markdown files) in a python file with a list of strings to translate it using gettext."""
|
||||||
|
|
||||||
def prepare_documentation_in_file(fileSource, fileDest):
|
def prepare_documentation_in_file(fileSource, fileDest):
|
||||||
@ -6,16 +7,16 @@ def prepare_documentation_in_file(fileSource, fileDest):
|
|||||||
@fileSource str: A markdown(.md) file.
|
@fileSource str: A markdown(.md) file.
|
||||||
@fileDest str: A file where this will put the new strings"""
|
@fileDest str: A file where this will put the new strings"""
|
||||||
|
|
||||||
f1 = open(fileSource, "r")
|
f1 = open(fileSource, "r", encoding="utf-8")
|
||||||
f2 = open(fileDest, "w")
|
f2 = open(fileDest, "w", encoding="utf-8")
|
||||||
lns = f1.readlines()
|
lns = f1.readlines()
|
||||||
f2.write("# -*- coding: utf-8 -*-\n")
|
f2.write("# -*- coding: utf-8 -*-\n")
|
||||||
f2.write("documentation = [\n")
|
f2.write("documentation = [\n")
|
||||||
for i in lns:
|
for i in lns:
|
||||||
if "\n" == i:
|
if "\n" == i or i.splitlines()[0] == "":
|
||||||
newvar = "\"\","
|
newvar = "\"\",\n"
|
||||||
elif "\n" == i[-1]:
|
elif "\n" == i[-1]:
|
||||||
newvar = "_(u\"\"\"%s\"\"\"),\n" % (i[:-1])
|
newvar = "_(u\"\"\"%s\"\"\"),\n" % (i.splitlines()[0])
|
||||||
else:
|
else:
|
||||||
newvar = "_(u\"\"\"%s\"\"\"),\n" % (i)
|
newvar = "_(u\"\"\"%s\"\"\"),\n" % (i)
|
||||||
f2.write(newvar)
|
f2.write(newvar)
|
||||||
@ -23,5 +24,6 @@ def prepare_documentation_in_file(fileSource, fileDest):
|
|||||||
f2.write("]")
|
f2.write("]")
|
||||||
f2.close()
|
f2.close()
|
||||||
|
|
||||||
|
|
||||||
prepare_documentation_in_file("manual.md", "strings.py")
|
prepare_documentation_in_file("manual.md", "strings.py")
|
||||||
prepare_documentation_in_file("changelog.md", "changelog.py")
|
prepare_documentation_in_file("changelog.md", "changelog.py")
|
@ -1,31 +1,50 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import markdown
|
import gettext
|
||||||
import os
|
import os
|
||||||
|
import locale
|
||||||
|
import markdown
|
||||||
import shutil
|
import shutil
|
||||||
from codecs import open as _open
|
from importlib import reload
|
||||||
import languageHandler
|
|
||||||
languageHandler.setLanguage("en")
|
|
||||||
import strings
|
|
||||||
import changelog
|
|
||||||
|
|
||||||
# the list of supported language codes
|
# Languages already translated or translating the documentation.
|
||||||
languages = ["en", "ru", "es"]
|
documentation_languages = ["ru", "en", "es"]
|
||||||
|
|
||||||
def generate_document(language, document_type="documentation"):
|
# Changelog translated languages.
|
||||||
reload(languageHandler)
|
changelog_languages = ["ru", "en", "es"]
|
||||||
|
|
||||||
|
# this function will help us to have both strings.py and changelog.py without issues by installing a global dummy translation function.
|
||||||
|
def install_null_translation(name):
|
||||||
|
_ = gettext.NullTranslations()
|
||||||
|
_.install()
|
||||||
|
return
|
||||||
|
|
||||||
|
def get_translations(name):
|
||||||
|
""" Create translation instances for every language of the translated document. """
|
||||||
|
translations = {}
|
||||||
|
if "documentation" in name:
|
||||||
|
langs = documentation_languages
|
||||||
|
else:
|
||||||
|
langs = changelog_languages
|
||||||
|
for l in langs:
|
||||||
|
if l != "en":
|
||||||
|
_ = gettext.translation(name, os.path.join(os.getcwd(), "locales"), languages=[l])
|
||||||
|
translations[l] = _
|
||||||
|
else:
|
||||||
|
_ = gettext.NullTranslations()
|
||||||
|
translations[l] = _
|
||||||
|
return translations
|
||||||
|
|
||||||
|
def generate_document(lang, lang_name, document_type="documentation"):
|
||||||
|
""" Generates a document by using the provided lang object, which should be a translation, and lang_name, which should be the two letter code representing the language. """
|
||||||
if document_type == "documentation":
|
if document_type == "documentation":
|
||||||
translation_file = "socializer-documentation"
|
translation_file = "socializer-documentation"
|
||||||
languageHandler.setLanguage(language, translation_file)
|
markdown_file = markdown.markdown("\n".join([lang.gettext(s) if s != "" else s for s in strings.documentation[1:]]), extensions=["markdown.extensions.toc"])
|
||||||
reload(strings)
|
title = lang.gettext(strings.documentation[0])
|
||||||
markdown_file = markdown.markdown("\n".join(strings.documentation[1:]), extensions=["markdown.extensions.toc"])
|
|
||||||
title = strings.documentation[0][1:]
|
|
||||||
filename = "manual.html"
|
filename = "manual.html"
|
||||||
elif document_type == "changelog":
|
elif document_type == "changelog":
|
||||||
translation_file = "socializer-documentation"
|
translation_file = "socializer-documentation"
|
||||||
languageHandler.setLanguage(language, translation_file)
|
markdown_file = markdown.markdown("\n".join([lang.gettext(s) if s != "" else s for s in changelog.documentation[1:]]), extensions=["markdown.extensions.toc"])
|
||||||
reload(changelog)
|
title = lang.gettext(changelog.documentation[0])
|
||||||
markdown_file = markdown.markdown("\n".join(changelog.documentation[1:]), extensions=["markdown.extensions.toc"])
|
|
||||||
title = changelog.documentation[0][1:]
|
|
||||||
filename = "changelog.html"
|
filename = "changelog.html"
|
||||||
first_html_block = """<!doctype html>
|
first_html_block = """<!doctype html>
|
||||||
<html lang="%s">
|
<html lang="%s">
|
||||||
@ -35,25 +54,32 @@ def generate_document(language, document_type="documentation"):
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header><h1>%s</h1></header>
|
<header><h1>%s</h1></header>
|
||||||
""" % (language, title, title)
|
""" % (lang_name, title, title)
|
||||||
first_html_block = first_html_block+ markdown_file
|
first_html_block = first_html_block+ markdown_file
|
||||||
first_html_block = first_html_block + "\n</body>\n</html>"
|
first_html_block = first_html_block + "\n</body>\n</html>"
|
||||||
if not os.path.exists(os.path.join("documentation", language)):
|
if not os.path.exists(os.path.join("documentation", lang_name)):
|
||||||
os.mkdir(os.path.join("documentation", language))
|
os.mkdir(os.path.join("documentation", lang_name))
|
||||||
mdfile = _open(os.path.join("documentation", language, filename), "w", encoding="utf-8")
|
mdfile = open(os.path.join("documentation", lang_name, filename), "w", encoding="utf-8")
|
||||||
mdfile.write(first_html_block)
|
mdfile.write(first_html_block)
|
||||||
mdfile.close()
|
mdfile.close()
|
||||||
|
|
||||||
def create_documentation():
|
def create_documentation():
|
||||||
|
changelog_translations = get_translations("socializer-documentation")
|
||||||
|
documentation_translations = get_translations("socializer-documentation")
|
||||||
print("Creating documentation in the supported languages...\n")
|
print("Creating documentation in the supported languages...\n")
|
||||||
if not os.path.exists("documentation"):
|
if not os.path.exists("documentation"):
|
||||||
os.mkdir("documentation")
|
os.mkdir("documentation")
|
||||||
if os.path.exists(os.path.join("documentation", "license.txt")) == False:
|
if os.path.exists(os.path.join("documentation", "license.txt")) == False:
|
||||||
shutil.copy(os.path.join("..", "license.txt"), os.path.join("documentation", "license.txt"))
|
shutil.copy(os.path.join("..", "license.txt"), os.path.join("documentation", "license.txt"))
|
||||||
for i in languages:
|
for i in documentation_languages:
|
||||||
print("Creating documentation for: %s" % (i,))
|
print("Creating documentation for: %s" % (i,))
|
||||||
generate_document(i)
|
generate_document(lang_name=i, lang=documentation_translations.get(i))
|
||||||
generate_document(i, "changelog")
|
for i in changelog_languages:
|
||||||
|
print("Creating changelog for: %s" % (i,))
|
||||||
|
generate_document(lang_name=i, lang=changelog_translations.get(i), document_type="changelog")
|
||||||
print("Done")
|
print("Done")
|
||||||
|
|
||||||
|
install_null_translation("twblue-documentation")
|
||||||
|
import strings
|
||||||
|
import changelog
|
||||||
create_documentation()
|
create_documentation()
|
@ -1,176 +0,0 @@
|
|||||||
import __builtin__
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import ctypes
|
|
||||||
import locale
|
|
||||||
import gettext
|
|
||||||
#import paths
|
|
||||||
import platform
|
|
||||||
|
|
||||||
# A fix for the mac locales
|
|
||||||
if platform.system() != 'Windows':
|
|
||||||
if locale.getlocale()[0] is None:
|
|
||||||
locale.setlocale(locale.LC_ALL, 'en_US')
|
|
||||||
|
|
||||||
#a few Windows locale constants
|
|
||||||
LOCALE_SLANGUAGE=0x2
|
|
||||||
LOCALE_SLANGDISPLAYNAME=0x6f
|
|
||||||
|
|
||||||
curLang="en"
|
|
||||||
|
|
||||||
def localeNameToWindowsLCID(localeName):
|
|
||||||
"""Retreave the Windows locale identifier (LCID) for the given locale name
|
|
||||||
@param localeName: a string of 2letterLanguage_2letterCountry or or just 2letterLanguage
|
|
||||||
@type localeName: string
|
|
||||||
@returns: a Windows LCID
|
|
||||||
@rtype: integer
|
|
||||||
"""
|
|
||||||
#Windows Vista is able to convert locale names to LCIDs
|
|
||||||
func_LocaleNameToLCID=getattr(ctypes.windll.kernel32,'LocaleNameToLCID',None)
|
|
||||||
if func_LocaleNameToLCID is not None:
|
|
||||||
localeName=localeName.replace('_','-')
|
|
||||||
LCID=func_LocaleNameToLCID(unicode(localeName),0)
|
|
||||||
else: #Windows doesn't have this functionality, manually search Python's windows_locale dictionary for the LCID
|
|
||||||
localeName=locale.normalize(localeName)
|
|
||||||
if '.' in localeName:
|
|
||||||
localeName=localeName.split('.')[0]
|
|
||||||
LCList=[x[0] for x in locale.windows_locale.iteritems() if x[1]==localeName]
|
|
||||||
if len(LCList)>0:
|
|
||||||
LCID=LCList[0]
|
|
||||||
else:
|
|
||||||
LCID=0
|
|
||||||
return LCID
|
|
||||||
|
|
||||||
def getLanguageDescription(language):
|
|
||||||
"""Finds out the description (localized full name) of a given local name"""
|
|
||||||
desc=None
|
|
||||||
if platform.system() == "Windows":
|
|
||||||
LCID=localeNameToWindowsLCID(language)
|
|
||||||
if LCID!=0:
|
|
||||||
buf=ctypes.create_unicode_buffer(1024)
|
|
||||||
if '_' not in language:
|
|
||||||
res=ctypes.windll.kernel32.GetLocaleInfoW(LCID,LOCALE_SLANGDISPLAYNAME,buf,1024)
|
|
||||||
else:
|
|
||||||
res=0
|
|
||||||
if res==0:
|
|
||||||
res=ctypes.windll.kernel32.GetLocaleInfoW(LCID,LOCALE_SLANGUAGE,buf,1024)
|
|
||||||
desc=buf.value
|
|
||||||
elif platform.system() == "Linux" or not desc:
|
|
||||||
desc={
|
|
||||||
"am":pgettext("languageName","Amharic"),
|
|
||||||
"an":pgettext("languageName","Aragonese"),
|
|
||||||
"es":pgettext("languageName","Spanish"),
|
|
||||||
"pt":pgettext("languageName","Portuguese"),
|
|
||||||
"ru":pgettext("languageName","Russian"),
|
|
||||||
"it":pgettext("languageName","italian"),
|
|
||||||
"tr":pgettext("languageName","Turkey"),
|
|
||||||
"gl":pgettext("languageName","Galician"),
|
|
||||||
"ca":pgettext("languageName","Catala"),
|
|
||||||
"eu":pgettext("languageName","Vasque"),
|
|
||||||
"pl":pgettext("languageName","polish"),
|
|
||||||
"ar":pgettext("languageName","Arabic"),
|
|
||||||
"ne":pgettext("languageName","Nepali"),
|
|
||||||
"sr":pgettext("languageName","Serbian (Latin)"),
|
|
||||||
}.get(language,None)
|
|
||||||
return desc
|
|
||||||
|
|
||||||
def getAvailableLanguages():
|
|
||||||
"""generates a list of locale names, plus their full localized language and country names.
|
|
||||||
@rtype: list of tuples
|
|
||||||
"""
|
|
||||||
#Make a list of all the locales found in NVDA's locale dir
|
|
||||||
l=[x for x in os.listdir("locales") if not x.startswith('.')]
|
|
||||||
l=[x for x in l if os.path.isfile('locales/%s/LC_MESSAGES/twblue-documentation.mo' % x)]
|
|
||||||
#Make sure that en (english) is in the list as it may not have any locale files, but is default
|
|
||||||
if 'en' not in l:
|
|
||||||
l.append('en')
|
|
||||||
l.sort()
|
|
||||||
#For each locale, ask Windows for its human readable display name
|
|
||||||
d=[]
|
|
||||||
for i in l:
|
|
||||||
desc=getLanguageDescription(i)
|
|
||||||
label="%s, %s"%(desc,i) if desc else i
|
|
||||||
d.append(label)
|
|
||||||
#include a 'user default, windows' language, which just represents the default language for this user account
|
|
||||||
l.append("system")
|
|
||||||
# Translators: the label for the Windows default NVDA interface language.
|
|
||||||
d.append(_("User default"))
|
|
||||||
#return a zipped up version of both the lists (a list with tuples of locale,label)
|
|
||||||
return zip(l,d)
|
|
||||||
|
|
||||||
def makePgettext(translations):
|
|
||||||
"""Obtaina pgettext function for use with a gettext translations instance.
|
|
||||||
pgettext is used to support message contexts,
|
|
||||||
but Python 2.7's gettext module doesn't support this,
|
|
||||||
so NVDA must provide its own implementation.
|
|
||||||
"""
|
|
||||||
if isinstance(translations, gettext.GNUTranslations):
|
|
||||||
def pgettext(context, message):
|
|
||||||
message = unicode(message)
|
|
||||||
try:
|
|
||||||
# Look up the message with its context.
|
|
||||||
return translations._catalog[u"%s\x04%s" % (context, message)]
|
|
||||||
except KeyError:
|
|
||||||
return message
|
|
||||||
else:
|
|
||||||
def pgettext(context, message):
|
|
||||||
return unicode(message)
|
|
||||||
return pgettext
|
|
||||||
|
|
||||||
def setLanguage(lang, translation_file="socializer-documentation"):
|
|
||||||
system = platform.system()
|
|
||||||
global curLang
|
|
||||||
try:
|
|
||||||
if lang=="system":
|
|
||||||
if system == "Windows":
|
|
||||||
windowsLCID=ctypes.windll.kernel32.GetUserDefaultUILanguage()
|
|
||||||
localeName=locale.windows_locale[windowsLCID]
|
|
||||||
else:
|
|
||||||
localeName=locale.getlocale()[0]
|
|
||||||
trans=gettext.translation(translation_file, localedir="locales", languages=[localeName])
|
|
||||||
curLang=localeName
|
|
||||||
else:
|
|
||||||
trans=gettext.translation(translation_file, localedir="locales", languages=[lang])
|
|
||||||
curLang=lang
|
|
||||||
localeChanged=False
|
|
||||||
#Try setting Python's locale to lang
|
|
||||||
try:
|
|
||||||
locale.setlocale(locale.LC_ALL, lang)
|
|
||||||
localeChanged=True
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
if not localeChanged and '_' in lang:
|
|
||||||
#Python couldn'tsupport the language_country locale, just try language.
|
|
||||||
try:
|
|
||||||
locale.setlocale(locale.LC_ALL, lang.split('_')[0])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
#Set the windows locale for this thread (NVDA core) to this locale.
|
|
||||||
if system == "Windows":
|
|
||||||
LCID=localeNameToWindowsLCID(lang)
|
|
||||||
ctypes.windll.kernel32.SetThreadLocale(LCID)
|
|
||||||
except IOError:
|
|
||||||
trans=gettext.translation(translation_file,fallback=True)
|
|
||||||
curLang="en"
|
|
||||||
trans.install(unicode=True)
|
|
||||||
# Install our pgettext function.
|
|
||||||
__builtin__.__dict__["pgettext"] = makePgettext(trans)
|
|
||||||
|
|
||||||
def getLanguage():
|
|
||||||
return curLang
|
|
||||||
|
|
||||||
def normalizeLanguage(lang):
|
|
||||||
"""
|
|
||||||
Normalizes a language-dialect string in to a standard form we can deal with.
|
|
||||||
Converts any dash to underline, and makes sure that language is lowercase and dialect is upercase.
|
|
||||||
"""
|
|
||||||
lang=lang.replace('-','_')
|
|
||||||
ld=lang.split('_')
|
|
||||||
ld[0]=ld[0].lower()
|
|
||||||
#Filter out meta languages such as x-western
|
|
||||||
if ld[0]=='x':
|
|
||||||
return None
|
|
||||||
if len(ld)>=2:
|
|
||||||
ld[1]=ld[1].upper()
|
|
||||||
return "_".join(ld)
|
|
||||||
|
|
BIN
doc/locales/es/LC_MESSAGES/socializer-documentation.mo
Normal file
BIN
doc/locales/es/LC_MESSAGES/socializer-documentation.mo
Normal file
Binary file not shown.
2335
doc/locales/es/LC_MESSAGES/socializer-documentation.po
Normal file
2335
doc/locales/es/LC_MESSAGES/socializer-documentation.po
Normal file
File diff suppressed because it is too large
Load Diff
BIN
doc/locales/ru/LC_MESSAGES/socializer-documentation.mo
Normal file
BIN
doc/locales/ru/LC_MESSAGES/socializer-documentation.mo
Normal file
Binary file not shown.
3463
doc/locales/ru/LC_MESSAGES/socializer-documentation.po
Normal file
3463
doc/locales/ru/LC_MESSAGES/socializer-documentation.po
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
# Socializer's manual
|
Socializer's manual
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
|
2308
doc/socializer-documentation.pot
Normal file
2308
doc/socializer-documentation.pot
Normal file
File diff suppressed because it is too large
Load Diff
229
doc/strings.py
229
doc/strings.py
@ -1,69 +1,114 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
documentation = [
|
documentation = [
|
||||||
_(u"""Socializer's manual """),
|
_(u"""# Socializer's manual """),
|
||||||
"",_(u"""## Introduction"""),
|
"",
|
||||||
"",_(u"""Socializer is an application to use [VK.com](https://vk.com) in an easy and accessible way with minimal CPU resource usage. Socializer will allow you to interact with the VK social network by giving you access to the most relevant features such as:"""),
|
_(u"""## Introduction"""),
|
||||||
"",_(u"""* Basic post creation in your wall (including photos)."""),
|
"",
|
||||||
_(u"""* (limited) audio support. (*)"""),
|
_(u"""Socializer is an application to use [VK.com](https://vk.com) in an easy and accessible way with minimal CPU resource usage. Socializer will allow you to interact with the VK social network by giving you access to the most relevant features such as:"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Supports two factor authentication (2FA)."""),
|
||||||
|
_(u"""* Post creation in user and community walls."""),
|
||||||
|
_(u"""* audio support."""),
|
||||||
_(u"""* Post comments."""),
|
_(u"""* Post comments."""),
|
||||||
_(u"""* like, unlike and repost other's posts."""),
|
_(u"""* like, unlike and repost other's posts."""),
|
||||||
_(u"""* Open other's timelines so you could track their friends, posts or audio files."""),
|
_(u"""* Open other's timelines so you could track their friends, posts, audio or video files."""),
|
||||||
_(u"""* Basic chat features."""),
|
_(u"""* Basic chat features."""),
|
||||||
"",_(u"""\* Audio support in socializer is limited due to the restrictions VK has decided to apply for third party applications on december 2016."""),
|
"",
|
||||||
"",_(u"""## Usage"""),
|
_(u"""## Usage"""),
|
||||||
"",_(u"""In order to use socializer, you must have an account in the [VK](https://vk.com) website. The process for registering an account is very accessible and is not covered in this manual. In the documentation, it is assumed you have a registered account on VK and you are able to sign in in the website by providing your phone number or email address, and a password. You will require this data for signing in the application later."""),
|
"",
|
||||||
"",_(u"""## authorising the application"""),
|
_(u"""In order to use socializer, you must have an account in the [VK](https://vk.com) website. The process for registering an account is very accessible and is not covered in this manual. In the documentation, it is assumed you have a registered account on VK and you are able to sign in in the website by providing your phone number or email address, and a password. You will require this data for signing in the application later."""),
|
||||||
"",_(u"""First of all, it's necessary to authorise the application so it can access your VK account and act on your behalf. The authorisation process is quite simple, and will be required only once. In order to start the authorisation process, you just need to run the executable file called "socializer.exe" (on some computers it will appear only as socializer, depending if windows explorer is set to display file extensions or not). You may like to place a Windows shortcut in your desktop for an easier access to the application."""),
|
"",
|
||||||
"",_(u"""If this is the first time you have launched socializer, you will see a message dialog asking you to proceed with the account authorisation process. It consists in providing the authentication data you normally use to sign in VK. It is very important to know that this data will be stored in a folder called config, located in the same folder where are the socializer files. Your config folder is a very important storage for your authentication data, so you must be sure you never will share it with anyone, mostly because your data is stored as plain text (this will be fixed in a future release and your data will be properly encrypted). Socializer will need your authentication data for acting in your behalf and offering you a better experience that what it could do with a simple access token. You must provide your phone number or email address in the first text box, and your password in the second. When pressing OK, your data will be saved and the application will start to retrieve all the required information for showing your buffers."""),
|
_(u"""## authorising the application"""),
|
||||||
"",_(u"""Once started, the application will start loading your data (posts, audio files, conversations, friends). When done, it will show you a notification indicating that the program is ready."""),
|
"",
|
||||||
"",_(u"""## General concepts"""),
|
_(u"""First of all, it's necessary to authorise the application so it can access your VK account and act on your behalf. The authorisation process is quite simple, and will be required only once. In order to start the authorisation process, you just need to run the executable file called "socializer.exe" (on some computers it will appear only as socializer, depending if windows explorer is set to display file extensions or not). You may like to place a Windows shortcut in your desktop for an easier access to the application."""),
|
||||||
"",_(u"""Before starting to describe Socializer's usage, we'll explain some concepts that will be used extensively throughout this manual."""),
|
"",
|
||||||
"",_(u"""### Buffer"""),
|
_(u"""If this is the first time you have launched socializer, you will see a message asking you whether socializer should connect through a proxy server, already configured in the application, or use the system network settings. This allows people from countries where VK is blocked to use the social network without having to look for a proxy server themselves. It is highly adviced to use the proxy server only if you are in need of it."""),
|
||||||
"",_(u"""A buffer is a list of items that will manage the data which arrives from VK, after being processed by the application. When you configure your account on Socializer and start it, many buffers are created. Each of them may contain some of the items which this program works with: Newsfeed posts, wall posts, audio and video files, friendship requests and conversations. According to the buffer you are focusing, you will be able to do different actions with these items."""),
|
"",
|
||||||
"",_(u"""All buffers will be updated in one of the following ways:"""),
|
_(u"""After the proxy message, you will see a new message dialog asking you to proceed with the account authorisation process. It consists in providing the authentication data you normally use to sign in VK. It is very important to know that this data will be stored in a folder called config, located in the same folder where the socializer files are. Your config folder is a very important storage for your authentication data, so you must be sure you never will share it with anyone, mostly because your data is stored as plain text (this will be fixed in a future release and your data will be properly encrypted). Socializer will need your authentication data for acting in your behalf and offering you a better experience that what it could do with a simple access token. You must provide your phone number or email address in the first text box, and your password in the second. When pressing OK, your data will be saved and the application will start to retrieve all the required information for showing your buffers. If you have two factor authentication configured in your account, you will see an additional dialog where you have to type the code provided by VK via SMS."""),
|
||||||
"",_(u"""* Periodically: Most buffers containing posts, audio or video files and people, will be updated periodically to reflect the new additions to them. Updates will be every 2 minutes for every buffer, so if you posted something and did not see the post in the buffer, you may need to wait a moment. There is an option, located in the buffer menu on the menu bar, which allows you to trigger a manual update in the current buffer."""),
|
"",
|
||||||
_(u"""* Real time: Conversation buffers will be updated every time someone sends a message to you. When an user sends you a message, if there is not a conversation buffer created to receive the message, a new conversation buffer will be opened automatically and the message will be placed on it. If you already have an opened conversation for the user sending the message, the message will be placed at the end of the buffer. A different sound will indicate whether a new conversation has been opened or an existing buffer gets updated."""),
|
_(u"""It is worth saying that whenever you change your password in the VK website, you will need to authorize Socializer again. When you open socializer after changing your password, you will see a message informing you of the problem and the application will be restarted, allowing you to write your new data and start the authorization again."""),
|
||||||
"",_(u"""### item"""),
|
"",
|
||||||
"",_(u"""An item is an element representing some data provided by VK. Items are separated in buffers which stores items of the same type: Audio buffers will contain only audio files, wall buffers will be full of wall posts. The only exception to this rule is the newsfeed buffer, which can contain different kind of items. Actions are available in a per-item basis, allowing certain items to be treated differently than others and showing different dialogs, depending in the kind of data VK sends for them. All items show a menu with their available actions by focusing them in the list and pressing the menu key or a right mouse click."""),
|
_(u"""Once started, the application will start loading your data (posts, audio files, conversations, friends). When done, it will show you a notification indicating that the program is ready."""),
|
||||||
"",_(u"""The following is a brief description of the kind of items socializer can work with, and what actions are available for those."""),
|
"",
|
||||||
"",_(u"""* Newsfeed post: It represents a post displayed in your "home" page on VK. It may contain a variety of information based in what you or your friends do. A newsfeed item may contain information about new audios added to your friend's library, new people added to friends, wall posts, reposts and new photos added. Depending on the kind of data VK has supplied, the item can open a dialog showing information about the post, a list displaying the people added to friends, or a dialog displaying information for every audio added to library. Take into account that it is not possible to play an audio item from the newsfeed buffer due to limits placed by VK, however, you may add it to your library and play it from your "my music" folder. If a wall post contains a long message, the first 140 characters will be displayed only. You can open the post to read the full message in the dialog. Available options for this item are different depending in the information the item contains. You can open or view the profile of the user that generated the item, like, dislike or add a comment to a post."""),
|
_(u"""## General concepts"""),
|
||||||
_(u"""* Wall post: Represent a post in an user's wall. This posts will be similar to wall posts displayed in the newsfeed. If a wall post contains a long message, the first 140 characters will be displayed only. You can open the post to read the full message in the dialog. When opened (by pressing enter or the open option in the associated menu), it will show a dialogue where you can read the message, see and interact with attachment files (by searching the list and pressing enter in the focused attachment to open it), see the photos included in the post, read information related to likes and times the post has been shared, and read all comments. Additionally, you can share the post, indicate you like it, or add a comment. You can cycle through every item in the dialog by pressing tab."""),
|
"",
|
||||||
_(u"""* Audio: It represent an audio uploaded to the VK'S platform. Actions available for this item are only opening the audio in a dialog and play it due to limitations in access to audio features. When opened, it will be displayed in a dialog allowing you to read the title of the song, artist name, duration and a few buttons: play and download. You can control playback of audio items from the buffer by using the player menu on the menu bar."""),
|
_(u"""Before starting to describe Socializer's usage, we'll explain some concepts that will be used extensively throughout this manual."""),
|
||||||
_(u"""* Video: It represent a video uploaded to the VK'S platform. Actions available for this item are opening the video in your default web browser and move it to a video album. When opened, it will open a web browser and play the video automatically due to VK limitations in access to video files."""),
|
"",
|
||||||
_(u"""* person: It contains information about a VK user, this item is present in all buffers under the "people" category. Actions available for this item are view user profile, send message and create a timeline, which is a special buffer to track all posts, friends or audios owned by the user. When opened, it will display the profile of this user in a dialog and will provide actions to send a message to the user, or view other sections of her/his profile."""),
|
_(u"""### Buffer"""),
|
||||||
|
"",
|
||||||
|
_(u"""A buffer is a list of items that will manage the data which arrives from VK, after being processed by the application. When you configure your account on Socializer and start it, many buffers are created. Each of them may contain some of the items which this program works with: Newsfeed posts, wall posts, audio and video files, documents, friendship requests and conversations. According to the buffer you are focusing, you will be able to do different actions with these items."""),
|
||||||
|
"",
|
||||||
|
_(u"""All buffers will be updated in one of the following ways:"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Periodically: Most buffers containing posts, audio or video files and people, will be updated periodically to reflect the new additions to them. Updates will be every 2 minutes for every buffer, so if you posted something and did not see the post in the buffer, you may need to wait a moment. There is an option, located in the buffer menu on the menu bar, which allows you to trigger a manual update in the current buffer."""),
|
||||||
|
_(u"""* Real time: Conversation buffers will be updated every time someone sends a message to you. When an user sends you a message, if there is not a conversation buffer created to receive the message, a new conversation buffer will be opened automatically and the message will be placed on it. If you already have an opened conversation for the user sending the message, the message will be placed at the end of the buffer. A different sound will indicate whether a new conversation has been opened or an existing buffer gets updated. Socializer will sort conversation buffers by placing buffers with unread messages at the top of the conversations section. When a buffer gets a new message, it will be moved automatically to the first place in the conversations category."""),
|
||||||
|
"",
|
||||||
|
_(u"""### item"""),
|
||||||
|
"",
|
||||||
|
_(u"""An item is an element representing some data provided by VK. Items are separated in buffers which stores items of the same type: Audio buffers will contain only audio files, wall buffers will be full of wall posts. The only exception to this rule is the newsfeed buffer, which can contain different kind of items. Actions are available in a per-item basis, allowing certain items to be treated differently than others and showing different dialogs, depending in the kind of data VK sends for them. All items show a menu with their available actions by focusing them in the list and pressing the menu key or a right mouse click."""),
|
||||||
|
"",
|
||||||
|
_(u"""The following is a brief description of the kind of items socializer can work with, and what actions are available for those."""),
|
||||||
|
"",
|
||||||
|
_(u"""* Newsfeed post: It represents a post displayed in your "home" page on VK. It may contain a variety of information based in what you or your friends do. A newsfeed item may contain information about new audios added to your friend's library, new people added to friends, wall posts, reposts and new photos added. Depending on the kind of data VK has supplied, the item can open a dialog showing information about the post, a list displaying the people added to friends, or a dialog displaying information for every audio added to library. If a wall post contains a long message, only the first 140 characters will be displayed. You can open the post to read the full message in the dialog. Available options for this item are different depending in the information the item contains. You can open or view the profile of the user that generated the item, like, dislike or add a comment to a post."""),
|
||||||
|
_(u"""* Wall post: Represents a post in an user's wall. This post will be similar to wall posts displayed in the newsfeed. If a wall post contains a long message, only the first 140 characters will be displayed. You can open the post to read the full message in the dialog. When opened (by pressing enter or the open option in the associated menu), it will show a dialogue where you can read the message, see how many times the post has been viewed by other users, interact with attachment files (by searching the list and pressing enter in the focused attachment to open it), see the photos included in the post, read information related to likes and times the post has been shared, read and reply to comments. Additionally, you can share the post, indicate you like it, or add a comment. You can cycle through every item in the dialog by pressing tab."""),
|
||||||
|
_(u"""* Audio: It represents an audio uploaded to the VK'S platform. Actions available for this item are opening the audio in a dialog, add or remove it from your library, move the audio to a playlist, and play it. When opened, it will be displayed in a dialog allowing you to read the title of the song, artist name, duration and a few buttons: play, add or remove from your library and download. You can control playback of audio items from the buffer by using the player menu on the menu bar or the corresponding keyboard shortcuts. Additionally, it is possible to select multiple audios in the same buffer to perform specific actions on them, such as play, remove or add the selected audios to a playlist. In order to select multiple audios, press the spacebar in every audio item you want to select. You will hear a sound when an item is selected, and when you focus a selected audio. When you're done, press enter to play all the selected audios or use the context menu to see available actions. All actions will be applied in the selected audios."""),
|
||||||
|
_(u"""* Video: It represents a video uploaded to the VK'S platform. Actions available for this item are opening the video in your default web browser and move it to a video album. When opened, it will open a web browser and play the video automatically due to VK limitations in access to video files."""),
|
||||||
|
_(u"""* person: It contains information about a VK user, this item is present in all buffers under the "people" category. Actions available for this item are view user profile, send message and create a timeline, which is a special buffer to track all posts, friends, audios or videos owned by the user. When opened, it will display the profile of this user in a dialog and will provide actions to send a message to the user, or view other sections of her/his profile."""),
|
||||||
_(u"""* Message: A message appears only in conversation buffers and represents a chat message. It may include a list of attached files that will be displayed in a separated list. You can tab to that list (from the history) and press enter in the attached file you want to open. Chat items are marked as read automatically as soon as they are focused."""),
|
_(u"""* Message: A message appears only in conversation buffers and represents a chat message. It may include a list of attached files that will be displayed in a separated list. You can tab to that list (from the history) and press enter in the attached file you want to open. Chat items are marked as read automatically as soon as they are focused."""),
|
||||||
"",_(u"""## Main interface"""),
|
"",
|
||||||
"",_(u"""The graphical user interface of Socializer consists of a window containing:"""),
|
_(u"""## Main interface"""),
|
||||||
"",_(u"""* a menu bar accomodating five menus (application, Me, buffer, player and help),"""),
|
"",
|
||||||
_(u"""* One tree view,"""),
|
_(u"""The graphical user interface of Socializer consists of a window containing:"""),
|
||||||
_(u"""* One list of items"""),
|
"",
|
||||||
|
_(u"""* a menu bar accomodating five menus (application, Me, buffer, player and help),"""),
|
||||||
|
_(u"""* One tree view, where you can press the menu key or right mouse click to display a context menu which contains actions you can apply in the selected buffer,"""),
|
||||||
|
_(u"""* One list of items, which also accepts the menu key to display actions available for the selected item,"""),
|
||||||
_(u"""* Some buttons, depending which is the focused buffer."""),
|
_(u"""* Some buttons, depending which is the focused buffer."""),
|
||||||
"",_(u"""The actions that are available for every item will be described later."""),
|
"",
|
||||||
"",_(u"""In summary, the GUI contains two core components. These are the controls you will find while pressing the Tab key within the program's interface, and the different elements present on the menu bar."""),
|
_(u"""The actions that are available for every item will be described later."""),
|
||||||
"",_(u"""### Buttons in the application"""),
|
"",
|
||||||
"",_(u"""* Post: this button opens up a dialogue box to write a post in your wall. For the moment, only posting in your own wall is supported. You can upload a picture by pressing the "attach" button and the photo button in the dialog which will appear, check spelling or translate your message by selecting one of the available buttons in the dialogue box. In addition, you can tag a friend in your post by pressing the corresponding button for that purpose. Also it is possible to configure the privacy settings for your post by allowing all users or just your friends to read it. Press the send button to send the post."""),
|
_(u"""In summary, the GUI contains two core components. These are the controls you will find while pressing the Tab key within the program's interface, and the different elements present on the menu bar."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Buttons in the application"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Post: this button opens up a dialogue box to write a post in the wall of the focused user. For example, if you are in the "my wall" buffer you will send a post to your own wall, but if you are in an user timeline the post will be sent to the owner of the timeline. You can upload an attachment by pressing the "attach" button and choosing between uploading a photo, audio file or document in the dialog which will appear, check spelling or translate your message by selecting one of the available buttons in the dialogue box. In addition, you can tag a friend in your post by pressing the corresponding button for that purpose. Also it is possible to configure the privacy settings for your post by allowing all users or just your friends to read it. Press the send button to send the post."""),
|
||||||
|
_(u"""* Load buffer: Some buffers are created but not loaded in VK. These special buffers need to be loaded manually by pressing the load button. Once loaded, this kind of buffers will behave in the same way other buffers do. Examples of these buffers are audio and video albums, community walls, and the current user's documents"""),
|
||||||
_(u"""* Play: In audio buffers, plays the focused song. In video buffers, this button will open a web browser for playing the focused video, due to a limitation VK placed to third party developers with videos."""),
|
_(u"""* Play: In audio buffers, plays the focused song. In video buffers, this button will open a web browser for playing the focused video, due to a limitation VK placed to third party developers with videos."""),
|
||||||
_(u"""* Play all: In audio buffers, play all songs starting from the focused buffer, until the last item in the list."""),
|
_(u"""* Play all: In audio buffers, play all songs starting from the focused buffer, until the last item in the list."""),
|
||||||
_(u"""* Send message: Send a message to a friend, which will open a conversation buffer if it does not exist already. Conversation buffers contain a full conversation, accommodating chat messages, between the current user and someone else. You can type your message in the provided box and press enter to send it to your friend. Additionally, you can add an attachment (for the moment, only attaching an audio file from your library is supported) and open attachments sent in the focused message by pressing tab and finding them in the attachments list."""),
|
_(u"""* Send message: Send a message to a friend, which will open a conversation buffer if it does not exist already. Conversation buffers contain a full conversation, accommodating chat messages, between the current user and someone else. You can type your message in the provided box and press enter to send it to your friend. Additionally, You can upload an attachment by pressing the "attach" button and choosing between uploading a photo, audio file or record a voice message in the dialog which will appear, and open attachments sent in the focused message by pressing tab and finding them in the attachments list."""),
|
||||||
"",_(u"""Bear in mind that buttons will appear according to which actions are possible on the list you are browsing."""),
|
"",
|
||||||
"",_(u"""## Menus"""),
|
_(u"""Bear in mind that buttons will appear according to which actions are possible on the list you are browsing."""),
|
||||||
"",_(u"""Visually, Towards the top of the main application window, can be found a menu bar which contains many of the same functions as listed in the previous section, together with some additional items. To access the menu bar, press the alt key. You will find five menus listed: application, Me, buffer, player and help. This section describes the items on each one of them."""),
|
"",
|
||||||
"",_(u"""### Application menu"""),
|
_(u"""## Menus"""),
|
||||||
"",_(u"""* Create: opens a menu where you can create a new album. At the moment, only video albums are supported."""),
|
"",
|
||||||
_(u"""* Delete: opens a menu where you can delete an already existing album owned by yourself. Only video albums are supported at this time."""),
|
_(u"""Visually, Towards the top of the main application window, A menu bar can be found which contains many of the same functions as listed in the previous section, together with some additional items. To access the menu bar, press the alt key. You will find five menus listed: application, Me, buffer, player and help. This section describes the items on each one of them."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Application menu"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Create: opens a menu where you can create a new album. At the moment, only audio and video albums are supported."""),
|
||||||
|
_(u"""* Delete: opens a menu where you can delete an already existing album owned by yourself. Only audio and video albums are supported at this time."""),
|
||||||
|
_(u"""* blacklist: Opens a dialog which allows you to manage blocked people on VK."""),
|
||||||
|
_(u"""* Manage accounts: Opens up a dialogue from where you are able to add or delete an account in socializer. If you have more than an account, you will be asked at startup for the account you want to use in the application. You can use an account at once, but it is possible to have multiple accounts and switch between them by restarting the application."""),
|
||||||
_(u"""* Preferences: Opens a dialogue which lets you configure settings for the entire application."""),
|
_(u"""* Preferences: Opens a dialogue which lets you configure settings for the entire application."""),
|
||||||
"",_(u"""### Me menu"""),
|
"",
|
||||||
"",_(u"""* Profile: Opens a menu with several options to do in your profile:"""),
|
_(u"""### Me menu"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Profile: Opens a menu with several options to do in your profile:"""),
|
||||||
_(u""" * View profile: Displays your profile in a dialog in the application."""),
|
_(u""" * View profile: Displays your profile in a dialog in the application."""),
|
||||||
_(u""" * Open in browser: Redirects you to your profile in vk.com."""),
|
_(u""" * Open in browser: Redirects you to your profile in vk.com."""),
|
||||||
"",_(u"""### Buffer menu"""),
|
_(u"""* Set status message: Opens up a dialog where you can write your status message. The status message is displayed in your profile and can contain up to 140 characters."""),
|
||||||
"",_(u"""* New timeline: Lets you open a user's timeline by choosing the user in a dialog box. You can choose which items you want to track: wall posts, friends or audio items. It is created when you press enter. If you invoke this option relative to a user that has no items of the kind you specified, the operation will fail. If you try creating an existing timeline the program will warn you and will not create it again."""),
|
"",
|
||||||
|
_(u"""### Buffer menu"""),
|
||||||
|
"",
|
||||||
|
_(u"""* New timeline: Lets you open an user's timeline by choosing the user in a dialog box. You can choose which items you want to track: wall posts, videos, friends or audio items. It is created when you press enter. If you invoke this option relative to a user that has no items of the kind you specified, the operation will fail. If you try creating an existing timeline the program will warn you and will not create it again."""),
|
||||||
_(u"""* Search: Shows a menu where you can search for audios or videos on VK. Search results will be created in a new buffer inside "music" or "videos"."""),
|
_(u"""* Search: Shows a menu where you can search for audios or videos on VK. Search results will be created in a new buffer inside "music" or "videos"."""),
|
||||||
_(u"""* Update buffer: Performs a manual update operation in the buffer, which will retrieve all new items present in the social network since the last update."""),
|
_(u"""* Update buffer: Performs a manual update operation in the buffer, which will retrieve all new items present in the social network since the last update."""),
|
||||||
_(u"""* Load previous items: This allows more items to be loaded for the specified buffer. Bear in mind that not all buffers support this setting."""),
|
_(u"""* Load previous items: This allows more items to be loaded for the specified buffer. Bear in mind that not all buffers support this setting."""),
|
||||||
_(u"""* Destroy: dismisses the list you're on, if possible."""),
|
_(u"""* Remove buffer: dismisses the list you're on, if possible."""),
|
||||||
"",_(u"""### Player menu"""),
|
"",
|
||||||
"",_(u"""* Play: Plays the currently focused audio item, if the current buffer contains audio files. If not, plays the focused audio in the "my music" buffer."""),
|
_(u"""### Player menu"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Play: Plays the currently focused audio item, if the current buffer contains audio files. If not, plays the focused audio in the "my music" buffer."""),
|
||||||
_(u"""* Play all: Plays all audio items in the current buffer or the "my music" buffer, starting by the currently focused audio item until the last audio in the list."""),
|
_(u"""* Play all: Plays all audio items in the current buffer or the "my music" buffer, starting by the currently focused audio item until the last audio in the list."""),
|
||||||
_(u"""* Stop: Stops audio playback."""),
|
_(u"""* Stop: Stops audio playback."""),
|
||||||
_(u"""* Previous: Plays the previous audio in the buffer or the last item in the list, if the current audio was the first on the buffer."""),
|
_(u"""* Previous: Plays the previous audio in the buffer or the last item in the list, if the current audio was the first on the buffer."""),
|
||||||
@ -72,24 +117,72 @@ _(u"""* Shuffle: Plays all audios in the current buffer or the "my music" buffer
|
|||||||
_(u"""* Volume up: Increases volume by 5%."""),
|
_(u"""* Volume up: Increases volume by 5%."""),
|
||||||
_(u"""* Volume down: decreases volume by 5%."""),
|
_(u"""* Volume down: decreases volume by 5%."""),
|
||||||
_(u"""* Mute: Mutes audio playback, setting volume to 0%."""),
|
_(u"""* Mute: Mutes audio playback, setting volume to 0%."""),
|
||||||
"",_(u"""### help menu"""),
|
"",
|
||||||
"",_(u"""* About Socializer: shows the credits of the program."""),
|
_(u"""### help menu"""),
|
||||||
|
"",
|
||||||
|
_(u"""* About Socializer: shows the credits of the program."""),
|
||||||
_(u"""* Documentation: opens up this file, where you can read some useful program concepts."""),
|
_(u"""* Documentation: opens up this file, where you can read some useful program concepts."""),
|
||||||
_(u"""* Check for updates: every time you open the program it automatically checks for new versions. If an update is available, it will ask you if you want to download the update. If you accept, the updating process will commence. When complete, Socializer will be restarted. This item checks for new updates without having to restart the application."""),
|
_(u"""* Check for updates: every time you open the program it automatically checks for new versions. If an update is available, it will ask you if you want to download the update. If you accept, the updating process will commence. When complete, Socializer will be restarted. This item checks for new updates without having to restart the application."""),
|
||||||
_(u"""* Changelog: opens up a document with the list of changes from the current version to the earliest."""),
|
_(u"""* Changelog: opens up a document with the list of changes from the current version to the earliest."""),
|
||||||
"",_(u"""## Keyboard shortcuts"""),
|
_(u"""* Open logs directory: Opens windows explorer in the logs directory, useful to include your logs in a bug report."""),
|
||||||
"",_(u"""## configuration"""),
|
_(u"""* Open config directory: Opens Windows explorer in your config directory."""),
|
||||||
"",_(u"""### The general tab"""),
|
_(u"""* Report an error: opens up a dialogue box to report a bug by completing a small number of fields. Pressing enter will send the report. If the operation doesn't succeed the program will display a warning."""),
|
||||||
"",_(u"""### The chats tab"""),
|
"",
|
||||||
"",_(u"""## License and source code"""),
|
_(u"""## Keyboard shortcuts"""),
|
||||||
"",_(u"""Socializer is free software, licensed under the GNU GPL license, either version 2 or, at your option, any later version. You can view the license in the file named license.txt, or online at <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>."""),
|
"",
|
||||||
"",_(u"""The source code of the program is available at <https://code.manuelcortez.net/manuelcortez/socializer>."""),
|
_(u"""Socializer includes some keyboard shortcuts, available from any buffer. Here you have the list of the available shortcuts:"""),
|
||||||
"",_(u"""## Contact"""),
|
"",
|
||||||
"",_(u"""If you still have questions after reading this document, if you wish to collaborate to the project in some other way, or if you simply want to get in touch with the application developer, follow the VK account of [Manuel Cortez.](https://vk.com/manuelcortez) You can also visit [The project website.](https://manuelcortez.net/socializer)"""),
|
_(u"""* Enter: Execute the default action for the focused item. It may be opening a post, view friends added by someone else, view audio details or opening an user profile. You need to be in the items list for using this key."""),
|
||||||
"",_(u"""## Credits"""),
|
_(u"""* Alt+Up/down: Increase and decrease audio volume by 5%."""),
|
||||||
"",_(u"""Socializer is developed and mantained by [Manuel Cortez,](https://manuelcortez.net) with contributions by [Anibal Hernandez](https://dragodark.com)"""),
|
_(u"""* Control+P: Play/pause. If this is the firt time you press this keystroke, it will automatically play all items present in the focused buffer or in your audios."""),
|
||||||
"",_(u"""We would also like to thank the translators of Socializer, who have allowed the spreading of the application."""),
|
_(u"""* control+Shift+P: Play all audio tracks. If the currently focused buffer does not contain audio items, it will play all items present in your audios buffer."""),
|
||||||
"",_(u"""* English: Manuel Cortéz."""),
|
_(u"""* Alt+Left: Play the previous song."""),
|
||||||
_(u"""* Spanish: Manuel Cortéz."""),
|
_(u"""* Alt+Right: Play the next song."""),
|
||||||
_(u"""* Russian: Valeria K."""),
|
"",
|
||||||
|
_(u"""## configuration"""),
|
||||||
|
"",
|
||||||
|
_(u"""As described above, this application has a preferences dialogue accessible under the application menu. Here you have a brief description of the settings present in this dialogue."""),
|
||||||
|
"",
|
||||||
|
_(u"""### General tab"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Language: allows you to switch the interface language for socializer. The application must be restarted after changing the language."""),
|
||||||
|
_(u"""* Load images in posts: Allows you to specify whether you want socializer to display all images when opening a post, or not. This can be useful for people with slow connections or not needing images."""),
|
||||||
|
_(u"""* Use proxy: for countries where Vk is blocked by the internet providers, this settings allows socializer to connect via a proxy server already included in the application."""),
|
||||||
|
_(u"""* Update channel: allows you to specify how often you will receive updates for the program. There are two update channels available: Alpha channel, which contains unstable versions of the application and gets updates almost dayly, and stable, which contain tested and more stable versions of the program, but gets updates once in a month, approximately."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Buffer settings tab"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Number of items to load for newsfeed and wall buffers: Allows you to specify how many items should be retrieved from VK in the newsfeed buffer and when opening walls for other users. Default is 50 items, and maximum is 100."""),
|
||||||
|
_(u"""* Number of items to load in video buffers: Allows you to specify how many items should be retrieved from VK in video buffers. Default is 50, maximum value is 200."""),
|
||||||
|
_(u"""* Number of items to load in conversation buffers: allows you to specify how many messages Socializer will retrieve when loading a conversation. Default is 50, maximum value is 200."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Chat settings tab"""),
|
||||||
|
"",
|
||||||
|
_(u"""* Show notifications when users are online/offline: These two checkboxes allows you to specify if you want socializer to notify you when someone is connected or disconnected in the VK network."""),
|
||||||
|
_(u"""* Notification type: This setting allows you to specify the notification type you prefer to use in socializer. The options are native and custom. Native notifications send a system notification every time someone is online or offline, while custom notifications play a sound and announce the notification in the screen reader only."""),
|
||||||
|
"",
|
||||||
|
_(u"""### Optional buffers tab"""),
|
||||||
|
"",
|
||||||
|
_(u"""This section allows you to specify which buffers should be precreated every time socializer starts. This kind of buffers, namely audio playlists, video albums and communities, have a special way of being created. When a buffer of the previously mentioned types is created, the buffer is added to the corresponding section but no data is loaded from VK. In order to load the data for one of these buffers you have to press the load button present in the buffer. From this tab you can mark and unmark the buffers Socializer will create when it starts. By default, buffers for audio playlists, video albums and communities are not created automatically when Socializer starts."""),
|
||||||
|
"",
|
||||||
|
_(u"""## License and source code"""),
|
||||||
|
"",
|
||||||
|
_(u"""Socializer is free software, licensed under the GNU GPL license, either version 2 or, at your option, any later version. You can view the license in the file named license.txt, or online at <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>."""),
|
||||||
|
"",
|
||||||
|
_(u"""The source code of the program is available at <https://code.manuelcortez.net/manuelcortez/socializer>."""),
|
||||||
|
"",
|
||||||
|
_(u"""## Contact"""),
|
||||||
|
"",
|
||||||
|
_(u"""If you still have questions after reading this document, if you wish to collaborate to the project in some other way, or if you simply want to get in touch with the team, [join the Socializer's community in VK.](https://vk.com/socializer.club) You can also visit [The project website.](http://socializer.su)"""),
|
||||||
|
"",
|
||||||
|
_(u"""## Credits"""),
|
||||||
|
"",
|
||||||
|
_(u"""Socializer is developed and maintained by [Manuel Cortez.](https://manuelcortez.net)"""),
|
||||||
|
"",
|
||||||
|
_(u"""We would also like to thank the translators of Socializer, who have allowed the spreading of the application."""),
|
||||||
|
"",
|
||||||
|
_(u"""* English: Manuel Cortéz."""),
|
||||||
|
_(u"""* Russian: Дарья Ратникова."""),
|
||||||
|
"",
|
||||||
|
_(u"""Special thanks to Дарья Ратникова, as she also manages the Socializer's community in VK, translates the website and the documentation into Russian."""),
|
||||||
]
|
]
|
5
doc/translate.py
Normal file
5
doc/translate.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from babel.messages.frontend import CommandLineInterface
|
||||||
|
|
||||||
|
CommandLineInterface().run(['pybabel', 'extract', '-o', '..\scripts\socializer-documentation.pot', '.'])
|
||||||
|
#CommandLineInterface().run(['pybabel','compile','-d','../src/locales'])
|
||||||
|
CommandLineInterface().run(['pybabel','update', '--input-file', 'socializer-documentation.pot', '--domain', 'socializer-documentation', '--output-dir', '../src/locales'])
|
@ -1,26 +1,23 @@
|
|||||||
# Stay in wxPython 4.0.3 because 4.0.4 has some regressions in accessibility related components.
|
wxpython
|
||||||
wxpython==4.0.3
|
|
||||||
pywin32
|
pywin32
|
||||||
pyenchant
|
|
||||||
markdown
|
markdown
|
||||||
# For the moment we will use the modified vk_api version that does not try to include enum34 and
|
vk_api
|
||||||
# already fixed the caption for wall uploaded photos.
|
vkaudiotoken
|
||||||
# Hopefully I can uncomment this in the near future when my changes will get merged upstream.
|
|
||||||
#vk_api
|
|
||||||
bs4
|
bs4
|
||||||
configobj
|
configobj
|
||||||
pypubsub
|
pypubsub
|
||||||
|
requests
|
||||||
requests-oauthlib
|
requests-oauthlib
|
||||||
future
|
future
|
||||||
arrow
|
arrow
|
||||||
backports.functools_lru_cache
|
backports.functools_lru_cache
|
||||||
yandex.translate
|
googletrans
|
||||||
mutagen
|
mutagen
|
||||||
mock
|
mock
|
||||||
# forked repositories previously found at http://q-continuum.net
|
babel
|
||||||
git+https://code.manuelcortez.net/manuelcortez/libloader
|
nuitka
|
||||||
git+https://code.manuelcortez.net/manuelcortez/platform_utils
|
pyenchant
|
||||||
git+https://github.com/chrisnorman7/sound_lib
|
git+https://github.com/accessibleapps/libloader
|
||||||
git+https://code.manuelcortez.net/manuelcortez/accessible_output2
|
git+https://github.com/accessibleapps/platform_utils
|
||||||
# Modified vk_api.
|
git+https://github.com/accessibleapps/sound_lib
|
||||||
git+https://github.com/manuelcortez/vk_api
|
git+https://github.com/accessibleapps/accessible_output2
|
@ -1,58 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Define paths for a regular use, if there are not paths for python32 or 64, these commands will be taken.
|
|
||||||
pythonpath32="/C/python27x86"
|
|
||||||
pandocpath="pandoc.exe"
|
|
||||||
|
|
||||||
help () {
|
|
||||||
echo -e "$0 | usage:"
|
|
||||||
echo -e "$0 | \t./build.sh [-py32path <path to python for 32 bits> | -h]"
|
|
||||||
}
|
|
||||||
|
|
||||||
# parsing options from the command line
|
|
||||||
while [[ $# > 1 ]]
|
|
||||||
do
|
|
||||||
key="$1"
|
|
||||||
shift
|
|
||||||
|
|
||||||
case $key in
|
|
||||||
-py32path)
|
|
||||||
pythonpath32="$1"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-help)
|
|
||||||
help
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
help
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
cd ../src
|
|
||||||
if [ -d build/ ];
|
|
||||||
then
|
|
||||||
rm -rf build
|
|
||||||
fi
|
|
||||||
if [ -d dist/ ];
|
|
||||||
then
|
|
||||||
rm -rf dist
|
|
||||||
fi
|
|
||||||
if [ -d documentation/ ];
|
|
||||||
then
|
|
||||||
rm -rf documentation
|
|
||||||
fi
|
|
||||||
mkdir documentation
|
|
||||||
cp ../changelog.md documentation/changelog.md
|
|
||||||
cd documentation
|
|
||||||
$pandocpath -s changelog.md -o changelog.html
|
|
||||||
rm changelog.md
|
|
||||||
cd ..
|
|
||||||
cd ../doc
|
|
||||||
$pythonpath32/python.exe generator.py
|
|
||||||
mv -f en ../src/documentation/
|
|
||||||
mv -f es ../src/documentation/
|
|
||||||
cd ../src
|
|
||||||
$pythonpath32/python.exe "setup.py" "py2exe" "--quiet"
|
|
||||||
mv -f dist ../nightly/socializer
|
|
||||||
rm -rf build
|
|
||||||
cd ../nightly
|
|
||||||
$pythonpath32/python.exe make_zipversion.py
|
|
26
scripts/copy_missing_files.py
Normal file
26
scripts/copy_missing_files.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#! /usr/bin/env python# -*- coding: iso-8859-1 -*-
|
||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
import accessible_output2
|
||||||
|
import sound_lib
|
||||||
|
import enchant
|
||||||
|
|
||||||
|
dist_folder = "socializer.dist"
|
||||||
|
|
||||||
|
accessible_output2_files = accessible_output2.find_datafiles()
|
||||||
|
final_folder = os.path.join(dist_folder, accessible_output2_files[0][0])
|
||||||
|
module_dir = os.path.dirname(accessible_output2_files[0][1][0])
|
||||||
|
shutil.copytree(module_dir, final_folder)
|
||||||
|
|
||||||
|
soundlib_files = sound_lib.find_datafiles()
|
||||||
|
final_folder = os.path.join(dist_folder, soundlib_files[0][0])
|
||||||
|
os.makedirs(final_folder, exist_ok=True)
|
||||||
|
for file in soundlib_files[0][1]:
|
||||||
|
shutil.copy(file, final_folder)
|
||||||
|
|
||||||
|
enchant_path = os.path.dirname(enchant.__file__)
|
||||||
|
final_folder = os.path.join(dist_folder, "enchant")
|
||||||
|
if os.path.exists(final_folder):
|
||||||
|
os.remove(final_folder)
|
||||||
|
os.makedirs(final_folder, exist_ok=True)
|
||||||
|
shutil.copytree(os.path.join(enchant_path, "data"), os.path.join(final_folder, "data"))
|
32
scripts/generate_update_file.py
Normal file
32
scripts/generate_update_file.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
print("Generating update files for Socializer...")# Determine if we are going to write stable or alpha update file.
|
||||||
|
# Stable file is when we build tags and alpha otherwise.
|
||||||
|
version = os.environ.get("CI_COMMIT_TAG") or os.environ.get("CI_COMMIT_SHORT_SHA")
|
||||||
|
if os.environ.get("CI_COMMIT_TAG") == None:
|
||||||
|
version_type = "alpha"
|
||||||
|
else:
|
||||||
|
version_type = "stable"
|
||||||
|
print("Version detected: %s" % (version_type,))
|
||||||
|
|
||||||
|
# Read update description and URL'S
|
||||||
|
if version_type == "alpha":
|
||||||
|
description = os.environ.get("CI_COMMIT_MESSAGE")
|
||||||
|
urls = dict(Windows32="https://files.mcvsoftware.com/socializer/alpha/socializer_x86.zip", Windows64="https://files.mcvsoftware.com/socializer/alpha/socializer_x64.zip")
|
||||||
|
else:
|
||||||
|
with open("update-description",'r') as f:
|
||||||
|
description = f.read()
|
||||||
|
urls=dict(Windows32="https://files.manuelcortez.net/socializer/{v}/socializer_{v}_x86.zip".format(v=version[1:]), Windows64="https://files.manuelcortez.net/socializer/{v}/socializer_{v}_x64.zip".format(v=version[1:]))
|
||||||
|
|
||||||
|
# build the main dict object
|
||||||
|
data = dict(current_version=version, description=description, downloads=urls)
|
||||||
|
print("Generating file with the following arguments: %r" % (data,))
|
||||||
|
if version_type == "alpha":
|
||||||
|
updatefile = "alpha.json"
|
||||||
|
else:
|
||||||
|
updatefile = "stable.json"
|
||||||
|
f = open(updatefile, "w")
|
||||||
|
json.dump(data, f, ensure_ascii=False)
|
||||||
|
f.close()
|
@ -6,10 +6,7 @@ import sys
|
|||||||
def create_archive():
|
def create_archive():
|
||||||
os.chdir("..\\src")
|
os.chdir("..\\src")
|
||||||
print("Creating zip archive...")
|
print("Creating zip archive...")
|
||||||
if sys.version[0] == "3":
|
folder = "socializer.dist"
|
||||||
folder = "dist/main"
|
|
||||||
else:
|
|
||||||
folder = "dist"
|
|
||||||
shutil.make_archive("socializer", "zip", folder)
|
shutil.make_archive("socializer", "zip", folder)
|
||||||
# if os.path.exists("dist"):
|
# if os.path.exists("dist"):
|
||||||
# shutil.rmtree("dist")
|
# shutil.rmtree("dist")
|
||||||
|
@ -1,669 +0,0 @@
|
|||||||
#! /usr/bin/env python
|
|
||||||
# -*- coding: iso-8859-1 -*-
|
|
||||||
# Originally written by Barry Warsaw <barry@zope.com>
|
|
||||||
#
|
|
||||||
# Minimally patched to make it even more xgettext compatible
|
|
||||||
# by Peter Funk <pf@artcom-gmbh.de>
|
|
||||||
#
|
|
||||||
# 2002-11-22 Jürgen Hermann <jh@web.de>
|
|
||||||
# Added checks that _() only contains string literals, and
|
|
||||||
# command line args are resolved to module lists, i.e. you
|
|
||||||
# can now pass a filename, a module or package name, or a
|
|
||||||
# directory (including globbing chars, important for Win32).
|
|
||||||
# Made docstring fit in 80 chars wide displays using pydoc.
|
|
||||||
#
|
|
||||||
|
|
||||||
# for selftesting
|
|
||||||
try:
|
|
||||||
import fintl
|
|
||||||
_ = fintl.gettext
|
|
||||||
except ImportError:
|
|
||||||
_ = lambda s: s
|
|
||||||
|
|
||||||
__doc__ = _("""pygettext -- Python equivalent of xgettext(1)
|
|
||||||
|
|
||||||
Many systems (Solaris, Linux, Gnu) provide extensive tools that ease the
|
|
||||||
internationalization of C programs. Most of these tools are independent of
|
|
||||||
the programming language and can be used from within Python programs.
|
|
||||||
Martin von Loewis' work[1] helps considerably in this regard.
|
|
||||||
|
|
||||||
There's one problem though; xgettext is the program that scans source code
|
|
||||||
looking for message strings, but it groks only C (or C++). Python
|
|
||||||
introduces a few wrinkles, such as dual quoting characters, triple quoted
|
|
||||||
strings, and raw strings. xgettext understands none of this.
|
|
||||||
|
|
||||||
Enter pygettext, which uses Python's standard tokenize module to scan
|
|
||||||
Python source code, generating .pot files identical to what GNU xgettext[2]
|
|
||||||
generates for C and C++ code. From there, the standard GNU tools can be
|
|
||||||
used.
|
|
||||||
|
|
||||||
A word about marking Python strings as candidates for translation. GNU
|
|
||||||
xgettext recognizes the following keywords: gettext, dgettext, dcgettext,
|
|
||||||
and gettext_noop. But those can be a lot of text to include all over your
|
|
||||||
code. C and C++ have a trick: they use the C preprocessor. Most
|
|
||||||
internationalized C source includes a #define for gettext() to _() so that
|
|
||||||
what has to be written in the source is much less. Thus these are both
|
|
||||||
translatable strings:
|
|
||||||
|
|
||||||
gettext("Translatable String")
|
|
||||||
_("Translatable String")
|
|
||||||
|
|
||||||
Python of course has no preprocessor so this doesn't work so well. Thus,
|
|
||||||
pygettext searches only for _() by default, but see the -k/--keyword flag
|
|
||||||
below for how to augment this.
|
|
||||||
|
|
||||||
[1] http://www.python.org/workshops/1997-10/proceedings/loewis.html
|
|
||||||
[2] http://www.gnu.org/software/gettext/gettext.html
|
|
||||||
|
|
||||||
NOTE: pygettext attempts to be option and feature compatible with GNU
|
|
||||||
xgettext where ever possible. However some options are still missing or are
|
|
||||||
not fully implemented. Also, xgettext's use of command line switches with
|
|
||||||
option arguments is broken, and in these cases, pygettext just defines
|
|
||||||
additional switches.
|
|
||||||
|
|
||||||
Usage: pygettext [options] inputfile ...
|
|
||||||
|
|
||||||
Options:
|
|
||||||
|
|
||||||
-a
|
|
||||||
--extract-all
|
|
||||||
Extract all strings.
|
|
||||||
|
|
||||||
-d name
|
|
||||||
--default-domain=name
|
|
||||||
Rename the default output file from messages.pot to name.pot.
|
|
||||||
|
|
||||||
-E
|
|
||||||
--escape
|
|
||||||
Replace non-ASCII characters with octal escape sequences.
|
|
||||||
|
|
||||||
-D
|
|
||||||
--docstrings
|
|
||||||
Extract module, class, method, and function docstrings. These do
|
|
||||||
not need to be wrapped in _() markers, and in fact cannot be for
|
|
||||||
Python to consider them docstrings. (See also the -X option).
|
|
||||||
|
|
||||||
-h
|
|
||||||
--help
|
|
||||||
Print this help message and exit.
|
|
||||||
|
|
||||||
-k word
|
|
||||||
--keyword=word
|
|
||||||
Keywords to look for in addition to the default set, which are:
|
|
||||||
%(DEFAULTKEYWORDS)s
|
|
||||||
|
|
||||||
You can have multiple -k flags on the command line.
|
|
||||||
|
|
||||||
-K
|
|
||||||
--no-default-keywords
|
|
||||||
Disable the default set of keywords (see above). Any keywords
|
|
||||||
explicitly added with the -k/--keyword option are still recognized.
|
|
||||||
|
|
||||||
--no-location
|
|
||||||
Do not write filename/lineno location comments.
|
|
||||||
|
|
||||||
-n
|
|
||||||
--add-location
|
|
||||||
Write filename/lineno location comments indicating where each
|
|
||||||
extracted string is found in the source. These lines appear before
|
|
||||||
each msgid. The style of comments is controlled by the -S/--style
|
|
||||||
option. This is the default.
|
|
||||||
|
|
||||||
-o filename
|
|
||||||
--output=filename
|
|
||||||
Rename the default output file from messages.pot to filename. If
|
|
||||||
filename is `-' then the output is sent to standard out.
|
|
||||||
|
|
||||||
-p dir
|
|
||||||
--output-dir=dir
|
|
||||||
Output files will be placed in directory dir.
|
|
||||||
|
|
||||||
-S stylename
|
|
||||||
--style stylename
|
|
||||||
Specify which style to use for location comments. Two styles are
|
|
||||||
supported:
|
|
||||||
|
|
||||||
Solaris # File: filename, line: line-number
|
|
||||||
GNU #: filename:line
|
|
||||||
|
|
||||||
The style name is case insensitive. GNU style is the default.
|
|
||||||
|
|
||||||
-v
|
|
||||||
--verbose
|
|
||||||
Print the names of the files being processed.
|
|
||||||
|
|
||||||
-V
|
|
||||||
--version
|
|
||||||
Print the version of pygettext and exit.
|
|
||||||
|
|
||||||
-w columns
|
|
||||||
--width=columns
|
|
||||||
Set width of output to columns.
|
|
||||||
|
|
||||||
-x filename
|
|
||||||
--exclude-file=filename
|
|
||||||
Specify a file that contains a list of strings that are not be
|
|
||||||
extracted from the input files. Each string to be excluded must
|
|
||||||
appear on a line by itself in the file.
|
|
||||||
|
|
||||||
-X filename
|
|
||||||
--no-docstrings=filename
|
|
||||||
Specify a file that contains a list of files (one per line) that
|
|
||||||
should not have their docstrings extracted. This is only useful in
|
|
||||||
conjunction with the -D option above.
|
|
||||||
|
|
||||||
If `inputfile' is -, standard input is read.
|
|
||||||
""")
|
|
||||||
|
|
||||||
import os
|
|
||||||
import imp
|
|
||||||
import sys
|
|
||||||
import glob
|
|
||||||
import time
|
|
||||||
import getopt
|
|
||||||
import token
|
|
||||||
import tokenize
|
|
||||||
import operator
|
|
||||||
|
|
||||||
__version__ = '1.5'
|
|
||||||
|
|
||||||
default_keywords = ['_']
|
|
||||||
DEFAULTKEYWORDS = ', '.join(default_keywords)
|
|
||||||
|
|
||||||
EMPTYSTRING = ''
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# The normal pot-file header. msgmerge and Emacs's po-mode work better if it's
|
|
||||||
# there.
|
|
||||||
pot_header = _('''\
|
|
||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR ORGANIZATION
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\\n"
|
|
||||||
"POT-Creation-Date: %(time)s\\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
|
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
|
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\\n"
|
|
||||||
"MIME-Version: 1.0\\n"
|
|
||||||
"Content-Type: text/plain; charset=CHARSET\\n"
|
|
||||||
"Content-Transfer-Encoding: ENCODING\\n"
|
|
||||||
"Generated-By: pygettext.py %(version)s\\n"
|
|
||||||
|
|
||||||
''')
|
|
||||||
|
|
||||||
|
|
||||||
def usage(code, msg=''):
|
|
||||||
print >> sys.stderr, __doc__ % globals()
|
|
||||||
if msg:
|
|
||||||
print >> sys.stderr, msg
|
|
||||||
sys.exit(code)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
escapes = []
|
|
||||||
|
|
||||||
def make_escapes(pass_iso8859):
|
|
||||||
global escapes
|
|
||||||
if pass_iso8859:
|
|
||||||
# Allow iso-8859 characters to pass through so that e.g. 'msgid
|
|
||||||
# "Höhe"' would result not result in 'msgid "H\366he"'. Otherwise we
|
|
||||||
# escape any character outside the 32..126 range.
|
|
||||||
mod = 128
|
|
||||||
else:
|
|
||||||
mod = 256
|
|
||||||
for i in range(256):
|
|
||||||
if 32 <= (i % mod) <= 126:
|
|
||||||
escapes.append(chr(i))
|
|
||||||
else:
|
|
||||||
escapes.append("\\%03o" % i)
|
|
||||||
escapes[ord('\\')] = '\\\\'
|
|
||||||
escapes[ord('\t')] = '\\t'
|
|
||||||
escapes[ord('\r')] = '\\r'
|
|
||||||
escapes[ord('\n')] = '\\n'
|
|
||||||
escapes[ord('\"')] = '\\"'
|
|
||||||
|
|
||||||
|
|
||||||
def escape(s):
|
|
||||||
global escapes
|
|
||||||
s = list(s)
|
|
||||||
for i in range(len(s)):
|
|
||||||
s[i] = escapes[ord(s[i])]
|
|
||||||
return EMPTYSTRING.join(s)
|
|
||||||
|
|
||||||
|
|
||||||
def safe_eval(s):
|
|
||||||
# unwrap quotes, safely
|
|
||||||
return eval(s, {'__builtins__':{}}, {})
|
|
||||||
|
|
||||||
|
|
||||||
def normalize(s):
|
|
||||||
# This converts the various Python string types into a format that is
|
|
||||||
# appropriate for .po files, namely much closer to C style.
|
|
||||||
lines = s.split('\n')
|
|
||||||
if len(lines) == 1:
|
|
||||||
s = '"' + escape(s) + '"'
|
|
||||||
else:
|
|
||||||
if not lines[-1]:
|
|
||||||
del lines[-1]
|
|
||||||
lines[-1] = lines[-1] + '\n'
|
|
||||||
for i in range(len(lines)):
|
|
||||||
lines[i] = escape(lines[i])
|
|
||||||
lineterm = '\\n"\n"'
|
|
||||||
s = '""\n"' + lineterm.join(lines) + '"'
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
def containsAny(str, set):
|
|
||||||
"""Check whether 'str' contains ANY of the chars in 'set'"""
|
|
||||||
return 1 in [c in str for c in set]
|
|
||||||
|
|
||||||
|
|
||||||
def _visit_pyfiles(list, dirname, names):
|
|
||||||
"""Helper for getFilesForName()."""
|
|
||||||
# get extension for python source files
|
|
||||||
if not globals().has_key('_py_ext'):
|
|
||||||
global _py_ext
|
|
||||||
_py_ext = [triple[0] for triple in imp.get_suffixes()
|
|
||||||
if triple[2] == imp.PY_SOURCE][0]
|
|
||||||
|
|
||||||
# don't recurse into CVS directories
|
|
||||||
if 'CVS' in names:
|
|
||||||
names.remove('CVS')
|
|
||||||
|
|
||||||
# add all *.py files to list
|
|
||||||
list.extend(
|
|
||||||
[os.path.join(dirname, file) for file in names
|
|
||||||
if os.path.splitext(file)[1] == _py_ext]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_modpkg_path(dotted_name, pathlist=None):
|
|
||||||
"""Get the filesystem path for a module or a package.
|
|
||||||
|
|
||||||
Return the file system path to a file for a module, and to a directory for
|
|
||||||
a package. Return None if the name is not found, or is a builtin or
|
|
||||||
extension module.
|
|
||||||
"""
|
|
||||||
# split off top-most name
|
|
||||||
parts = dotted_name.split('.', 1)
|
|
||||||
|
|
||||||
if len(parts) > 1:
|
|
||||||
# we have a dotted path, import top-level package
|
|
||||||
try:
|
|
||||||
file, pathname, description = imp.find_module(parts[0], pathlist)
|
|
||||||
if file: file.close()
|
|
||||||
except ImportError:
|
|
||||||
return None
|
|
||||||
|
|
||||||
# check if it's indeed a package
|
|
||||||
if description[2] == imp.PKG_DIRECTORY:
|
|
||||||
# recursively handle the remaining name parts
|
|
||||||
pathname = _get_modpkg_path(parts[1], [pathname])
|
|
||||||
else:
|
|
||||||
pathname = None
|
|
||||||
else:
|
|
||||||
# plain name
|
|
||||||
try:
|
|
||||||
file, pathname, description = imp.find_module(
|
|
||||||
dotted_name, pathlist)
|
|
||||||
if file:
|
|
||||||
file.close()
|
|
||||||
if description[2] not in [imp.PY_SOURCE, imp.PKG_DIRECTORY]:
|
|
||||||
pathname = None
|
|
||||||
except ImportError:
|
|
||||||
pathname = None
|
|
||||||
|
|
||||||
return pathname
|
|
||||||
|
|
||||||
|
|
||||||
def getFilesForName(name):
|
|
||||||
"""Get a list of module files for a filename, a module or package name,
|
|
||||||
or a directory.
|
|
||||||
"""
|
|
||||||
if not os.path.exists(name):
|
|
||||||
# check for glob chars
|
|
||||||
if containsAny(name, "*?[]"):
|
|
||||||
files = glob.glob(name)
|
|
||||||
list = []
|
|
||||||
for file in files:
|
|
||||||
list.extend(getFilesForName(file))
|
|
||||||
return list
|
|
||||||
|
|
||||||
# try to find module or package
|
|
||||||
name = _get_modpkg_path(name)
|
|
||||||
if not name:
|
|
||||||
return []
|
|
||||||
|
|
||||||
if os.path.isdir(name):
|
|
||||||
# find all python files in directory
|
|
||||||
list = []
|
|
||||||
os.path.walk(name, _visit_pyfiles, list)
|
|
||||||
return list
|
|
||||||
elif os.path.exists(name):
|
|
||||||
# a single file
|
|
||||||
return [name]
|
|
||||||
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
class TokenEater:
|
|
||||||
def __init__(self, options):
|
|
||||||
self.__options = options
|
|
||||||
self.__messages = {}
|
|
||||||
self.__state = self.__waiting
|
|
||||||
self.__data = []
|
|
||||||
self.__lineno = -1
|
|
||||||
self.__freshmodule = 1
|
|
||||||
self.__curfile = None
|
|
||||||
|
|
||||||
def __call__(self, ttype, tstring, stup, etup, line):
|
|
||||||
# dispatch
|
|
||||||
## import token
|
|
||||||
## print >> sys.stderr, 'ttype:', token.tok_name[ttype], \
|
|
||||||
## 'tstring:', tstring
|
|
||||||
self.__state(ttype, tstring, stup[0])
|
|
||||||
|
|
||||||
def __waiting(self, ttype, tstring, lineno):
|
|
||||||
opts = self.__options
|
|
||||||
# Do docstring extractions, if enabled
|
|
||||||
if opts.docstrings and not opts.nodocstrings.get(self.__curfile):
|
|
||||||
# module docstring?
|
|
||||||
if self.__freshmodule:
|
|
||||||
if ttype == tokenize.STRING:
|
|
||||||
self.__addentry(safe_eval(tstring), lineno, isdocstring=1)
|
|
||||||
self.__freshmodule = 0
|
|
||||||
elif ttype not in (tokenize.COMMENT, tokenize.NL):
|
|
||||||
self.__freshmodule = 0
|
|
||||||
return
|
|
||||||
# class docstring?
|
|
||||||
if ttype == tokenize.NAME and tstring in ('class', 'def'):
|
|
||||||
self.__state = self.__suiteseen
|
|
||||||
return
|
|
||||||
if ttype == tokenize.NAME and tstring in opts.keywords:
|
|
||||||
self.__state = self.__keywordseen
|
|
||||||
|
|
||||||
def __suiteseen(self, ttype, tstring, lineno):
|
|
||||||
# ignore anything until we see the colon
|
|
||||||
if ttype == tokenize.OP and tstring == ':':
|
|
||||||
self.__state = self.__suitedocstring
|
|
||||||
|
|
||||||
def __suitedocstring(self, ttype, tstring, lineno):
|
|
||||||
# ignore any intervening noise
|
|
||||||
if ttype == tokenize.STRING:
|
|
||||||
self.__addentry(safe_eval(tstring), lineno, isdocstring=1)
|
|
||||||
self.__state = self.__waiting
|
|
||||||
elif ttype not in (tokenize.NEWLINE, tokenize.INDENT,
|
|
||||||
tokenize.COMMENT):
|
|
||||||
# there was no class docstring
|
|
||||||
self.__state = self.__waiting
|
|
||||||
|
|
||||||
def __keywordseen(self, ttype, tstring, lineno):
|
|
||||||
if ttype == tokenize.OP and tstring == '(':
|
|
||||||
self.__data = []
|
|
||||||
self.__lineno = lineno
|
|
||||||
self.__state = self.__openseen
|
|
||||||
else:
|
|
||||||
self.__state = self.__waiting
|
|
||||||
|
|
||||||
def __openseen(self, ttype, tstring, lineno):
|
|
||||||
if ttype == tokenize.OP and tstring == ')':
|
|
||||||
# We've seen the last of the translatable strings. Record the
|
|
||||||
# line number of the first line of the strings and update the list
|
|
||||||
# of messages seen. Reset state for the next batch. If there
|
|
||||||
# were no strings inside _(), then just ignore this entry.
|
|
||||||
if self.__data:
|
|
||||||
self.__addentry(EMPTYSTRING.join(self.__data))
|
|
||||||
self.__state = self.__waiting
|
|
||||||
elif ttype == tokenize.STRING:
|
|
||||||
self.__data.append(safe_eval(tstring))
|
|
||||||
elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT,
|
|
||||||
token.NEWLINE, tokenize.NL]:
|
|
||||||
# warn if we see anything else than STRING or whitespace
|
|
||||||
print >> sys.stderr, _(
|
|
||||||
'*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"'
|
|
||||||
) % {
|
|
||||||
'token': tstring,
|
|
||||||
'file': self.__curfile,
|
|
||||||
'lineno': self.__lineno
|
|
||||||
}
|
|
||||||
self.__state = self.__waiting
|
|
||||||
|
|
||||||
def __addentry(self, msg, lineno=None, isdocstring=0):
|
|
||||||
if lineno is None:
|
|
||||||
lineno = self.__lineno
|
|
||||||
if not msg in self.__options.toexclude:
|
|
||||||
entry = (self.__curfile, lineno)
|
|
||||||
self.__messages.setdefault(msg, {})[entry] = isdocstring
|
|
||||||
|
|
||||||
def set_filename(self, filename):
|
|
||||||
self.__curfile = filename
|
|
||||||
self.__freshmodule = 1
|
|
||||||
|
|
||||||
def write(self, fp):
|
|
||||||
options = self.__options
|
|
||||||
timestamp = time.strftime('%Y-%m-%d %H:%M+%Z')
|
|
||||||
# The time stamp in the header doesn't have the same format as that
|
|
||||||
# generated by xgettext...
|
|
||||||
print >> fp, pot_header % {'time': timestamp, 'version': __version__}
|
|
||||||
# Sort the entries. First sort each particular entry's keys, then
|
|
||||||
# sort all the entries by their first item.
|
|
||||||
reverse = {}
|
|
||||||
for k, v in self.__messages.items():
|
|
||||||
keys = v.keys()
|
|
||||||
keys.sort()
|
|
||||||
reverse.setdefault(tuple(keys), []).append((k, v))
|
|
||||||
rkeys = reverse.keys()
|
|
||||||
rkeys.sort()
|
|
||||||
for rkey in rkeys:
|
|
||||||
rentries = reverse[rkey]
|
|
||||||
rentries.sort()
|
|
||||||
for k, v in rentries:
|
|
||||||
isdocstring = 0
|
|
||||||
# If the entry was gleaned out of a docstring, then add a
|
|
||||||
# comment stating so. This is to aid translators who may wish
|
|
||||||
# to skip translating some unimportant docstrings.
|
|
||||||
if reduce(operator.__add__, v.values()):
|
|
||||||
isdocstring = 1
|
|
||||||
# k is the message string, v is a dictionary-set of (filename,
|
|
||||||
# lineno) tuples. We want to sort the entries in v first by
|
|
||||||
# file name and then by line number.
|
|
||||||
v = v.keys()
|
|
||||||
v.sort()
|
|
||||||
if not options.writelocations:
|
|
||||||
pass
|
|
||||||
# location comments are different b/w Solaris and GNU:
|
|
||||||
elif options.locationstyle == options.SOLARIS:
|
|
||||||
for filename, lineno in v:
|
|
||||||
d = {'filename': filename, 'lineno': lineno}
|
|
||||||
print >>fp, _(
|
|
||||||
'# File: %(filename)s, line: %(lineno)d') % d
|
|
||||||
elif options.locationstyle == options.GNU:
|
|
||||||
# fit as many locations on one line, as long as the
|
|
||||||
# resulting line length doesn't exceeds 'options.width'
|
|
||||||
locline = '#:'
|
|
||||||
for filename, lineno in v:
|
|
||||||
d = {'filename': filename, 'lineno': lineno}
|
|
||||||
s = _(' %(filename)s:%(lineno)d') % d
|
|
||||||
if len(locline) + len(s) <= options.width:
|
|
||||||
locline = locline + s
|
|
||||||
else:
|
|
||||||
print >> fp, locline
|
|
||||||
locline = "#:" + s
|
|
||||||
if len(locline) > 2:
|
|
||||||
print >> fp, locline
|
|
||||||
if isdocstring:
|
|
||||||
print >> fp, '#, docstring'
|
|
||||||
print >> fp, 'msgid', normalize(k)
|
|
||||||
print >> fp, 'msgstr ""\n'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
global default_keywords
|
|
||||||
try:
|
|
||||||
opts, args = getopt.getopt(
|
|
||||||
sys.argv[1:],
|
|
||||||
'ad:DEhk:Kno:p:S:Vvw:x:X:',
|
|
||||||
['extract-all', 'default-domain=', 'escape', 'help',
|
|
||||||
'keyword=', 'no-default-keywords',
|
|
||||||
'add-location', 'no-location', 'output=', 'output-dir=',
|
|
||||||
'style=', 'verbose', 'version', 'width=', 'exclude-file=',
|
|
||||||
'docstrings', 'no-docstrings',
|
|
||||||
])
|
|
||||||
except getopt.error, msg:
|
|
||||||
usage(1, msg)
|
|
||||||
|
|
||||||
# for holding option values
|
|
||||||
class Options:
|
|
||||||
# constants
|
|
||||||
GNU = 1
|
|
||||||
SOLARIS = 2
|
|
||||||
# defaults
|
|
||||||
extractall = 0 # FIXME: currently this option has no effect at all.
|
|
||||||
escape = 0
|
|
||||||
keywords = []
|
|
||||||
outpath = ''
|
|
||||||
outfile = 'messages.pot'
|
|
||||||
writelocations = 1
|
|
||||||
locationstyle = GNU
|
|
||||||
verbose = 0
|
|
||||||
width = 78
|
|
||||||
excludefilename = ''
|
|
||||||
docstrings = 0
|
|
||||||
nodocstrings = {}
|
|
||||||
|
|
||||||
options = Options()
|
|
||||||
locations = {'gnu' : options.GNU,
|
|
||||||
'solaris' : options.SOLARIS,
|
|
||||||
}
|
|
||||||
|
|
||||||
# parse options
|
|
||||||
for opt, arg in opts:
|
|
||||||
if opt in ('-h', '--help'):
|
|
||||||
usage(0)
|
|
||||||
elif opt in ('-a', '--extract-all'):
|
|
||||||
options.extractall = 1
|
|
||||||
elif opt in ('-d', '--default-domain'):
|
|
||||||
options.outfile = arg + '.pot'
|
|
||||||
elif opt in ('-E', '--escape'):
|
|
||||||
options.escape = 1
|
|
||||||
elif opt in ('-D', '--docstrings'):
|
|
||||||
options.docstrings = 1
|
|
||||||
elif opt in ('-k', '--keyword'):
|
|
||||||
options.keywords.append(arg)
|
|
||||||
elif opt in ('-K', '--no-default-keywords'):
|
|
||||||
default_keywords = []
|
|
||||||
elif opt in ('-n', '--add-location'):
|
|
||||||
options.writelocations = 1
|
|
||||||
elif opt in ('--no-location',):
|
|
||||||
options.writelocations = 0
|
|
||||||
elif opt in ('-S', '--style'):
|
|
||||||
options.locationstyle = locations.get(arg.lower())
|
|
||||||
if options.locationstyle is None:
|
|
||||||
usage(1, _('Invalid value for --style: %s') % arg)
|
|
||||||
elif opt in ('-o', '--output'):
|
|
||||||
options.outfile = arg
|
|
||||||
elif opt in ('-p', '--output-dir'):
|
|
||||||
options.outpath = arg
|
|
||||||
elif opt in ('-v', '--verbose'):
|
|
||||||
options.verbose = 1
|
|
||||||
elif opt in ('-V', '--version'):
|
|
||||||
print _('pygettext.py (xgettext for Python) %s') % __version__
|
|
||||||
sys.exit(0)
|
|
||||||
elif opt in ('-w', '--width'):
|
|
||||||
try:
|
|
||||||
options.width = int(arg)
|
|
||||||
except ValueError:
|
|
||||||
usage(1, _('--width argument must be an integer: %s') % arg)
|
|
||||||
elif opt in ('-x', '--exclude-file'):
|
|
||||||
options.excludefilename = arg
|
|
||||||
elif opt in ('-X', '--no-docstrings'):
|
|
||||||
fp = open(arg)
|
|
||||||
try:
|
|
||||||
while 1:
|
|
||||||
line = fp.readline()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
options.nodocstrings[line[:-1]] = 1
|
|
||||||
finally:
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
# calculate escapes
|
|
||||||
make_escapes(options.escape)
|
|
||||||
|
|
||||||
# calculate all keywords
|
|
||||||
options.keywords.extend(default_keywords)
|
|
||||||
|
|
||||||
# initialize list of strings to exclude
|
|
||||||
if options.excludefilename:
|
|
||||||
try:
|
|
||||||
fp = open(options.excludefilename)
|
|
||||||
options.toexclude = fp.readlines()
|
|
||||||
fp.close()
|
|
||||||
except IOError:
|
|
||||||
print >> sys.stderr, _(
|
|
||||||
"Can't read --exclude-file: %s") % options.excludefilename
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
options.toexclude = []
|
|
||||||
|
|
||||||
# resolve args to module lists
|
|
||||||
expanded = []
|
|
||||||
for arg in args:
|
|
||||||
if arg == '-':
|
|
||||||
expanded.append(arg)
|
|
||||||
else:
|
|
||||||
expanded.extend(getFilesForName(arg))
|
|
||||||
args = expanded
|
|
||||||
|
|
||||||
# slurp through all the files
|
|
||||||
eater = TokenEater(options)
|
|
||||||
for filename in args:
|
|
||||||
if filename == '-':
|
|
||||||
if options.verbose:
|
|
||||||
print _('Reading standard input')
|
|
||||||
fp = sys.stdin
|
|
||||||
closep = 0
|
|
||||||
else:
|
|
||||||
if options.verbose:
|
|
||||||
print _('Working on %s') % filename
|
|
||||||
fp = open(filename)
|
|
||||||
closep = 1
|
|
||||||
try:
|
|
||||||
eater.set_filename(filename)
|
|
||||||
try:
|
|
||||||
tokenize.tokenize(fp.readline, eater)
|
|
||||||
except tokenize.TokenError, e:
|
|
||||||
print >> sys.stderr, '%s: %s, line %d, column %d' % (
|
|
||||||
e[0], filename, e[1][0], e[1][1])
|
|
||||||
finally:
|
|
||||||
if closep:
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
# write the output
|
|
||||||
if options.outfile == '-':
|
|
||||||
fp = sys.stdout
|
|
||||||
closep = 0
|
|
||||||
else:
|
|
||||||
if options.outpath:
|
|
||||||
options.outfile = os.path.join(options.outpath, options.outfile)
|
|
||||||
fp = open(options.outfile, 'w')
|
|
||||||
closep = 1
|
|
||||||
try:
|
|
||||||
eater.write(fp)
|
|
||||||
finally:
|
|
||||||
if closep:
|
|
||||||
fp.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
# some more test strings
|
|
||||||
_(u'a unicode string')
|
|
||||||
# this one creates a warning
|
|
||||||
_('*** Seen unexpected token "%(token)s"') % {'token': 'test'}
|
|
||||||
_('more' 'than' 'one' 'string')
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
81
scripts/upload.py
Normal file
81
scripts/upload.py
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
""" Upload socializer to the ftp server. This script has been created to be executed from a continuous integrations system.
|
||||||
|
Important note: for this script to work, the following conditions should be met:
|
||||||
|
* There must be ftp server data, via environment variables (FTP_SERVER, FTP_USERNAME and FTP_PASSWORD) or via arguments to the script call (in the prior order). Connection to this server is done via default ftp port via TLS.
|
||||||
|
* this code assumes it's going to connect to an FTP via TLS.
|
||||||
|
* If the version to upload is alpha, there's not need of an extra variable. Otherwise, CI_COMMIT_TAG should point to a version as vx.x, where v is a literal and x are numbers, example may be v0.18, v0.25, v0.3. This variable should be set in the environment.
|
||||||
|
* Inside the ftp server, the following directory structure will be expected: socializer.su/static/files/. The script will create the <version> folder or alpha if needed.
|
||||||
|
* The script will upload all .exe, .zip and .json files located in the root directory from where it was called. The json files are uploaded to socializer.su/static/files/update and other files are going to socializer.su/static/files/<version>.
|
||||||
|
"""
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
import ftplib
|
||||||
|
|
||||||
|
transferred=0
|
||||||
|
|
||||||
|
class MyFTP_TLS(ftplib.FTP_TLS):
|
||||||
|
"""Explicit FTPS, with shared TLS session"""
|
||||||
|
def ntransfercmd(self, cmd, rest=None):
|
||||||
|
conn, size = ftplib.FTP.ntransfercmd(self, cmd, rest)
|
||||||
|
if self._prot_p:
|
||||||
|
conn = self.context.wrap_socket(conn,
|
||||||
|
server_hostname=self.host,
|
||||||
|
session=self.sock.session) # this is the fix
|
||||||
|
return conn, size
|
||||||
|
|
||||||
|
def convert_bytes(n):
|
||||||
|
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
|
||||||
|
if n >= P:
|
||||||
|
return '%.2fPb' % (float(n) / T)
|
||||||
|
elif n >= T:
|
||||||
|
return '%.2fTb' % (float(n) / T)
|
||||||
|
elif n >= G:
|
||||||
|
return '%.2fGb' % (float(n) / G)
|
||||||
|
elif n >= M:
|
||||||
|
return '%.2fMb' % (float(n) / M)
|
||||||
|
elif n >= K:
|
||||||
|
return '%.2fKb' % (float(n) / K)
|
||||||
|
else:
|
||||||
|
return '%d' % n
|
||||||
|
|
||||||
|
def callback(progress):
|
||||||
|
global transferred
|
||||||
|
transferred = transferred+len(progress)
|
||||||
|
print("Uploaded {}".format(convert_bytes(transferred),))
|
||||||
|
|
||||||
|
ftp_server = os.environ.get("FTP_SERVER") or sys.argv[1]
|
||||||
|
ftp_username = os.environ.get("FTP_USERNAME") or sys.argv[2]
|
||||||
|
ftp_password = os.environ.get("FTP_PASSWORD") or sys.argv[3]
|
||||||
|
version = os.environ.get("CI_COMMIT_TAG") or "alpha"
|
||||||
|
version = version.replace("v", "")
|
||||||
|
|
||||||
|
print("Uploading files to the Socializer server...")
|
||||||
|
print("Connecting to %s" % (ftp_server,))
|
||||||
|
connection = ftplib.FTP(ftp_server)
|
||||||
|
print("Connected to FTP server {}".format(ftp_server,))
|
||||||
|
connection.login(user=ftp_username, passwd=ftp_password)
|
||||||
|
#connection.prot_p()
|
||||||
|
print("Logged in successfully")
|
||||||
|
connection.cwd("socializer")
|
||||||
|
if version not in connection.nlst():
|
||||||
|
print("Creating version directory {} because does not exists...".format(version,))
|
||||||
|
connection.mkd(version)
|
||||||
|
|
||||||
|
if "update" not in connection.nlst():
|
||||||
|
print("Creating update info directory because does not exists...")
|
||||||
|
connection.mkd("update")
|
||||||
|
connection.cwd(version)
|
||||||
|
print("Moved into version directory")
|
||||||
|
files = glob.glob("*.zip")+glob.glob("*.exe")+glob.glob("*.json")
|
||||||
|
print("These files will be uploaded into the version folder: {}".format(files,))
|
||||||
|
for file in files:
|
||||||
|
transferred = 0
|
||||||
|
print("Uploading {}".format(file,))
|
||||||
|
with open(file, "rb") as f:
|
||||||
|
if file.endswith("json"):
|
||||||
|
connection.storbinary('STOR ../update/%s' % file, f, callback=callback, blocksize=1024*1024)
|
||||||
|
else:
|
||||||
|
connection.storbinary('STOR %s' % file, f, callback=callback, blocksize=1024*1024)
|
||||||
|
print("Upload completed. exiting...")
|
||||||
|
connection.quit()
|
@ -2,6 +2,7 @@
|
|||||||
language = string(default="system")
|
language = string(default="system")
|
||||||
use_proxy = boolean(default=False)
|
use_proxy = boolean(default=False)
|
||||||
first_start = boolean(default=True)
|
first_start = boolean(default=True)
|
||||||
|
debug_logging = boolean(default=False)
|
||||||
|
|
||||||
[sound]
|
[sound]
|
||||||
volume = integer(default=100)
|
volume = integer(default=100)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import platform
|
||||||
|
arch = platform.architecture()[0]
|
||||||
name = "Socializer"
|
name = "Socializer"
|
||||||
version = "0.23"
|
author = "MCV Software"
|
||||||
author = "Manuel Cortez"
|
authorEmail = "info@mcvsoftware.com"
|
||||||
authorEmail = "manuel@manuelcortez.net"
|
copyright = "Copyright (C) 2016-2022, MCV Software"
|
||||||
copyright = "Copyright (C) 2016-2019, Manuel Cortez"
|
|
||||||
description = name+" Is an accessible VK client for Windows."
|
description = name+" Is an accessible VK client for Windows."
|
||||||
url = "http://socializer.su"
|
url = "https://socializer.su"
|
||||||
# The short name will be used for detecting translation files. See languageHandler for more details.
|
# The short name will be used for detecting translation files. See languageHandler for more details.
|
||||||
short_name = "socializer"
|
short_name = "socializer"
|
||||||
translators = ["Darya Ratnikova (Russian)", "Manuel Cortez (Spanish)"]
|
translators = ["Darya Ratnikova (Russian)", "Manuel Cortez (Spanish)"]
|
||||||
@ -14,10 +14,7 @@ bts_name = "socializer"
|
|||||||
bts_access_token = "U29jaWFsaXplcg"
|
bts_access_token = "U29jaWFsaXplcg"
|
||||||
bts_url = "https://issues.manuelcortez.net"
|
bts_url = "https://issues.manuelcortez.net"
|
||||||
### Update information
|
### Update information
|
||||||
# URL to retrieve the latest updates for the stable branch.
|
update_url = "https://files.mcvsoftware.com/socializer/update/alpha.json"
|
||||||
update_stable_url = "https://code.manuelcortez.net/manuelcortez/socializer/raw/master/update-files/socializer.json"
|
|
||||||
# URL to retrieve update information for the "next" branch. This is a channel made for alpha versions.
|
|
||||||
# Every commit will trigger an update, so users wanting to have the bleeding edge code will get it as soon as it is committed here and build by a runner.
|
|
||||||
update_next_url = "https://code.manuelcortez.net/api/v4/projects/4/repository/commits/master"
|
|
||||||
# Short_id of the last commit, this is set to none here because it will be set manually by the building tools.
|
# Short_id of the last commit, this is set to none here because it will be set manually by the building tools.
|
||||||
update_next_version = "03286a44"
|
version = "2021.09.22"
|
||||||
|
update_next_version = "4bdba42e"
|
@ -1,103 +1,31 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" Set of methods used to retrieve access tokens by simulating the official VK application for Android. """
|
|
||||||
import random
|
|
||||||
import requests
|
|
||||||
import logging
|
import logging
|
||||||
from hashlib import md5
|
from vkaudiotoken import CommonParams, TokenReceiverOfficial, supported_clients, TokenException, TwoFAHelper
|
||||||
from .wxUI import two_factor_auth, bad_password
|
from . import wxUI
|
||||||
|
|
||||||
log = logging.getLogger("authenticator.official")
|
log = logging.getLogger("authenticator.official")
|
||||||
|
|
||||||
class AuthenticationError(Exception):
|
class AuthenticationError(Exception): pass
|
||||||
pass
|
|
||||||
|
|
||||||
# Data extracted from official VK android APP.
|
|
||||||
client_id = "2274003"
|
|
||||||
client_secret = "hHbZxrka2uZ6jB1inYsH"
|
|
||||||
api_ver="5.93"
|
|
||||||
scope = "nohttps,all"
|
|
||||||
user_agent = "VKAndroidApp/5.23-2978 (Android 4.4.2; SDK 19; x86; unknown Android SDK built for x86; en; 320x240)"
|
|
||||||
|
|
||||||
api_url = "https://api.vk.com/method/"
|
|
||||||
|
|
||||||
def get_device_id():
|
|
||||||
""" Generate a random device ID, consisting in 16 alphanumeric characters."""
|
|
||||||
return "".join(random.choice(["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e", "f"]) for _ in range(16))
|
|
||||||
|
|
||||||
def get_sig(method, values, secret):
|
|
||||||
""" Create a signature for parameters passed to VK API. """
|
|
||||||
postdata = ""
|
|
||||||
for key in values:
|
|
||||||
# None values should be excluded from SIG, otherwise VK won't validate it correctly.
|
|
||||||
if values[key] != None:
|
|
||||||
postdata = postdata + "{key}={value}&".format(key=key, value=values[key])
|
|
||||||
# Remove the last "&" character.
|
|
||||||
postdata = postdata[:-1]
|
|
||||||
sig = md5(b"/method/"+method.encode("utf-8")+b"?"+postdata.encode("utf-8")+secret.encode("utf-8"))
|
|
||||||
return sig.hexdigest()
|
|
||||||
|
|
||||||
def perform_request(method, postdata, secret):
|
|
||||||
""" Send a request to VK servers by signing the data with the 'sig' parameter."""
|
|
||||||
url = api_url+method
|
|
||||||
sig = get_sig(method, postdata, secret)
|
|
||||||
postdata.update(sig=sig)
|
|
||||||
headers = {'User-Agent': user_agent}
|
|
||||||
r = requests.post(url, data=postdata, headers=headers)
|
|
||||||
return r.json()
|
|
||||||
|
|
||||||
def get_non_refreshed(login, password, scope=scope):
|
|
||||||
""" Retrieves a non-refreshed token, this should be the first token needed to authenticate in VK.
|
|
||||||
returns the access_token which still needs to be refreshed, device_id, and secret code, needed to sign all petitions in VK."""
|
|
||||||
if not (login or password):
|
|
||||||
raise ValueError("Both user and password are required.")
|
|
||||||
device_id = get_device_id()
|
|
||||||
# Let's authenticate.
|
|
||||||
url = "https://oauth.vk.com/token"
|
|
||||||
params = dict(grant_type="password",
|
|
||||||
client_id=client_id, client_secret=client_secret, username=login,
|
|
||||||
password=password, v=api_ver, scope=scope, lang="en", device_id=device_id, force_sms=1)
|
|
||||||
# Add two factor auth later due to python's syntax.
|
|
||||||
params["2fa_supported"] = 1
|
|
||||||
headers = {'User-Agent': user_agent}
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
log.exception(r.json())
|
|
||||||
# If a 401 error is raised, we need to use 2FA here.
|
|
||||||
# see https://vk.com/dev/auth_direct (switch lang to russian, english docs are very incomplete in the matter)
|
|
||||||
# ToDo: this needs testing after implemented official VK tokens.
|
|
||||||
if r.status_code == 401 and "phone_mask" in r.text:
|
|
||||||
t = r.json()
|
|
||||||
code, remember = two_factor_auth()
|
|
||||||
url = "https://oauth.vk.com/token"
|
|
||||||
params = dict(grant_type="password", lang="en",
|
|
||||||
client_id=client_id, client_secret=client_secret, username=login,
|
|
||||||
password=password, v=api_ver, scope=scope, device_id=device_id, code=code)
|
|
||||||
r = requests.get(url, params=params, headers=headers)
|
|
||||||
if r.status_code == 200 and 'access_token' in r.text:
|
|
||||||
res = r.json()
|
|
||||||
# Retrieve access_token and secret.
|
|
||||||
access_token = res['access_token']
|
|
||||||
secret = res['secret']
|
|
||||||
return access_token, secret, device_id
|
|
||||||
else:
|
|
||||||
raise AuthenticationError(r.text)
|
|
||||||
|
|
||||||
def refresh_token(token, secret, device_id):
|
|
||||||
method = "execute.getUserInfo"
|
|
||||||
postdata = dict(v=api_ver, https=1, androidVersion=19, androidModel="Android SDK built for x86", info_fields="audio_ads,audio_background_limit,country,discover_design_version,discover_preload,discover_preload_not_seen,gif_autoplay,https_required,inline_comments,intro,lang,menu_intro,money_clubs_p2p,money_p2p,money_p2p_params,music_intro,audio_restrictions,profiler_settings,raise_to_record_enabled,stories,masks,subscriptions,support_url,video_autoplay,video_player,vklive_app,community_comments,webview_authorization,story_replies,animated_stickers,community_stories,live_section,playlists_download,calls,security_issue,eu_user,wallet,vkui_community_create,vkui_profile_edit,vkui_community_manage,vk_apps,stories_photo_duration,stories_reposts,live_streaming,live_masks,camera_pingpong,role,video_discover", device_id=device_id, lang="en", func_v=11, androidManufacturer="unknown", fields="photo_100,photo_50,exports,country,sex,status,bdate,first_name_gen,last_name_gen,verified,trending", access_token=token)
|
|
||||||
perform_request(method, postdata, secret)
|
|
||||||
method = "auth.refreshToken"
|
|
||||||
postdata = dict(v=api_ver, https=1, timestamp=0, receipt2="", device_id=device_id, receipt="", lang="en", nonce="", access_token=token)
|
|
||||||
return perform_request(method, postdata, secret)
|
|
||||||
|
|
||||||
def login(user, password):
|
def login(user, password):
|
||||||
|
""" Generates authentication workflow at VK servers. """
|
||||||
|
log.info("Authenticating user account.")
|
||||||
|
access_token = None
|
||||||
try:
|
try:
|
||||||
access_token, secret, device_id = get_non_refreshed(user, password)
|
params = CommonParams(supported_clients.VK_OFFICIAL.user_agent)
|
||||||
response = refresh_token(access_token, secret, device_id)
|
receiver = TokenReceiverOfficial(user, password, params, "GET_CODE")
|
||||||
except AuthenticationError:
|
access_token = receiver.get_token()["access_token"]
|
||||||
bad_password()
|
log.debug("got a valid access token for {}".format(user))
|
||||||
raise AuthenticationError("")
|
except TokenException as err:
|
||||||
|
if err.code == TokenException.TWOFA_REQ and 'validation_sid' in err.extra:
|
||||||
|
log.debug("User requires two factor verification. Calling methods to send an SMS...")
|
||||||
try:
|
try:
|
||||||
return response["response"]["token"], secret, device_id
|
TwoFAHelper(params).validate_phone(err.extra['validation_sid'])
|
||||||
except KeyError:
|
except TokenException as err:
|
||||||
log.exception("An exception has occurred while attempting to authenticate. Printing response returned by vk...")
|
if err.code == TokenException.TWOFA_ERR:
|
||||||
log.exception(response)
|
wxUI.two_auth_limit()
|
||||||
|
raise AuthenticationError("Error authentication two factor auth.")
|
||||||
|
code, remember = wxUI.two_factor_auth()
|
||||||
|
receiver = TokenReceiverOfficial(user, password, params, code)
|
||||||
|
access_token = receiver.get_token()["access_token"]
|
||||||
|
return access_token
|
||||||
|
@ -15,3 +15,6 @@ def two_factor_auth():
|
|||||||
|
|
||||||
def bad_password():
|
def bad_password():
|
||||||
return wx.MessageDialog(None, _("Your password or email address are incorrect. Please fix the mistakes and try it again."), _("Wrong data"), wx.ICON_ERROR).ShowModal()
|
return wx.MessageDialog(None, _("Your password or email address are incorrect. Please fix the mistakes and try it again."), _("Wrong data"), wx.ICON_ERROR).ShowModal()
|
||||||
|
|
||||||
|
def two_auth_limit():
|
||||||
|
return wx.MessageDialog(None, _("It seems you have reached the limits to request authorization via SMS. Please try it again in a couple of hours."), _("Error requiring sms verification"), wx.ICON_ERROR).ShowModal()
|
||||||
|
5
src/babel.cfg
Normal file
5
src/babel.cfg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[python: **.py]
|
||||||
|
input_dirs = .
|
||||||
|
output_file=socializer.pot
|
||||||
|
msgid_bugs_address=manuel@manuelcortez.net
|
||||||
|
copyright_holder=Manuel Cortez
|
@ -14,4 +14,3 @@ def setup ():
|
|||||||
global app
|
global app
|
||||||
log.debug("Loading global app settings...")
|
log.debug("Loading global app settings...")
|
||||||
app = config_utils.load_config(os.path.join(paths.config_path(), MAINFILE), os.path.join(paths.app_path(), MAINSPEC))
|
app = config_utils.load_config(os.path.join(paths.config_path(), MAINFILE), os.path.join(paths.app_path(), MAINSPEC))
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
15
src/controller/buffers/__init__.py
Normal file
15
src/controller/buffers/__init__.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from .empty import emptyBuffer
|
||||||
|
from .home import homeBuffer as baseBuffer
|
||||||
|
from .wall import wallBuffer as feedBuffer
|
||||||
|
from .communityWall import communityWallBuffer as communityBuffer
|
||||||
|
from .communityBoard import communityBoardBuffer as topicBuffer
|
||||||
|
from .documents import documentsBuffer as documentBuffer
|
||||||
|
from .communityDocuments import communityDocumentsBuffer as documentCommunityBuffer
|
||||||
|
from .audio import audioBuffer
|
||||||
|
from .audioAlbum import audioAlbumBuffer as audioAlbum
|
||||||
|
from .video import videoBuffer
|
||||||
|
from .videoAlbum import videoAlbumBuffer as videoAlbum
|
||||||
|
from .chat import chatBuffer
|
||||||
|
from .people import peopleBuffer
|
||||||
|
from .friendRequests import friendRequestsBuffer as requestsBuffer
|
||||||
|
from .communityPeople import communityPeopleBuffer
|
309
src/controller/buffers/audio.py
Normal file
309
src/controller/buffers/audio.py
Normal file
@ -0,0 +1,309 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import os
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import widgetUtils
|
||||||
|
from pubsub import pub
|
||||||
|
from vk_api import upload
|
||||||
|
from mutagen.id3 import ID3
|
||||||
|
from presenters import player
|
||||||
|
from wxUI.tabs import audio
|
||||||
|
from sessionmanager import utils
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import commonMessages, menus
|
||||||
|
from controller import selector
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.audio")
|
||||||
|
|
||||||
|
class audioBuffer(wallBuffer):
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = audio.audioTab(parent)
|
||||||
|
self.tab.name = self.name
|
||||||
|
self.connect_events()
|
||||||
|
if self.name == "me_audio":
|
||||||
|
self.tab.post.Enable(True)
|
||||||
|
|
||||||
|
def get_event(self, ev):
|
||||||
|
if ev.GetKeyCode() == wx.WXK_RETURN:
|
||||||
|
if len(self.tab.list.get_multiple_selection()) < 2:
|
||||||
|
event = "play_all"
|
||||||
|
else:
|
||||||
|
event = "play_audio"
|
||||||
|
else:
|
||||||
|
event = None
|
||||||
|
ev.Skip()
|
||||||
|
if event != None:
|
||||||
|
try:
|
||||||
|
getattr(self, event)(skip_pause=True)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
widgetUtils.connect_event(self.tab.play, widgetUtils.BUTTON_PRESSED, self.play_audio)
|
||||||
|
widgetUtils.connect_event(self.tab.play_all, widgetUtils.BUTTON_PRESSED, self.play_all)
|
||||||
|
pub.subscribe(self.change_label, "playback-changed")
|
||||||
|
super(audioBuffer, self).connect_events()
|
||||||
|
|
||||||
|
def play_audio(self, *args, **kwargs):
|
||||||
|
if player.player.check_is_playing() and not "skip_pause" in kwargs:
|
||||||
|
return pub.sendMessage("pause")
|
||||||
|
selected = self.tab.list.get_multiple_selection()
|
||||||
|
if len(selected) == 0:
|
||||||
|
return
|
||||||
|
elif len(selected) == 1:
|
||||||
|
pub.sendMessage("play", object=self.session.db[self.name]["items"][selected[0]])
|
||||||
|
else:
|
||||||
|
selected_audios = [self.session.db[self.name]["items"][item] for item in selected]
|
||||||
|
pub.sendMessage("play-all", list_of_songs=selected_audios)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def play_next(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_selected()
|
||||||
|
if selected < 0:
|
||||||
|
selected = 0
|
||||||
|
if self.tab.list.get_count() <= selected+1:
|
||||||
|
newpos = 0
|
||||||
|
else:
|
||||||
|
newpos = selected+1
|
||||||
|
self.tab.list.select_item(newpos)
|
||||||
|
self.play_audio()
|
||||||
|
|
||||||
|
def play_previous(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_selected()
|
||||||
|
if selected <= 0:
|
||||||
|
selected = self.tab.list.get_count()
|
||||||
|
newpos = selected-1
|
||||||
|
self.tab.list.select_item(newpos)
|
||||||
|
self.play_audio()
|
||||||
|
|
||||||
|
def open_post(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_multiple_selection()
|
||||||
|
if len(selected) < 1:
|
||||||
|
return
|
||||||
|
audios = [self.session.db[self.name]["items"][audio] for audio in selected]
|
||||||
|
a = presenters.displayAudioPresenter(session=self.session, postObject=audios, interactor=interactors.displayAudioInteractor(), view=views.displayAudio())
|
||||||
|
|
||||||
|
def play_all(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_selected()
|
||||||
|
if selected == -1:
|
||||||
|
selected = 0
|
||||||
|
if self.name not in self.session.db:
|
||||||
|
return
|
||||||
|
audios = [i for i in self.session.db[self.name]["items"][selected:]]
|
||||||
|
pub.sendMessage("play-all", list_of_songs=audios)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def remove_buffer(self, mandatory=False):
|
||||||
|
if "me_audio" == self.name or "popular_audio" == self.name or "recommended_audio" == self.name:
|
||||||
|
output.speak(_("This buffer can't be deleted"))
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if mandatory == False:
|
||||||
|
dlg = commonMessages.remove_buffer()
|
||||||
|
else:
|
||||||
|
dlg = widgetUtils.YES
|
||||||
|
if dlg == widgetUtils.YES:
|
||||||
|
self.session.db.pop(self.name)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get_more_items(self, *args, **kwargs):
|
||||||
|
# Translators: Some buffers can't use the get previous item feature due to API limitations.
|
||||||
|
output.speak(_("This buffer doesn't support getting more items."))
|
||||||
|
|
||||||
|
def onFocus(self, event, *args, **kwargs):
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def add_to_library(self, *args, **kwargs):
|
||||||
|
call_threaded(self._add_to_library, *args, **kwargs)
|
||||||
|
|
||||||
|
def _add_to_library(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_multiple_selection()
|
||||||
|
if len(selected) < 1:
|
||||||
|
return
|
||||||
|
audios = [self.session.db[self.name]["items"][audio] for audio in selected]
|
||||||
|
errors_detected = 0
|
||||||
|
for i in audios:
|
||||||
|
args = {}
|
||||||
|
args["audio_id"] = i["id"]
|
||||||
|
if "album_id" in i:
|
||||||
|
args["album_id"] = i["album_id"]
|
||||||
|
args["owner_id"] = i["owner_id"]
|
||||||
|
try:
|
||||||
|
audio = self.session.vk.client.audio.add(**args)
|
||||||
|
except VkApiError:
|
||||||
|
errors_detected = errors_detected + 1
|
||||||
|
continue
|
||||||
|
if audio != None and int(audio) < 21:
|
||||||
|
errors_detected = errors_detected + 1
|
||||||
|
if errors_detected == 0:
|
||||||
|
if len(selected) == 1:
|
||||||
|
msg = _("Audio added to your library")
|
||||||
|
elif len(selected) > 1 and len(selected) < 5:
|
||||||
|
msg = _("{0} audios were added to your library.").format(len(selected),)
|
||||||
|
else:
|
||||||
|
msg = _("{audios} audios were added to your library.").format(audios=len(selected),)
|
||||||
|
output.speak(msg)
|
||||||
|
else:
|
||||||
|
output.speak(_("{0} errors occurred while attempting to add {1} audios to your library.").format(errors_detected, len(selected)))
|
||||||
|
|
||||||
|
def remove_from_library(self, *args, **kwargs):
|
||||||
|
call_threaded(self._remove_from_library, *args, **kwargs)
|
||||||
|
|
||||||
|
def _remove_from_library(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_multiple_selection()
|
||||||
|
if len(selected) < 1:
|
||||||
|
return
|
||||||
|
audios = [self.session.db[self.name]["items"][audio] for audio in selected]
|
||||||
|
errors_detected = 0
|
||||||
|
audios_removed = 0
|
||||||
|
for i in range(0, len(selected)):
|
||||||
|
args = {}
|
||||||
|
args["audio_id"] = audios[i]["id"]
|
||||||
|
args["owner_id"] = self.session.user_id
|
||||||
|
result = self.session.vk.client.audio.delete(**args)
|
||||||
|
if int(result) != 1:
|
||||||
|
errors_dtected = errors_detected + 1
|
||||||
|
else:
|
||||||
|
self.session.db[self.name]["items"].pop(selected[i]-audios_removed)
|
||||||
|
self.tab.list.remove_item(selected[i]-audios_removed)
|
||||||
|
audios_removed = audios_removed + 1
|
||||||
|
if errors_detected == 0:
|
||||||
|
if len(selected) == 1:
|
||||||
|
msg = _("Audio removed.")
|
||||||
|
elif len(selected) > 1 and len(selected) < 5:
|
||||||
|
msg = _("{0} audios were removed.").format(len(selected),)
|
||||||
|
else:
|
||||||
|
msg = _("{audios} audios were removed.").format(audios=len(selected),)
|
||||||
|
output.speak(msg)
|
||||||
|
else:
|
||||||
|
output.speak(_("{0} errors occurred while attempting to remove {1} audios.").format(errors_detected, len(selected)))
|
||||||
|
|
||||||
|
def move_to_album(self, *args, **kwargs):
|
||||||
|
if len(self.session.audio_albums) == 0:
|
||||||
|
return commonMessages.no_audio_albums()
|
||||||
|
album = selector.album(_("Select the album where you want to move this song"), self.session)
|
||||||
|
if album.item == None:
|
||||||
|
return
|
||||||
|
call_threaded(self._move_to_album, album.item, *args, **kwargs)
|
||||||
|
|
||||||
|
def _move_to_album(self, album, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_multiple_selection()
|
||||||
|
if len(selected) < 1:
|
||||||
|
return
|
||||||
|
audios = [self.session.db[self.name]["items"][audio] for audio in selected]
|
||||||
|
errors_detected = 0
|
||||||
|
for i in audios:
|
||||||
|
id = i["id"]
|
||||||
|
try:
|
||||||
|
response = self.session.vk.client.audio.add(playlist_id=album, audio_id=id, owner_id=i["owner_id"])
|
||||||
|
except VkApiError:
|
||||||
|
errors_detected = errors_detected + 1
|
||||||
|
if errors_detected == 0:
|
||||||
|
if len(selected) == 1:
|
||||||
|
msg = _("Audio added to playlist.")
|
||||||
|
elif len(selected) > 1 and len(selected) < 5:
|
||||||
|
msg = _("{0} audios were added to playlist.").format(len(selected),)
|
||||||
|
else:
|
||||||
|
msg = _("{audios} audios were added to playlist.").format(audios=len(selected),)
|
||||||
|
output.speak(msg)
|
||||||
|
else:
|
||||||
|
output.speak(_("{0} errors occurred while attempting to add {1} audios to your playlist.").format(errors_detected, len(selected)))
|
||||||
|
|
||||||
|
def get_menu(self):
|
||||||
|
p = self.get_post()
|
||||||
|
if p == None:
|
||||||
|
return
|
||||||
|
m = menus.audioMenu()
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_post, menuitem=m.open)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.play_audio, menuitem=m.play)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.move_to_album, menuitem=m.move)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.download, menuitem=m.download)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.select_all, menuitem=m.select)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.deselect_all, menuitem=m.deselect)
|
||||||
|
# if owner_id is the current user, the audio is added to the user's audios.
|
||||||
|
if p["owner_id"] == self.session.user_id:
|
||||||
|
m.library.SetItemLabel(_("&Remove"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.remove_from_library, menuitem=m.library)
|
||||||
|
else:
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.add_to_library, menuitem=m.library)
|
||||||
|
return m
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
""" Uploads an audio to the current user's library from the computer. """
|
||||||
|
file = self.tab.get_file_to_upload()
|
||||||
|
if file == None:
|
||||||
|
return
|
||||||
|
audio_tags = ID3(file)
|
||||||
|
if "TIT2" in audio_tags:
|
||||||
|
title = audio_tags["TIT2"].text[0]
|
||||||
|
else:
|
||||||
|
title = _("Untitled")
|
||||||
|
if "TPE1" in audio_tags:
|
||||||
|
artist = audio_tags["TPE1"].text[0]
|
||||||
|
else:
|
||||||
|
artist = _("Unknown artist")
|
||||||
|
uploader = upload.VkUpload(self.session.vk.session_object)
|
||||||
|
call_threaded(uploader.audio, file, title=title, artist=artist)
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
url = "https://vk.com/audio{user_id}_{post_id}".format(user_id=post["owner_id"], post_id=post["id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
|
||||||
|
def change_label(self, stopped):
|
||||||
|
if hasattr(self.tab, "play"):
|
||||||
|
if stopped == False:
|
||||||
|
self.tab.play.SetLabel(_("P&ause"))
|
||||||
|
else:
|
||||||
|
self.tab.play.SetLabel(_("P&lay"))
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
pub.unsubscribe(self.change_label, "playback-changed")
|
||||||
|
|
||||||
|
def download(self, *args, **kwargs):
|
||||||
|
selected = self.tab.list.get_multiple_selection()
|
||||||
|
if len(selected) < 1:
|
||||||
|
return
|
||||||
|
audios = [self.session.db[self.name]["items"][audio] for audio in selected]
|
||||||
|
if len(audios) == 0:
|
||||||
|
return
|
||||||
|
elif len(audios) == 1:
|
||||||
|
multiple = False
|
||||||
|
filename = utils.safe_filename("{0} - {1}.mp3".format(audios[0]["title"], audios[0]["artist"]))
|
||||||
|
else:
|
||||||
|
multiple = True
|
||||||
|
filename = "" # No default filename for multiple files.
|
||||||
|
path = self.tab.get_download_path(filename=filename, multiple=multiple)
|
||||||
|
self.download_threaded(path, multiple, audios)
|
||||||
|
|
||||||
|
def download_threaded(self, path, multiple, audios):
|
||||||
|
if multiple == False:
|
||||||
|
url = audios[0]["url"]
|
||||||
|
pub.sendMessage("download-file", url=url, filename=path)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
downloads = []
|
||||||
|
for i in audios:
|
||||||
|
filename = utils.safe_filename("{0} - {1}.mp3".format(i["title"], i["artist"]))
|
||||||
|
filepath = os.path.join(path, filename)
|
||||||
|
downloads.append((utils.transform_audio_url(i["url"]), filepath))
|
||||||
|
pub.sendMessage("download-files", downloads=downloads)
|
||||||
|
|
||||||
|
def select_all(self, *args, **kwargs):
|
||||||
|
items = self.tab.list.list.GetItemCount()
|
||||||
|
for i in range(0, items):
|
||||||
|
self.tab.list.list.SetItemImage(i, 1)
|
||||||
|
|
||||||
|
def deselect_all(self, *args, **kwargs):
|
||||||
|
items = self.tab.list.list.GetItemCount()
|
||||||
|
for i in range(0, items):
|
||||||
|
self.tab.list.list.SetItemImage(i, 0)
|
34
src/controller/buffers/audioAlbum.py
Normal file
34
src/controller/buffers/audioAlbum.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import wx
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from wxUI.tabs import audioAlbum
|
||||||
|
from .audio import audioBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.audioPlaylist")
|
||||||
|
|
||||||
|
class audioAlbumBuffer(audioBuffer):
|
||||||
|
""" this buffer was supposed to be used with audio albums
|
||||||
|
but is deprecated as VK removed its audio support for third party apps."""
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = audioAlbum.audioAlbumTab(parent)
|
||||||
|
self.tab.play.Enable(False)
|
||||||
|
self.tab.play_all.Enable(False)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
super(audioAlbumBuffer, self).connect_events()
|
||||||
|
widgetUtils.connect_event(self.tab.load, widgetUtils.BUTTON_PRESSED, self.load_album)
|
||||||
|
|
||||||
|
def load_album(self, *args, **kwargs):
|
||||||
|
output.speak(_("Loading album..."))
|
||||||
|
self.can_get_items = True
|
||||||
|
self.tab.load.Enable(False)
|
||||||
|
wx.CallAfter(self.get_items)
|
||||||
|
self.tab.play.Enable(True)
|
||||||
|
self.tab.play_all.Enable(True)
|
307
src/controller/buffers/chat.py
Normal file
307
src/controller/buffers/chat.py
Normal file
@ -0,0 +1,307 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from pubsub import pub
|
||||||
|
from vk_api.exceptions import VkApiError
|
||||||
|
from extra import translator, SpellChecker
|
||||||
|
from wxUI.tabs import chat
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import commonMessages, menus
|
||||||
|
from sessionmanager import renderers
|
||||||
|
from .home import homeBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.chat")
|
||||||
|
|
||||||
|
class chatBuffer(homeBuffer):
|
||||||
|
|
||||||
|
def insert(self, item, reversed=False):
|
||||||
|
""" Add a new item to the list. Uses session.composefunc for parsing the dictionary and create a valid result for putting it in the list."""
|
||||||
|
# as this tab is based in a text control, we have to overwrite the defaults.
|
||||||
|
item_ = getattr(renderers, self.compose_function)(item, self.session)
|
||||||
|
# the self.chat dictionary will have (first_line, last_line) as keys and message ID as a value for looking into it when needed.
|
||||||
|
# Here we will get first and last line of a chat message appended to the history.
|
||||||
|
values = self.tab.add_message(item_[0], reverse=reversed)
|
||||||
|
self.chats[values] = item["id"]
|
||||||
|
|
||||||
|
def get_focused_post(self):
|
||||||
|
""" Gets chat message currently in focus"""
|
||||||
|
# this function replaces self.get_post for this buffer, as we rely in a TextCtrl control for getting chats.
|
||||||
|
# Instead of the traditional method to do the trick.
|
||||||
|
# Get text position here.
|
||||||
|
position = self.tab.history.PositionToXY(self.tab.history.GetInsertionPoint())
|
||||||
|
id_ = None
|
||||||
|
# The dictionary keys should be looked in reverse order as we are interested in the last result only.
|
||||||
|
for i in reversed(list(self.chats.keys())):
|
||||||
|
# Check if position[2] (line position) matches with something in self.chats
|
||||||
|
# (All messages, except the last one, should be able to be matched here).
|
||||||
|
# position[2]+1 is added because line may start with 0, while in wx.TextCtrl.GetNumberOfLines() it returns a value counting from 1.
|
||||||
|
if position[2]+1 >= i[0]:
|
||||||
|
id_ = self.chats[i]
|
||||||
|
# If we find our chat message, let's skip the rest of the loop.
|
||||||
|
break
|
||||||
|
# Retrieve here the object based in id_
|
||||||
|
if id_ != None:
|
||||||
|
for i in self.session.db[self.name]["items"]:
|
||||||
|
if i["id"] == id_:
|
||||||
|
return i
|
||||||
|
return False
|
||||||
|
|
||||||
|
get_post = get_focused_post
|
||||||
|
|
||||||
|
def onFocus(self, event, *args, **kwargs):
|
||||||
|
if event.GetKeyCode() == wx.WXK_UP or event.GetKeyCode() == wx.WXK_DOWN or event.GetKeyCode() == wx.WXK_START or event.GetKeyCode() == wx.WXK_PAGEUP or event.GetKeyCode() == wx.WXK_PAGEDOWN or event.GetKeyCode() == wx.WXK_END:
|
||||||
|
msg = self.get_focused_post()
|
||||||
|
if msg == False: # Handle the case where the last line of the control cannot be matched to anything.
|
||||||
|
return
|
||||||
|
# Mark unread conversations as read.
|
||||||
|
if "read_state" in msg and msg["read_state"] == 0 and "out" in msg and msg["out"] == 0:
|
||||||
|
self.session.soundplayer.play("message_unread.ogg")
|
||||||
|
call_threaded(self.session.vk.client.messages.markAsRead, peer_id=self.kwargs["peer_id"])
|
||||||
|
[i.update(read_state=1) for i in self.session.db[self.name]["items"]]
|
||||||
|
if "attachments" in msg and len(msg["attachments"]) > 0:
|
||||||
|
self.tab.attachments.list.Enable(True)
|
||||||
|
self.attachments = list()
|
||||||
|
self.tab.attachments.clear()
|
||||||
|
self.parse_attachments(msg)
|
||||||
|
else:
|
||||||
|
self.tab.attachments.list.Enable(False)
|
||||||
|
self.tab.attachments.clear()
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = chat.chatTab(parent)
|
||||||
|
self.attachments = list()
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
widgetUtils.connect_event(self.tab.send, widgetUtils.BUTTON_PRESSED, self.send_chat_to_user)
|
||||||
|
widgetUtils.connect_event(self.tab.attachment, widgetUtils.BUTTON_PRESSED, self.add_attachment)
|
||||||
|
widgetUtils.connect_event(self.tab.text, widgetUtils.KEYPRESS, self.catch_enter)
|
||||||
|
widgetUtils.connect_event(self.tab.actions, widgetUtils.BUTTON_PRESSED, self.actions)
|
||||||
|
self.tab.set_focus_function(self.onFocus)
|
||||||
|
|
||||||
|
def catch_enter(self, event, *args, **kwargs):
|
||||||
|
shift=event.ShiftDown()
|
||||||
|
if event.GetKeyCode() == wx.WXK_RETURN and shift == False:
|
||||||
|
return self.send_chat_to_user()
|
||||||
|
t = time.time()
|
||||||
|
if event.GetUnicodeKey() != wx.WXK_NONE and t-self.last_keypress > 5:
|
||||||
|
self.last_keypress = t
|
||||||
|
call_threaded(self.session.vk.client.messages.setActivity, peer_id=self.kwargs["peer_id"], type="typing")
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def get_items(self, show_nextpage=False):
|
||||||
|
""" Update buffer with newest items or get older items in the buffer."""
|
||||||
|
if self.can_get_items == False: return
|
||||||
|
retrieved = True
|
||||||
|
try:
|
||||||
|
num = getattr(self.session, "get_page")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs)
|
||||||
|
except VkApiError as err:
|
||||||
|
log.error("Error {0}: {1}".format(err.code, err.error))
|
||||||
|
retrieved = err.code
|
||||||
|
return retrieved
|
||||||
|
except:
|
||||||
|
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
|
||||||
|
return False
|
||||||
|
if not hasattr(self, "tab"):
|
||||||
|
# Create GUI associated to this buffer.
|
||||||
|
self.create_tab(self.parent)
|
||||||
|
# Add name to the new control so we could look for it when needed.
|
||||||
|
self.tab.name = self.name
|
||||||
|
if show_nextpage == False:
|
||||||
|
if self.tab.history.GetValue() != "" and num > 0:
|
||||||
|
v = [i for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
[self.insert(i, False) for i in v]
|
||||||
|
else:
|
||||||
|
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
else:
|
||||||
|
if num > 0:
|
||||||
|
# At this point we save more CPU and mathematical work if we just delete everything in the chat history and readd all messages.
|
||||||
|
# Otherwise we'd have to insert new lines at the top and recalculate positions everywhere else.
|
||||||
|
# Firstly, we'd have to save the current focused object so we will place the user in the right part of the text after loading everything again.
|
||||||
|
focused_post = self.get_post()
|
||||||
|
self.chats = dict()
|
||||||
|
wx.CallAfter(self.tab.history.SetValue, "")
|
||||||
|
v = [i for i in self.session.db[self.name]["items"]]
|
||||||
|
[self.insert(i) for i in v]
|
||||||
|
# Now it's time to set back the focus in the post.
|
||||||
|
for i in self.chats.keys():
|
||||||
|
if self.chats[i] == focused_post["id"]:
|
||||||
|
line = i[0]
|
||||||
|
wx.CallAfter(self.tab.history.SetInsertionPoint, self.tab.history.XYToPosition(0, line))
|
||||||
|
output.speak(_("Items loaded"))
|
||||||
|
break
|
||||||
|
if self.unread == True and num > 0:
|
||||||
|
self.session.db[self.name]["items"][-1].update(read_state=0)
|
||||||
|
return retrieved
|
||||||
|
|
||||||
|
def get_more_items(self):
|
||||||
|
output.speak(_("Getting more items..."))
|
||||||
|
call_threaded(self.get_items, show_nextpage=True)
|
||||||
|
|
||||||
|
def add_attachment(self, *args, **kwargs):
|
||||||
|
a = presenters.attachPresenter(session=self.session, view=views.attachDialog(voice_messages=True), interactor=interactors.attachInteractor())
|
||||||
|
if len(a.attachments) != 0:
|
||||||
|
self.attachments_to_be_sent = a.attachments
|
||||||
|
|
||||||
|
def send_chat_to_user(self, *args, **kwargs):
|
||||||
|
text = self.tab.text.GetValue()
|
||||||
|
if text == "" and not hasattr(self, "attachments_to_be_sent"):
|
||||||
|
wx.Bell()
|
||||||
|
return
|
||||||
|
self.tab.text.SetValue("")
|
||||||
|
post_arguments = dict(random_id = random.randint(0, 100000), peer_id=self.kwargs["peer_id"])
|
||||||
|
if len(text) > 0:
|
||||||
|
post_arguments.update(message=text)
|
||||||
|
if hasattr(self, "attachments_to_be_sent") and len(self.attachments_to_be_sent) > 0:
|
||||||
|
attachments = self.attachments_to_be_sent[::]
|
||||||
|
else:
|
||||||
|
attachments = []
|
||||||
|
call_threaded(pub.sendMessage, "post", parent_endpoint="messages", child_endpoint="send", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
|
||||||
|
if hasattr(self, "attachments_to_be_sent"):
|
||||||
|
del self.attachments_to_be_sent
|
||||||
|
|
||||||
|
def __init__(self, unread=False, *args, **kwargs):
|
||||||
|
super(chatBuffer, self).__init__(*args, **kwargs)
|
||||||
|
self.unread = unread
|
||||||
|
self.chats = dict()
|
||||||
|
self.peer_typing = 0
|
||||||
|
self.last_keypress = time.time()
|
||||||
|
|
||||||
|
def parse_attachments(self, post):
|
||||||
|
attachments = []
|
||||||
|
|
||||||
|
if "attachments" in post:
|
||||||
|
for i in post["attachments"]:
|
||||||
|
# We don't need the photos_list attachment, so skip it.
|
||||||
|
if i["type"] == "photos_list":
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
rendered_object = renderers.add_attachment(i)
|
||||||
|
except:
|
||||||
|
log.exception("Error parsing the following attachment on chat: %r" % (i,))
|
||||||
|
attachments.append(rendered_object)
|
||||||
|
self.attachments.append(i)
|
||||||
|
self.tab.attachments.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.open_attachment)
|
||||||
|
self.tab.insert_attachments(attachments)
|
||||||
|
|
||||||
|
def open_attachment(self, *args, **kwargs):
|
||||||
|
index = self.tab.attachments.get_selected()
|
||||||
|
attachment = self.attachments[index]
|
||||||
|
if attachment["type"] == "audio":
|
||||||
|
a = presenters.displayAudioPresenter(session=self.session, postObject=[attachment["audio"]], interactor=interactors.displayAudioInteractor(), view=views.displayAudio())
|
||||||
|
elif attachment["type"] == "audio_message":
|
||||||
|
link = attachment["audio_message"]["link_mp3"]
|
||||||
|
pub.sendMessage("play-message", message_url=link)
|
||||||
|
elif attachment["type"] == "link":
|
||||||
|
output.speak(_("Opening URL..."), True)
|
||||||
|
webbrowser.open_new_tab(attachment["link"]["url"])
|
||||||
|
elif attachment["type"] == "doc":
|
||||||
|
output.speak(_("Opening document in web browser..."))
|
||||||
|
webbrowser.open(attachment["doc"]["url"])
|
||||||
|
elif attachment["type"] == "video":
|
||||||
|
# it seems VK doesn't like to attach video links as normal URLS, so we'll have to
|
||||||
|
# get the full video object and use its "player" key which will open a webbrowser in their site with a player for the video.
|
||||||
|
# see https://vk.com/dev/attachments_w and and https://vk.com/dev/video.get
|
||||||
|
# However, the flash player isn't good for visually impaired people (when you press play you won't be able to close the window with alt+f4), so it could be good to use the HTML5 player.
|
||||||
|
# For firefox, see https://addons.mozilla.org/ru/firefox/addon/force-html5-video-player-at-vk/
|
||||||
|
# May be I could use a dialogue here for inviting people to use this addon in firefox. It seems it isn't possible to use this html5 player from the player URL.
|
||||||
|
object_id = "{0}_{1}".format(attachment["video"]["owner_id"], attachment["video"]["id"])
|
||||||
|
video_object = self.session.vk.client.video.get(owner_id=attachment["video"]["owner_id"], videos=object_id)
|
||||||
|
video_object = video_object["items"][0]
|
||||||
|
output.speak(_("Opening video in web browser..."), True)
|
||||||
|
webbrowser.open_new_tab(video_object["player"])
|
||||||
|
elif attachment["type"] == "photo":
|
||||||
|
output.speak(_("Opening photo in web browser..."), True)
|
||||||
|
# Possible photo sizes for looking in the attachment information. Try to use the biggest photo available.
|
||||||
|
possible_sizes = [1280, 604, 130, 75]
|
||||||
|
url = ""
|
||||||
|
for i in possible_sizes:
|
||||||
|
if "photo_{0}".format(i,) in attachment["photo"]:
|
||||||
|
url = attachment["photo"]["photo_{0}".format(i,)]
|
||||||
|
break
|
||||||
|
if url != "":
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
if attachment["type"] == "wall":
|
||||||
|
pub.sendMessage("open-post", post_object=attachment["wall"], controller_="displayPost")
|
||||||
|
else:
|
||||||
|
log.debug("Unhandled attachment: %r" % (attachment,))
|
||||||
|
|
||||||
|
def clear_reads(self):
|
||||||
|
for i in self.session.db[self.name]["items"]:
|
||||||
|
if "read_state" in i and i["read_state"] == 0:
|
||||||
|
i["read_state"] = 1
|
||||||
|
|
||||||
|
def remove_buffer(self, mandatory=False):
|
||||||
|
""" Remove buffer if the current buffer is not the logged user's wall."""
|
||||||
|
if mandatory == False:
|
||||||
|
dlg = commonMessages.remove_buffer()
|
||||||
|
else:
|
||||||
|
dlg = widgetUtils.YES
|
||||||
|
if dlg == widgetUtils.YES:
|
||||||
|
self.session.db.pop(self.name)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
peer_id = self.kwargs["peer_id"]
|
||||||
|
url = "https://vk.com/im?sel={peer_id}".format(peer_id=peer_id)
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
|
||||||
|
def actions(self, *args, **kwargs):
|
||||||
|
menu = menus.toolsMenu()
|
||||||
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.translate_action, menuitem=menu.translate)
|
||||||
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.spellcheck_action, menuitem=menu.spellcheck)
|
||||||
|
self.tab.PopupMenu(menu, self.tab.actions.GetPosition())
|
||||||
|
|
||||||
|
def translate(self, text):
|
||||||
|
dlg = translator.gui.translateDialog()
|
||||||
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
|
language_dict = translator.translator.available_languages()
|
||||||
|
for k in language_dict:
|
||||||
|
if language_dict[k] == dlg.dest_lang.GetStringSelection():
|
||||||
|
dst = k
|
||||||
|
msg = translator.translator.translate(text, dst)
|
||||||
|
dlg.Destroy()
|
||||||
|
return msg
|
||||||
|
|
||||||
|
def spellcheck(self, text):
|
||||||
|
checker = SpellChecker.spellchecker.spellChecker(text)
|
||||||
|
if hasattr(checker, "fixed_text"):
|
||||||
|
final_text = checker.fixed_text
|
||||||
|
return final_text
|
||||||
|
|
||||||
|
def translate_action(self, *args, **kwargs):
|
||||||
|
text = self.tab.text.GetValue()
|
||||||
|
if text == "":
|
||||||
|
wx.Bell()
|
||||||
|
return
|
||||||
|
translated = self.translate(text)
|
||||||
|
if translated != None:
|
||||||
|
self.tab.text.ChangeValue(translated)
|
||||||
|
self.tab.text.SetFocus()
|
||||||
|
|
||||||
|
def spellcheck_action(self, *args, **kwargs):
|
||||||
|
text = self.tab.text.GetValue()
|
||||||
|
fixed = self.spellcheck(text)
|
||||||
|
if fixed != None:
|
||||||
|
self.tab.text.ChangeValue(fixed)
|
||||||
|
self.tab.text.SetFocus()
|
||||||
|
|
||||||
|
def translate_message(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def spellcheck_message(self, *args, **kwargs):
|
||||||
|
pass
|
68
src/controller/buffers/communityBoard.py
Normal file
68
src/controller/buffers/communityBoard.py
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import widgetUtils
|
||||||
|
from pubsub import pub
|
||||||
|
from wxUI.tabs import communityBoard
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.communityBoard")
|
||||||
|
|
||||||
|
class communityBoardBuffer(wallBuffer):
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = communityBoard.communityBoardTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if "can_create_topic" not in self.session.db["group_info"][self.kwargs["group_id"]*-1] or ("can_create_topic" in self.session.db["group_info"][self.kwargs["group_id"]*-1] and self.session.db["group_info"][self.kwargs["group_id"]*-1]["can_create_topic"] != True):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def onFocus(self, event, *args, **kwargs):
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def open_post(self, *args, **kwargs):
|
||||||
|
""" Opens the currently focused post."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
a = presenters.displayTopicPresenter(session=self.session, postObject=post, group_id=self.kwargs["group_id"], interactor=interactors.displayPostInteractor(), view=views.displayTopic())
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
# In order to load the selected topic we firstly have to catch the group_id, which is present in self.kwargs
|
||||||
|
# After getting the group_id we should make it negative
|
||||||
|
group_id = self.kwargs["group_id"]*-1
|
||||||
|
url = "https://vk.com/topic{group_id}_{topic_id}".format(group_id=group_id, topic_id=post["id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
menu = wx.Menu()
|
||||||
|
user1 = self.session.get_user(self.session.user_id)
|
||||||
|
user2 = self.session.get_user(-1*self.kwargs["group_id"])
|
||||||
|
user = menu.Append(wx.NewId(), _("Post as {user1_nom}").format(**user1))
|
||||||
|
group = menu.Append(wx.NewId(), _("Post as {user1_nom}").format(**user2))
|
||||||
|
menu.Bind(widgetUtils.MENU, lambda evt: self._post(evt, 1), group)
|
||||||
|
menu.Bind(widgetUtils.MENU, lambda evt: self._post(evt, 0), user)
|
||||||
|
self.tab.post.PopupMenu(menu, self.tab.post.GetPosition())
|
||||||
|
|
||||||
|
def _post(self, event, from_group):
|
||||||
|
owner_id = self.kwargs["group_id"]
|
||||||
|
user = self.session.get_user(-1*owner_id, key="user1")
|
||||||
|
title = _("Create topic in {user1_nom}").format(**user)
|
||||||
|
p = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createTopicDialog(title=title, message="", text="", topic_title=""))
|
||||||
|
if hasattr(p, "text") or hasattr(p, "privacy"):
|
||||||
|
title = p.view.title.GetValue()
|
||||||
|
msg = p.text
|
||||||
|
post_arguments = dict(title=title, text=msg, group_id=owner_id, from_group=from_group)
|
||||||
|
attachments = []
|
||||||
|
if hasattr(p, "attachments"):
|
||||||
|
attachments = p.attachments
|
||||||
|
call_threaded(pub.sendMessage, "post", parent_endpoint="board", child_endpoint="addTopic", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
|
16
src/controller/buffers/communityDocuments.py
Normal file
16
src/controller/buffers/communityDocuments.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
from wxUI.tabs import communityDocuments
|
||||||
|
from .documents import documentsBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.communityDocuments")
|
||||||
|
|
||||||
|
class communityDocumentsBuffer(documentsBuffer):
|
||||||
|
can_get_items = True
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = communityDocuments.communityDocumentsTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
26
src/controller/buffers/communityPeople.py
Normal file
26
src/controller/buffers/communityPeople.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import wx
|
||||||
|
import widgetUtils
|
||||||
|
from .people import peopleBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.communityPeople")
|
||||||
|
|
||||||
|
class communityPeopleBuffer(peopleBuffer):
|
||||||
|
|
||||||
|
def get_menu(self, *args, **kwargs):
|
||||||
|
user = self.get_post()
|
||||||
|
m = wx.Menu()
|
||||||
|
if user.get("can_post") == True:
|
||||||
|
can_post = m.Append(wx.NewId(), _("&Post on user's wall"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.post, menuitem=can_post)
|
||||||
|
if user.get("can_write_private_message") == True:
|
||||||
|
can_write_message = m.Append(wx.Id(), _("Send message"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.new_chat, menuitem=can_write_message)
|
||||||
|
profile = m.Append(wx.NewId(), _("View profile"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_person_profile, menuitem=profile)
|
||||||
|
timeline = m.Append(wx.NewId(), _("Open timeline"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_timeline, menuitem=timeline)
|
||||||
|
open_in_browser = m.Append(wx.NewId(), _("Open in vk.com"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_in_browser, menuitem=open_in_browser)
|
||||||
|
return m
|
69
src/controller/buffers/communityWall.py
Normal file
69
src/controller/buffers/communityWall.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
|
||||||
|
import logging
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from pubsub import pub
|
||||||
|
from wxUI.tabs import communityWall
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.communityWall")
|
||||||
|
|
||||||
|
class communityWallBuffer(wallBuffer):
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(communityWallBuffer, self).__init__(*args, **kwargs)
|
||||||
|
self.group_id = self.kwargs["owner_id"]
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = communityWall.communityWallTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
super(communityWallBuffer, self).connect_events()
|
||||||
|
widgetUtils.connect_event(self.tab.load, widgetUtils.BUTTON_PRESSED, self.load_community)
|
||||||
|
|
||||||
|
def load_community(self, *args, **kwargs):
|
||||||
|
output.speak(_("Loading community..."))
|
||||||
|
self.can_get_items = True
|
||||||
|
self.tab.load.Enable(False)
|
||||||
|
wx.CallAfter(self.get_items)
|
||||||
|
|
||||||
|
def get_items(self, *args, **kwargs):
|
||||||
|
""" This method retrieves community information, useful to show different parts of the community itself."""
|
||||||
|
if self.can_get_items:
|
||||||
|
# Strangely, groups.get does not return counters so we need those to show options for loading specific posts for communities.
|
||||||
|
group_info = self.session.vk.client.groups.getById(group_ids=-1*self.kwargs["owner_id"], fields="counters")[0]
|
||||||
|
self.session.db["group_info"][self.group_id].update(group_info)
|
||||||
|
if "can_post" in self.session.db["group_info"][self.group_id] and self.session.db["group_info"][self.group_id]["can_post"] == True:
|
||||||
|
self.tab.post.Enable(True)
|
||||||
|
super(communityWallBuffer, self).get_items(*args, **kwargs)
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
menu = wx.Menu()
|
||||||
|
user1 = self.session.get_user(self.session.user_id)
|
||||||
|
user2 = self.session.get_user(self.kwargs["owner_id"])
|
||||||
|
user = menu.Append(wx.NewId(), _("Post as {user1_nom}").format(**user1))
|
||||||
|
group = menu.Append(wx.NewId(), _("Post as {user1_nom}").format(**user2))
|
||||||
|
menu.Bind(widgetUtils.MENU, lambda evt: self._post(evt, 1), group)
|
||||||
|
menu.Bind(widgetUtils.MENU, lambda evt: self._post(evt, 0), user)
|
||||||
|
self.tab.post.PopupMenu(menu, self.tab.post.GetPosition())
|
||||||
|
|
||||||
|
def _post(self, event, from_group):
|
||||||
|
owner_id = self.kwargs["owner_id"]
|
||||||
|
user = self.session.get_user(owner_id, key="user1")
|
||||||
|
title = _("Post to {user1_nom}'s wall").format(**user)
|
||||||
|
p = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=title, message="", text=""))
|
||||||
|
if hasattr(p, "text") or hasattr(p, "privacy"):
|
||||||
|
post_arguments=dict(privacy=p.privacy, message=p.text, owner_id=owner_id, from_group=from_group)
|
||||||
|
attachments = []
|
||||||
|
if hasattr(p, "attachments"):
|
||||||
|
attachments = p.attachments
|
||||||
|
call_threaded(pub.sendMessage, "post", parent_endpoint="wall", child_endpoint="post", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
|
93
src/controller/buffers/documents.py
Normal file
93
src/controller/buffers/documents.py
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import arrow
|
||||||
|
import wx
|
||||||
|
import languageHandler
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from pubsub import pub
|
||||||
|
from wxUI.tabs import documents
|
||||||
|
from sessionmanager import utils
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import menus
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.documents")
|
||||||
|
|
||||||
|
class documentsBuffer(wallBuffer):
|
||||||
|
can_get_items = False
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = documents.documentsTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def onFocus(self, event, *args,**kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
original_date = arrow.get(post["date"])
|
||||||
|
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
|
||||||
|
self.tab.list.list.SetItem(self.tab.list.get_selected(), 4, created_at)
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
super(documentsBuffer, self).connect_events()
|
||||||
|
# Check if we have a load button in the tab, because documents community buffers don't include it.
|
||||||
|
if hasattr(self.tab, "load"):
|
||||||
|
widgetUtils.connect_event(self.tab.load, widgetUtils.BUTTON_PRESSED, self.load_documents)
|
||||||
|
|
||||||
|
def load_documents(self, *args, **kwargs):
|
||||||
|
output.speak(_("Loading documents..."))
|
||||||
|
self.can_get_items = True
|
||||||
|
self.tab.load.Enable(False)
|
||||||
|
wx.CallAfter(self.get_items)
|
||||||
|
|
||||||
|
def get_menu(self):
|
||||||
|
p = self.get_post()
|
||||||
|
if p == None:
|
||||||
|
return
|
||||||
|
if p["owner_id"] == self.session.user_id:
|
||||||
|
added = True
|
||||||
|
else:
|
||||||
|
added = False
|
||||||
|
m = menus.documentMenu(added)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.add_remove_document, menuitem=m.action)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.download, menuitem=m.download)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_in_browser, menuitem=m.open_in_browser)
|
||||||
|
return m
|
||||||
|
|
||||||
|
def add_remove_document(self, *args, **kwargs):
|
||||||
|
p = self.get_post()
|
||||||
|
if p == None:
|
||||||
|
return
|
||||||
|
if p["owner_id"] == self.session.user_id:
|
||||||
|
result = self.session.vk.client.docs.delete(owner_id=p["owner_id"], doc_id=p["id"])
|
||||||
|
if result == 1:
|
||||||
|
output.speak(_("The document has been successfully deleted."))
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
else:
|
||||||
|
result = self.session.vk.client.docs.add(owner_id=p["owner_id"], doc_id=p["id"])
|
||||||
|
output.speak(_("The document has been successfully added."))
|
||||||
|
|
||||||
|
def download(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
filename = utils.safe_filename(post["title"])
|
||||||
|
# If document does not end in .extension we must fix it so the file dialog will save it properly later.
|
||||||
|
if filename.endswith(post["ext"]) == False:
|
||||||
|
filename = filename+ "."+post["ext"]
|
||||||
|
filepath = self.tab.get_download_path(filename)
|
||||||
|
if filepath != None:
|
||||||
|
pub.sendMessage("download-file", url=post["url"], filename=filepath)
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
url = "https://vk.com/doc{user_id}_{post_id}".format(user_id=post["owner_id"], post_id=post["id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
27
src/controller/buffers/empty.py
Normal file
27
src/controller/buffers/empty.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
|
||||||
|
import logging
|
||||||
|
import output
|
||||||
|
from wxUI.tabs import empty
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.empty")
|
||||||
|
|
||||||
|
class emptyBuffer(object):
|
||||||
|
|
||||||
|
def __init__(self, name=None, parent=None, *args, **kwargs):
|
||||||
|
self.tab = empty.emptyTab(parent=parent, name=name)
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def get_items(self, *args, **kwargs):
|
||||||
|
if not hasattr(self, "tab"):
|
||||||
|
# Create GUI associated to this buffer.
|
||||||
|
self.create_tab(self.parent)
|
||||||
|
# Add name to the new control so we could look for it when needed.
|
||||||
|
self.tab.name = self.name
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_more_items(self, *args, **kwargs):
|
||||||
|
output.speak(_("This buffer doesn't support getting more items."))
|
||||||
|
|
||||||
|
def remove_buffer(self, mandatory=False):
|
||||||
|
return False
|
81
src/controller/buffers/friendRequests.py
Normal file
81
src/controller/buffers/friendRequests.py
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import wx
|
||||||
|
from pubsub import pub
|
||||||
|
from vk_api.exceptions import VkApiError
|
||||||
|
from .people import peopleBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.friendRequests")
|
||||||
|
|
||||||
|
class friendRequestsBuffer(peopleBuffer):
|
||||||
|
|
||||||
|
def get_items(self, show_nextpage=False):
|
||||||
|
if self.can_get_items == False: return
|
||||||
|
retrieved = True
|
||||||
|
try:
|
||||||
|
ids = self.session.vk.client.friends.getRequests(*self.args, **self.kwargs)
|
||||||
|
except VkApiError as err:
|
||||||
|
log.error("Error {0}: {1}".format(err.code, err.error))
|
||||||
|
retrieved = err.code
|
||||||
|
return retrieved
|
||||||
|
except:
|
||||||
|
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
|
||||||
|
return False
|
||||||
|
num = self.session.get_page(name=self.name, show_nextpage=show_nextpage, endpoint="get", parent_endpoint="users", count=1000, user_ids=", ".join([str(i) for i in ids["items"]]), fields="uid, first_name, last_name, last_seen")
|
||||||
|
if not hasattr(self, "tab"):
|
||||||
|
# Create GUI associated to this buffer.
|
||||||
|
self.create_tab(self.parent)
|
||||||
|
# Add name to the new control so we could look for it when needed.
|
||||||
|
self.tab.name = self.name
|
||||||
|
if show_nextpage == False:
|
||||||
|
if self.tab.list.get_count() > 0 and num > 0:
|
||||||
|
v = [i for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
v.reverse()
|
||||||
|
[wx.CallAfter(self.insert, i, True) for i in v]
|
||||||
|
else:
|
||||||
|
[wx.CallAfter(self.insert, i) for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
return retrieved
|
||||||
|
|
||||||
|
def accept_friendship(self, *args, **kwargs):
|
||||||
|
""" Adds a person to a list of friends. This method is done for accepting someone else's friend request.
|
||||||
|
https://vk.com/dev/friends.add
|
||||||
|
"""
|
||||||
|
person = self.get_post()
|
||||||
|
if person == None:
|
||||||
|
return
|
||||||
|
result = self.session.vk.client.friends.add(user_id=person["id"])
|
||||||
|
if result == 2:
|
||||||
|
msg = _("{0} {1} now is your friend.").format(person["first_name"], person["last_name"])
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def decline_friendship(self, *args, **kwargs):
|
||||||
|
""" Declines a freind request.
|
||||||
|
https://vk.com/dev/friends.delete
|
||||||
|
"""
|
||||||
|
person = self.get_post()
|
||||||
|
if person == None:
|
||||||
|
return
|
||||||
|
result = self.session.vk.client.friends.delete(user_id=person["id"])
|
||||||
|
if "out_request_deleted" in result:
|
||||||
|
msg = _("You've deleted the friends request to {0} {1}.").format(person["first_name"], person["last_name"])
|
||||||
|
elif "in_request_deleted" in result:
|
||||||
|
msg = _("You've declined the friend request of {0} {1}.").format(person["first_name"], person["last_name"])
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def keep_as_follower(self, *args, **kwargs):
|
||||||
|
""" Adds a person to The followers list of the current user.
|
||||||
|
https://vk.com/dev/friends.add
|
||||||
|
"""
|
||||||
|
person = self.get_post()
|
||||||
|
if person == None:
|
||||||
|
return
|
||||||
|
result = self.session.vk.client.friends.add(user_id=person["id"], follow=1)
|
||||||
|
if result == 2:
|
||||||
|
msg = _("{0} {1} is following you.").format(person["first_name"], person["last_name"])
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
332
src/controller/buffers/home.py
Normal file
332
src/controller/buffers/home.py
Normal file
@ -0,0 +1,332 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import arrow
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import languageHandler
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from pubsub import pub
|
||||||
|
from vk_api.exceptions import VkApiError
|
||||||
|
from presenters import player
|
||||||
|
from wxUI.tabs import home
|
||||||
|
from sessionmanager import session, renderers
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import commonMessages, menus
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.home")
|
||||||
|
|
||||||
|
class homeBuffer(object):
|
||||||
|
""" a basic representation of a buffer. Other buffers should be derived from this class. This buffer represents the "news feed" """
|
||||||
|
|
||||||
|
def get_post(self):
|
||||||
|
""" Return the currently focused post."""
|
||||||
|
# Handle case where there are no items in the buffer.
|
||||||
|
if self.tab.list.get_count() == 0:
|
||||||
|
wx.Bell()
|
||||||
|
return None
|
||||||
|
return self.session.db[self.name]["items"][self.tab.list.get_selected()]
|
||||||
|
|
||||||
|
def __init__(self, parent=None, name="", session=None, composefunc=None, create_tab=True, *args, **kwargs):
|
||||||
|
""" Constructor:
|
||||||
|
@parent wx.Treebook: parent for the buffer panel,
|
||||||
|
@name str: Name for saving this buffer's data in the local storage variable,
|
||||||
|
@session sessionmanager.session.vkSession: Session for performing operations in the Vk API. This session should be logged in when this class is instanciated.
|
||||||
|
@composefunc str: This function will be called for composing the result which will be put in the listCtrl. Composefunc should exist in the sessionmanager.renderers module.
|
||||||
|
args and kwargs will be passed to get_items() without any filtering. Be careful there.
|
||||||
|
"""
|
||||||
|
super(homeBuffer, self).__init__()
|
||||||
|
self.parent = parent
|
||||||
|
self.args = args
|
||||||
|
self.kwargs = kwargs
|
||||||
|
self.session = session
|
||||||
|
self.compose_function = composefunc
|
||||||
|
self.name = name
|
||||||
|
if create_tab:
|
||||||
|
self.create_tab(self.parent)
|
||||||
|
#Update_function will be called every 3 minutes and it should be able to
|
||||||
|
# Get all new items in the buffer and sort them properly in the CtrlList.
|
||||||
|
# ToDo: Shall we allow dinamically set for update_function?
|
||||||
|
self.update_function = "get_page"
|
||||||
|
self.name = name
|
||||||
|
# source_key and post_key will point to the keys for sender and posts in VK API objects.
|
||||||
|
# They can be changed in the future for other item types in different buffers.
|
||||||
|
self.user_key = "source_id"
|
||||||
|
self.post_key = "post_id"
|
||||||
|
# When set to False, update_function won't be executed here.
|
||||||
|
self.can_get_items = True
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
""" Create the Wx panel."""
|
||||||
|
self.tab = home.homeTab(parent)
|
||||||
|
# Bind local events (they will respond to events happened in the buffer).
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def insert(self, item, reversed=False):
|
||||||
|
""" Add a new item to the list. Uses renderers.composefunc for parsing the dictionary and create a valid result for putting it in the list."""
|
||||||
|
try:
|
||||||
|
item_ = getattr(renderers, self.compose_function)(item, self.session)
|
||||||
|
wx.CallAfter(self.tab.list.insert_item, reversed, *item_)
|
||||||
|
except:
|
||||||
|
log.exception(item)
|
||||||
|
|
||||||
|
def get_items(self, show_nextpage=False):
|
||||||
|
""" Retrieve items from the VK API. This function is called repeatedly by the main controller and users could call it implicitly as well with the update buffer option.
|
||||||
|
@show_nextpage boolean: If it's true, it will try to load previous results.
|
||||||
|
"""
|
||||||
|
if self.can_get_items == False: return
|
||||||
|
retrieved = True # Control variable for handling unauthorised/connection errors.
|
||||||
|
try:
|
||||||
|
num = getattr(self.session, "get_newsfeed")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs)
|
||||||
|
except VkApiError as err:
|
||||||
|
log.error("Error {0}: {1}".format(err.code, err.error))
|
||||||
|
retrieved = err.code
|
||||||
|
return retrieved
|
||||||
|
except:
|
||||||
|
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
|
||||||
|
return False
|
||||||
|
if not hasattr(self, "tab"):
|
||||||
|
# Create GUI associated to this buffer.
|
||||||
|
self.create_tab(self.parent)
|
||||||
|
# Add name to the new control so we could look for it when needed.
|
||||||
|
if show_nextpage == False:
|
||||||
|
if self.tab.list.get_count() > 0 and num > 0:
|
||||||
|
v = [i for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
v.reverse()
|
||||||
|
[wx.CallAfter(self.insert, i, True) for i in v]
|
||||||
|
else:
|
||||||
|
[wx.CallAfter(self.insert, i) for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
else:
|
||||||
|
if num > 0:
|
||||||
|
[wx.CallAfter(self.insert, i, False) for i in self.session.db[self.name]["items"][-num:]]
|
||||||
|
return retrieved
|
||||||
|
|
||||||
|
def get_more_items(self):
|
||||||
|
""" Returns previous items in the buffer."""
|
||||||
|
self.get_items(show_nextpage=True)
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
""" Create a post in the current user's wall.
|
||||||
|
This process is handled in two parts. This is the first part, where the GUI is created and user can send the post.
|
||||||
|
During the second part (threaded), the post will be sent to the API."""
|
||||||
|
p = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Write your post"), message="", text=""))
|
||||||
|
if hasattr(p, "text") or hasattr(p, "privacy"):
|
||||||
|
post_arguments=dict(privacy=p.privacy, message=p.text)
|
||||||
|
attachments = []
|
||||||
|
if hasattr(p, "attachments"):
|
||||||
|
attachments = p.attachments
|
||||||
|
call_threaded(pub.sendMessage, "post", parent_endpoint="wall", child_endpoint="post", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
""" Bind all events to this buffer"""
|
||||||
|
widgetUtils.connect_event(self.tab.post, widgetUtils.BUTTON_PRESSED, self.post)
|
||||||
|
widgetUtils.connect_event(self.tab.list.list, widgetUtils.KEYPRESS, self.get_event)
|
||||||
|
widgetUtils.connect_event(self.tab.list.list, wx.EVT_CONTEXT_MENU, self.show_menu)
|
||||||
|
self.tab.set_focus_function(self.onFocus)
|
||||||
|
|
||||||
|
def show_menu(self, ev, pos=0, *args, **kwargs):
|
||||||
|
""" Show contextual menu when pressing menu key or right mouse click in a list item."""
|
||||||
|
if self.tab.list.get_count() == 0: return
|
||||||
|
menu = self.get_menu()
|
||||||
|
if pos != 0:
|
||||||
|
self.tab.PopupMenu(menu, pos)
|
||||||
|
else:
|
||||||
|
self.tab.PopupMenu(menu, self.tab.list.list.GetPosition())
|
||||||
|
|
||||||
|
def show_menu_by_key(self, ev):
|
||||||
|
""" Show contextual menu when menu key is pressed"""
|
||||||
|
if self.tab.list.get_count() == 0:
|
||||||
|
return
|
||||||
|
if ev.GetKeyCode() == wx.WXK_WINDOWS_MENU:
|
||||||
|
self.show_menu(widgetUtils.MENU, pos=self.tab.list.list.GetPosition())
|
||||||
|
|
||||||
|
def get_menu(self):
|
||||||
|
""" Returns contextual menu options. They will change according to the focused item"""
|
||||||
|
p = self.get_post()
|
||||||
|
if p == None:
|
||||||
|
return
|
||||||
|
# determine if the current user is able to delete the object.
|
||||||
|
if "can_delete" in p:
|
||||||
|
can_delete = True==p["can_delete"]
|
||||||
|
else:
|
||||||
|
can_delete = False
|
||||||
|
m = menus.postMenu(can_delete=can_delete)
|
||||||
|
if ("likes" in p) == False:
|
||||||
|
m.like.Enable(False)
|
||||||
|
elif p["likes"]["user_likes"] == 1:
|
||||||
|
m.like.Enable(False)
|
||||||
|
m.dislike.Enable(True)
|
||||||
|
if ("comments" in p) == False:
|
||||||
|
m.comment.Enable(False)
|
||||||
|
m.open_in_browser.Enable(False)
|
||||||
|
if "type" in p and p["type"] != "friend" and p["type"] != "audio" and p["type"] != "video" and p["type"] != "playlist" or self.name != "home_timeline":
|
||||||
|
m.open_in_browser.Enable(True)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_post, menuitem=m.open)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.do_like, menuitem=m.like)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.do_dislike, menuitem=m.dislike)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.do_comment, menuitem=m.comment)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_in_browser, menuitem=m.open_in_browser)
|
||||||
|
if hasattr(m, "view_profile"):
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_person_profile, menuitem=m.view_profile)
|
||||||
|
if hasattr(m, "delete"):
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.delete, menuitem=m.delete)
|
||||||
|
return m
|
||||||
|
|
||||||
|
def do_like(self, *args, **kwargs):
|
||||||
|
""" Set like in the currently focused post."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
user = post[self.user_key]
|
||||||
|
id = post[self.post_key]
|
||||||
|
if "type" in post:
|
||||||
|
type_ = post["type"]
|
||||||
|
else:
|
||||||
|
type_ = "post"
|
||||||
|
l = self.session.vk.client.likes.add(owner_id=user, item_id=id, type=type_)
|
||||||
|
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["count"] = l["likes"]
|
||||||
|
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["user_likes"] = 1
|
||||||
|
# Translators: This will be used when user presses like.
|
||||||
|
output.speak(_("You liked this"))
|
||||||
|
|
||||||
|
def do_dislike(self, *args, **kwargs):
|
||||||
|
""" Set dislike (undo like) in the currently focused post."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
user = post[self.user_key]
|
||||||
|
id = post[self.post_key]
|
||||||
|
if "type" in post:
|
||||||
|
type_ = post["type"]
|
||||||
|
else:
|
||||||
|
type_ = "post"
|
||||||
|
l = self.session.vk.client.likes.delete(owner_id=user, item_id=id, type=type_)
|
||||||
|
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["count"] = l["likes"]
|
||||||
|
self.session.db[self.name]["items"][self.tab.list.get_selected()]["likes"]["user_likes"] = 2
|
||||||
|
# Translators: This will be user in 'dislike'
|
||||||
|
output.speak(_("You don't like this"))
|
||||||
|
|
||||||
|
def do_comment(self, *args, **kwargs):
|
||||||
|
""" Make a comment into the currently focused post."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
comment = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Add a comment"), message="", text="", mode="comment"))
|
||||||
|
if hasattr(comment, "text") or hasattr(comment, "privacy"):
|
||||||
|
msg = comment.text
|
||||||
|
try:
|
||||||
|
user = post[self.user_key]
|
||||||
|
id = post[self.post_key]
|
||||||
|
self.session.vk.client.wall.addComment(owner_id=user, post_id=id, text=msg)
|
||||||
|
output.speak(_("You've posted a comment"))
|
||||||
|
except Exception as msg:
|
||||||
|
log.error(msg)
|
||||||
|
|
||||||
|
def delete(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if ("type" in post and post["type"] == "post") or self.name != "newsfeed":
|
||||||
|
question = commonMessages.remove_post()
|
||||||
|
if question == widgetUtils.NO:
|
||||||
|
return
|
||||||
|
if "owner_id" in self.kwargs:
|
||||||
|
result = self.session.vk.client.wall.delete(owner_id=self.kwargs["owner_id"], post_id=post[self.post_key])
|
||||||
|
else:
|
||||||
|
result = self.session.vk.client.wall.delete(post_id=post[self.post_key])
|
||||||
|
pub.sendMessage("post_deleted", post_id=post[self.post_key])
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def get_event(self, ev):
|
||||||
|
""" Parses keyboard input in the ListCtrl and executes the event associated with user keypresses."""
|
||||||
|
if ev.GetKeyCode() == wx.WXK_RETURN: event = "open_post"
|
||||||
|
else:
|
||||||
|
event = None
|
||||||
|
ev.Skip()
|
||||||
|
if event != None:
|
||||||
|
try:
|
||||||
|
getattr(self, event)()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def volume_down(self):
|
||||||
|
""" Decreases player volume by 2%"""
|
||||||
|
player.player.volume = player.player.volume-2
|
||||||
|
|
||||||
|
def volume_up(self):
|
||||||
|
""" Increases player volume by 2%"""
|
||||||
|
player.player.volume = player.player.volume+2
|
||||||
|
|
||||||
|
def play_audio(self, *args, **kwargs):
|
||||||
|
""" Play audio in currently focused buffer, if possible."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
if "type" in post and post["type"] == "audio":
|
||||||
|
pub.sendMessage("play", object=post["audio"]["items"][0])
|
||||||
|
return True
|
||||||
|
|
||||||
|
def open_person_profile(self, *args, **kwargs):
|
||||||
|
""" Views someone's profile."""
|
||||||
|
selected = self.get_post()
|
||||||
|
if selected == None:
|
||||||
|
return
|
||||||
|
# Check all possible keys for an user object in VK API.
|
||||||
|
keys = ["from_id", "source_id", "id"]
|
||||||
|
for i in keys:
|
||||||
|
if i in selected:
|
||||||
|
pub.sendMessage("user-profile", person=selected[i])
|
||||||
|
break
|
||||||
|
|
||||||
|
def open_post(self, *args, **kwargs):
|
||||||
|
""" Opens the currently focused post."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
if "type" in post and post["type"] == "audio":
|
||||||
|
a = presenters.displayAudioPresenter(session=self.session, postObject=post["audio"]["items"], interactor=interactors.displayAudioInteractor(), view=views.displayAudio())
|
||||||
|
elif "type" in post and post["type"] == "friend":
|
||||||
|
pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("{user1_nom} added the following friends")))
|
||||||
|
else:
|
||||||
|
pub.sendMessage("open-post", post_object=post, controller_="displayPost")
|
||||||
|
|
||||||
|
def pause_audio(self, *args, **kwargs):
|
||||||
|
""" pauses audio playback."""
|
||||||
|
pub.sendMessage("pause")
|
||||||
|
|
||||||
|
def remove_buffer(self, mandatory):
|
||||||
|
""" Function for removing a buffer. Returns True if removal is successful, False otherwise"""
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get_users(self):
|
||||||
|
""" Returns source user in the post."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
if ("type" in post) == False:
|
||||||
|
return [post["from_id"]]
|
||||||
|
else:
|
||||||
|
return [post["source_id"]]
|
||||||
|
|
||||||
|
def onFocus(self, event, *args,**kwargs):
|
||||||
|
""" Function executed when the item in a list is selected.
|
||||||
|
For this buffer it updates the date of posts in the list."""
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
original_date = arrow.get(post["date"])
|
||||||
|
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
|
||||||
|
self.tab.list.list.SetItem(self.tab.list.get_selected(), 2, created_at)
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
url = "https://vk.com/wall{user_id}_{post_id}".format(user_id=post["source_id"], post_id=post["post_id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
16
src/controller/buffers/notification.py
Normal file
16
src/controller/buffers/notification.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
from wxUI.tabs import notification
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers")
|
||||||
|
|
||||||
|
class notificationBuffer(wallBuffer):
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = notification.notificationTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
|
||||||
|
def onFocus(self, event, *args, **kwargs):
|
||||||
|
event.Skip()
|
225
src/controller/buffers/people.py
Normal file
225
src/controller/buffers/people.py
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
|
||||||
|
import time
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import arrow
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import languageHandler
|
||||||
|
import widgetUtils
|
||||||
|
from pubsub import pub
|
||||||
|
from wxUI.tabs import people
|
||||||
|
from wxUI.dialogs import timeline
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import commonMessages, menus
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.friends")
|
||||||
|
|
||||||
|
class peopleBuffer(wallBuffer):
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
user = self.get_post()
|
||||||
|
if "can_post" not in user: # retrieve data if not present in the object.
|
||||||
|
user = self.session.vk.client.users.get(user_ids=user["id"], fields="can_post")[0]
|
||||||
|
if user.get("can_post") == True:
|
||||||
|
user_str = self.session.get_user(user["id"], key="user1")
|
||||||
|
title = _("Post to {user1_nom}'s wall").format(**user_str)
|
||||||
|
p = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=title, message="", text=""))
|
||||||
|
if hasattr(p, "text") or hasattr(p, "privacy"):
|
||||||
|
post_arguments=dict(privacy=p.privacy, message=p.text, owner_id=user["id"])
|
||||||
|
attachments = []
|
||||||
|
if hasattr(p, "attachments"):
|
||||||
|
attachments = p.attachments
|
||||||
|
call_threaded(pub.sendMessage, "post", parent_endpoint="wall", child_endpoint="post", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = people.peopleTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
super(peopleBuffer, self).connect_events()
|
||||||
|
widgetUtils.connect_event(self.tab.new_chat, widgetUtils.BUTTON_PRESSED, self.new_chat)
|
||||||
|
|
||||||
|
def new_chat(self, *args, **kwargs):
|
||||||
|
user = self.get_post()
|
||||||
|
if user == None:
|
||||||
|
return
|
||||||
|
user_id = user["id"]
|
||||||
|
pub.sendMessage("new-chat", user_id=user_id)
|
||||||
|
|
||||||
|
def onFocus(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
if post.get("can_post") == True:
|
||||||
|
self.tab.post.Enable(True)
|
||||||
|
else:
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
# Check if we are allowed to contact people. this might be false for communitiy members.
|
||||||
|
if post.get("can_write_private_message") == True:
|
||||||
|
self.tab.new_chat.Enable(True)
|
||||||
|
else:
|
||||||
|
self.tab.new_chat.Enable(False)
|
||||||
|
if ("last_seen" in post) == False: return
|
||||||
|
original_date = arrow.get(post["last_seen"]["time"])
|
||||||
|
now = arrow.now()
|
||||||
|
original_date.to(now.tzinfo)
|
||||||
|
diffdate = now-original_date
|
||||||
|
if diffdate.days == 0 and diffdate.seconds <= 360:
|
||||||
|
online_status = _("Online")
|
||||||
|
else:
|
||||||
|
# Translators: This is the date of last seen
|
||||||
|
online_status = _("Last seen {0}").format(original_date.humanize(locale=languageHandler.curLang[:2]),)
|
||||||
|
self.tab.list.list.SetItem(self.tab.list.get_selected(), 1, online_status)
|
||||||
|
|
||||||
|
def open_timeline(self, *args, **kwargs):
|
||||||
|
user = self.get_post()
|
||||||
|
if user == None:
|
||||||
|
return
|
||||||
|
a = timeline.timelineDialog([self.session.get_user(user["id"])["user1_gen"]], show_selector=False)
|
||||||
|
if a.get_response() == widgetUtils.OK:
|
||||||
|
buffer_type = a.get_buffer_type()
|
||||||
|
user_id = user["id"]
|
||||||
|
pub.sendMessage("create-timeline", user_id=user_id, buffer_type=buffer_type)
|
||||||
|
|
||||||
|
def get_menu(self, *args, **kwargs):
|
||||||
|
""" display menu for people buffers (friends and requests)"""
|
||||||
|
# If this is an incoming requests buffer, there is a flag in the peopleMenu that shows a few new options.
|
||||||
|
# So let's make sure we call it accordingly.
|
||||||
|
if self.name == "friend_requests":
|
||||||
|
m = menus.peopleMenu(is_request=True)
|
||||||
|
# Connect the accept and decline methods from here.
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.accept)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.keep_as_follower, menuitem=m.keep_as_follower)
|
||||||
|
elif self.name == "subscribers":
|
||||||
|
m = menus.peopleMenu(is_subscriber=True)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.add)
|
||||||
|
else:
|
||||||
|
m = menus.peopleMenu(is_request=False)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.block_person, menuitem=m.block)
|
||||||
|
# It is not allowed to send messages to people who is not your friends, so let's disable it if we're in a pending or outgoing requests buffer.
|
||||||
|
if "friend_requests" in self.name:
|
||||||
|
m.message.Enable(False)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.new_chat, menuitem=m.message)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_timeline, menuitem=m.timeline)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_person_profile, menuitem=m.view_profile)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_in_browser, menuitem=m.open_in_browser)
|
||||||
|
return m
|
||||||
|
|
||||||
|
def open_post(self, *args, **kwargs): pass
|
||||||
|
|
||||||
|
def play_audio(self, *args, **kwargs): return False
|
||||||
|
|
||||||
|
def pause_audio(self, *args, **kwargs): pass
|
||||||
|
|
||||||
|
def accept_friendship(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def decline_friendship(self, *args, **kwargs):
|
||||||
|
person = self.get_post()
|
||||||
|
if person == None:
|
||||||
|
return
|
||||||
|
user = self.session.get_user(person["id"])
|
||||||
|
question = commonMessages.remove_friend(user)
|
||||||
|
if question == widgetUtils.NO:
|
||||||
|
return
|
||||||
|
result = self.session.vk.client.friends.delete(user_id=person["id"])
|
||||||
|
if "friend_deleted" in result:
|
||||||
|
msg = _("You've removed {user1_nom} from your friends.").format(**user,)
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def block_person(self, *args, **kwargs):
|
||||||
|
person = self.get_post()
|
||||||
|
if person == None:
|
||||||
|
return
|
||||||
|
user = self.session.get_user(person["id"])
|
||||||
|
question = commonMessages.block_person(user)
|
||||||
|
if question == widgetUtils.NO:
|
||||||
|
return
|
||||||
|
result = self.session.vk.client.account.ban(owner_id=person["id"])
|
||||||
|
if result == 1:
|
||||||
|
msg = _("You've blocked {user1_nom} from your friends.").format(**user,)
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def keep_as_follower(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def add_person(self, person):
|
||||||
|
# This tracks if the user already exists here, in such case we just will update the last_seen variable
|
||||||
|
existing = False
|
||||||
|
for i in self.session.db[self.name]["items"]:
|
||||||
|
if person["id"] == i["id"]:
|
||||||
|
existing = True
|
||||||
|
i["last_seen"]["time"] = person["last_seen"]["time"]
|
||||||
|
break
|
||||||
|
# Add the new user to the buffer just if it does not exists previously.
|
||||||
|
if existing == False:
|
||||||
|
# Ensure the user won't loose the focus after the new item is added.
|
||||||
|
focused_item = self.tab.list.get_selected()+1
|
||||||
|
self.session.db[self.name]["items"].insert(0, person)
|
||||||
|
self.insert(person, True)
|
||||||
|
# Selects back the previously focused item.
|
||||||
|
self.tab.list.select_item(focused_item)
|
||||||
|
|
||||||
|
def remove_person(self, user_id):
|
||||||
|
# Make sure the user is present in the buffer, otherwise don't attempt to remove a None Value from the list.
|
||||||
|
user = None
|
||||||
|
focused_user = self.get_post()
|
||||||
|
for i in self.session.db[self.name]["items"]:
|
||||||
|
if i["id"] == user_id:
|
||||||
|
user = i
|
||||||
|
break
|
||||||
|
if user != None:
|
||||||
|
person_index = self.session.db[self.name]["items"].index(user)
|
||||||
|
focused_item = self.tab.list.get_selected()
|
||||||
|
self.session.db[self.name]["items"].pop(person_index)
|
||||||
|
self.tab.list.remove_item(person_index)
|
||||||
|
if user != focused_user:
|
||||||
|
# Let's find the position of the previously focused user.
|
||||||
|
focus = None
|
||||||
|
for i in range(0, len(self.session.db[self.name]["items"])):
|
||||||
|
if focused_user["id"] == self.session.db[self.name]["items"][i]["id"]:
|
||||||
|
self.tab.list.select_item(i)
|
||||||
|
return
|
||||||
|
elif user == focused_user and person_index < self.tab.list.get_count():
|
||||||
|
self.tab.list.select_item(person_index)
|
||||||
|
else:
|
||||||
|
self.tab.list.select_item(self.tab.list.get_count()-1)
|
||||||
|
|
||||||
|
def get_friend(self, user_id):
|
||||||
|
for i in self.session.db["friends_"]["items"]:
|
||||||
|
if i["id"] == user_id:
|
||||||
|
return i
|
||||||
|
log.exception("Getting user manually...")
|
||||||
|
user = self.session.vk.client.users.get(user_ids=event.user_id, fields="last_seen")[0]
|
||||||
|
return user
|
||||||
|
|
||||||
|
def update_online(self):
|
||||||
|
online_users = self.session.vk.client.friends.getOnline()
|
||||||
|
now = time.time()
|
||||||
|
for i in self.session.db[self.name]["items"]:
|
||||||
|
if i["id"] in online_users:
|
||||||
|
i["last_seen"]["time"] = now
|
||||||
|
else:
|
||||||
|
log.exception("Removing an user from online status manually... %r" % (i))
|
||||||
|
self.remove_person(i["id"])
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
url = "https://vk.com/id{user_id}".format(user_id=post["id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
125
src/controller/buffers/video.py
Normal file
125
src/controller/buffers/video.py
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import wx
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from wxUI.tabs import video
|
||||||
|
from wxUI import commonMessages, menus
|
||||||
|
from controller import selector
|
||||||
|
from .wall import wallBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.video")
|
||||||
|
|
||||||
|
class videoBuffer(wallBuffer):
|
||||||
|
""" This buffer represents video elements, and it can be used for showing videos for the logged user or someone else."""
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = video.videoTab(parent)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
widgetUtils.connect_event(self.tab.play, widgetUtils.BUTTON_PRESSED, self.play_audio)
|
||||||
|
super(videoBuffer, self).connect_events()
|
||||||
|
|
||||||
|
def play_audio(self, *args, **kwargs):
|
||||||
|
""" Due to inheritance this method should be called play_audio, but play the currently focused video.
|
||||||
|
Opens a webbrowser pointing to the video's URL."""
|
||||||
|
selected = self.tab.list.get_selected()
|
||||||
|
if self.tab.list.get_count() == 0:
|
||||||
|
return
|
||||||
|
if selected == -1:
|
||||||
|
selected = 0
|
||||||
|
output.speak(_("Opening video in webbrowser..."))
|
||||||
|
webbrowser.open_new_tab(self.session.db[self.name]["items"][selected]["player"])
|
||||||
|
# print self.session.db[self.name]["items"][selected]
|
||||||
|
return True
|
||||||
|
|
||||||
|
def open_post(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def remove_buffer(self, mandatory=False):
|
||||||
|
if "me_video" == self.name:
|
||||||
|
output.speak(_("This buffer can't be deleted"))
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if mandatory == False:
|
||||||
|
dlg = commonMessages.remove_buffer()
|
||||||
|
else:
|
||||||
|
dlg = widgetUtils.YES
|
||||||
|
if dlg == widgetUtils.YES:
|
||||||
|
self.session.db.pop(self.name)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def get_more_items(self, *args, **kwargs):
|
||||||
|
# Translators: Some buffers can't use the get previous item feature due to API limitations.
|
||||||
|
output.speak(_("This buffer doesn't support getting more items."))
|
||||||
|
|
||||||
|
def onFocus(self, event, *args, **kwargs):
|
||||||
|
event.Skip()
|
||||||
|
|
||||||
|
def add_to_library(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
args = {}
|
||||||
|
args["video_id"] = post["id"]
|
||||||
|
if "album_id" in post:
|
||||||
|
args["album_id"] = post["album_id"]
|
||||||
|
args["owner_id"] = post["owner_id"]
|
||||||
|
video = self.session.vk.client.video.add(**args)
|
||||||
|
if video != None and int(video) > 21:
|
||||||
|
output.speak(_("Video added to your library"))
|
||||||
|
|
||||||
|
def remove_from_library(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
args = {}
|
||||||
|
args["video_id"] = post["id"]
|
||||||
|
args["owner_id"] = self.session.user_id
|
||||||
|
result = self.session.vk.client.video.delete(**args)
|
||||||
|
if int(result) == 1:
|
||||||
|
output.speak(_("Removed video from library"))
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def move_to_album(self, *args, **kwargs):
|
||||||
|
if len(self.session.video_albums) == 0:
|
||||||
|
return commonMessages.no_video_albums()
|
||||||
|
post= self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
album = selector.album(_("Select the album where you want to move this video"), self.session, "video_albums")
|
||||||
|
if album.item == None: return
|
||||||
|
id = post["id"]
|
||||||
|
response = self.session.vk.client.video.addToAlbum(album_ids=album.item, video_id=id, target_id=self.session.user_id, owner_id=self.get_post()["owner_id"])
|
||||||
|
if response == 1:
|
||||||
|
# Translators: Used when the user has moved an video to an album.
|
||||||
|
output.speak(_("Moved"))
|
||||||
|
|
||||||
|
def get_menu(self):
|
||||||
|
""" We'll use the same menu that is used for audio items, as the options are exactly the same"""
|
||||||
|
p = self.get_post()
|
||||||
|
if p == None:
|
||||||
|
return
|
||||||
|
m = menus.audioMenu()
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.move_to_album, menuitem=m.move)
|
||||||
|
# if owner_id is the current user, the audio is added to the user's audios.
|
||||||
|
if p["owner_id"] == self.session.user_id:
|
||||||
|
m.library.SetItemLabel(_("&Remove"))
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.remove_from_library, menuitem=m.library)
|
||||||
|
else:
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.add_to_library, menuitem=m.library)
|
||||||
|
return m
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
url = "https://vk.com/video{user_id}_{video_id}".format(user_id=post["owner_id"], video_id=post["id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
30
src/controller/buffers/videoAlbum.py
Normal file
30
src/controller/buffers/videoAlbum.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import wx
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from wxUI.tabs import videoAlbum
|
||||||
|
from .video import videoBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers")
|
||||||
|
|
||||||
|
class videoAlbumBuffer(videoBuffer):
|
||||||
|
|
||||||
|
def create_tab(self, parent):
|
||||||
|
self.tab = video.videoAlbumTab(parent)
|
||||||
|
self.tab.play.Enable(False)
|
||||||
|
self.connect_events()
|
||||||
|
self.tab.name = self.name
|
||||||
|
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
|
||||||
|
self.tab.post.Enable(False)
|
||||||
|
|
||||||
|
def connect_events(self):
|
||||||
|
super(videoAlbumBuffer, self).connect_events()
|
||||||
|
widgetUtils.connect_event(self.tab.load, widgetUtils.BUTTON_PRESSED, self.load_album)
|
||||||
|
|
||||||
|
def load_album(self, *args, **kwargs):
|
||||||
|
output.speak(_("Loading album..."))
|
||||||
|
self.can_get_items = True
|
||||||
|
self.tab.load.Enable(False)
|
||||||
|
wx.CallAfter(self.get_items)
|
||||||
|
self.tab.play.Enable(True)
|
104
src/controller/buffers/wall.py
Normal file
104
src/controller/buffers/wall.py
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
|
||||||
|
import logging
|
||||||
|
import webbrowser
|
||||||
|
import wx
|
||||||
|
import presenters
|
||||||
|
import views
|
||||||
|
import interactors
|
||||||
|
import widgetUtils
|
||||||
|
import output
|
||||||
|
from pubsub import pub
|
||||||
|
from vk_api.exceptions import VkApiError
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import commonMessages
|
||||||
|
from .home import homeBuffer
|
||||||
|
|
||||||
|
log = logging.getLogger("controller.buffers.wall")
|
||||||
|
|
||||||
|
class wallBuffer(homeBuffer):
|
||||||
|
""" This buffer represents an user's wall. It may be used either for the current user or someone else."""
|
||||||
|
|
||||||
|
def get_items(self, show_nextpage=False):
|
||||||
|
""" Update buffer with newest items or get older items in the buffer."""
|
||||||
|
if self.can_get_items == False: return
|
||||||
|
retrieved = True
|
||||||
|
try:
|
||||||
|
num = getattr(self.session, "get_page")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs)
|
||||||
|
except VkApiError as err:
|
||||||
|
log.error("Error {0}: {1}".format(err.code, err.error))
|
||||||
|
retrieved = err.code
|
||||||
|
return retrieved
|
||||||
|
except:
|
||||||
|
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
|
||||||
|
return False
|
||||||
|
if not hasattr(self, "tab"):
|
||||||
|
# Create GUI associated to this buffer.
|
||||||
|
self.create_tab(self.parent)
|
||||||
|
# Add name to the new control so we could look for it when needed.
|
||||||
|
self.tab.name = self.name
|
||||||
|
if show_nextpage == False:
|
||||||
|
if self.tab.list.get_count() > 0 and num > 0:
|
||||||
|
v = [i for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
v.reverse()
|
||||||
|
[wx.CallAfter(self.insert, i, True) for i in v]
|
||||||
|
else:
|
||||||
|
[wx.CallAfter(self.insert, i) for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
else:
|
||||||
|
if num > 0:
|
||||||
|
[wx.CallAfter(self.insert, i, False) for i in self.session.db[self.name]["items"][-num:]]
|
||||||
|
return retrieved
|
||||||
|
|
||||||
|
def remove_buffer(self, mandatory=False):
|
||||||
|
""" Remove buffer if the current buffer is not the logged user's wall."""
|
||||||
|
if "me_feed" == self.name:
|
||||||
|
output.speak(_("This buffer can't be deleted"))
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if mandatory == False:
|
||||||
|
dlg = commonMessages.remove_buffer()
|
||||||
|
else:
|
||||||
|
dlg = widgetUtils.YES
|
||||||
|
if dlg == widgetUtils.YES:
|
||||||
|
self.session.db.pop(self.name)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(wallBuffer, self).__init__(*args, **kwargs)
|
||||||
|
self.user_key = "from_id"
|
||||||
|
self.post_key = "id"
|
||||||
|
self.can_post = True
|
||||||
|
self.can_write_private_message = True
|
||||||
|
# if this is an user timeline we must check permissions to hide buttons when needed.
|
||||||
|
if "owner_id" in self.kwargs and self.kwargs["owner_id"] > 0 and "feed" in self.name:
|
||||||
|
permissions = self.session.vk.client.users.get(user_ids=self.kwargs["owner_id"], fields="can_post, can_see_all_posts, can_write_private_message")
|
||||||
|
self.can_post = permissions[0]["can_post"]
|
||||||
|
self.can_see_all_posts = permissions[0]["can_see_all_posts"]
|
||||||
|
self.can_write_private_message = permissions[0]["can_write_private_message"]
|
||||||
|
log.debug("Checked permissions on buffer {0}, permissions were {1}".format(self.name, permissions))
|
||||||
|
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
""" Create a post in the wall for the specified user
|
||||||
|
This process is handled in two parts. This is the first part, where the GUI is created and user can send the post.
|
||||||
|
During the second part (threaded), the post will be sent to the API."""
|
||||||
|
if "owner_id" not in self.kwargs:
|
||||||
|
return super(wallBuffer, self).post()
|
||||||
|
owner_id = self.kwargs["owner_id"]
|
||||||
|
user = self.session.get_user(owner_id, key="user1")
|
||||||
|
title = _("Post to {user1_nom}'s wall").format(**user)
|
||||||
|
p = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=title, message="", text=""))
|
||||||
|
if hasattr(p, "text") or hasattr(p, "privacy"):
|
||||||
|
post_arguments=dict(privacy=p.privacy, message=p.text, owner_id=owner_id)
|
||||||
|
attachments = []
|
||||||
|
if hasattr(p, "attachments"):
|
||||||
|
attachments = p.attachments
|
||||||
|
call_threaded(pub.sendMessage, "post", parent_endpoint="wall", child_endpoint="post", from_buffer=self.name, attachments_list=attachments, post_arguments=post_arguments)
|
||||||
|
|
||||||
|
def open_in_browser(self, *args, **kwargs):
|
||||||
|
post = self.get_post()
|
||||||
|
if post == None:
|
||||||
|
return
|
||||||
|
url = "https://vk.com/wall{user_id}_{post_id}".format(user_id=post["from_id"], post_id=post["id"])
|
||||||
|
webbrowser.open_new_tab(url)
|
@ -99,7 +99,7 @@ class Controller(object):
|
|||||||
self.connect_pubsub_events()
|
self.connect_pubsub_events()
|
||||||
self.connect_gui_events()
|
self.connect_gui_events()
|
||||||
self.create_controls()
|
self.create_controls()
|
||||||
call_threaded(updater.do_update, update_type=self.session.settings["general"]["update_channel"])
|
call_threaded(updater.do_update)
|
||||||
|
|
||||||
def is_focused(self):
|
def is_focused(self):
|
||||||
""" Return True if the Socializer Window is Focused. """
|
""" Return True if the Socializer Window is Focused. """
|
||||||
@ -127,12 +127,12 @@ class Controller(object):
|
|||||||
pub.sendMessage("create_buffer", buffer_type="videoBuffer", buffer_title=_("My videos"), parent_tab="videos", kwargs=dict(parent=self.window.tb, name="me_video", composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"]))
|
pub.sendMessage("create_buffer", buffer_type="videoBuffer", buffer_title=_("My videos"), parent_tab="videos", kwargs=dict(parent=self.window.tb, name="me_video", composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"]))
|
||||||
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("Albums"), parent_tab="videos", kwargs=dict(parent=self.window.tb, name="video_albums"))
|
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("Albums"), parent_tab="videos", kwargs=dict(parent=self.window.tb, name="video_albums"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("People"), kwargs=dict(parent=self.window.tb, name="people"))
|
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("People"), kwargs=dict(parent=self.window.tb, name="people"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="peopleBuffer", buffer_title=_("Online"), parent_tab="people", kwargs=dict(parent=self.window.tb, name="online_friends", composefunc="render_person", session=self.session, endpoint="getOnline", parent_endpoint="friends", count=5000, order="hints", fields="uid, first_name, last_name, last_seen, can_post"))
|
pub.sendMessage("create_buffer", buffer_type="peopleBuffer", buffer_title=_("Online"), parent_tab="people", kwargs=dict(parent=self.window.tb, name="online_friends", composefunc="render_person", session=self.session, endpoint="getOnline", parent_endpoint="friends", count=5000, order="hints", fields="uid, first_name, last_name, last_seen, can_post, can_write_private_message"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="peopleBuffer", buffer_title=_("All friends"), parent_tab="people", kwargs=dict(parent=self.window.tb, name="friends_", composefunc="render_person", session=self.session, endpoint="get", parent_endpoint="friends", count=5000, order="hints", fields="uid, first_name, last_name, last_seen, can_post"))
|
pub.sendMessage("create_buffer", buffer_type="peopleBuffer", buffer_title=_("All friends"), parent_tab="people", kwargs=dict(parent=self.window.tb, name="friends_", composefunc="render_person", session=self.session, endpoint="get", parent_endpoint="friends", count=5000, order="hints", fields="uid, first_name, last_name, last_seen, can_post, can_write_private_message"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("Friendship requests"), parent_tab="people", kwargs=dict(parent=self.window.tb, name="requests"))
|
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("Friendship requests"), parent_tab="people", kwargs=dict(parent=self.window.tb, name="requests"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="requestsBuffer", buffer_title=_("Pending requests"), parent_tab="requests", kwargs=dict(parent=self.window.tb, name="friend_requests", composefunc="render_person", session=self.session, count=1000, fields="can_post"))
|
pub.sendMessage("create_buffer", buffer_type="requestsBuffer", buffer_title=_("Pending requests"), parent_tab="requests", kwargs=dict(parent=self.window.tb, name="friend_requests", composefunc="render_person", session=self.session, count=1000, fields="can_post, can_write_private_message"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="requestsBuffer", buffer_title=_("I follow"), parent_tab="requests", kwargs=dict(parent=self.window.tb, name="friend_requests_sent", composefunc="render_person", session=self.session, count=1000, out=1, fields="can_post"))
|
pub.sendMessage("create_buffer", buffer_type="requestsBuffer", buffer_title=_("I follow"), parent_tab="requests", kwargs=dict(parent=self.window.tb, name="friend_requests_sent", composefunc="render_person", session=self.session, count=1000, out=1, fields="can_post, can_write_private_message"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="requestsBuffer", buffer_title=_("Subscribers"), parent_tab="requests", kwargs=dict(parent=self.window.tb, name="subscribers", composefunc="render_person", session=self.session, count=1000, need_viewed=1, fields="can_post"))
|
pub.sendMessage("create_buffer", buffer_type="requestsBuffer", buffer_title=_("Subscribers"), parent_tab="requests", kwargs=dict(parent=self.window.tb, name="subscribers", composefunc="render_person", session=self.session, count=1000, need_viewed=1, fields="can_post, can_write_private_message"))
|
||||||
# pub.sendMessage("create_buffer", buffer_type="notificationBuffer", buffer_title=_("Notifications"), parent_tab=None, loadable=False, kwargs=dict(parent=self.window.tb, name="notifications", composefunc="render_notification", session=self.session, endpoint="get", parent_endpoint="notifications", count=100, filters="wall,mentions,comments,likes,reposted,followers,friends"))
|
# pub.sendMessage("create_buffer", buffer_type="notificationBuffer", buffer_title=_("Notifications"), parent_tab=None, loadable=False, kwargs=dict(parent=self.window.tb, name="notifications", composefunc="render_notification", session=self.session, endpoint="get", parent_endpoint="notifications", count=100, filters="wall,mentions,comments,likes,reposted,followers,friends"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="documentBuffer", buffer_title=_("Documents"), parent_tab=None, loadable=True, kwargs=dict(parent=self.window.tb, name="documents", composefunc="render_document", session=self.session, endpoint="get", parent_endpoint="docs"))
|
pub.sendMessage("create_buffer", buffer_type="documentBuffer", buffer_title=_("Documents"), parent_tab=None, loadable=True, kwargs=dict(parent=self.window.tb, name="documents", composefunc="render_document", session=self.session, endpoint="get", parent_endpoint="docs"))
|
||||||
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("Groups"), kwargs=dict(parent=self.window.tb, name="communities"))
|
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("Groups"), kwargs=dict(parent=self.window.tb, name="communities"))
|
||||||
@ -173,11 +173,16 @@ class Controller(object):
|
|||||||
def create_unread_messages(self):
|
def create_unread_messages(self):
|
||||||
try:
|
try:
|
||||||
log.debug("Creating conversation buffers...")
|
log.debug("Creating conversation buffers...")
|
||||||
msgs = self.session.vk.client.messages.getConversations(count=200)
|
msgs = self.session.vk.client.messages.getConversations(count=200, filter="all")
|
||||||
|
log.debug("Total conversations count: {}".format(msgs.get("count")))
|
||||||
|
log.debug("total conversations returned by VK: {}".format(len(msgs["items"])))
|
||||||
|
log.debug("Dictionary keys of conversations object: {}".format(msgs.keys()))
|
||||||
except VkApiError as ex:
|
except VkApiError as ex:
|
||||||
if ex.code == 6:
|
if ex.code == 6:
|
||||||
log.exception("Something went wrong when getting messages. Waiting a second to retry")
|
log.exception("Something went wrong when getting messages. Waiting a second to retry")
|
||||||
|
log.debug("Creating buffer conversation for {} buffers".format(len(msgs["items"])))
|
||||||
for i in msgs["items"]:
|
for i in msgs["items"]:
|
||||||
|
log.debug("Creating chat buffer for peer_id {}".format(i["last_message"]["peer_id"]))
|
||||||
self.chat_from_id(i["last_message"]["peer_id"], setfocus=False, unread=False)
|
self.chat_from_id(i["last_message"]["peer_id"], setfocus=False, unread=False)
|
||||||
|
|
||||||
def get_audio_albums(self, user_id=None, create_buffers=True, force_action=False):
|
def get_audio_albums(self, user_id=None, create_buffers=True, force_action=False):
|
||||||
@ -187,7 +192,7 @@ class Controller(object):
|
|||||||
if self.session.settings["vk"]["use_alternative_tokens"]:
|
if self.session.settings["vk"]["use_alternative_tokens"]:
|
||||||
albums = self.session.vk.client_audio.get_albums(owner_id=user_id)
|
albums = self.session.vk.client_audio.get_albums(owner_id=user_id)
|
||||||
else:
|
else:
|
||||||
albums = self.session.vk.client.audio.getPlaylists(owner_id=user_id)
|
albums = self.session.vk.client.audio.getPlaylists(owner_id=user_id, count=100)
|
||||||
albums = albums["items"]
|
albums = albums["items"]
|
||||||
self.session.audio_albums = albums
|
self.session.audio_albums = albums
|
||||||
if create_buffers:
|
if create_buffers:
|
||||||
@ -198,7 +203,7 @@ class Controller(object):
|
|||||||
if self.session.settings["load_at_startup"]["video_albums"] == False and force_action == False:
|
if self.session.settings["load_at_startup"]["video_albums"] == False and force_action == False:
|
||||||
return
|
return
|
||||||
log.debug("Create video albums...")
|
log.debug("Create video albums...")
|
||||||
albums = self.session.vk.client.video.getAlbums(owner_id=user_id)
|
albums = self.session.vk.client.video.getAlbums(owner_id=user_id, count=100)
|
||||||
self.session.video_albums = albums["items"]
|
self.session.video_albums = albums["items"]
|
||||||
if create_buffers:
|
if create_buffers:
|
||||||
for i in albums["items"]:
|
for i in albums["items"]:
|
||||||
@ -243,7 +248,7 @@ class Controller(object):
|
|||||||
wx.CallAfter(self.window.change_status, _("Loading items for {0}").format(i.name,))
|
wx.CallAfter(self.window.change_status, _("Loading items for {0}").format(i.name,))
|
||||||
i.get_items()
|
i.get_items()
|
||||||
wx.CallAfter(self.window.change_status, _("Ready"))
|
wx.CallAfter(self.window.change_status, _("Ready"))
|
||||||
call_threaded(self.create_unread_messages)
|
self.create_unread_messages()
|
||||||
self.status_setter = RepeatingTimer(280, self.set_online)
|
self.status_setter = RepeatingTimer(280, self.set_online)
|
||||||
self.status_setter.start()
|
self.status_setter.start()
|
||||||
self.set_online(notify=True)
|
self.set_online(notify=True)
|
||||||
@ -307,6 +312,7 @@ class Controller(object):
|
|||||||
pub.subscribe(self.in_post, "posted")
|
pub.subscribe(self.in_post, "posted")
|
||||||
pub.subscribe(self.post_failed, "postFailed")
|
pub.subscribe(self.post_failed, "postFailed")
|
||||||
pub.subscribe(self.download, "download-file")
|
pub.subscribe(self.download, "download-file")
|
||||||
|
pub.subscribe(self.download_files, "download-files")
|
||||||
pub.subscribe(self.view_post, "open-post")
|
pub.subscribe(self.view_post, "open-post")
|
||||||
pub.subscribe(self.update_status_bar, "update-status-bar")
|
pub.subscribe(self.update_status_bar, "update-status-bar")
|
||||||
pub.subscribe(self.chat_from_id, "new-chat")
|
pub.subscribe(self.chat_from_id, "new-chat")
|
||||||
@ -319,8 +325,10 @@ class Controller(object):
|
|||||||
pub.subscribe(self.handle_longpoll_read_timeout, "longpoll-read-timeout")
|
pub.subscribe(self.handle_longpoll_read_timeout, "longpoll-read-timeout")
|
||||||
pub.subscribe(self.create_buffer, "create_buffer")
|
pub.subscribe(self.create_buffer, "create_buffer")
|
||||||
pub.subscribe(self.user_typing, "user-typing")
|
pub.subscribe(self.user_typing, "user-typing")
|
||||||
|
pub.subscribe(self.edit_message, "edit-message")
|
||||||
pub.subscribe(self.get_chat, "order-sent-message")
|
pub.subscribe(self.get_chat, "order-sent-message")
|
||||||
pub.subscribe(self.create_timeline, "create-timeline")
|
pub.subscribe(self.create_timeline, "create-timeline")
|
||||||
|
pub.subscribe(self.api_error, "api-error")
|
||||||
|
|
||||||
def disconnect_events(self):
|
def disconnect_events(self):
|
||||||
log.debug("Disconnecting some events...")
|
log.debug("Disconnecting some events...")
|
||||||
@ -393,6 +401,10 @@ class Controller(object):
|
|||||||
buffer.tab.text.SetFocus()
|
buffer.tab.text.SetFocus()
|
||||||
buffer.attachments_to_be_sent = attachments_list
|
buffer.attachments_to_be_sent = attachments_list
|
||||||
|
|
||||||
|
def api_error(self, code):
|
||||||
|
""" Display an understandable error dialog to users. """
|
||||||
|
commonMessages.vk_error(code)
|
||||||
|
|
||||||
def download(self, url, filename):
|
def download(self, url, filename):
|
||||||
""" Download a file to te current user's computer.
|
""" Download a file to te current user's computer.
|
||||||
@ url: The URl from where the file can be directly accessed.
|
@ url: The URl from where the file can be directly accessed.
|
||||||
@ -401,7 +413,10 @@ class Controller(object):
|
|||||||
"""
|
"""
|
||||||
url = utils.transform_audio_url(url)
|
url = utils.transform_audio_url(url)
|
||||||
log.debug("downloading %s URL to %s filename" % (url, filename,))
|
log.debug("downloading %s URL to %s filename" % (url, filename,))
|
||||||
call_threaded(utils.download_file, url, filename, self.window)
|
call_threaded(utils.download_file, url, filename)
|
||||||
|
|
||||||
|
def download_files(self, downloads):
|
||||||
|
call_threaded(utils.download_files, downloads)
|
||||||
|
|
||||||
def view_post(self, post_object, controller_, vars=dict()):
|
def view_post(self, post_object, controller_, vars=dict()):
|
||||||
""" Display the passed post in the passed post presenter.
|
""" Display the passed post in the passed post presenter.
|
||||||
@ -422,8 +437,10 @@ class Controller(object):
|
|||||||
@ setfocus boolean: If set to True, the buffer will receive focus automatically right after being created.
|
@ setfocus boolean: If set to True, the buffer will receive focus automatically right after being created.
|
||||||
@ unread: if set to True, the last message of the buffer will be marked as unread
|
@ unread: if set to True, the last message of the buffer will be marked as unread
|
||||||
"""
|
"""
|
||||||
|
log.debug("Received request to create buffer for conversation {0} with args of unread={1}, setfocus={2}".format(user_id, unread, setfocus))
|
||||||
b = self.search_chat_buffer(user_id)
|
b = self.search_chat_buffer(user_id)
|
||||||
if b != None:
|
if b != None:
|
||||||
|
log.debug("Chat buffer found. Skipping...")
|
||||||
pos = self.window.search(b.name)
|
pos = self.window.search(b.name)
|
||||||
if setfocus:
|
if setfocus:
|
||||||
self.window.change_buffer(pos)
|
self.window.change_buffer(pos)
|
||||||
@ -431,12 +448,18 @@ class Controller(object):
|
|||||||
return
|
return
|
||||||
# Get name based in the ID.
|
# Get name based in the ID.
|
||||||
# for users.
|
# for users.
|
||||||
|
log.debug("Determining name for buffer...")
|
||||||
if user_id > 0 and user_id < 2000000000:
|
if user_id > 0 and user_id < 2000000000:
|
||||||
user = self.session.get_user(user_id, key="user1")
|
user = self.session.get_user(user_id, key="user1")
|
||||||
name = user["user1_nom"]
|
name = user["user1_nom"]
|
||||||
elif user_id > 2000000000:
|
elif user_id > 2000000000:
|
||||||
chat = self.session.vk.client.messages.getChat(chat_id=user_id-2000000000)
|
chat = self.session.vk.client.messages.getChat(chat_id=user_id-2000000000)
|
||||||
name = chat["title"]
|
name = chat["title"]
|
||||||
|
log.debug("Buffer name: {}".format(name,))
|
||||||
|
elif user_id < -20000000:
|
||||||
|
app = self.session.vk.client.apps.get(id=user_id*-1)
|
||||||
|
log.debug(app)
|
||||||
|
name = app["items"][0]["title"]
|
||||||
pub.sendMessage("create_buffer", buffer_type="chatBuffer", buffer_title=name, parent_tab="chats", get_items=True, kwargs=dict(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="render_message", parent_endpoint="messages", endpoint="getHistory", session=self.session, unread=unread, count=self.session.settings["buffers"]["count_for_chat_buffers"], peer_id=user_id, rev=0, extended=True, fields="id, user_id, date, read_state, out, body, attachments, deleted"))
|
pub.sendMessage("create_buffer", buffer_type="chatBuffer", buffer_title=name, parent_tab="chats", get_items=True, kwargs=dict(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="render_message", parent_endpoint="messages", endpoint="getHistory", session=self.session, unread=unread, count=self.session.settings["buffers"]["count_for_chat_buffers"], peer_id=user_id, rev=0, extended=True, fields="id, user_id, date, read_state, out, body, attachments, deleted"))
|
||||||
# if setfocus:
|
# if setfocus:
|
||||||
# pos = self.window.search(buffer.name)
|
# pos = self.window.search(buffer.name)
|
||||||
@ -504,7 +527,7 @@ class Controller(object):
|
|||||||
Native notifications are made with WX and don't have sound, while custom notifications have sound but are not displayed in the window.
|
Native notifications are made with WX and don't have sound, while custom notifications have sound but are not displayed in the window.
|
||||||
"""
|
"""
|
||||||
if type == "native":
|
if type == "native":
|
||||||
self.window.notify(_("Socializer"), message)
|
wx.CallAfter(self.window.notify, _("Socializer"), message)
|
||||||
else:
|
else:
|
||||||
if sound != "":
|
if sound != "":
|
||||||
self.session.soundplayer.play(sound)
|
self.session.soundplayer.play(sound)
|
||||||
@ -521,6 +544,7 @@ class Controller(object):
|
|||||||
if hasattr(self, "longpoll"):
|
if hasattr(self, "longpoll"):
|
||||||
del self.longpoll
|
del self.longpoll
|
||||||
self.create_longpoll_thread(notify=True)
|
self.create_longpoll_thread(notify=True)
|
||||||
|
|
||||||
@wx_call_after
|
@wx_call_after
|
||||||
def create_buffer(self, buffer_type="baseBuffer", buffer_title="", parent_tab=None, loadable=False, get_items=False, kwargs={}):
|
def create_buffer(self, buffer_type="baseBuffer", buffer_title="", parent_tab=None, loadable=False, get_items=False, kwargs={}):
|
||||||
""" Create and insert a buffer in the specified place.
|
""" Create and insert a buffer in the specified place.
|
||||||
@ -530,6 +554,7 @@ class Controller(object):
|
|||||||
@loadable bool: If set to True, the new buffer will not be able to load contents until can_get_items will be set to True.
|
@loadable bool: If set to True, the new buffer will not be able to load contents until can_get_items will be set to True.
|
||||||
@get_items bool: If set to True, get_items will be called inmediately after creating the buffer.
|
@get_items bool: If set to True, get_items will be called inmediately after creating the buffer.
|
||||||
"""
|
"""
|
||||||
|
log.debug("Creating buffer of type {0} with parent_tab of {2} arguments {1}".format(buffer_type, kwargs, parent_tab))
|
||||||
if not hasattr(buffers, buffer_type):
|
if not hasattr(buffers, buffer_type):
|
||||||
raise AttributeError("Specified buffer type does not exist: %s" % (buffer_type,))
|
raise AttributeError("Specified buffer type does not exist: %s" % (buffer_type,))
|
||||||
buffer = getattr(buffers, buffer_type)(**kwargs)
|
buffer = getattr(buffers, buffer_type)(**kwargs)
|
||||||
@ -537,9 +562,11 @@ class Controller(object):
|
|||||||
buffer.can_get_items = False
|
buffer.can_get_items = False
|
||||||
self.buffers.append(buffer)
|
self.buffers.append(buffer)
|
||||||
if parent_tab == None:
|
if parent_tab == None:
|
||||||
|
log.debug("Appending buffer {}...".format(buffer,))
|
||||||
self.window.add_buffer(buffer.tab, buffer_title)
|
self.window.add_buffer(buffer.tab, buffer_title)
|
||||||
else:
|
else:
|
||||||
self.window.insert_buffer(buffer.tab, buffer_title, self.window.search(parent_tab))
|
self.window.insert_buffer(buffer.tab, buffer_title, self.window.search(parent_tab))
|
||||||
|
log.debug("Inserting buffer {0} into control {1}".format(buffer, self.window.search(parent_tab)))
|
||||||
if get_items:
|
if get_items:
|
||||||
call_threaded(buffer.get_items)
|
call_threaded(buffer.get_items)
|
||||||
|
|
||||||
@ -550,7 +577,11 @@ class Controller(object):
|
|||||||
buffer = self.search_chat_buffer(obj.user_id)
|
buffer = self.search_chat_buffer(obj.user_id)
|
||||||
if buffer != None and buffer == self.get_current_buffer() and self.is_focused():
|
if buffer != None and buffer == self.get_current_buffer() and self.is_focused():
|
||||||
user = self.session.get_user(obj.user_id)
|
user = self.session.get_user(obj.user_id)
|
||||||
output.speak(_("{user1_nom} is typing...").format(**user))
|
user1_nom = user["user1_nom"].split()[0]
|
||||||
|
output.speak(_("{user1_nom} is typing...").format(user1_nom=user1_nom))
|
||||||
|
|
||||||
|
def edit_message(self, obj):
|
||||||
|
print(vars(obj))
|
||||||
|
|
||||||
def get_chat(self, obj=None):
|
def get_chat(self, obj=None):
|
||||||
""" Searches or creates a chat buffer with the id of the user that is sending or receiving a message.
|
""" Searches or creates a chat buffer with the id of the user that is sending or receiving a message.
|
||||||
@ -567,9 +598,9 @@ class Controller(object):
|
|||||||
return
|
return
|
||||||
# If the chat already exists, let's create a dictionary wich will contains data of the received message.
|
# If the chat already exists, let's create a dictionary wich will contains data of the received message.
|
||||||
message.update(id=obj.message_id, user_id=uid, date=obj.timestamp, body=utils.clean_text(obj.text), attachments=obj.attachments)
|
message.update(id=obj.message_id, user_id=uid, date=obj.timestamp, body=utils.clean_text(obj.text), attachments=obj.attachments)
|
||||||
# if attachments is true, let's request for the full message with attachments formatted in a better way.
|
# if attachments is true or body contains at least an URL, let's request for the full message with attachments formatted in a better way.
|
||||||
# ToDo: code improvements. We shouldn't need to request the same message again just for these attachments.
|
# ToDo: code improvements. We shouldn't need to request the same message again just for these attachments.
|
||||||
if len(message["attachments"]) != 0:
|
if len(message["attachments"]) != 0 or len(utils.find_urls_in_text(message["body"])) != 0:
|
||||||
message_ids = message["id"]
|
message_ids = message["id"]
|
||||||
results = self.session.vk.client.messages.getById(message_ids=message_ids)
|
results = self.session.vk.client.messages.getById(message_ids=message_ids)
|
||||||
message = results["items"][0]
|
message = results["items"][0]
|
||||||
@ -610,7 +641,7 @@ class Controller(object):
|
|||||||
user = self.session.get_user(user_id, key="user1")
|
user = self.session.get_user(user_id, key="user1")
|
||||||
name_ = _("{user1_nom}'s videos").format(**user)
|
name_ = _("{user1_nom}'s videos").format(**user)
|
||||||
elif buffer_type == "friends":
|
elif buffer_type == "friends":
|
||||||
buffer = buffers.peopleBuffer(parent=self.window.tb, name="friends_{0}".format(user_id,), composefunc="render_person", session=self.session, create_tab=False, endpoint="get", parent_endpoint="friends", count=5000, fields="uid, first_name, last_name, last_seen", user_id=user_id)
|
buffer = buffers.peopleBuffer(parent=self.window.tb, name="friends_{0}".format(user_id,), composefunc="render_person", session=self.session, create_tab=False, endpoint="get", parent_endpoint="friends", count=5000, fields="uid, first_name, last_name, last_seen, can_post, can_write_private_message", user_id=user_id)
|
||||||
user = self.session.get_user(user_id, key="user1")
|
user = self.session.get_user(user_id, key="user1")
|
||||||
name_ = _("{user1_nom}'s friends").format(**user)
|
name_ = _("{user1_nom}'s friends").format(**user)
|
||||||
wx.CallAfter(self.complete_buffer_creation, buffer=buffer, name_=name_, position=self.window.search("timelines"))
|
wx.CallAfter(self.complete_buffer_creation, buffer=buffer, name_=name_, position=self.window.search("timelines"))
|
||||||
@ -618,6 +649,7 @@ class Controller(object):
|
|||||||
### GUI events
|
### GUI events
|
||||||
# These functions are connected to GUI elements such as menus, buttons and so on.
|
# These functions are connected to GUI elements such as menus, buttons and so on.
|
||||||
def connect_gui_events(self):
|
def connect_gui_events(self):
|
||||||
|
widgetUtils.connectExitFunction(self.exit_)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.CLOSE_EVENT, self.exit)
|
widgetUtils.connect_event(self.window, widgetUtils.CLOSE_EVENT, self.exit)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.update_buffer, menuitem=self.window.update_buffer)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.update_buffer, menuitem=self.window.update_buffer)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.check_for_updates, menuitem=self.window.check_for_updates)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.check_for_updates, menuitem=self.window.check_for_updates)
|
||||||
@ -654,6 +686,11 @@ class Controller(object):
|
|||||||
self.window.tb.Bind(wx.EVT_CONTEXT_MENU, self.on_context_menu)
|
self.window.tb.Bind(wx.EVT_CONTEXT_MENU, self.on_context_menu)
|
||||||
|
|
||||||
def exit(self, *args, **kwargs):
|
def exit(self, *args, **kwargs):
|
||||||
|
answer = commonMessages.exit()
|
||||||
|
if answer == widgetUtils.YES:
|
||||||
|
self.exit_()
|
||||||
|
|
||||||
|
def exit_(self, *args, **kwargs):
|
||||||
""" Try to set offline in the current user's profile at VK, then closes the application. """
|
""" Try to set offline in the current user's profile at VK, then closes the application. """
|
||||||
log.debug("Receibed an exit signal. closing...")
|
log.debug("Receibed an exit signal. closing...")
|
||||||
self.set_offline()
|
self.set_offline()
|
||||||
@ -670,13 +707,12 @@ class Controller(object):
|
|||||||
b.get_items()
|
b.get_items()
|
||||||
|
|
||||||
def check_for_updates(self, *args, **kwargs):
|
def check_for_updates(self, *args, **kwargs):
|
||||||
update = updater.do_update(update_type=self.session.settings["general"]["update_channel"])
|
update = updater.do_update()
|
||||||
if update == False:
|
if update == False:
|
||||||
commonMessages.no_update_available()
|
commonMessages.no_update_available()
|
||||||
|
|
||||||
def on_about(self, *args, **kwargs):
|
def on_about(self, *args, **kwargs):
|
||||||
channel = self.session.settings["general"]["update_channel"]
|
self.window.about_dialog()
|
||||||
self.window.about_dialog(channel)
|
|
||||||
|
|
||||||
def search_audios(self, *args, **kwargs):
|
def search_audios(self, *args, **kwargs):
|
||||||
dlg = searchDialogs.searchAudioDialog()
|
dlg = searchDialogs.searchAudioDialog()
|
||||||
@ -938,11 +974,14 @@ class Controller(object):
|
|||||||
elif "counters" in self.session.db["group_info"][current_buffer.group_id] and "docs" not in self.session.db["group_info"][current_buffer.group_id]["counters"]:
|
elif "counters" in self.session.db["group_info"][current_buffer.group_id] and "docs" not in self.session.db["group_info"][current_buffer.group_id]["counters"]:
|
||||||
menu.load_documents.Enable(False)
|
menu.load_documents.Enable(False)
|
||||||
# Connect the rest of the functions.
|
# Connect the rest of the functions.
|
||||||
|
print(self.session.db["group_info"][current_buffer.group_id])
|
||||||
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_posts, menuitem=menu.load_posts)
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_posts, menuitem=menu.load_posts)
|
||||||
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_topics, menuitem=menu.load_topics)
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_topics, menuitem=menu.load_topics)
|
||||||
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_members, menuitem=menu.load_members)
|
||||||
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_audios, menuitem=menu.load_audios)
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_audios, menuitem=menu.load_audios)
|
||||||
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_videos, menuitem=menu.load_videos)
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_videos, menuitem=menu.load_videos)
|
||||||
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_documents, menuitem=menu.load_documents)
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_documents, menuitem=menu.load_documents)
|
||||||
|
widgetUtils.connect_event(menu, widgetUtils.MENU, self.open_community_in_browser, menuitem=menu.open_in_browser)
|
||||||
# Deal with the communities section itself.
|
# Deal with the communities section itself.
|
||||||
elif current_buffer.name == "communities":
|
elif current_buffer.name == "communities":
|
||||||
menu = wx.Menu()
|
menu = wx.Menu()
|
||||||
@ -1025,6 +1064,27 @@ class Controller(object):
|
|||||||
new_name = current_buffer.name+"_topics"
|
new_name = current_buffer.name+"_topics"
|
||||||
pub.sendMessage("create_buffer", buffer_type="topicBuffer", buffer_title=_("Topics"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=new_name, composefunc="render_topic", session=self.session, endpoint="getTopics", parent_endpoint="board", count=100, group_id=-1*current_buffer.kwargs["owner_id"], extended=1))
|
pub.sendMessage("create_buffer", buffer_type="topicBuffer", buffer_title=_("Topics"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=new_name, composefunc="render_topic", session=self.session, endpoint="getTopics", parent_endpoint="board", count=100, group_id=-1*current_buffer.kwargs["owner_id"], extended=1))
|
||||||
|
|
||||||
|
def load_community_members(self, *args, **kwargs):
|
||||||
|
""" Load community members. """
|
||||||
|
current_buffer = self.get_current_buffer()
|
||||||
|
# Get group_info if the community buffer does not have it already, so future menus will be able to use it.
|
||||||
|
if current_buffer.group_id not in self.session.db["group_info"] or "counters" not in self.session.db["group_info"][current_buffer.group_id]:
|
||||||
|
group_info = self.session.vk.client.groups.getById(group_ids=-1*current_buffer.kwargs["owner_id"], fields="counters,can_create_topic,can_post")[0]
|
||||||
|
self.session.db["group_info"][current_buffer.kwargs["owner_id"]].update(group_info)
|
||||||
|
# Determine whether we can request ordering by time descending or not.
|
||||||
|
if (self.session.db["group_info"][current_buffer.group_id].get("is_admin") != None and self.session.db["group_info"][current_buffer.group_id].get("is_admin") == 1):
|
||||||
|
sorting = "time_desc"
|
||||||
|
else:
|
||||||
|
sorting = "id_desc"
|
||||||
|
# Apparently, only administrators in a community are able to see invited users on it, despite users can invite the amount of friends they want.
|
||||||
|
# ToDo: This needs testing in groups where the current user is not a full admin (such as moderator or editor).
|
||||||
|
if (self.session.db["group_info"][current_buffer.group_id].get("is_admin") != None and self.session.db["group_info"][current_buffer.group_id].get("is_admin") == 1):
|
||||||
|
pub.sendMessage("create_buffer", buffer_type="emptyBuffer", buffer_title=_("People"), parent_tab=current_buffer.tab.name, kwargs=dict(parent=self.window.tb, name=current_buffer.tab.name+"_people"))
|
||||||
|
pub.sendMessage("create_buffer", buffer_type="communityPeopleBuffer", buffer_title=_("Members"), parent_tab=current_buffer.name+"_people", get_items=True, kwargs=dict(parent=self.window.tb, name=current_buffer.name+"_members", composefunc="render_person", session=self.session, endpoint="getMembers", parent_endpoint="groups", count=1000, order=sorting, fields="uid, first_name, last_name, last_seen, can_post", group_id=-1*current_buffer.kwargs["owner_id"]))
|
||||||
|
pub.sendMessage("create_buffer", buffer_type="communityPeopleBuffer", buffer_title=_("Invited users"), parent_tab=current_buffer.name+"_people", get_items=True, kwargs=dict(parent=self.window.tb, name=current_buffer.name+"_invites", composefunc="render_person", session=self.session, endpoint="getInvitedUsers", parent_endpoint="groups", count=1000, fields="first_name, last_name, last_seen, can_post, can_write_private_message", group_id=-1*current_buffer.kwargs["owner_id"]))
|
||||||
|
else: # Create this for non administrators.
|
||||||
|
pub.sendMessage("create_buffer", buffer_type="communityPeopleBuffer", buffer_title=_("Members"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=current_buffer.name+"_members", composefunc="render_person", session=self.session, endpoint="getMembers", parent_endpoint="groups", count=1000, order=sorting, fields="uid, first_name, last_name, last_seen, can_post, can_write_private_message", group_id=-1*current_buffer.kwargs["owner_id"]))
|
||||||
|
|
||||||
def load_community_documents(self, *args, **kwargs):
|
def load_community_documents(self, *args, **kwargs):
|
||||||
current_buffer = self.get_current_buffer()
|
current_buffer = self.get_current_buffer()
|
||||||
# Get group_info if the community buffer does not have it already, so future menus will be able to use it.
|
# Get group_info if the community buffer does not have it already, so future menus will be able to use it.
|
||||||
@ -1037,6 +1097,11 @@ class Controller(object):
|
|||||||
new_name = current_buffer.name+"_documents"
|
new_name = current_buffer.name+"_documents"
|
||||||
pub.sendMessage("create_buffer", buffer_type="documentCommunityBuffer", buffer_title=_("Documents"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=new_name, composefunc="render_document", session=self.session, endpoint="get", parent_endpoint="docs", owner_id=current_buffer.kwargs["owner_id"]))
|
pub.sendMessage("create_buffer", buffer_type="documentCommunityBuffer", buffer_title=_("Documents"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=new_name, composefunc="render_document", session=self.session, endpoint="get", parent_endpoint="docs", owner_id=current_buffer.kwargs["owner_id"]))
|
||||||
|
|
||||||
|
def open_community_in_browser(self, *args, **kwargs):
|
||||||
|
current_buffer = self.get_current_buffer()
|
||||||
|
if current_buffer.name.endswith("_community"):
|
||||||
|
webbrowser.open_new_tab("https://vk.com/club{0}".format(-1*current_buffer.kwargs["owner_id"]))
|
||||||
|
|
||||||
def load_community_buffers(self, *args, **kwargs):
|
def load_community_buffers(self, *args, **kwargs):
|
||||||
""" Load all community buffers regardless of the setting present in optional buffers tab of the preferences dialog."""
|
""" Load all community buffers regardless of the setting present in optional buffers tab of the preferences dialog."""
|
||||||
call_threaded(self.get_communities, self.session.user_id, force_action=True)
|
call_threaded(self.get_communities, self.session.user_id, force_action=True)
|
||||||
|
@ -24,4 +24,3 @@ class album(object):
|
|||||||
if i["title"] == item:
|
if i["title"] == item:
|
||||||
return i["id"]
|
return i["id"]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import unicode_literals
|
||||||
from . import spellchecker
|
from . import spellchecker
|
||||||
import platform
|
import platform
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
@ -1,35 +1,36 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
from . import wx_ui
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import output
|
import output
|
||||||
import config
|
import config
|
||||||
import languageHandler
|
import languageHandler
|
||||||
|
import enchant
|
||||||
|
import paths
|
||||||
|
from . import twitterFilter
|
||||||
from enchant.checker import SpellChecker
|
from enchant.checker import SpellChecker
|
||||||
from enchant.errors import DictNotFoundError
|
from enchant.errors import DictNotFoundError
|
||||||
from enchant import tokenize
|
from enchant import tokenize
|
||||||
from . import wx_ui
|
|
||||||
|
|
||||||
log = logging.getLogger("extra.SpellChecker.spellChecker")
|
log = logging.getLogger("extra.SpellChecker.spellChecker")
|
||||||
|
|
||||||
class spellChecker(object):
|
class spellChecker(object):
|
||||||
def __init__(self, text, dictionary):
|
def __init__(self, text):
|
||||||
super(spellChecker, self).__init__()
|
super(spellChecker, self).__init__()
|
||||||
log.debug("Creating the SpellChecker object. Dictionary: %s" % (dictionary,))
|
|
||||||
self.active = True
|
self.active = True
|
||||||
try:
|
try:
|
||||||
if config.app["app-settings"]["language"] == "system":
|
if config.app["app-settings"]["language"] == "system":
|
||||||
log.debug("Using the system language")
|
log.debug("Using the system language")
|
||||||
self.checker = SpellChecker(languageHandler.curLang, filters=[tokenize.EmailFilter, tokenize.URLFilter])
|
self.dict = enchant.DictWithPWL(languageHandler.curLang[:2], os.path.join(paths.config_path(), "wordlist.dict"))
|
||||||
else:
|
else:
|
||||||
log.debug("Using language: %s" % (languageHandler.getLanguage(),))
|
log.debug("Using language: %s" % (languageHandler.getLanguage(),))
|
||||||
self.checker = SpellChecker(languageHandler.curLang, filters=[tokenize.EmailFilter, tokenize.URLFilter])
|
self.dict = enchant.DictWithPWL(languageHandler.getLanguage()[:2], os.path.join(paths.config_path(), "wordlist.dict"))
|
||||||
self.checker.set_text(text)
|
|
||||||
except DictNotFoundError:
|
except DictNotFoundError:
|
||||||
print("no dict")
|
log.exception("Dictionary for language %s not found." % (languageHandler.getLanguage(),))
|
||||||
log.exception("Dictionary for language %s not found." % (dictionary,))
|
|
||||||
wx_ui.dict_not_found_error()
|
wx_ui.dict_not_found_error()
|
||||||
self.active = False
|
self.active = False
|
||||||
|
self.checker = SpellChecker(self.dict, filters=[twitterFilter.TwitterFilter, tokenize.EmailFilter, tokenize.URLFilter])
|
||||||
|
self.checker.set_text(text)
|
||||||
if self.active == True:
|
if self.active == True:
|
||||||
log.debug("Creating dialog...")
|
log.debug("Creating dialog...")
|
||||||
self.dialog = wx_ui.spellCheckerDialog()
|
self.dialog = wx_ui.spellCheckerDialog()
|
||||||
@ -37,6 +38,7 @@ class spellChecker(object):
|
|||||||
widgetUtils.connect_event(self.dialog.ignoreAll, widgetUtils.BUTTON_PRESSED, self.ignoreAll)
|
widgetUtils.connect_event(self.dialog.ignoreAll, widgetUtils.BUTTON_PRESSED, self.ignoreAll)
|
||||||
widgetUtils.connect_event(self.dialog.replace, widgetUtils.BUTTON_PRESSED, self.replace)
|
widgetUtils.connect_event(self.dialog.replace, widgetUtils.BUTTON_PRESSED, self.replace)
|
||||||
widgetUtils.connect_event(self.dialog.replaceAll, widgetUtils.BUTTON_PRESSED, self.replaceAll)
|
widgetUtils.connect_event(self.dialog.replaceAll, widgetUtils.BUTTON_PRESSED, self.replaceAll)
|
||||||
|
widgetUtils.connect_event(self.dialog.add, widgetUtils.BUTTON_PRESSED, self.add)
|
||||||
self.check()
|
self.check()
|
||||||
self.dialog.get_response()
|
self.dialog.get_response()
|
||||||
self.fixed_text = self.checker.get_text()
|
self.fixed_text = self.checker.get_text()
|
||||||
@ -44,8 +46,8 @@ class spellChecker(object):
|
|||||||
def check(self):
|
def check(self):
|
||||||
try:
|
try:
|
||||||
next(self.checker)
|
next(self.checker)
|
||||||
textToSay = _("Misspelled word: %s") % (self.checker.word,)
|
textToSay = _(u"Misspelled word: %s") % (self.checker.word,)
|
||||||
context = "... %s %s %s" % (self.checker.leading_context(10), self.checker.word, self.checker.trailing_context(10))
|
context = u"... %s %s %s" % (self.checker.leading_context(10), self.checker.word, self.checker.trailing_context(10))
|
||||||
self.dialog.set_title(textToSay)
|
self.dialog.set_title(textToSay)
|
||||||
output.speak(textToSay)
|
output.speak(textToSay)
|
||||||
self.dialog.set_word_and_suggestions(word=self.checker.word, context=context, suggestions=self.checker.suggest())
|
self.dialog.set_word_and_suggestions(word=self.checker.word, context=context, suggestions=self.checker.suggest())
|
||||||
@ -69,6 +71,6 @@ class spellChecker(object):
|
|||||||
self.checker.replace_always(self.dialog.get_selected_suggestion())
|
self.checker.replace_always(self.dialog.get_selected_suggestion())
|
||||||
self.check()
|
self.check()
|
||||||
|
|
||||||
def clean(self):
|
def add(self, ev):
|
||||||
if hasattr(self, "dialog"):
|
self.checker.add()
|
||||||
self.dialog.Destroy()
|
self.check()
|
||||||
|
16
src/extra/SpellChecker/twitterFilter.py
Normal file
16
src/extra/SpellChecker/twitterFilter.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import re
|
||||||
|
from enchant.tokenize import Filter
|
||||||
|
|
||||||
|
class TwitterFilter(Filter):
|
||||||
|
"""Filter skipping over twitter usernames and hashtags.
|
||||||
|
This filter skips any words matching the following regular expression:
|
||||||
|
^[#@](\S){1, }$
|
||||||
|
That is, any words that resemble users and hashtags.
|
||||||
|
"""
|
||||||
|
_pattern = re.compile(r"^[#@](\S){1,}$")
|
||||||
|
def _skip(self,word):
|
||||||
|
if self._pattern.match(word):
|
||||||
|
return True
|
||||||
|
return False
|
@ -25,31 +25,33 @@ class spellCheckerDialog(wx.Dialog):
|
|||||||
super(spellCheckerDialog, self).__init__(None, 1)
|
super(spellCheckerDialog, self).__init__(None, 1)
|
||||||
panel = wx.Panel(self)
|
panel = wx.Panel(self)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
word = wx.StaticText(panel, -1, _("&Misspelled word"))
|
word = wx.StaticText(panel, -1, _(u"Misspelled word"))
|
||||||
self.word = wx.TextCtrl(panel, -1)
|
self.word = wx.TextCtrl(panel, -1)
|
||||||
wordBox = wx.BoxSizer(wx.HORIZONTAL)
|
wordBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
wordBox.Add(word, 0, wx.ALL, 5)
|
wordBox.Add(word, 0, wx.ALL, 5)
|
||||||
wordBox.Add(self.word, 0, wx.ALL, 5)
|
wordBox.Add(self.word, 0, wx.ALL, 5)
|
||||||
context = wx.StaticText(panel, -1, _("Con&text"))
|
context = wx.StaticText(panel, -1, _(u"Context"))
|
||||||
self.context = wx.TextCtrl(panel, -1)
|
self.context = wx.TextCtrl(panel, -1)
|
||||||
contextBox = wx.BoxSizer(wx.HORIZONTAL)
|
contextBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
contextBox.Add(context, 0, wx.ALL, 5)
|
contextBox.Add(context, 0, wx.ALL, 5)
|
||||||
contextBox.Add(self.context, 0, wx.ALL, 5)
|
contextBox.Add(self.context, 0, wx.ALL, 5)
|
||||||
suggest = wx.StaticText(panel, -1, _("&Suggestions"))
|
suggest = wx.StaticText(panel, -1, _(u"Suggestions"))
|
||||||
self.suggestions = wx.ListBox(panel, -1, choices=[], style=wx.LB_SINGLE)
|
self.suggestions = wx.ListBox(panel, -1, choices=[], style=wx.LB_SINGLE)
|
||||||
suggestionsBox = wx.BoxSizer(wx.HORIZONTAL)
|
suggestionsBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
suggestionsBox.Add(suggest, 0, wx.ALL, 5)
|
suggestionsBox.Add(suggest, 0, wx.ALL, 5)
|
||||||
suggestionsBox.Add(self.suggestions, 0, wx.ALL, 5)
|
suggestionsBox.Add(self.suggestions, 0, wx.ALL, 5)
|
||||||
self.ignore = wx.Button(panel, -1, _("&Ignore"))
|
self.ignore = wx.Button(panel, -1, _(u"&Ignore"))
|
||||||
self.ignoreAll = wx.Button(panel, -1, _("Ignore &all"))
|
self.ignoreAll = wx.Button(panel, -1, _(u"I&gnore all"))
|
||||||
self.replace = wx.Button(panel, -1, _("&Replace"))
|
self.replace = wx.Button(panel, -1, _(u"&Replace"))
|
||||||
self.replaceAll = wx.Button(panel, -1, _("Replace a&ll"))
|
self.replaceAll = wx.Button(panel, -1, _(u"R&eplace all"))
|
||||||
|
self.add = wx.Button(panel, -1, _(u"&Add to personal dictionary"))
|
||||||
close = wx.Button(panel, wx.ID_CANCEL)
|
close = wx.Button(panel, wx.ID_CANCEL)
|
||||||
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
btnBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
btnBox.Add(self.ignore, 0, wx.ALL, 5)
|
btnBox.Add(self.ignore, 0, wx.ALL, 5)
|
||||||
btnBox.Add(self.ignoreAll, 0, wx.ALL, 5)
|
btnBox.Add(self.ignoreAll, 0, wx.ALL, 5)
|
||||||
btnBox.Add(self.replace, 0, wx.ALL, 5)
|
btnBox.Add(self.replace, 0, wx.ALL, 5)
|
||||||
btnBox.Add(self.replaceAll, 0, wx.ALL, 5)
|
btnBox.Add(self.replaceAll, 0, wx.ALL, 5)
|
||||||
|
btnBox.Add(self.add, 0, wx.ALL, 5)
|
||||||
btnBox.Add(close, 0, wx.ALL, 5)
|
btnBox.Add(close, 0, wx.ALL, 5)
|
||||||
sizer.Add(wordBox, 0, wx.ALL, 5)
|
sizer.Add(wordBox, 0, wx.ALL, 5)
|
||||||
sizer.Add(contextBox, 0, wx.ALL, 5)
|
sizer.Add(contextBox, 0, wx.ALL, 5)
|
||||||
@ -58,6 +60,7 @@ class spellCheckerDialog(wx.Dialog):
|
|||||||
panel.SetSizer(sizer)
|
panel.SetSizer(sizer)
|
||||||
self.SetClientSize(sizer.CalcMin())
|
self.SetClientSize(sizer.CalcMin())
|
||||||
|
|
||||||
|
|
||||||
def get_response(self):
|
def get_response(self):
|
||||||
return self.ShowModal()
|
return self.ShowModal()
|
||||||
|
|
||||||
@ -74,7 +77,7 @@ class spellCheckerDialog(wx.Dialog):
|
|||||||
return self.suggestions.GetStringSelection()
|
return self.suggestions.GetStringSelection()
|
||||||
|
|
||||||
def dict_not_found_error():
|
def dict_not_found_error():
|
||||||
wx.MessageDialog(None, _("An error has occurred. There are no dictionaries available for the selected language in {0}").format(application.name,), _("Error"), wx.ICON_ERROR).ShowModal()
|
wx.MessageDialog(None, _(u"An error has occurred. There are no dictionaries available for the selected language in {0}").format(application.name,), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
||||||
|
|
||||||
def finished():
|
def finished():
|
||||||
wx.MessageDialog(None, _("Spell check complete."), application.name, style=wx.OK).ShowModal()
|
wx.MessageDialog(None, _(u"Spell check complete."), application.name, style=wx.OK).ShowModal()
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import platform
|
import platform
|
||||||
from . import translator
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
from . import wx_ui as gui
|
from . import wx_ui as gui
|
||||||
|
from . import translator
|
||||||
|
@ -1,115 +1,116 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
import logging
|
||||||
from builtins import zip
|
from googletrans import Translator, LANGUAGES
|
||||||
from yandex_translate import YandexTranslate
|
|
||||||
|
log = logging.getLogger("extras.translator")
|
||||||
|
|
||||||
|
# create a single translator instance
|
||||||
|
# see https://github.com/ssut/py-googletrans/issues/234
|
||||||
|
t = None
|
||||||
|
|
||||||
def translate(text="", target="en"):
|
def translate(text="", target="en"):
|
||||||
t = YandexTranslate("trnsl.1.1.20161012T134532Z.d01b9c75fc39aa74.7d1be75a5166a80583eeb020e10f584168da6bf7")
|
global t
|
||||||
vars = dict(text=text, lang=target)
|
log.debug("Received translation request for language %s, text=%s" % (target, text))
|
||||||
return t.translate(**vars)["text"][0]
|
if t == None:
|
||||||
|
t = Translator()
|
||||||
|
vars = dict(text=text, dest=target)
|
||||||
|
return t.translate(**vars).text
|
||||||
|
|
||||||
supported_langs = None
|
supported_langs = None
|
||||||
d = None
|
|
||||||
languages = {
|
languages = {
|
||||||
"af": _("Afrikaans"),
|
"af": _(u"Afrikaans"),
|
||||||
"sq": _("Albanian"),
|
"sq": _(u"Albanian"),
|
||||||
"am": _("Amharic"),
|
"am": _(u"Amharic"),
|
||||||
"ar": _("Arabic"),
|
"ar": _(u"Arabic"),
|
||||||
"hy": _("Armenian"),
|
"hy": _(u"Armenian"),
|
||||||
"az": _("Azerbaijani"),
|
"az": _(u"Azerbaijani"),
|
||||||
"eu": _("Basque"),
|
"eu": _(u"Basque"),
|
||||||
"be": _("Belarusian"),
|
"be": _(u"Belarusian"),
|
||||||
"bn": _("Bengali"),
|
"bn": _(u"Bengali"),
|
||||||
"bh": _("Bihari"),
|
"bh": _(u"Bihari"),
|
||||||
"bg": _("Bulgarian"),
|
"bg": _(u"Bulgarian"),
|
||||||
"my": _("Burmese"),
|
"my": _(u"Burmese"),
|
||||||
"ca": _("Catalan"),
|
"ca": _(u"Catalan"),
|
||||||
"chr": _("Cherokee"),
|
"chr": _(u"Cherokee"),
|
||||||
"zh": _("Chinese"),
|
"zh": _(u"Chinese"),
|
||||||
"zh-CN": _("Chinese_simplified"),
|
"zh-CN": _(u"Chinese_simplified"),
|
||||||
"zh-TW": _("Chinese_traditional"),
|
"zh-TW": _(u"Chinese_traditional"),
|
||||||
"hr": _("Croatian"),
|
"hr": _(u"Croatian"),
|
||||||
"cs": _("Czech"),
|
"cs": _(u"Czech"),
|
||||||
"da": _("Danish"),
|
"da": _(u"Danish"),
|
||||||
"dv": _("Dhivehi"),
|
"dv": _(u"Dhivehi"),
|
||||||
"nl": _("Dutch"),
|
"nl": _(u"Dutch"),
|
||||||
"en": _("English"),
|
"en": _(u"English"),
|
||||||
"eo": _("Esperanto"),
|
"eo": _(u"Esperanto"),
|
||||||
"et": _("Estonian"),
|
"et": _(u"Estonian"),
|
||||||
"tl": _("Filipino"),
|
"tl": _(u"Filipino"),
|
||||||
"fi": _("Finnish"),
|
"fi": _(u"Finnish"),
|
||||||
"fr": _("French"),
|
"fr": _(u"French"),
|
||||||
"gl": _("Galician"),
|
"gl": _(u"Galician"),
|
||||||
"ka": _("Georgian"),
|
"ka": _(u"Georgian"),
|
||||||
"de": _("German"),
|
"de": _(u"German"),
|
||||||
"el": _("Greek"),
|
"el": _(u"Greek"),
|
||||||
"gn": _("Guarani"),
|
"gn": _(u"Guarani"),
|
||||||
"gu": _("Gujarati"),
|
"gu": _(u"Gujarati"),
|
||||||
"iw": _("Hebrew"),
|
"iw": _(u"Hebrew"),
|
||||||
"hi": _("Hindi"),
|
"hi": _(u"Hindi"),
|
||||||
"hu": _("Hungarian"),
|
"hu": _(u"Hungarian"),
|
||||||
"is": _("Icelandic"),
|
"is": _(u"Icelandic"),
|
||||||
"id": _("Indonesian"),
|
"id": _(u"Indonesian"),
|
||||||
"iu": _("Inuktitut"),
|
"iu": _(u"Inuktitut"),
|
||||||
"ga": _("Irish"),
|
"ga": _(u"Irish"),
|
||||||
"it": _("Italian"),
|
"it": _(u"Italian"),
|
||||||
"ja": _("Japanese"),
|
"ja": _(u"Japanese"),
|
||||||
"kn": _("Kannada"),
|
"kn": _(u"Kannada"),
|
||||||
"kk": _("Kazakh"),
|
"kk": _(u"Kazakh"),
|
||||||
"km": _("Khmer"),
|
"km": _(u"Khmer"),
|
||||||
"ko": _("Korean"),
|
"ko": _(u"Korean"),
|
||||||
"ku": _("Kurdish"),
|
"ku": _(u"Kurdish"),
|
||||||
"ky": _("Kyrgyz"),
|
"ky": _(u"Kyrgyz"),
|
||||||
"lo": _("Laothian"),
|
"lo": _(u"Laothian"),
|
||||||
"lv": _("Latvian"),
|
"lv": _(u"Latvian"),
|
||||||
"lt": _("Lithuanian"),
|
"lt": _(u"Lithuanian"),
|
||||||
"mk": _("Macedonian"),
|
"mk": _(u"Macedonian"),
|
||||||
"ms": _("Malay"),
|
"ms": _(u"Malay"),
|
||||||
"ml": _("Malayalam"),
|
"ml": _(u"Malayalam"),
|
||||||
"mt": _("Maltese"),
|
"mt": _(u"Maltese"),
|
||||||
"mr": _("Marathi"),
|
"mr": _(u"Marathi"),
|
||||||
"mn": _("Mongolian"),
|
"mn": _(u"Mongolian"),
|
||||||
"ne": _("Nepali"),
|
"ne": _(u"Nepali"),
|
||||||
"no": _("Norwegian"),
|
"no": _(u"Norwegian"),
|
||||||
"or": _("Oriya"),
|
"or": _(u"Oriya"),
|
||||||
"ps": _("Pashto"),
|
"ps": _(u"Pashto"),
|
||||||
"fa": _("Persian"),
|
"fa": _(u"Persian"),
|
||||||
"pl": _("Polish"),
|
"pl": _(u"Polish"),
|
||||||
"pt": _("Portuguese"),
|
"pt": _(u"Portuguese"),
|
||||||
"pa": _("Punjabi"),
|
"pa": _(u"Punjabi"),
|
||||||
"ro": _("Romanian"),
|
"ro": _(u"Romanian"),
|
||||||
"ru": _("Russian"),
|
"ru": _(u"Russian"),
|
||||||
"sa": _("Sanskrit"),
|
"sa": _(u"Sanskrit"),
|
||||||
"sr": _("Serbian"),
|
"sr": _(u"Serbian"),
|
||||||
"sd": _("Sindhi"),
|
"sd": _(u"Sindhi"),
|
||||||
"si": _("Sinhalese"),
|
"si": _(u"Sinhalese"),
|
||||||
"sk": _("Slovak"),
|
"sk": _(u"Slovak"),
|
||||||
"sl": _("Slovenian"),
|
"sl": _(u"Slovenian"),
|
||||||
"es": _("Spanish"),
|
"es": _(u"Spanish"),
|
||||||
"sw": _("Swahili"),
|
"sw": _(u"Swahili"),
|
||||||
"sv": _("Swedish"),
|
"sv": _(u"Swedish"),
|
||||||
"tg": _("Tajik"),
|
"tg": _(u"Tajik"),
|
||||||
"ta": _("Tamil"),
|
"ta": _(u"Tamil"),
|
||||||
"tl": _("Tagalog"),
|
"tl": _(u"Tagalog"),
|
||||||
"te": _("Telugu"),
|
"te": _(u"Telugu"),
|
||||||
"th": _("Thai"),
|
"th": _(u"Thai"),
|
||||||
"bo": _("Tibetan"),
|
"bo": _(u"Tibetan"),
|
||||||
"tr": _("Turkish"),
|
"tr": _(u"Turkish"),
|
||||||
"uk": _("Ukrainian"),
|
"uk": _(u"Ukrainian"),
|
||||||
"ur": _("Urdu"),
|
"ur": _(u"Urdu"),
|
||||||
"uz": _("Uzbek"),
|
"uz": _(u"Uzbek"),
|
||||||
"ug": _("Uighur"),
|
"ug": _(u"Uighur"),
|
||||||
"vi": _("Vietnamese"),
|
"vi": _(u"Vietnamese"),
|
||||||
"cy": _("Welsh"),
|
"cy": _(u"Welsh"),
|
||||||
"yi": _("Yiddish")
|
"yi": _(u"Yiddish")
|
||||||
}
|
}
|
||||||
|
|
||||||
def available_languages():
|
def available_languages():
|
||||||
global supported_langs, d
|
return dict(sorted(languages.items(), key=lambda x: x[1]))
|
||||||
if supported_langs == None and d == None:
|
|
||||||
t = YandexTranslate("trnsl.1.1.20161012T134532Z.d01b9c75fc39aa74.7d1be75a5166a80583eeb020e10f584168da6bf7")
|
|
||||||
supported_langs = t.langs
|
|
||||||
d = []
|
|
||||||
for i in supported_langs:
|
|
||||||
d.append(languages[i])
|
|
||||||
return sorted(zip(supported_langs, d))
|
|
||||||
|
@ -16,17 +16,21 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
############################################################
|
############################################################
|
||||||
from __future__ import unicode_literals
|
|
||||||
import wx
|
|
||||||
from . import translator
|
from . import translator
|
||||||
|
import wx
|
||||||
|
from widgetUtils import BaseDialog
|
||||||
|
|
||||||
class translateDialog(wx.Dialog):
|
class translateDialog(BaseDialog):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(translateDialog, self).__init__(None, -1, title=_("Translate message"))
|
languages = []
|
||||||
|
language_dict = translator.available_languages()
|
||||||
|
for k in language_dict:
|
||||||
|
languages.append(language_dict[k])
|
||||||
|
super(translateDialog, self).__init__(None, -1, title=_(u"Translate message"))
|
||||||
panel = wx.Panel(self)
|
panel = wx.Panel(self)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
staticDest = wx.StaticText(panel, -1, _("Target language"))
|
staticDest = wx.StaticText(panel, -1, _(u"Target language"))
|
||||||
self.dest_lang = wx.ComboBox(panel, -1, choices=[x[1] for x in translator.available_languages()], style = wx.CB_READONLY)
|
self.dest_lang = wx.ComboBox(panel, -1, choices=languages, style = wx.CB_READONLY)
|
||||||
self.dest_lang.SetFocus()
|
self.dest_lang.SetFocus()
|
||||||
self.dest_lang.SetSelection(0)
|
self.dest_lang.SetSelection(0)
|
||||||
listSizer = wx.BoxSizer(wx.HORIZONTAL)
|
listSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
@ -39,6 +43,3 @@ class translateDialog(wx.Dialog):
|
|||||||
|
|
||||||
def get(self, control):
|
def get(self, control):
|
||||||
return getattr(self, control).GetSelection()
|
return getattr(self, control).GetSelection()
|
||||||
|
|
||||||
def get_response(self):
|
|
||||||
return self.ShowModal()
|
|
@ -1,14 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
import sys
|
|
||||||
from . import fix_requests
|
|
||||||
|
|
||||||
#if hasattr(sys, "frozen"):
|
|
||||||
from . import fix_win32com
|
|
||||||
from . import fix_libloader
|
|
||||||
|
|
||||||
def setup():
|
|
||||||
fix_requests.fix()
|
|
||||||
# if hasattr(sys, "frozen"):
|
|
||||||
fix_libloader.fix()
|
|
||||||
fix_win32com.fix()
|
|
@ -1,36 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import win32com
|
|
||||||
import paths
|
|
||||||
win32com.__build_path__=paths.com_path()
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.append(os.path.join(win32com.__gen_path__, "."))
|
|
||||||
from win32com.client import gencache
|
|
||||||
from pywintypes import com_error
|
|
||||||
from libloader import com
|
|
||||||
|
|
||||||
fixed=False
|
|
||||||
|
|
||||||
def patched_getmodule(modname):
|
|
||||||
mod=__import__(modname)
|
|
||||||
return sys.modules[modname]
|
|
||||||
|
|
||||||
def load_com(*names):
|
|
||||||
global fixed
|
|
||||||
if fixed==False:
|
|
||||||
gencache._GetModule=patched_getmodule
|
|
||||||
com.prepare_gencache()
|
|
||||||
fixed=True
|
|
||||||
result = None
|
|
||||||
for name in names:
|
|
||||||
try:
|
|
||||||
result = gencache.EnsureDispatch(name)
|
|
||||||
break
|
|
||||||
except com_error:
|
|
||||||
continue
|
|
||||||
if result is None:
|
|
||||||
raise com_error("Unable to load any of the provided com objects.")
|
|
||||||
return result
|
|
||||||
|
|
||||||
def fix():
|
|
||||||
com.load_com = load_com
|
|
@ -1,12 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
import requests
|
|
||||||
import paths
|
|
||||||
import os
|
|
||||||
import logging
|
|
||||||
log = logging.getLogger("fixes.fix_requests")
|
|
||||||
|
|
||||||
def fix():
|
|
||||||
log.debug("Applying fix for requests...")
|
|
||||||
os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(paths.app_path(), "cacert.pem")#.encode(paths.fsencoding)
|
|
||||||
# log.debug("Changed CA path to %s" % (os.environ["REQUESTS_CA_BUNDLE"]))#.decode(paths.fsencoding)))
|
|
@ -1,6 +0,0 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
import win32com.client
|
|
||||||
def fix():
|
|
||||||
if win32com.client.gencache.is_readonly == True:
|
|
||||||
win32com.client.gencache.is_readonly = False
|
|
||||||
win32com.client.gencache.Rebuild()
|
|
@ -1,11 +1,12 @@
|
|||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
!include "LogicLib.nsh"
|
!include "LogicLib.nsh"
|
||||||
|
!include "x64.nsh"
|
||||||
Unicode true
|
Unicode true
|
||||||
CRCCheck on
|
CRCCheck on
|
||||||
ManifestSupportedOS all
|
ManifestSupportedOS all
|
||||||
XPStyle on
|
XPStyle on
|
||||||
Name "Socializer"
|
Name "Socializer"
|
||||||
OutFile "socializer_0.23_setup.exe"
|
OutFile "socializer_setup.exe"
|
||||||
InstallDir "$PROGRAMFILES\socializer"
|
InstallDir "$PROGRAMFILES\socializer"
|
||||||
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "InstallLocation"
|
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "InstallLocation"
|
||||||
RequestExecutionLevel admin
|
RequestExecutionLevel admin
|
||||||
@ -14,10 +15,10 @@ SetCompressor /solid lzma
|
|||||||
SetDatablockOptimize on
|
SetDatablockOptimize on
|
||||||
VIAddVersionKey ProductName "Socializer"
|
VIAddVersionKey ProductName "Socializer"
|
||||||
VIAddVersionKey LegalCopyright "Copyright 2019 Manuel Cortez."
|
VIAddVersionKey LegalCopyright "Copyright 2019 Manuel Cortez."
|
||||||
VIAddVersionKey ProductVersion "0.23"
|
VIAddVersionKey ProductVersion "0.24"
|
||||||
VIAddVersionKey FileVersion "0.23"
|
VIAddVersionKey FileVersion "0.24"
|
||||||
VIProductVersion "0.23.0.0"
|
VIProductVersion "0.24.0.0"
|
||||||
VIFileVersion "0.23.0.0"
|
VIFileVersion "0.24.0.0"
|
||||||
!insertmacro MUI_PAGE_WELCOME
|
!insertmacro MUI_PAGE_WELCOME
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
var StartMenuFolder
|
var StartMenuFolder
|
||||||
@ -37,7 +38,11 @@ var StartMenuFolder
|
|||||||
Section
|
Section
|
||||||
SetShellVarContext All
|
SetShellVarContext All
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
File /r dist\main\*
|
${If} ${RunningX64}
|
||||||
|
File /r program64\*
|
||||||
|
${Else}
|
||||||
|
File /r program32\*
|
||||||
|
${EndIf}
|
||||||
CreateShortCut "$DESKTOP\socializer.lnk" "$INSTDIR\socializer.exe"
|
CreateShortCut "$DESKTOP\socializer.lnk" "$INSTDIR\socializer.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN startmenu
|
||||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||||
@ -50,7 +55,7 @@ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer
|
|||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "InstallLocation" $INSTDIR
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortez"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortez"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "DisplayVersion" "0.23"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "DisplayVersion" "0.24"
|
||||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "URLInfoAbout" "http://socializer.su"
|
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "URLInfoAbout" "http://socializer.su"
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMajor" 0
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMajor" 0
|
||||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMinor" 19
|
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMinor" 19
|
||||||
@ -67,4 +72,7 @@ RMDir /r "$SMPROGRAMS\$StartMenuFolder"
|
|||||||
SectionEnd
|
SectionEnd
|
||||||
Function .onInit
|
Function .onInit
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
${If} ${RunningX64}
|
||||||
|
StrCpy $instdir "$programfiles64\socializer"
|
||||||
|
${EndIf}
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from .base import *
|
||||||
from .attach import *
|
from .attach import *
|
||||||
from . audioRecorder import *
|
from . audioRecorder import *
|
||||||
from . blacklist import *
|
from . blacklist import *
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
from wxUI.commonMessages import restart_program as restart_program_dialog
|
from wxUI.commonMessages import restart_program as restart_program_dialog
|
||||||
@ -46,18 +45,6 @@ class configurationInteractor(base.baseInteractor):
|
|||||||
self.presenter.update_setting(section="buffers", setting="count_for_video_buffers", value=self.view.get_value("buffers", "video_buffers_count"))
|
self.presenter.update_setting(section="buffers", setting="count_for_video_buffers", value=self.view.get_value("buffers", "video_buffers_count"))
|
||||||
self.presenter.update_setting(section="buffers", setting="count_for_chat_buffers", value=self.view.get_value("buffers", "chat_buffers_count"))
|
self.presenter.update_setting(section="buffers", setting="count_for_chat_buffers", value=self.view.get_value("buffers", "chat_buffers_count"))
|
||||||
self.presenter.update_setting(section="general", setting="load_images", value=self.view.get_value("general", "load_images"))
|
self.presenter.update_setting(section="general", setting="load_images", value=self.view.get_value("general", "load_images"))
|
||||||
update_channel = self.presenter.get_update_channel_type(self.view.get_value("general", "update_channel"))
|
|
||||||
if update_channel != self.presenter.session.settings["general"]["update_channel"]:
|
|
||||||
if update_channel == "stable":
|
|
||||||
self.presenter.update_setting(section="general", setting="update_channel", value=update_channel)
|
|
||||||
elif update_channel == "weekly":
|
|
||||||
dialog = self.view.weekly_channel()
|
|
||||||
if dialog == widgetUtils.YES:
|
|
||||||
self.presenter.update_setting(section="general", setting="update_channel", value=update_channel)
|
|
||||||
elif update_channel == "alpha":
|
|
||||||
dialog = self.view.alpha_channel()
|
|
||||||
if dialog == widgetUtils.YES:
|
|
||||||
self.presenter.update_setting(section="general", setting="update_channel", value=update_channel)
|
|
||||||
self.presenter.update_setting(section="chat", setting="notify_online", value=self.view.get_value("chat", "notify_online"))
|
self.presenter.update_setting(section="chat", setting="notify_online", value=self.view.get_value("chat", "notify_online"))
|
||||||
self.presenter.update_setting(section="chat", setting="notify_offline", value=self.view.get_value("chat", "notify_offline"))
|
self.presenter.update_setting(section="chat", setting="notify_offline", value=self.view.get_value("chat", "notify_offline"))
|
||||||
self.presenter.update_setting(section="chat", setting="notifications", value=self.presenter.get_notification_type(self.view.get_value("chat", "notifications")))
|
self.presenter.update_setting(section="chat", setting="notifications", value=self.presenter.get_notification_type(self.view.get_value("chat", "notifications")))
|
||||||
@ -67,6 +54,7 @@ class configurationInteractor(base.baseInteractor):
|
|||||||
self.presenter.update_app_setting(section="app-settings", setting="language", value=self.presenter.codes[self.view.general.language.GetSelection()])
|
self.presenter.update_app_setting(section="app-settings", setting="language", value=self.presenter.codes[self.view.general.language.GetSelection()])
|
||||||
self.presenter.update_app_setting(section="sound", setting="input_device", value=self.view.get_value("sound", "input"))
|
self.presenter.update_app_setting(section="sound", setting="input_device", value=self.view.get_value("sound", "input"))
|
||||||
self.presenter.update_app_setting(section="sound", setting="output_device", value=self.view.get_value("sound", "output"))
|
self.presenter.update_app_setting(section="sound", setting="output_device", value=self.view.get_value("sound", "output"))
|
||||||
self.presenter.update_app_setting(section="app-settings", setting="use_proxy", value=self.view.get_value("general", "use_proxy"))
|
# self.presenter.update_app_setting(section="app-settings", setting="use_proxy", value=self.view.get_value("general", "use_proxy"))
|
||||||
|
self.presenter.update_app_setting(section="app-settings", setting="debug_logging", value=self.view.get_value("general", "debug_logging"))
|
||||||
self.presenter.save_app_settings_file()
|
self.presenter.save_app_settings_file()
|
||||||
self.presenter.save_settings_file()
|
self.presenter.save_settings_file()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
from wxUI.dialogs import selector
|
from wxUI.dialogs import selector
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
@ -59,8 +58,11 @@ class createPostInteractor(base.baseInteractor):
|
|||||||
dlg = translator.gui.translateDialog()
|
dlg = translator.gui.translateDialog()
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
text_to_translate = self.view.get_text()
|
text_to_translate = self.view.get_text()
|
||||||
dest = [x[0] for x in translator.translator.available_languages()][dlg.get("dest_lang")]
|
language_dict = translator.translator.available_languages()
|
||||||
self.presenter.translate(text_to_translate, dest)
|
for k in language_dict:
|
||||||
|
if language_dict[k] == dlg.dest_lang.GetStringSelection():
|
||||||
|
dst = k
|
||||||
|
self.presenter.translate(text_to_translate, dst)
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
def on_spellcheck(self, event=None):
|
def on_spellcheck(self, event=None):
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
import six
|
import six
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
import wx
|
import wx
|
||||||
|
from extra import translator
|
||||||
from pubsub import pub
|
from pubsub import pub
|
||||||
from wxUI import menus
|
from wxUI import menus
|
||||||
from wxUI import commonMessages
|
from wxUI import commonMessages
|
||||||
@ -119,9 +119,9 @@ class displayPostInteractor(base.baseInteractor):
|
|||||||
|
|
||||||
def on_show_tools_menu(self, *args, **kwargs):
|
def on_show_tools_menu(self, *args, **kwargs):
|
||||||
menu = menus.toolsMenu()
|
menu = menus.toolsMenu()
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_open_url, menuitem=menu.url)
|
# widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_open_url, menuitem=menu.url)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_translate, menuitem=menu.translate)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_translate, menuitem=menu.translate)
|
||||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_spellcheck, menuitem=menu.CheckSpelling)
|
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_spellcheck, menuitem=menu.spellcheck)
|
||||||
self.view.PopupMenu(menu, self.view.tools.GetPosition())
|
self.view.PopupMenu(menu, self.view.tools.GetPosition())
|
||||||
|
|
||||||
def on_open_url(self, *args, **kwargs):
|
def on_open_url(self, *args, **kwargs):
|
||||||
@ -135,8 +135,11 @@ class displayPostInteractor(base.baseInteractor):
|
|||||||
dlg = translator.gui.translateDialog()
|
dlg = translator.gui.translateDialog()
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
text_to_translate = self.view.get("post_view")
|
text_to_translate = self.view.get("post_view")
|
||||||
dest = [x[0] for x in translator.translator.available_languages()][dlg.get("dest_lang")]
|
language_dict = translator.translator.available_languages()
|
||||||
self.presenter.translate(text_to_translate, dest)
|
for k in language_dict:
|
||||||
|
if language_dict[k] == dlg.dest_lang.GetStringSelection():
|
||||||
|
dst = k
|
||||||
|
self.presenter.translate(text_to_translate, dst)
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
def on_spellcheck(self, event=None):
|
def on_spellcheck(self, event=None):
|
||||||
@ -218,6 +221,21 @@ class displayAudioInteractor(base.baseInteractor):
|
|||||||
post = self.view.get_audio()
|
post = self.view.get_audio()
|
||||||
self.presenter.remove_from_library(post)
|
self.presenter.remove_from_library(post)
|
||||||
|
|
||||||
|
class displayArticleInteractor(base.baseInteractor):
|
||||||
|
|
||||||
|
def set(self, control, value):
|
||||||
|
if not hasattr(self.view, control):
|
||||||
|
raise AttributeError("The control is not present in the view.")
|
||||||
|
getattr(self.view, control).SetValue(value)
|
||||||
|
|
||||||
|
def install(self, *args, **kwargs):
|
||||||
|
super(displayArticleInteractor, self).install(*args, **kwargs)
|
||||||
|
pub.subscribe(self.set, self.modulename+"_set")
|
||||||
|
|
||||||
|
def uninstall(self):
|
||||||
|
super(displayArticleInteractor, self).uninstall()
|
||||||
|
pub.unsubscribe(self.set, self.modulename+"_set")
|
||||||
|
|
||||||
class displayPollInteractor(base.baseInteractor):
|
class displayPollInteractor(base.baseInteractor):
|
||||||
|
|
||||||
def set(self, control, value):
|
def set(self, control, value):
|
||||||
|
Binary file not shown.
@ -1,535 +0,0 @@
|
|||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: Socializer\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2016-06-29 13:33-0500\n"
|
|
||||||
"PO-Revision-Date: 2016-06-29 16:25-0600\n"
|
|
||||||
"Last-Translator: \n"
|
|
||||||
"Language-Team: Manuel Cortez <manuel@manuelcortez.net>\n"
|
|
||||||
"Language: es\n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
"X-Generator: Poedit 1.6.11\n"
|
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
|
||||||
|
|
||||||
#. Translators: the label for the Windows default NVDA interface language.
|
|
||||||
msgid "User default"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "socializer's manual "
|
|
||||||
msgstr "Manual de Socializer"
|
|
||||||
|
|
||||||
msgid "## Introduction"
|
|
||||||
msgstr "## Introducción"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Socializer is an application to use [VK.com](https://vk.com) in an easy and "
|
|
||||||
"accessible way with minimal CPU resource usage. Socializer will allow you to "
|
|
||||||
"interact with the VK social network by giving you access to the most "
|
|
||||||
"relevant features such as:"
|
|
||||||
msgstr ""
|
|
||||||
"Socializer es una aplicación para usar [vk.com](http://vk.com) de forma "
|
|
||||||
"fácil y accesible, con un consumo de CPU mínimo. Socializer te permitirá "
|
|
||||||
"interactuar con la red social VK, brindándote acceso a las características "
|
|
||||||
"más relevantes, tales como:"
|
|
||||||
|
|
||||||
msgid "* Basic post creation in your wall (including photos)."
|
|
||||||
msgstr ""
|
|
||||||
"* Creación básica de publicaciones en tu muro (incluyendo subida de fotos)"
|
|
||||||
|
|
||||||
msgid "* Audio addition, removal, download and search."
|
|
||||||
msgstr "* Añadir, descargar y buscar archivos de audio."
|
|
||||||
|
|
||||||
msgid "* audio albums management (create, delete and add audios)."
|
|
||||||
msgstr ""
|
|
||||||
"* Administración de albums de audio (crear, eliminar y añadir audios dentro "
|
|
||||||
"de albums)."
|
|
||||||
|
|
||||||
msgid "* Post comments."
|
|
||||||
msgstr "* Publicar comentarios."
|
|
||||||
|
|
||||||
msgid "* like, unlike and repost other's posts."
|
|
||||||
msgstr ""
|
|
||||||
"* Indicar que te gusta, que ya no te gusta o compartir publicaciones de "
|
|
||||||
"otros usuarios."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Open other's timelines so you could track someone's friends, posts or "
|
|
||||||
"audio files."
|
|
||||||
msgstr ""
|
|
||||||
"* Abrir líneas temporales de otros usuarios para poder ver sus "
|
|
||||||
"publicaciones, audios o amigos."
|
|
||||||
|
|
||||||
msgid "* Basic chat features."
|
|
||||||
msgstr "* Características básicas de chat."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Note: When new features are added to socializer they will be added to this "
|
|
||||||
"section."
|
|
||||||
msgstr ""
|
|
||||||
"Nota: Cuando sean añadidas, las nuevas características se incluirán aquí."
|
|
||||||
|
|
||||||
msgid "## Running"
|
|
||||||
msgstr "## Abriendo socializer"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you are using a built version, unzip the file in a new directory with no "
|
|
||||||
"special characters, and open the socializer.exe file. If you haven't "
|
|
||||||
"configured your VK account, you will see a dialogue, just press yes and a "
|
|
||||||
"new dialogue will prompt for an user email or phone number and the password "
|
|
||||||
"for your account. Take into account that the provided information will be "
|
|
||||||
"saved in a config file as plain text. This application will need your "
|
|
||||||
"information for renegotiating the access token when it expires."
|
|
||||||
msgstr ""
|
|
||||||
"Si estás usando una versión compilada (distribuible), descomprime el archivo "
|
|
||||||
"ZIP en un nuevo directorio que no contenga caracteres especiales, y abre el "
|
|
||||||
"archivo socializer.exe. Si no has configurado tu cuenta de VK, verás un "
|
|
||||||
"diálogo donde se te preguntará si deseas configurar una. Si presionas en sí, "
|
|
||||||
"podrás introducir tus datos. Toma en cuenta que la información proporcionada "
|
|
||||||
"ha de guardarse en un archivo de configuración, como texto plano. La "
|
|
||||||
"aplicación necesitará tu información para renovar el código de acceso cuando "
|
|
||||||
"expire."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Note: Every time you grant access to socializer, probably You will receive "
|
|
||||||
"an email from VK by telling you that someone has accessed to your account. "
|
|
||||||
"It means that a new token has been negotiated between VK and socializer by "
|
|
||||||
"using an authomatic process, you should ignore those advices, unless you "
|
|
||||||
"receive an email when you are not logged in VK with socializer or other "
|
|
||||||
"application. You can see your authorised applications in the configuration "
|
|
||||||
"section in the VK website. New tokens are renegotiated every 24 hours."
|
|
||||||
msgstr ""
|
|
||||||
"Nota: Cada que se brinde acceso a socializer, probablemente recibirás un "
|
|
||||||
"correo electrónico de VK diciéndote que puede que alguien haya entrado a tu "
|
|
||||||
"cuenta. Significa que un nuevo código de acceso ha sido generado entre VK y "
|
|
||||||
"Socializer mediante un proceso automático. Deberías ignorar estos avisos, a "
|
|
||||||
"no ser que hayas recibido un correo cuando no estés usando Socializer o "
|
|
||||||
"alguna otra aplicación. Puedes ver tus aplicaciones autorizadas en la página "
|
|
||||||
"de tu perfil en el sitio web de VK. Un nuevo código de acceso debe ser "
|
|
||||||
"generado cada 24 horas."
|
|
||||||
|
|
||||||
msgid "## Main interface"
|
|
||||||
msgstr "## Interfaz"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you have used [TWBlue](https://github.com/manuelcortez/twblue) before, "
|
|
||||||
"the socializer's interface is quite similar. Once you have authorised your "
|
|
||||||
"account, you will see a window with the following elements:"
|
|
||||||
msgstr ""
|
|
||||||
"Si alguna vez has usado [TWBlue](https//github.com/manuelcortez/twblue) "
|
|
||||||
"anteriormente, te darás cuenta que la interfaz gráfica de socializer es muy "
|
|
||||||
"parecida. Una vez que hayas autorizado tu cuenta, Podrás ver una ventana con "
|
|
||||||
"los siguientes elementos:"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* A tree view at the left of the window, where you will see the list of "
|
|
||||||
"buffers. These buffers are divided in three categories, posts, music and "
|
|
||||||
"people. You could expand each category for seeing the child buffers. There "
|
|
||||||
"are some additional buffers, timelines and chats, wich will be filled with "
|
|
||||||
"timelines for your friends or with chats, when you start or receive a chat "
|
|
||||||
"session."
|
|
||||||
msgstr ""
|
|
||||||
"* Una vista de árbol en la parte izquierda de laventana, donde podrás ver la "
|
|
||||||
"lista de buffers. Los buffers están divididos en tres categorías, "
|
|
||||||
"publicaciones, música y gente. Puedes expandir cada categoría para ver los "
|
|
||||||
"elementos hijos. Hay además buffers adicionales, líneas temporales y chats, "
|
|
||||||
"que serán usados para guardar líneas temporales para tus amigos, o chats "
|
|
||||||
"cuando recibas o envíes un mensaje."
|
|
||||||
|
|
||||||
msgid "* A button for making a post to your wall."
|
|
||||||
msgstr "* Un botón para publicar en tu muro."
|
|
||||||
|
|
||||||
msgid "* In audio buffers, Two buttons: Play and play all."
|
|
||||||
msgstr ""
|
|
||||||
"* En buffers de audio, un par de botones: Reproducir y reproducir todo."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* In audio album buffers, a button for loading music. By default, albums are "
|
|
||||||
"empty, you have to press the load button for getting the album's items."
|
|
||||||
msgstr ""
|
|
||||||
"* En buffers para albums de audio, un botón llamado cargar álbum. De manera "
|
|
||||||
"predeterminada, los álbumes se encuentran vacíos, debes pulsar el botón "
|
|
||||||
"cargar álbum para descargar la información necesaria que permitirá mostrar "
|
|
||||||
"la música dentro del buffer del álbum."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* A list where you will see the posts for the currently selected buffer."
|
|
||||||
msgstr "* Una lista donde podrás ver los elementos del buffer seleccionado."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* In people buffers, like the friends buffer, a button for sending a message "
|
|
||||||
"to your friends. Pressing that button will cause a chat buffer to be created."
|
|
||||||
msgstr ""
|
|
||||||
"* En buffers de amigos, un botón que permite enviar un mensaje a la persona "
|
|
||||||
"seleccionada. Si es activado, el botón creará un buffer de chat "
|
|
||||||
"automáticamente."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* A status bar where the program will put some useful information about what "
|
|
||||||
"it's doing at the moment."
|
|
||||||
msgstr ""
|
|
||||||
"* Una barra de estado, donde el programa escribirá información importante "
|
|
||||||
"sobre lo que se encuentra haciendo en cada momento."
|
|
||||||
|
|
||||||
msgid "* And a menu bar."
|
|
||||||
msgstr "* Y una barra de menú."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"When socializer starts, it will try to load your news items, wall, audios "
|
|
||||||
"(your audios, recommended and populars) and friends. At the moment there are "
|
|
||||||
"only a few supported actions for these items:"
|
|
||||||
msgstr ""
|
|
||||||
"Cuando socializer inicia, intentará cargar los elementos en el buffer "
|
|
||||||
"principal, publicaciones en tu muro, canciones en tus buffers de audio (mis "
|
|
||||||
"audios, populares y recomendaciones), así como tus amigos. Por el momento "
|
|
||||||
"solo se pueden hacer pocas acciones para cada uno de estos tipos de elemento."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Audio files: You can play the currently selected song, view the song's "
|
|
||||||
"details (including lyrics, if available), add or remove from your library, "
|
|
||||||
"and download it to a desired place in your hard drive. You can find audio "
|
|
||||||
"files in your news feed or in your own audios buffers. You can find audios "
|
|
||||||
"as post's attachments. You can create an audios timeline for displaying "
|
|
||||||
"other's audios."
|
|
||||||
msgstr ""
|
|
||||||
"* Archivos de audio: Puedes reproducir el audio seleccionado, ver los "
|
|
||||||
"detalles de la canción (incluyendo letras, si las tiene), añadirlo y "
|
|
||||||
"eliminarlo de tu biblioteca, y descargar la canción a tu disco duro. Puedes "
|
|
||||||
"encontrar archivos de audio en tus propios buffers de audio, en el buffer "
|
|
||||||
"principal y pueden estar incluidos como adjuntos en publicaciones. Puedes "
|
|
||||||
"abrir una línea temporal de audios para ver los audios de otros usuarios de "
|
|
||||||
"VK."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* News feed's post: In your news feed buffer, you can press return in any "
|
|
||||||
"post and socializer will open a new dialogue which can be different, "
|
|
||||||
"depending in the kind of post you are when the return key was pressed. For "
|
|
||||||
"example it will open the post if you are focusing a \"normal\" post, a list "
|
|
||||||
"of people if you are in a post wich indicates that someone has added "
|
|
||||||
"friends, an audio displayer if you are in a post wich indicates that someone "
|
|
||||||
"has added an audio, etc."
|
|
||||||
msgstr ""
|
|
||||||
"* Publicaciones en el buffer principal: En el buffer principal, puedes "
|
|
||||||
"pulsar la tecla intro y socializer abrirá un diálogo que puede ser "
|
|
||||||
"diferente, dependiendo del tipo de publicación que estaba enfocada cuando se "
|
|
||||||
"presionó la tecla. Por ejemplo, abrirá la publicación si estabas en una "
|
|
||||||
"publicación \"normal\", una lista de personas si estabas en una publicación "
|
|
||||||
"que indicaba que alguien había añadido amigos, el visualizador de detalles "
|
|
||||||
"de audios si estabas en una publicación que indicaba que alguien había "
|
|
||||||
"añadido audios, etc."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Wall posts: It will show the post in a dialogue so you could interact with "
|
|
||||||
"its attachments, view and post comments, or like/unlike/share the post."
|
|
||||||
msgstr ""
|
|
||||||
"* publicaciones en el muro: Mostrará la publicación en un nuevo diálogo, que "
|
|
||||||
"te permitirá interactuar con el post, ver los adjuntos, ver y publicar "
|
|
||||||
"comentarios, así como indicar si te gusta, ya no te gusta y compartir la "
|
|
||||||
"publicación."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* You can send a message to someone by pressing the send message button in "
|
|
||||||
"the buffer where you are, if available. Deactivated accounts cannot receive "
|
|
||||||
"messages."
|
|
||||||
msgstr ""
|
|
||||||
"* Puedes enviar un mensaje a alguien pulsando el botón Enviar mensaje, si "
|
|
||||||
"está disponible. Los usuarios con cuentas desactivadas no pueden recibir "
|
|
||||||
"mensajes."
|
|
||||||
|
|
||||||
msgid "### Making a post"
|
|
||||||
msgstr "### Haciendo una publicación"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"When you press the post button, a new dialogue will show up. This dialogue "
|
|
||||||
"allows you to post something in your wall. In this dialogue you have to "
|
|
||||||
"write a message. You can translate your message and fix your spelling "
|
|
||||||
"mistakes. Also you can post an URL address, socializer will try to add it as "
|
|
||||||
"an attachment, so you will not have to worry about this. When you're ready, "
|
|
||||||
"just press the send button and it'll be done."
|
|
||||||
msgstr ""
|
|
||||||
"Cuando pulses el botón para publicar, se mostrará un diálogo. Este diálogo "
|
|
||||||
"te permitirá publicar algo en tu muro. En este diálogo tienes que escribir "
|
|
||||||
"un mensaje. Puedes traducir el mensaje y corregir tus errores ortográficos. "
|
|
||||||
"También puedes publicar una dirección URL, y socializer intentará enviarla "
|
|
||||||
"como un adjunto a tu publicación, por lo que no tienes que preocuparte. "
|
|
||||||
"Cuando estés listo, solo presiona el botón enviar, y estará listo."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you want to add some photos, you can press the attach button, then press "
|
|
||||||
"the kind of attachment you want to add. After this, select the file you want "
|
|
||||||
"to add and you will see it in the list, once processed. When you are done "
|
|
||||||
"with attachments, press the OK button, and continue with your post. When you "
|
|
||||||
"are ready, press the send button. Your post could take some time to be "
|
|
||||||
"published, depending in the amount of files you have added, but it should be "
|
|
||||||
"displayed in your wall and newsfeed as soon as it is posted."
|
|
||||||
msgstr ""
|
|
||||||
"Si quieres añadir algunas fotos, presiona el botón adjuntar, seguidamente "
|
|
||||||
"encuentra el botón del elemento que quieres añadir. Después, selecciona el "
|
|
||||||
"archivo a adjuntar y lo podrás ver en la lista de archivos a cargar una vez "
|
|
||||||
"sea procesado por el programa. Cuando hayas terminado con los adjuntos, "
|
|
||||||
"presiona el botón aceptar, y continúa con tu publicación. Cuando esté todo "
|
|
||||||
"listo, pulsa el botón enviar. Tu publicación podría tomar un tiempo en ser "
|
|
||||||
"enviada, dependiendo de la cantidad y el tamaño de los adjuntos que "
|
|
||||||
"añadiste, pero debería aparecer publicada en tu muro y en el buffer "
|
|
||||||
"principal tan rápidamente como sea publicada."
|
|
||||||
|
|
||||||
msgid "### Working with posts in news feed"
|
|
||||||
msgstr "### Trabajando con publicaciones en el buffer principal."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"You can press the return key in any post in your news feed for opening a new "
|
|
||||||
"dialogue with some information. The information and dialogue will be "
|
|
||||||
"different if you are viewing a friendship's notification (when someone has "
|
|
||||||
"added some friends), an audio file, or a regular post."
|
|
||||||
msgstr ""
|
|
||||||
"Puedes pulsar la tecla intro en cualquier publicación de tu buffer principal "
|
|
||||||
"para abrir un nuevo diálogo con información. La información puede variar si "
|
|
||||||
"estás viendo una notificación de nuevos amigos (cuando alguien añade "
|
|
||||||
"amigos), un archivo de audio, o una publicación regular."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you open a regular post in your newsfeed, you will be able to see the "
|
|
||||||
"comments in a list, indicate if you do like or dislike the post, repost or "
|
|
||||||
"add a new comment. If the post has some attachments, you'll find a list "
|
|
||||||
"populated with them, you can press return in an attachment to execute its "
|
|
||||||
"default action, wich will be different depending on the kind of attachment "
|
|
||||||
"that you are viewing."
|
|
||||||
msgstr ""
|
|
||||||
"Si abres una publicación regular en tu buffer principal, serás capaz de leer "
|
|
||||||
"los comentarios en una lista, indicar si te gusta o ya no te gusta la "
|
|
||||||
"publicación, compartirla o añadir un nuevo comentario. Si la publicación "
|
|
||||||
"contiene adjuntos, encontrarás una lista con ellos. Puedes pulsar intro "
|
|
||||||
"sobre uno de ellos para abrir la acción predeterminada. La acción "
|
|
||||||
"predeterminada para cada archivo dependerá del tipo de archivo en el que te "
|
|
||||||
"enfoques."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"For friend notifications, you can only view the new added friends in a list "
|
|
||||||
"and there are some kind of posts that aren't handled. It should be improved."
|
|
||||||
msgstr ""
|
|
||||||
"Para las notificaciones de nuevos amigos, solo puedes ver las personas que "
|
|
||||||
"han sido añadidas. También hay algunas publicaciones que no se muestran por "
|
|
||||||
"defecto."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Additionally, you can press the menu Key or the right click for displaying "
|
|
||||||
"a menu with some quick actions available for the post you are focusing. "
|
|
||||||
"These actions are different for every post type."
|
|
||||||
msgstr ""
|
|
||||||
"Además, puedes pulsar la tecla de aplicaciones o el botón derecho del ratón "
|
|
||||||
"para mostrar un menú de acciones rápidas que están disponibles para el "
|
|
||||||
"elemento seleccionado. Las acciones son diferentes para cada tipo de "
|
|
||||||
"publicación."
|
|
||||||
|
|
||||||
msgid "### Working with songs"
|
|
||||||
msgstr "### Trabajando con audios"
|
|
||||||
|
|
||||||
msgid "Note: the following applies to audio timelines too."
|
|
||||||
msgstr "Nota: Lo siguiente también es aplicable a líneas temporales de audio."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you want to play or view audio's details, you'll have to navigate to the "
|
|
||||||
"tree view, and, using the down arrow, look for \"my audios\", \"populars\" "
|
|
||||||
"or \"Recommendations\". You will see two more buttons, play and play all. "
|
|
||||||
"The play button will play the currently selected audio, and the play all "
|
|
||||||
"button will play audios in the current buffer, starting with the current "
|
|
||||||
"selected item. You can go to the song's list, look for a desired song and "
|
|
||||||
"press the play button, or Ctrl+return, which is a keyboard shorcut. Take in "
|
|
||||||
"to account that there are some keyboard shorcuts that only work in the list "
|
|
||||||
"of items."
|
|
||||||
msgstr ""
|
|
||||||
"Si quieres reproducir o ver los detalles de un archivo de audio, debes "
|
|
||||||
"navegar hasta la vista de árbol y, utilizando las flechas de cursor, ubicar "
|
|
||||||
"algún buffer de audio (mis audios, populares o recomendaciones). Verás dos "
|
|
||||||
"botones extras, reproducir y reproducir todo. El botón reproducir "
|
|
||||||
"reproducirá el audio seleccionado, y el botón reproducir todo comenzará a "
|
|
||||||
"reproducir, a partir del audio seleccionado y hasta el final, todos los "
|
|
||||||
"audios del buffer. Puedes ir a la lista de canciones, buscar una canción que "
|
|
||||||
"te guste y pulsar el botón reproducir, o pulsar Control intro, que es un "
|
|
||||||
"atajo de teclado. Ten en cuenta que algunos atajos de teclado solo funcionan "
|
|
||||||
"cuando estás en la lista de elementos."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"You can play audio from any buffer, just press ctrl+return for making the "
|
|
||||||
"audio playback possible."
|
|
||||||
msgstr ""
|
|
||||||
"Puedes reproducir audios desde cualquier buffer, solo presiona Control intro "
|
|
||||||
"para hacer posible la reproducción."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If someone has added multiple audios at once to his library, you will see "
|
|
||||||
"something like this in your newsfeed: \"(friend) has added 4 audios: audio "
|
|
||||||
"1, audio2, audio3 and audio4\". You can press return in the post for "
|
|
||||||
"opening the audio's details dialogue, where you will be able to see a list "
|
|
||||||
"with these audios. By default the first detected song is selected, which "
|
|
||||||
"means that you could read its details by pressing tab, download or add it to "
|
|
||||||
"your library. If you change the audio in the list, the information will be "
|
|
||||||
"updated and you will see details and actions will take effect in the new "
|
|
||||||
"selected audio."
|
|
||||||
msgstr ""
|
|
||||||
"Si alguien ha añadido más de un audio a su biblioteca, podrás ver algo como "
|
|
||||||
"lo siguiente: \"(alguien) ha añadido 4 audios: audio1, audio2, audio3 y "
|
|
||||||
"audio4\". Puedes pulsar intro en la publicación para abrir el diálogo del "
|
|
||||||
"visualizador de detalles de audios, donde podrás verlos todos en una lista. "
|
|
||||||
"De forma predeterminada, el primer audio detectado está seleccionado, lo que "
|
|
||||||
"significa que puedes pulsar tab para ver sus detalles, descargarlo y "
|
|
||||||
"añadirlo a la biblioteca. Si cambias la canción en la lista, notarás que la "
|
|
||||||
"información se actualizará y ahora los detalles y acciones a mostrar tendrán "
|
|
||||||
"efecto en el nuevo audio seleccionado."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"When an audio file is playing, you can press f5 and f6 for decreasing and "
|
|
||||||
"increasing volume, respectively, or control+shift+return for play/pause."
|
|
||||||
msgstr ""
|
|
||||||
"Cuando un archivo de audio está siendo reproducido, puedes pulsar las teclas "
|
|
||||||
"f5 y f6 para bajar y subir volumen, respectivamente. También puedes pulsar "
|
|
||||||
"Control Shift Intro para pausar/reproducir la canción."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you want to see some details for the selected audio file, you can do it "
|
|
||||||
"by pressing the return key. You will be able to read some useful "
|
|
||||||
"information (title, artist, duration and the lyric, if available). Also you "
|
|
||||||
"will be able to download the song to your hard drive, you have to press the "
|
|
||||||
"download button in the details' dialogue."
|
|
||||||
msgstr ""
|
|
||||||
"Si quieres ver algunos detalles para el audio seleccionado, pulsa intro "
|
|
||||||
"sobre él. Podrás leer información importante sobre la canción (título, "
|
|
||||||
"artista, duración y la letra, si está disponible). También podrás descargar "
|
|
||||||
"la canción a tu disco duro, solo tienes que pulsar el botón descargar en el "
|
|
||||||
"diálogo de detalles de audio."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"When the download starts, you can close the details dialogue and check the "
|
|
||||||
"status bar in the main window for seeing the current progress."
|
|
||||||
msgstr ""
|
|
||||||
"Cuando la descarga inicie, puedes cerrar el visualizador de detalles de "
|
|
||||||
"audio y revisar la barra de estado para ver el progreso."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"Additionally, you can search for audios by using the menu bar, in the buffer "
|
|
||||||
"menu, select search, then audio. It will display a dialog where you have to "
|
|
||||||
"set your search preferences."
|
|
||||||
msgstr ""
|
|
||||||
"Además, puedes hacer una búsqueda de canciones usando la barra de menú, en "
|
|
||||||
"el menú buffer, buscar, luego audio. Mostrará un diálogo donde deberás "
|
|
||||||
"establecer tus preferencias de búsqueda."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you press the menu key, you will see a menu where you will be able to do "
|
|
||||||
"some actions, for example, add the audio to an album, or add/remove the song "
|
|
||||||
"from your library."
|
|
||||||
msgstr ""
|
|
||||||
"Si presionas la tecla de aplicaciones podrás ver un menú desde el que puedes "
|
|
||||||
"realizar algunas acciones, por ejemplo mover la canción a un álbum, o "
|
|
||||||
"agregarlo/eliminarlo de tu biblioteca."
|
|
||||||
|
|
||||||
msgid "## menu Bar"
|
|
||||||
msgstr "## barra de menú"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"You can go to the menu bar by pressing ALT. Right now, there are three "
|
|
||||||
"menus, application, buffer and help:"
|
|
||||||
msgstr ""
|
|
||||||
"Puedes ir a la barra de menú pulsando la tecla ALT. Actualmente existen tres "
|
|
||||||
"menús: aplicación, buffer y ayuda."
|
|
||||||
|
|
||||||
msgid "### Application menu"
|
|
||||||
msgstr "### Menú aplicación"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Create. Here you can create some things in VK. The only supported item at "
|
|
||||||
"this moment is the audio album."
|
|
||||||
msgstr ""
|
|
||||||
"* Crear. Aquí puedes crear algunas cosas en VK. Actualmente solo se "
|
|
||||||
"encuentra soportada la creación de álbumes de audio."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Delete: Removes items from the VK servers. The only supported item here is "
|
|
||||||
"the audio album."
|
|
||||||
msgstr ""
|
|
||||||
"* eliminar. Elimina elementos desde el servidor de VK. Actualmente solo se "
|
|
||||||
"encuentra soportado el borrado de álbumes de audio."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* you can set your preferences by opening the preferences dialog located in "
|
|
||||||
"this menu."
|
|
||||||
msgstr ""
|
|
||||||
"* Puedes establecer tus preferencias desde el diálogo de preferencias, "
|
|
||||||
"ubicado en este menú."
|
|
||||||
|
|
||||||
msgid "### Buffer menu"
|
|
||||||
msgstr "### Menú buffer"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* new timeline: This option allows you to create a new timeline. This kind "
|
|
||||||
"of buffers is capable of download all posts in an user's profile."
|
|
||||||
msgstr ""
|
|
||||||
"* Nueva línea temporal: Esta opción permite crear una línea temporal para "
|
|
||||||
"otro usuario de VK. Las líneas temporales pueden descargar publicaciones de "
|
|
||||||
"otros usuarios."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* search: This submenu allows you to create a new buffer, at the moment, "
|
|
||||||
"you can create only a kind of buffer, an audio search. The audio search will "
|
|
||||||
"be located in the music category and will have the last 299 results of your "
|
|
||||||
"query."
|
|
||||||
msgstr ""
|
|
||||||
"* Buscar: permite hacer una búsqueda en VK. Por el momento solo se pueden "
|
|
||||||
"buscar archivos de audio. Las búsquedas de audio se añadirán en el buffer de "
|
|
||||||
"música y contendrán los últimos 299 resultados."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Update current buffer: perform an update operation in the selected buffer, "
|
|
||||||
"which will retrieve the new items."
|
|
||||||
msgstr ""
|
|
||||||
"* Actualizar buffer: Realiza una operación de actualización en el buffer "
|
|
||||||
"actual, lo que recuperará los nuevos elementos."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Load previous items: Get the previous items for the currently focused "
|
|
||||||
"buffer."
|
|
||||||
msgstr ""
|
|
||||||
"* Cargar elementos anteriores: Carga los elementos anteriormente publicados "
|
|
||||||
"en el buffer actual."
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"* Remove buffer: Tries to remove the current buffer. Default buffers can't "
|
|
||||||
"be removed."
|
|
||||||
msgstr ""
|
|
||||||
"* Eliminar buffer: Intenta remover el buffer actual. Los buffers "
|
|
||||||
"predeterminados no pueden eliminarse."
|
|
||||||
|
|
||||||
msgid "The help menu is self explanatory."
|
|
||||||
msgstr "El menú ayuda se explica por sí solo."
|
|
||||||
|
|
||||||
msgid "## Contributing"
|
|
||||||
msgstr "## Contribuir"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you notice some errors in this document, or features that are not "
|
|
||||||
"documented yet, you can suggest those changes by contacting me (more "
|
|
||||||
"information can be find in the following section)."
|
|
||||||
msgstr ""
|
|
||||||
"Si notas algún error en este documento, alguna sección no cubierta o "
|
|
||||||
"simplemente quieres sugerir algo, puedes hacerlo mediante las formas de "
|
|
||||||
"contacto (lee la siguiente sección)."
|
|
||||||
|
|
||||||
msgid "## contact"
|
|
||||||
msgstr "## Contacto"
|
|
||||||
|
|
||||||
msgid ""
|
|
||||||
"If you have questions, don't esitate to contact me in [Twitter,](https://"
|
|
||||||
"twitter.com/manuelcortez00) or sending me an email to "
|
|
||||||
"manuel(at)manuelcortez(dot)net. Just replace the words in parentheses with "
|
|
||||||
"the original signs."
|
|
||||||
msgstr ""
|
|
||||||
"Si tienes preguntas, no dudes en contactarme mediante [Twitter,](https://"
|
|
||||||
"twitter.com/manuelcortez00) o envíame un correo electrónico a "
|
|
||||||
"manuel(arroba)manuelcortez(punto)net. Solo asegúrate de remplazar las "
|
|
||||||
"palabras entre paréntesis por el símbolo original."
|
|
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
@ -8,10 +8,11 @@ import sys
|
|||||||
APP_LOG_FILE = 'debug.log'
|
APP_LOG_FILE = 'debug.log'
|
||||||
ERROR_LOG_FILE = "error.log"
|
ERROR_LOG_FILE = "error.log"
|
||||||
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
|
MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s"
|
||||||
DATE_FORMAT = "%d/%m/%Y %H:%M:%S"
|
DATE_FORMAT = "%d-%m-%Y %H:%M:%S"
|
||||||
|
|
||||||
formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT)
|
formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT)
|
||||||
|
|
||||||
|
# Let's mute some really verbose logs.
|
||||||
requests_log = logging.getLogger("requests")
|
requests_log = logging.getLogger("requests")
|
||||||
requests_log.setLevel(logging.WARNING)
|
requests_log.setLevel(logging.WARNING)
|
||||||
urllib3 = logging.getLogger("urllib3")
|
urllib3 = logging.getLogger("urllib3")
|
||||||
@ -24,7 +25,7 @@ logger.setLevel(logging.DEBUG)
|
|||||||
|
|
||||||
app_handler = RotatingFileHandler(os.path.join(paths.logs_path(), APP_LOG_FILE), mode="w", encoding="utf-8")
|
app_handler = RotatingFileHandler(os.path.join(paths.logs_path(), APP_LOG_FILE), mode="w", encoding="utf-8")
|
||||||
app_handler.setFormatter(formatter)
|
app_handler.setFormatter(formatter)
|
||||||
app_handler.setLevel(logging.DEBUG)
|
app_handler.setLevel(logging.WARNING)
|
||||||
logger.addHandler(app_handler)
|
logger.addHandler(app_handler)
|
||||||
|
|
||||||
error_handler = logging.FileHandler(os.path.join(paths.logs_path(), ERROR_LOG_FILE), mode="w", encoding="utf-8")
|
error_handler = logging.FileHandler(os.path.join(paths.logs_path(), ERROR_LOG_FILE), mode="w", encoding="utf-8")
|
||||||
|
67
src/main.py
67
src/main.py
@ -1,67 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import logger
|
|
||||||
import sys
|
|
||||||
import fixes
|
|
||||||
import traceback
|
|
||||||
#if hasattr(sys, "frozen"):
|
|
||||||
fixes.setup()
|
|
||||||
import platform
|
|
||||||
import languageHandler
|
|
||||||
import widgetUtils
|
|
||||||
import paths
|
|
||||||
import config
|
|
||||||
import output
|
|
||||||
import logging
|
|
||||||
import keys
|
|
||||||
import application
|
|
||||||
if hasattr(sys, "frozen"):
|
|
||||||
sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z)))
|
|
||||||
from mysc.thread_utils import call_threaded
|
|
||||||
from wxUI import commonMessages
|
|
||||||
|
|
||||||
log = logging.getLogger("main")
|
|
||||||
|
|
||||||
orig_session_init = None
|
|
||||||
|
|
||||||
def setup():
|
|
||||||
global orig_session_init
|
|
||||||
log.debug("Starting Socializer %s" % (application.version,))
|
|
||||||
config.setup()
|
|
||||||
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
|
|
||||||
log.debug("Application path is %s" % (paths.app_path(),))
|
|
||||||
log.debug("config path is %s" % (paths.config_path(),))
|
|
||||||
output.setup()
|
|
||||||
languageHandler.setLanguage(config.app["app-settings"]["language"])
|
|
||||||
log.debug("Language set to %s" % (languageHandler.getLanguage()))
|
|
||||||
keys.setup()
|
|
||||||
app = widgetUtils.mainLoopObject()
|
|
||||||
if config.app["app-settings"]["first_start"]:
|
|
||||||
proxy_option = commonMessages.proxy_question()
|
|
||||||
if proxy_option == widgetUtils.YES:
|
|
||||||
config.app["app-settings"]["use_proxy"] = True
|
|
||||||
config.app["app-settings"]["first_start"] = False
|
|
||||||
config.app.write()
|
|
||||||
if config.app["app-settings"]["use_proxy"]:
|
|
||||||
log.debug("Enabling proxy support... ")
|
|
||||||
import requests
|
|
||||||
orig_session_init=requests.sessions.Session.__init__
|
|
||||||
requests.sessions.Session.__init__=patched_session_init
|
|
||||||
requests.Session.__init__=patched_session_init
|
|
||||||
from controller import mainController
|
|
||||||
from sessionmanager import sessionManager
|
|
||||||
|
|
||||||
log.debug("Created Application mainloop object")
|
|
||||||
sm = sessionManager.sessionManagerController()
|
|
||||||
sm.show()
|
|
||||||
del sm
|
|
||||||
r = mainController.Controller()
|
|
||||||
call_threaded(r.login)
|
|
||||||
app.run()
|
|
||||||
|
|
||||||
def patched_session_init(self):
|
|
||||||
global orig_session_init
|
|
||||||
orig_session_init(self)
|
|
||||||
self.proxies={"http": "http://socializer:socializer@socializer.su:3128",
|
|
||||||
"https": "http://socializer:socializer@socializer.su:3128"}
|
|
||||||
|
|
||||||
setup()
|
|
@ -1,41 +0,0 @@
|
|||||||
# -*- mode: python -*-
|
|
||||||
|
|
||||||
block_cipher = None
|
|
||||||
|
|
||||||
a = Analysis(['main.py'],
|
|
||||||
pathex=['.'],
|
|
||||||
binaries=[("sounds", "sounds"),
|
|
||||||
("documentation", "documentation"),
|
|
||||||
("locales", "locales"),
|
|
||||||
("..\\windows-dependencies\\dictionaries", "enchant\\share\\enchant\\myspell"),
|
|
||||||
("..\\windows-dependencies\\x86\\oggenc2.exe", "."),
|
|
||||||
("..\\windows-dependencies\\x86\\bootstrap.exe", "."),
|
|
||||||
("app-configuration.defaults", "."),
|
|
||||||
("session.defaults", "."),
|
|
||||||
("cacert.pem", "."),
|
|
||||||
],
|
|
||||||
datas=[],
|
|
||||||
hiddenimports=[],
|
|
||||||
hookspath=[],
|
|
||||||
runtime_hooks=[],
|
|
||||||
excludes=[],
|
|
||||||
win_no_prefer_redirects=False,
|
|
||||||
win_private_assemblies=False,
|
|
||||||
cipher=block_cipher)
|
|
||||||
pyz = PYZ(a.pure, a.zipped_data,
|
|
||||||
cipher=block_cipher)
|
|
||||||
exe = EXE(pyz,
|
|
||||||
a.scripts,
|
|
||||||
exclude_binaries=True,
|
|
||||||
name='socializer',
|
|
||||||
debug=False,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
console=False )
|
|
||||||
coll = COLLECT(exe,
|
|
||||||
a.binaries,
|
|
||||||
a.zipfiles,
|
|
||||||
a.datas,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
name='main')
|
|
@ -15,4 +15,3 @@ def get(rootFolder):
|
|||||||
else:
|
else:
|
||||||
log.debug("The folder does not exist, using the English folder...")
|
log.debug("The folder does not exist, using the English folder...")
|
||||||
return "en"
|
return "en"
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
By using this design pattern it allows more decoupled code, easier testing (as we don't need to instantiate the views) and easy to switch (or add) a new graphical user interface by replacing interactors and views.
|
By using this design pattern it allows more decoupled code, easier testing (as we don't need to instantiate the views) and easy to switch (or add) a new graphical user interface by replacing interactors and views.
|
||||||
"""
|
"""
|
||||||
|
from . import player
|
||||||
|
from .base import *
|
||||||
from .attach import *
|
from .attach import *
|
||||||
from .audioRecorder import *
|
from .audioRecorder import *
|
||||||
from .blacklist import *
|
from .blacklist import *
|
||||||
|
@ -22,28 +22,12 @@ class configurationPresenter(base.basePresenter):
|
|||||||
else:
|
else:
|
||||||
return _("Custom")
|
return _("Custom")
|
||||||
|
|
||||||
def get_update_channel_label(self, value):
|
|
||||||
if value == "stable":
|
|
||||||
return _("Stable")
|
|
||||||
elif value == "weekly":
|
|
||||||
return _("Weekly")
|
|
||||||
else:
|
|
||||||
return _("Alpha")
|
|
||||||
|
|
||||||
def get_notification_type(self, value):
|
def get_notification_type(self, value):
|
||||||
if value == _("Native"):
|
if value == _("Native"):
|
||||||
return "native"
|
return "native"
|
||||||
else:
|
else:
|
||||||
return "custom"
|
return "custom"
|
||||||
|
|
||||||
def get_update_channel_type(self, value):
|
|
||||||
if value == _("Stable"):
|
|
||||||
return "stable"
|
|
||||||
elif value == _("Weekly"):
|
|
||||||
return "weekly"
|
|
||||||
else:
|
|
||||||
return "alpha"
|
|
||||||
|
|
||||||
def create_config(self):
|
def create_config(self):
|
||||||
self.langs = languageHandler.getAvailableLanguages()
|
self.langs = languageHandler.getAvailableLanguages()
|
||||||
langs = [i[1] for i in self.langs]
|
langs = [i[1] for i in self.langs]
|
||||||
@ -52,8 +36,8 @@ class configurationPresenter(base.basePresenter):
|
|||||||
self.send_message("create_tab", tab="general", arglist=dict(languages=langs))
|
self.send_message("create_tab", tab="general", arglist=dict(languages=langs))
|
||||||
self.send_message("set_language", language=id)
|
self.send_message("set_language", language=id)
|
||||||
self.send_message("set", tab="general", setting="load_images", value=self.session.settings["general"]["load_images"])
|
self.send_message("set", tab="general", setting="load_images", value=self.session.settings["general"]["load_images"])
|
||||||
self.send_message("set", tab="general", setting="use_proxy", value=config.app["app-settings"]["use_proxy"])
|
# self.send_message("set", tab="general", setting="use_proxy", value=config.app["app-settings"]["use_proxy"])
|
||||||
self.send_message("set", tab="general", setting="update_channel", value=self.get_update_channel_label(self.session.settings["general"]["update_channel"]))
|
self.send_message("set", tab="general", setting="debug_logging", value=config.app["app-settings"]["debug_logging"])
|
||||||
self.send_message("create_tab", tab="buffers")
|
self.send_message("create_tab", tab="buffers")
|
||||||
self.send_message("set", tab="buffers", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"])
|
self.send_message("set", tab="buffers", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"])
|
||||||
self.send_message("set", tab="buffers", setting="video_buffers_count", value=self.session.settings["buffers"]["count_for_video_buffers"])
|
self.send_message("set", tab="buffers", setting="video_buffers_count", value=self.session.settings["buffers"]["count_for_video_buffers"])
|
||||||
@ -89,7 +73,7 @@ class configurationPresenter(base.basePresenter):
|
|||||||
raise AttributeError("The setting you specified is not present in the config file.")
|
raise AttributeError("The setting you specified is not present in the config file.")
|
||||||
# check if certain settings have been changed so we'd restart the client.
|
# check if certain settings have been changed so we'd restart the client.
|
||||||
# List of app settings that require a restart after being changed.
|
# List of app settings that require a restart after being changed.
|
||||||
settings_needing_restart = ["language", "use_proxy", "input_device", "output_device"]
|
settings_needing_restart = ["language", "input_device", "output_device", "debug_logging"]
|
||||||
if value != config.app[section][setting] and setting in settings_needing_restart:
|
if value != config.app[section][setting] and setting in settings_needing_restart:
|
||||||
self.needs_restart = True
|
self.needs_restart = True
|
||||||
config.app[section][setting] = value
|
config.app[section][setting] = value
|
||||||
|
@ -47,11 +47,10 @@ class createPostPresenter(base.basePresenter):
|
|||||||
output.speak(_("Translated"))
|
output.speak(_("Translated"))
|
||||||
|
|
||||||
def spellcheck(self, text):
|
def spellcheck(self, text):
|
||||||
checker = SpellChecker.spellchecker.spellChecker(text, "")
|
checker = SpellChecker.spellchecker.spellChecker(text)
|
||||||
if hasattr(checker, "fixed_text"):
|
if hasattr(checker, "fixed_text"):
|
||||||
self.send_message("set", control="text", value=checker.fixed_text)
|
self.send_message("set", control="text", value=checker.fixed_text)
|
||||||
self.send_message("focus_control", control="text")
|
self.send_message("focus_control", control="text")
|
||||||
checker.clean()
|
|
||||||
|
|
||||||
def add_attachments(self):
|
def add_attachments(self):
|
||||||
a = attach.attachPresenter(session=self.session, view=views.attachDialog(), interactor=interactors.attachInteractor())
|
a = attach.attachPresenter(session=self.session, view=views.attachDialog(), interactor=interactors.attachInteractor())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from .basePost import *
|
from .basePost import *
|
||||||
from .audio import *
|
from .audio import *
|
||||||
|
from .article import *
|
||||||
from .comment import *
|
from .comment import *
|
||||||
from .peopleList import *
|
from .peopleList import *
|
||||||
from .poll import *
|
from .poll import *
|
||||||
|
47
src/presenters/displayPosts/article.py
Normal file
47
src/presenters/displayPosts/article.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
""" Presenter to render an article from the VK mobile website.
|
||||||
|
this is an helper class to display an article within socializer, as opposed to opening a web browser and asking the user to get there.
|
||||||
|
"""
|
||||||
|
import logging
|
||||||
|
import re
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from presenters import base
|
||||||
|
|
||||||
|
log = logging.getLogger(__file__)
|
||||||
|
|
||||||
|
class displayArticlePresenter(base.basePresenter):
|
||||||
|
def __init__(self, session, postObject, view, interactor):
|
||||||
|
super(displayArticlePresenter, self).__init__(view=view, interactor=interactor, modulename="display_article")
|
||||||
|
self.session = session
|
||||||
|
self.post = postObject
|
||||||
|
self.load_article()
|
||||||
|
self.run()
|
||||||
|
|
||||||
|
def load_article(self):
|
||||||
|
""" Loads the article in the interactor.
|
||||||
|
This function retrieves, by using the params defined in the VK API, the web version of the article and extracts some info from it.
|
||||||
|
this is needed because there are no public API for articles so far.
|
||||||
|
"""
|
||||||
|
article = self.post[0]
|
||||||
|
# By using the vk_api's session, proxy settings are applied, thus might work in blocked countries.
|
||||||
|
article_body = self.session.vk.session_object.http.get(article["view_url"])
|
||||||
|
# Parse and extract text from all paragraphs.
|
||||||
|
# ToDo: Extract all links and set those as attachments.
|
||||||
|
soup = BeautifulSoup(article_body.text, "lxml")
|
||||||
|
# ToDo: Article extraction require testing to see if you can add more tags beside paragraphs.
|
||||||
|
msg = [p.get_text() for p in soup.find_all("p")]
|
||||||
|
msg = "\n\n".join(msg)
|
||||||
|
self.send_message("set", control="article_view", value=msg)
|
||||||
|
self.send_message("set_title", value=article["title"])
|
||||||
|
# Retrieve views count
|
||||||
|
views = soup.find("div", class_="articleView__views_info")
|
||||||
|
# This might return None if VK changes anything, so let's avoid errors.
|
||||||
|
if views == None:
|
||||||
|
views = str(-1)
|
||||||
|
else:
|
||||||
|
views = views.text
|
||||||
|
# Find the integer and remove the words from the string.
|
||||||
|
numbers = re.findall(r'\d+', views)
|
||||||
|
if len(numbers) != 0:
|
||||||
|
views = numbers[0]
|
||||||
|
self.send_message("set", control="views", value=views)
|
@ -73,7 +73,7 @@ class displayAudioPresenter(base.basePresenter):
|
|||||||
|
|
||||||
def get_suggested_filename(self, audio_index):
|
def get_suggested_filename(self, audio_index):
|
||||||
post = self.post[audio_index]
|
post = self.post[audio_index]
|
||||||
return "{0} - {1}.mp3".format(post["title"], post["artist"])
|
return utils.safe_filename("{0} - {1}.mp3".format(post["title"], post["artist"]))
|
||||||
|
|
||||||
def download(self, audio_index, path):
|
def download(self, audio_index, path):
|
||||||
post = self.post[audio_index]
|
post = self.post[audio_index]
|
||||||
|
@ -15,7 +15,7 @@ from extra import SpellChecker, translator
|
|||||||
from mysc.thread_utils import call_threaded
|
from mysc.thread_utils import call_threaded
|
||||||
from presenters import base
|
from presenters import base
|
||||||
from presenters.createPosts.basePost import createPostPresenter
|
from presenters.createPosts.basePost import createPostPresenter
|
||||||
from . import audio, poll
|
from . import audio, poll, article
|
||||||
|
|
||||||
log = logging.getLogger(__file__)
|
log = logging.getLogger(__file__)
|
||||||
|
|
||||||
@ -309,11 +309,10 @@ class displayPostPresenter(base.basePresenter):
|
|||||||
output.speak(_("Translated"))
|
output.speak(_("Translated"))
|
||||||
|
|
||||||
def spellcheck(self, text):
|
def spellcheck(self, text):
|
||||||
checker = SpellChecker.spellchecker.spellChecker(text, "")
|
checker = SpellChecker.spellchecker.spellChecker(text)
|
||||||
if hasattr(checker, "fixed_text"):
|
if hasattr(checker, "fixed_text"):
|
||||||
self.send_message("set", control="post_view", value=checker.fixed_text)
|
self.send_message("set", control="post_view", value=checker.fixed_text)
|
||||||
self.send_message("focus_control", control="post_view")
|
self.send_message("focus_control", control="post_view")
|
||||||
checker.clean()
|
|
||||||
|
|
||||||
def open_attachment(self, index):
|
def open_attachment(self, index):
|
||||||
attachment = self.attachments[index]
|
attachment = self.attachments[index]
|
||||||
@ -350,8 +349,10 @@ class displayPostPresenter(base.basePresenter):
|
|||||||
webbrowser.open_new_tab(url)
|
webbrowser.open_new_tab(url)
|
||||||
elif attachment["type"] == "poll":
|
elif attachment["type"] == "poll":
|
||||||
a = poll.displayPollPresenter(session=self.session, poll=attachment, interactor=interactors.displayPollInteractor(), view=views.displayPoll())
|
a = poll.displayPollPresenter(session=self.session, poll=attachment, interactor=interactors.displayPollInteractor(), view=views.displayPoll())
|
||||||
|
elif attachment["type"] == "article":
|
||||||
|
a = article.displayArticlePresenter(session=self.session, postObject=[attachment["article"]], interactor=interactors.displayArticleInteractor(), view=views.displayArticle())
|
||||||
else:
|
else:
|
||||||
log.debug("Unhandled attachment: %r" % (attachment,))
|
log.error("Unhandled attachment: %r" % (attachment,))
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if hasattr(self, "worker"):
|
if hasattr(self, "worker"):
|
||||||
|
@ -833,4 +833,3 @@ class Controller(base.basePresenter):
|
|||||||
self.window.remove_buffer(buff)
|
self.window.remove_buffer(buff)
|
||||||
self.buffers.remove(buffer)
|
self.buffers.remove(buffer)
|
||||||
del self.session.groups
|
del self.session.groups
|
||||||
|
|
||||||
|
@ -93,9 +93,7 @@ class audioPlayer(object):
|
|||||||
# Make sure that there are no other sounds trying to be played.
|
# Make sure that there are no other sounds trying to be played.
|
||||||
if self.is_working == False:
|
if self.is_working == False:
|
||||||
self.is_working = True
|
self.is_working = True
|
||||||
# Let's encode the URL as bytes if on Python 3
|
|
||||||
url_ = utils.transform_audio_url(object["url"])
|
url_ = utils.transform_audio_url(object["url"])
|
||||||
url_ = bytes(url_, "utf-8")
|
|
||||||
try:
|
try:
|
||||||
self.stream = URLStream(url=url_)
|
self.stream = URLStream(url=url_)
|
||||||
except:
|
except:
|
||||||
@ -115,7 +113,6 @@ class audioPlayer(object):
|
|||||||
return self.stop_message()
|
return self.stop_message()
|
||||||
output.speak(_("Playing..."))
|
output.speak(_("Playing..."))
|
||||||
url_ = utils.transform_audio_url(message_url)
|
url_ = utils.transform_audio_url(message_url)
|
||||||
url_ = bytes(url_, "utf-8")
|
|
||||||
try:
|
try:
|
||||||
self.message = URLStream(url=url_)
|
self.message = URLStream(url=url_)
|
||||||
except:
|
except:
|
||||||
|
@ -2,15 +2,12 @@
|
|||||||
user = string(default="")
|
user = string(default="")
|
||||||
password = string(default="")
|
password = string(default="")
|
||||||
token = string(default="")
|
token = string(default="")
|
||||||
secret = string(default="")
|
|
||||||
device_id = string(default="")
|
|
||||||
use_alternative_tokens = boolean(default=False)
|
use_alternative_tokens = boolean(default=False)
|
||||||
invited_to_group = boolean(default=False)
|
invited_to_group = boolean(default=False)
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
reverse_timelines = boolean(default=False)
|
reverse_timelines = boolean(default=False)
|
||||||
load_images = boolean(default=True)
|
load_images = boolean(default=True)
|
||||||
update_channel = string(default="stable")
|
|
||||||
|
|
||||||
[buffers]
|
[buffers]
|
||||||
count_for_wall_buffers = integer(default=50)
|
count_for_wall_buffers = integer(default=50)
|
||||||
|
@ -9,7 +9,7 @@ from . utils import seconds_to_string, clean_text
|
|||||||
|
|
||||||
log = logging.getLogger(__file__)
|
log = logging.getLogger(__file__)
|
||||||
|
|
||||||
### Some util funtions
|
### Some util functions
|
||||||
|
|
||||||
def extract_attachment(attachment):
|
def extract_attachment(attachment):
|
||||||
""" Adds information about attachment files in posts. It only adds the text, I mean, no attachment file is added here.
|
""" Adds information about attachment files in posts. It only adds the text, I mean, no attachment file is added here.
|
||||||
@ -83,6 +83,9 @@ def add_attachment(attachment):
|
|||||||
else:
|
else:
|
||||||
text = attachment["wall"]["text"]
|
text = attachment["wall"]["text"]
|
||||||
msg = _("{user}: {post}").format(user=user, post=text)
|
msg = _("{user}: {post}").format(user=user, post=text)
|
||||||
|
elif attachment["type"] == "article":
|
||||||
|
tpe = _("Article")
|
||||||
|
msg = "{author}: {article}".format(author=attachment["article"]["owner_name"], article=attachment["article"]["title"])
|
||||||
else:
|
else:
|
||||||
print(attachment)
|
print(attachment)
|
||||||
return [tpe, msg]
|
return [tpe, msg]
|
||||||
@ -93,6 +96,9 @@ def render_person(status, session):
|
|||||||
""" Render users in people buffers such as everything related to friendships or buffers created with only people.
|
""" Render users in people buffers such as everything related to friendships or buffers created with only people.
|
||||||
Example result: ["John Doe", "An hour ago"]
|
Example result: ["John Doe", "An hour ago"]
|
||||||
Reference: https://vk.com/dev/fields"""
|
Reference: https://vk.com/dev/fields"""
|
||||||
|
# In case the user decided to not show his/her last seen information we must provide a default.
|
||||||
|
# ToDo: Shall we indicate this with a message?
|
||||||
|
online_status = ""
|
||||||
if "last_seen" in status:
|
if "last_seen" in status:
|
||||||
original_date = arrow.get(status["last_seen"]["time"])
|
original_date = arrow.get(status["last_seen"]["time"])
|
||||||
now = arrow.now()
|
now = arrow.now()
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" Session object for Socializer. A session is the only object to call VK API methods, save settings and access to the cache database and sound playback mechanisms. """
|
""" Session object for Socializer. A session is the only object to call VK API methods, save settings and access to the cache database and sound playback mechanisms. """
|
||||||
from __future__ import unicode_literals
|
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import warnings
|
import warnings
|
||||||
@ -136,23 +135,17 @@ class vkSession(object):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
config_filename = os.path.join(paths.config_path(), self.session_id, "vkconfig.json")
|
config_filename = os.path.join(paths.config_path(), self.session_id, "vkconfig.json")
|
||||||
self.vk.login(self.settings["vk"]["user"], self.settings["vk"]["password"], token=self.settings["vk"]["token"], secret=self.settings["vk"]["secret"], device_id=self.settings["vk"]["device_id"], alt_token=self.settings["vk"]["use_alternative_tokens"], filename=config_filename)
|
self.vk.login(self.settings["vk"]["user"], self.settings["vk"]["password"], token=self.settings["vk"]["token"], alt_token=self.settings["vk"]["use_alternative_tokens"], filename=config_filename)
|
||||||
self.settings["vk"]["token"] = self.vk.session_object.token["access_token"]
|
self.settings["vk"]["token"] = self.vk.session_object.token["access_token"]
|
||||||
try:
|
|
||||||
self.settings["vk"]["secret"] = self.vk.session_object.secret
|
|
||||||
self.settings["vk"]["device_id"] = self.vk.session_object.device_id
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
self.settings.write()
|
self.settings.write()
|
||||||
self.logged = True
|
self.logged = True
|
||||||
self.get_my_data()
|
self.get_my_data()
|
||||||
except VkApiError as error:
|
except VkApiError as error:
|
||||||
|
print(error)
|
||||||
if error.code == 5: # this means invalid access token.
|
if error.code == 5: # this means invalid access token.
|
||||||
self.settings["vk"]["user"] = ""
|
self.settings["vk"]["user"] = ""
|
||||||
self.settings["vk"]["password"] = ""
|
self.settings["vk"]["password"] = ""
|
||||||
self.settings["vk"]["token"] = ""
|
self.settings["vk"]["token"] = ""
|
||||||
self.settings["vk"]["secret"] = ""
|
|
||||||
self.settings["vk"]["device_id"] = ""
|
|
||||||
self.settings.write()
|
self.settings.write()
|
||||||
pub.sendMessage("authorisation-failed")
|
pub.sendMessage("authorisation-failed")
|
||||||
else: # print out error so we we will handle it in future versions.
|
else: # print out error so we we will handle it in future versions.
|
||||||
@ -318,6 +311,8 @@ class vkSession(object):
|
|||||||
""" Generic function to be called whenever user wants to post something to VK.
|
""" Generic function to be called whenever user wants to post something to VK.
|
||||||
This function should be capable of uploading all attachments before posting, and send a special event in case the post has failed,
|
This function should be capable of uploading all attachments before posting, and send a special event in case the post has failed,
|
||||||
So the program can recreate the post and show it back to the user."""
|
So the program can recreate the post and show it back to the user."""
|
||||||
|
# Define a list of error codes that are handled by the application.
|
||||||
|
handled_errors = [7, 900]
|
||||||
# ToDo: this function will occasionally be called with attachments already set to post_arguments, example if the user could upload the files but was unable to send the post due to a connection problem.
|
# ToDo: this function will occasionally be called with attachments already set to post_arguments, example if the user could upload the files but was unable to send the post due to a connection problem.
|
||||||
# We should see what can be done (reuploading everything vs using the already added attachments).
|
# We should see what can be done (reuploading everything vs using the already added attachments).
|
||||||
attachments = ""
|
attachments = ""
|
||||||
@ -330,17 +325,6 @@ class vkSession(object):
|
|||||||
log.error("Error calling method %s.%s with arguments: %r. Failed during loading attachments. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
|
log.error("Error calling method %s.%s with arguments: %r. Failed during loading attachments. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
|
||||||
# Report a failed function here too with same arguments so the client should be able to recreate it again.
|
# Report a failed function here too with same arguments so the client should be able to recreate it again.
|
||||||
wx.CallAfter(pub.sendMessage, "postFailed", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
wx.CallAfter(pub.sendMessage, "postFailed", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
||||||
# VK generally defines all kind of messages under "text", "message" or "body" so let's try with all of those
|
|
||||||
possible_message_keys = ["text", "message", "body"]
|
|
||||||
for i in possible_message_keys:
|
|
||||||
if post_arguments.get(i):
|
|
||||||
urls = utils.find_urls_in_text(post_arguments[i])
|
|
||||||
if len(urls) != 0:
|
|
||||||
if len(attachments) == 0:
|
|
||||||
attachments = urls[0]
|
|
||||||
else:
|
|
||||||
attachments += urls[0]
|
|
||||||
post_arguments[i] = post_arguments[i].replace(urls[0], "")
|
|
||||||
# After modifying everything, let's update the post arguments if needed.
|
# After modifying everything, let's update the post arguments if needed.
|
||||||
if len(attachments) > 0:
|
if len(attachments) > 0:
|
||||||
if parent_endpoint == "messages":
|
if parent_endpoint == "messages":
|
||||||
@ -356,6 +340,10 @@ class vkSession(object):
|
|||||||
pub.sendMessage("posted", from_buffer=from_buffer)
|
pub.sendMessage("posted", from_buffer=from_buffer)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
log.exception("Error calling method %s.%s with arguments: %r. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
|
log.exception("Error calling method %s.%s with arguments: %r. Error: %s" % (parent_endpoint, child_endpoint, post_arguments, str(error)))
|
||||||
|
# Send handled errors to the corresponding function, call the default handler otherwise.
|
||||||
|
if error.code in handled_errors:
|
||||||
|
wx.CallAfter(pub.sendMessage, "api-error", code=error.code)
|
||||||
|
else:
|
||||||
# Report a failed function here too with same arguments so the client should be able to recreate it again.
|
# Report a failed function here too with same arguments so the client should be able to recreate it again.
|
||||||
wx.CallAfter(pub.sendMessage, "postFailed", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
wx.CallAfter(pub.sendMessage, "postFailed", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class sessionManagerController(object):
|
|||||||
self.sessions = []
|
self.sessions = []
|
||||||
log.debug("Filling the session list...")
|
log.debug("Filling the session list...")
|
||||||
for i in os.listdir(paths.config_path()):
|
for i in os.listdir(paths.config_path()):
|
||||||
if os.path.isdir(os.path.join(paths.config_path(), i)):
|
if i != "dicts" and os.path.isdir(os.path.join(paths.config_path(), i)):
|
||||||
log.debug("Adding session %s" % (i,))
|
log.debug("Adding session %s" % (i,))
|
||||||
config_test = Configuration(os.path.join(paths.config_path(), i, "session.conf"))
|
config_test = Configuration(os.path.join(paths.config_path(), i, "session.conf"))
|
||||||
name = config_test["vk"]["user"]
|
name = config_test["vk"]["user"]
|
||||||
|
@ -5,6 +5,7 @@ import re
|
|||||||
import html
|
import html
|
||||||
import logging
|
import logging
|
||||||
import requests
|
import requests
|
||||||
|
from pubsub import pub
|
||||||
|
|
||||||
log = logging.getLogger("utils")
|
log = logging.getLogger("utils")
|
||||||
url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*")
|
url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*")
|
||||||
@ -41,23 +42,28 @@ def seconds_to_string(seconds, precision=0):
|
|||||||
def find_urls_in_text(text):
|
def find_urls_in_text(text):
|
||||||
return [s.strip(bad_chars) for s in url_re.findall(text)]
|
return [s.strip(bad_chars) for s in url_re.findall(text)]
|
||||||
|
|
||||||
def download_file(url, local_filename, window):
|
def download_file(url, local_filename):
|
||||||
r = requests.get(url, stream=True)
|
r = requests.get(url, stream=True)
|
||||||
window.change_status(_("Downloading {0}").format(local_filename,))
|
pub.sendMessage("change_status", status=_("Downloading {0}").format(local_filename,))
|
||||||
total_length = r.headers.get("content-length")
|
total_length = r.headers.get("content-length")
|
||||||
dl = 0
|
dl = 0
|
||||||
total_length = int(total_length)
|
total_length = int(total_length)
|
||||||
with open(local_filename, 'wb') as f:
|
with open(local_filename, 'wb') as f:
|
||||||
for chunk in r.iter_content(chunk_size=64):
|
for chunk in r.iter_content(chunk_size=512*1024):
|
||||||
if chunk: # filter out keep-alive new chunks
|
if chunk: # filter out keep-alive new chunks
|
||||||
dl += len(chunk)
|
dl += len(chunk)
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
done = int(100 * dl/total_length)
|
done = int(100 * dl/total_length)
|
||||||
msg = _("Downloading {0} ({1}%)").format(os.path.basename(local_filename), done)
|
msg = _("Downloading {0} ({1}%)").format(os.path.basename(local_filename), done)
|
||||||
window.change_status(msg)
|
# print(msg)
|
||||||
window.change_status(_("Ready"))
|
pub.sendMessage("change_status", status=msg)
|
||||||
|
pub.sendMessage("change_status", status=_("Ready"))
|
||||||
return local_filename
|
return local_filename
|
||||||
|
|
||||||
|
def download_files(downloads):
|
||||||
|
for download in downloads:
|
||||||
|
download_file(download[0], download[1])
|
||||||
|
|
||||||
def detect_users(text):
|
def detect_users(text):
|
||||||
""" Detect all users and communities mentionned in any text posted in VK."""
|
""" Detect all users and communities mentionned in any text posted in VK."""
|
||||||
# This regexp gets group and users mentionned in topic comments.
|
# This regexp gets group and users mentionned in topic comments.
|
||||||
@ -90,4 +96,9 @@ def transform_audio_url(url):
|
|||||||
url = url.replace("/"+parts[-2], "")
|
url = url.replace("/"+parts[-2], "")
|
||||||
else:
|
else:
|
||||||
url = url.replace("/"+parts[-3], "")
|
url = url.replace("/"+parts[-3], "")
|
||||||
|
url = url.split(".mp3?")[0]+".mp3"
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
def safe_filename(filename):
|
||||||
|
allowed_symbols = ["_", ".", ",", "-", "(", ")"]
|
||||||
|
return "".join([c for c in filename if c.isalpha() or c.isdigit() or c==' ' or c in allowed_symbols]).rstrip()
|
||||||
|
@ -12,7 +12,7 @@ class vkObject(object):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.api_key = keys.keyring.get_api_key()
|
self.api_key = keys.keyring.get_api_key()
|
||||||
|
|
||||||
def login(self, user, password, token, secret, device_id, alt_token, filename):
|
def login(self, user, password, token, alt_token, filename):
|
||||||
if alt_token == False:
|
if alt_token == False:
|
||||||
log.info("Using kate's token...")
|
log.info("Using kate's token...")
|
||||||
# Let's import the patched vk_api module for using a different user agent
|
# Let's import the patched vk_api module for using a different user agent
|
||||||
@ -20,11 +20,9 @@ class vkObject(object):
|
|||||||
if token == "" or token == None:
|
if token == "" or token == None:
|
||||||
log.info("Token is not valid. Generating one...")
|
log.info("Token is not valid. Generating one...")
|
||||||
original_token = official.login(user, password)
|
original_token = official.login(user, password)
|
||||||
token = original_token[0]
|
token = original_token
|
||||||
secret = original_token[1]
|
|
||||||
device_id = original_token[2]
|
|
||||||
log.info("Token validated...")
|
log.info("Token validated...")
|
||||||
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, token=token, secret=secret, device_id=device_id, scope="offline, wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename)
|
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, token=token, scope="all", config_filename=filename)
|
||||||
else:
|
else:
|
||||||
import vk_api
|
import vk_api
|
||||||
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, scope="offline, wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename, auth_handler=two_factor_auth)
|
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, scope="offline, wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename, auth_handler=two_factor_auth)
|
||||||
|
@ -7,7 +7,6 @@ import logging
|
|||||||
import vk_api
|
import vk_api
|
||||||
import threading
|
import threading
|
||||||
import requests
|
import requests
|
||||||
from authenticator.official import get_sig
|
|
||||||
from . import jconfig_patched as jconfig
|
from . import jconfig_patched as jconfig
|
||||||
from vk_api.enums import VkUserPermissions
|
from vk_api.enums import VkUserPermissions
|
||||||
from vk_api.exceptions import *
|
from vk_api.exceptions import *
|
||||||
@ -16,7 +15,7 @@ DEFAULT_USER_SCOPE = sum(VkUserPermissions)
|
|||||||
|
|
||||||
class VkApi(vk_api.VkApi):
|
class VkApi(vk_api.VkApi):
|
||||||
|
|
||||||
def __init__(self, login=None, password=None, token=None, secret=None, device_id=None,
|
def __init__(self, login=None, password=None, token=None,
|
||||||
auth_handler=None, captcha_handler=None,
|
auth_handler=None, captcha_handler=None,
|
||||||
config=jconfig.Config, config_filename='vk_config.v2.json',
|
config=jconfig.Config, config_filename='vk_config.v2.json',
|
||||||
api_version='5.101', app_id=2685278, scope=DEFAULT_USER_SCOPE,
|
api_version='5.101', app_id=2685278, scope=DEFAULT_USER_SCOPE,
|
||||||
@ -26,8 +25,6 @@ class VkApi(vk_api.VkApi):
|
|||||||
self.password = password
|
self.password = password
|
||||||
|
|
||||||
self.token = {'access_token': token}
|
self.token = {'access_token': token}
|
||||||
self.secret = secret
|
|
||||||
self.device_id = device_id
|
|
||||||
self.api_version = api_version
|
self.api_version = api_version
|
||||||
self.app_id = app_id
|
self.app_id = app_id
|
||||||
self.scope = scope
|
self.scope = scope
|
||||||
@ -93,9 +90,7 @@ class VkApi(vk_api.VkApi):
|
|||||||
|
|
||||||
if delay > 0:
|
if delay > 0:
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
values.update(https=1, device_id=self.device_id)
|
values.update(https=1)
|
||||||
sig = get_sig(method, values, self.secret)
|
|
||||||
values.update(sig=sig)
|
|
||||||
response = self.http.post(
|
response = self.http.post(
|
||||||
'https://api.vk.com/method/' + method,
|
'https://api.vk.com/method/' + method,
|
||||||
values
|
values
|
||||||
|
103
src/setup.py
103
src/setup.py
@ -1,103 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
""" Setup file to create executables and distribute the source code of this application. Don't forget this file! """
|
|
||||||
############################################################
|
|
||||||
# Copyright (c) 2016 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
############################################################
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
import py2exe
|
|
||||||
import os
|
|
||||||
import application
|
|
||||||
import platform
|
|
||||||
from glob import glob
|
|
||||||
|
|
||||||
def get_architecture_files():
|
|
||||||
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 [
|
|
||||||
("", ["../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 [
|
|
||||||
("", ["session.defaults", "app-configuration.defaults", "cacert.pem"]),
|
|
||||||
("accessible_output2/lib", glob("accessible_output2/lib/*.dll")),
|
|
||||||
|
|
||||||
]+get_sounds()+get_locales()+get_documentation()+accessible_output2.find_datafiles()+enchant.utils.win32_data_files()+get_architecture_files()+sound_lib.find_datafiles()
|
|
||||||
|
|
||||||
def get_documentation ():
|
|
||||||
answer = [("documentation", ["documentation/license.txt"])]
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
setup(
|
|
||||||
name = application.name,
|
|
||||||
author = application.author,
|
|
||||||
author_email = application.authorEmail,
|
|
||||||
version = application.version,
|
|
||||||
url = application.url,
|
|
||||||
packages= find_packages(),
|
|
||||||
data_files = get_data(),
|
|
||||||
options = {
|
|
||||||
'py2exe': {
|
|
||||||
'optimize':2,
|
|
||||||
'packages': ["pubsub", "pubsub.core", "pubsub.core.kwargs", "future"],
|
|
||||||
'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-l2-1-0.dll", "api-ms-win-core-string-obsolete-l1-1-0.dll", "WLDAP32.dll", "MSVCP90.dll", "CRYPT32.dll", "api-ms-win-core-memory-l1-1-2.dll", "api-ms-win-core-psapi-l1-1-0.dll", "api-ms-win-core-libraryloader-l1-2-2.dll", "api-ms-win-core-string-l2-1-0.dll", "api-ms-win-core-string-l1-1-0.dll", "api-ms-win-core-processthreads-l1-1-2.dll", "api-ms-win-core-atoms-l1-1-0.dll", "api-ms-win-core-heap-l2-1-0.dll", "api-ms-win-core-com-midlproxystub-l1-1-0.dll", "api-ms-win-core-libraryloader-l1-2-0.dll", "api-ms-win-core-localization-l1-2-1.dll", "api-ms-win-core-sysinfo-l1-2-1.dll"],
|
|
||||||
# 'skip_archive': False
|
|
||||||
},
|
|
||||||
},
|
|
||||||
windows = [
|
|
||||||
{
|
|
||||||
'script': 'main.py',
|
|
||||||
'dest_base': 'socializer',
|
|
||||||
}
|
|
||||||
],
|
|
||||||
install_requires = [
|
|
||||||
]
|
|
||||||
)
|
|
70
src/socializer.py
Normal file
70
src/socializer.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logger
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
#if hasattr(sys, "frozen"):
|
||||||
|
import platform
|
||||||
|
import languageHandler
|
||||||
|
import widgetUtils
|
||||||
|
import paths
|
||||||
|
import config
|
||||||
|
import output
|
||||||
|
import logging
|
||||||
|
import keys
|
||||||
|
import application
|
||||||
|
if hasattr(sys, "frozen"):
|
||||||
|
sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z)))
|
||||||
|
from mysc.thread_utils import call_threaded
|
||||||
|
from wxUI import commonMessages
|
||||||
|
|
||||||
|
log = logging.getLogger("main")
|
||||||
|
|
||||||
|
orig_session_init = None
|
||||||
|
|
||||||
|
def setup():
|
||||||
|
global orig_session_init
|
||||||
|
log.debug("Starting Socializer %s" % (application.version,))
|
||||||
|
config.setup()
|
||||||
|
if config.app["app-settings"]["debug_logging"] == True:
|
||||||
|
logger.app_handler.setLevel(logging.DEBUG)
|
||||||
|
log.info("Using %s %s" % (platform.system(), platform.architecture()[0]))
|
||||||
|
log.debug("Application path is %s" % (paths.app_path(),))
|
||||||
|
log.debug("config path is %s" % (paths.config_path(),))
|
||||||
|
output.setup()
|
||||||
|
languageHandler.setLanguage(config.app["app-settings"]["language"])
|
||||||
|
log.debug("Language set to %s" % (languageHandler.getLanguage()))
|
||||||
|
keys.setup()
|
||||||
|
app = widgetUtils.mainLoopObject()
|
||||||
|
if config.app["app-settings"]["first_start"]:
|
||||||
|
log.debug("Detected first time execution.")
|
||||||
|
# proxy_option = commonMessages.proxy_question()
|
||||||
|
# if proxy_option == widgetUtils.YES:
|
||||||
|
# config.app["app-settings"]["use_proxy"] = True
|
||||||
|
# log.debug("User has requested to use proxy for connecting to VK.")
|
||||||
|
config.app["app-settings"]["first_start"] = False
|
||||||
|
config.app.write()
|
||||||
|
# if config.app["app-settings"]["use_proxy"]:
|
||||||
|
# log.debug("Enabling proxy support... ")
|
||||||
|
# import requests
|
||||||
|
# orig_session_init=requests.sessions.Session.__init__
|
||||||
|
# requests.sessions.Session.__init__=patched_session_init
|
||||||
|
# requests.Session.__init__=patched_session_init
|
||||||
|
from controller import mainController
|
||||||
|
from sessionmanager import sessionManager
|
||||||
|
|
||||||
|
log.debug("Created Application mainloop object")
|
||||||
|
sm = sessionManager.sessionManagerController()
|
||||||
|
sm.show()
|
||||||
|
del sm
|
||||||
|
r = mainController.Controller()
|
||||||
|
call_threaded(r.login)
|
||||||
|
app.run()
|
||||||
|
|
||||||
|
### ToDo: Use this when proxy is available again.
|
||||||
|
def patched_session_init(self):
|
||||||
|
global orig_session_init
|
||||||
|
orig_session_init(self)
|
||||||
|
self.proxies={"http": "http://socializer:socializer@socializer.su:3128",
|
||||||
|
"https": "http://socializer:socializer@socializer.su:3128"}
|
||||||
|
|
||||||
|
setup()
|
@ -17,13 +17,13 @@ except ImportError:
|
|||||||
|
|
||||||
from platform_utils import paths
|
from platform_utils import paths
|
||||||
|
|
||||||
def perform_update(endpoint, current_version, update_type="stable", app_name='', password=None, update_available_callback=None, progress_callback=None, update_complete_callback=None):
|
def perform_update(endpoint, current_version, app_name='', password=None, update_available_callback=None, progress_callback=None, update_complete_callback=None):
|
||||||
requests_session = create_requests_session(app_name=app_name, version=current_version)
|
requests_session = create_requests_session(app_name=app_name, version=current_version)
|
||||||
available_update = find_update(endpoint, requests_session=requests_session)
|
available_update = find_update(endpoint, requests_session=requests_session)
|
||||||
if not available_update:
|
if not available_update:
|
||||||
logger.debug("No update available")
|
logger.debug("No update available")
|
||||||
return False
|
return False
|
||||||
available_version, available_description, update_url = find_version_data(update_type, current_version, available_update)
|
available_version, available_description, update_url = find_version_data(current_version, available_update)
|
||||||
if available_version == False:
|
if available_version == False:
|
||||||
return False
|
return False
|
||||||
logger.info("A new update is available. Version %s" % available_version)
|
logger.info("A new update is available. Version %s" % available_version)
|
||||||
@ -55,30 +55,12 @@ def find_update(endpoint, requests_session):
|
|||||||
content = response.json()
|
content = response.json()
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def find_version_data(update_type, current_version, available_update):
|
def find_version_data(current_version, available_update):
|
||||||
if update_type == "stable":
|
available_version = available_update["current_version"]
|
||||||
available_version = float(available_update['current_version'])
|
|
||||||
if not float(available_version) > float(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']:
|
|
||||||
logger.debug("No update for this architecture")
|
|
||||||
return (False, False, False)
|
|
||||||
available_description = available_update.get('description', None)
|
|
||||||
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
|
|
||||||
return (available_version, available_description, update_url)
|
|
||||||
else: # Unstable versions, based in commits instead of version numbers.
|
|
||||||
# A condition for this to work is a successful ran of a pipeline.
|
|
||||||
if "status" not in available_update:
|
|
||||||
return (False, False, False)
|
|
||||||
if "status" in available_update and available_update["status"] != "success":
|
|
||||||
return (False, False, False)
|
|
||||||
available_version = available_update["short_id"]
|
|
||||||
if available_version == current_version:
|
if available_version == current_version:
|
||||||
return (False, False, False)
|
return (False, False, False)
|
||||||
available_description = available_update["message"]
|
available_description = available_update["description"]
|
||||||
# ToDo: simplify this so it can be reused in other projects.
|
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
|
||||||
if sys.version[0] == "3":
|
|
||||||
update_url = "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=alpha_python3"
|
|
||||||
else:
|
|
||||||
update_url = "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=alpha"
|
|
||||||
return (available_version, available_description, update_url)
|
return (available_version, available_description, update_url)
|
||||||
|
|
||||||
def download_update(update_url, update_destination, requests_session, progress_callback=None, chunk_size=io.DEFAULT_BUFFER_SIZE):
|
def download_update(update_url, update_destination, requests_session, progress_callback=None, chunk_size=io.DEFAULT_BUFFER_SIZE):
|
||||||
|
@ -9,18 +9,14 @@ from . import update
|
|||||||
from .wxUpdater import *
|
from .wxUpdater import *
|
||||||
logger = logging.getLogger("updater")
|
logger = logging.getLogger("updater")
|
||||||
|
|
||||||
def do_update(update_type="stable"):
|
def do_update():
|
||||||
# Updates cannot be performed in the source code version of Socializer.
|
# Updates cannot be performed in the source code version of Socializer.
|
||||||
if hasattr(sys, "frozen") == False:
|
if hasattr(sys, "frozen") == False:
|
||||||
return
|
return
|
||||||
if update_type == "stable":
|
endpoint = application.update_url
|
||||||
endpoint = application.update_stable_url
|
|
||||||
version = application.version
|
|
||||||
else:
|
|
||||||
endpoint = application.update_next_url
|
|
||||||
version = application.update_next_version
|
version = application.update_next_version
|
||||||
try:
|
try:
|
||||||
return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_type=update_type, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
logger.exception("Update failed.")
|
logger.exception("Update failed.")
|
||||||
output.speak("An exception occurred while attempting to update " + application.name + ". If this message persists, contact the " + application.name + " developers. More information about the exception has been written to the error log.",True)
|
output.speak("An exception occurred while attempting to update " + application.name + ". If this message persists, contact the " + application.name + " developers. More information about the exception has been written to the error log.",True)
|
@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
|
||||||
import wx
|
import wx
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ class blacklistDialog(widgetUtils.BaseDialog):
|
|||||||
sizer.Add(box1, 0, wx.ALL, 5)
|
sizer.Add(box1, 0, wx.ALL, 5)
|
||||||
self.unblock = wx.Button(panel, wx.NewId(), _("Unblock"))
|
self.unblock = wx.Button(panel, wx.NewId(), _("Unblock"))
|
||||||
sizer.Add(self.unblock, 0, wx.ALL, 5)
|
sizer.Add(self.unblock, 0, wx.ALL, 5)
|
||||||
close = wx.Button(panel, wx.ID_CLOSE)
|
close = wx.Button(panel, wx.ID_CANCEL, _("Close"))
|
||||||
sizer.Add(close, 0, wx.ALL, 5)
|
sizer.Add(close, 0, wx.ALL, 5)
|
||||||
panel.SetSizer(sizer)
|
panel.SetSizer(sizer)
|
||||||
self.SetClientSize(sizer.CalcMin())
|
self.SetClientSize(sizer.CalcMin())
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user