183 Commits
v0.18 ... v0.21

Author SHA1 Message Date
853cce4a66 Bumped version to 0.21 2019-07-13 08:56:00 -05:00
2d944b276c Updated translations 2019-07-13 08:47:40 -05:00
b4299ef066 Updated translations 2019-07-13 08:40:33 -05:00
ae93efb17a Display version type in about dialog between alpha or stable 2019-07-02 09:26:07 -05:00
d95dfb18fd Removed some settings no longer needed 2019-07-02 08:55:55 -05:00
4e3c397ce5 Refactored some functions to call wx's threads properly. 2019-06-10 09:26:10 -05:00
4e6126405f Send links when posting a topic comment 2019-06-06 13:42:22 -05:00
8cdec543e1 Modified auth info for 2 factor auth 2019-06-05 10:38:59 -05:00
4810cbe138 Added timeline creation from the context menu in people buffers 2019-05-29 17:51:37 -05:00
8ec7fbb49e Added support for displaying and opening wall posts as attachments in conversations 2019-05-29 09:17:02 -05:00
7d52ed8802 Fixed error retrieving group information of objects not present in the db. 2019-05-29 09:16:16 -05:00
9d44d063eb Modified timeline dialog for a future change 2019-05-24 17:42:59 -05:00
d5eb9ed478 Merge branch 'master' of code.manuelcortez.net:manuelcortez/socializer 2019-05-24 16:33:20 -05:00
40afb6cdc2 Fixed error when attenpting to upload photos to wall posts. Now it should work normally 2019-05-21 16:20:38 -05:00
74234476ab Updated button label in group feed buffers 2019-05-20 21:32:51 -05:00
82c71a3bd8 Merge branch 'master' of code.manuelcortez.net:manuelcortez/socializer 2019-05-20 00:42:19 -05:00
5161e1c045 Updated changelog 2019-05-19 12:35:19 -05:00
40052dbf3f Fixed audio player on walls 2019-05-15 17:19:02 -05:00
e73d92754e Fixed a typo in documentation translation 2019-05-07 11:38:04 -05:00
6df1b80941 Test 4 2019-05-07 10:37:31 -05:00
a9e5963b74 Test 3 2019-05-07 10:35:12 -05:00
95671966cd Test 2 2019-05-07 10:32:12 -05:00
a8ce7216e1 Test 2019-05-07 10:29:15 -05:00
5c6829165b Fixed a typo 2019-05-07 03:46:14 -05:00
91eebfd895 Added topic creation in groups (experimental) 2019-05-06 17:57:34 -05:00
72cc04342f Restructured group info storage for a wider usage 2019-05-06 15:50:45 -05:00
75267294f9 Now it is possible to post as group or username in group walls 2019-05-06 14:58:45 -05:00
f81d302c9a Updated player 2019-05-06 12:09:53 -05:00
c3ab0406e4 Updated documentation translations 2019-05-06 11:45:58 -05:00
fdcaf4e596 Fixed two factor auth in socializer! 2019-05-05 01:01:31 -05:00
ca7b3eff29 Added some debug info 2019-05-04 14:25:39 -05:00
f1eb640564 Select songs with spacebar and play audio from selected tracks has been implemented 2019-05-02 05:57:49 -05:00
194ca2d380 Implemented a selection control in audio buffers (not working yet) 2019-04-30 17:36:53 -05:00
976e90f0a0 Fixed audio methods 2019-04-30 15:32:38 -05:00
2c836f473d Fixed a strange issue with play_all function 2019-04-30 15:31:54 -05:00
f834b6046e Added the full implementation, pending usage into an experiment 2019-04-26 17:53:55 -05:00
e6087f3818 Fixed a typo 2019-04-26 17:51:18 -05:00
20c3df6be2 Added experiment of a selectableList (not implemented, et) 2019-04-26 17:49:54 -05:00
b914e4b548 Merge branch 'next' 2019-04-25 17:42:16 -05:00
f336489609 Released v0.20 2019-04-25 12:10:35 -05:00
4ce2e88568 Updated changelog 2019-04-25 11:38:38 -05:00
a917a6a9cd Ducking when voice messages are being played 2019-04-25 11:38:00 -05:00
a01eabea91 Separate playback of voice messages from regular audio playback 2019-04-25 10:18:13 -05:00
605f0da751 Modified worker in player module so it will set stopped to True after finishing playback 2019-04-25 09:58:53 -05:00
6bd0c10ef2 Removed some old keystrokes no longer needed 2019-04-25 09:17:48 -05:00
a9032602bf Added play and pause functionality in the audios displayer 2019-04-25 08:56:12 -05:00
8c03601bd2 Change lable to 'pause' in the play button when something is playing 2019-04-25 08:48:19 -05:00
afc4c0ca1f prepared content for V0.20 2019-04-24 17:39:25 -05:00
e0ee8a7040 Updated translations 2019-04-24 17:34:09 -05:00
e32336aff8 Added support for loading all comments in topics 2019-04-23 13:13:58 -05:00
0edbba5625 fixed a typo in last commit 2019-04-23 11:31:49 -05:00
eec5350926 Improve checks for audio in stayed state 2019-04-22 00:10:40 -05:00
20f0b3f782 Updated changelog 2019-04-20 14:17:36 -05:00
5cf4128c49 Fixed error in disconnected friends algorithm 2019-04-19 14:41:57 -05:00
47768acf5c Fixed session error in new config files 2019-04-19 02:13:29 -05:00
f88d2177c3 Updated audio methods for changes introduced in 17/04 2019-04-17 11:50:15 -05:00
9373f10d68 Added seeking in the audio player menu and in new keystrokes (read changelog) 2019-04-17 11:46:26 -05:00
4f3bb6ac93 Fixed all audio methods due to latest VK changes 2019-04-16 15:45:25 -05:00
5f224a077c Reordered presenters for post display and cretion 2019-04-16 12:24:42 -05:00
14cdeb0b5a Updated and restructured Socializer's changelog 2019-04-16 09:41:47 -05:00
b02137c216 Added display of people who shared the post in the post displayer dialog 2019-04-16 09:41:32 -05:00
7c90103af4 Show people who have liked a post if pressing the likes button in the post displayer 2019-04-15 17:50:56 -05:00
903af03d15 Added menu in list of added friends in home timeline buffer 2019-04-15 16:16:17 -05:00
b57ca4d207 Fix error on 'open in vk' for group topics 2019-04-14 23:51:18 -05:00
2fe58941ea Added open in vk.com option in context menu for lots of items 2019-04-13 18:43:48 -05:00
04f734bebe some functions present in the player should not freeze the app while taking place 2019-04-11 17:43:52 -05:00
a0d43ebe0e Moved audio playback infrastructure to pubsub events 2019-04-11 17:15:45 -05:00
6d80dce66d Sent voice messages from socializer should work in phones now 2019-04-11 15:52:41 -05:00
3d765dd701 Fix some issues introduced in the last player stuff 2019-04-11 15:52:18 -05:00
2b42c64160 Fix AttributeError when saving data from the alternative tokens method 2019-04-11 05:29:42 -05:00
7928131112 Added language settings in preferences dialog 2019-04-11 05:25:43 -05:00
9cb1f9647c Started pubsub implementation in all player related functions 2019-04-10 17:49:23 -05:00
6d6daa60b6 Added comments to the player module 2019-04-10 17:36:02 -05:00
81a454c29c Read confirmations will be sent in real time in conversations 2019-04-10 15:19:22 -05:00
6f245d9b7f Added support to delete conversations 2019-04-09 17:55:05 -05:00
05c001067e Removed old alpha version built with Python 2 2019-04-09 16:15:38 -05:00
fea57a4034 Updated changelog with getting more items to conversation buffers 2019-04-09 16:09:33 -05:00
00eebf9260 Added support for loading more items in conversation buffers 2019-04-09 16:08:14 -05:00
cde18c8d35 Include all relevant spelling dictionaries in binary builds 2019-03-28 10:18:44 -06:00
0b2c3fa96e Added sound settings tab in the preferences dialog. Only available options there are input and output device 2019-03-28 08:57:48 -06:00
8f631cfe4b Modify audio player volume by 2% instead of 5% 2019-03-25 16:35:56 -06:00
f10b25c07f Updated app to 0.19 2019-03-12 17:19:10 -06:00
77a959fe29 Moved documentation locales to Src directory, as doc is generated already from the src dir in CI environments 2019-03-12 16:33:18 -06:00
d8db111d30 Updaed locales for documentation 2019-03-12 16:04:29 -06:00
c2811f2818 Updated Russian translation 2019-03-12 12:09:01 -06:00
b258a3ff9c Updated installer file 2019-03-12 12:08:43 -06:00
02029d22b0 Updated information before release of 0.19 2019-03-11 17:34:33 -06:00
1f7f1c170d Updated translations 2019-03-11 02:17:46 -06:00
a13a4a5695 display results of polls closed when reaching end_date, and polls where the current user cannot vote 2019-03-07 15:23:37 -06:00
0b9dcaa8f1 Remove option 'view information' from documents menu as there is not much to show from a document 2019-03-07 15:12:17 -06:00
9c7030f80e prefix calls to scripts 2019-03-06 16:52:58 -06:00
d8112550f5 Updates some strings 2019-03-06 16:38:11 -06:00
4eb662d314 Modify move command for generated files 2019-03-06 16:28:27 -06:00
8e06ffc3b1 Attempt to upload translation catalogs to CI artifacts 2019-03-06 16:19:22 -06:00
98c5c052de Added option to download document from the context menu 2019-03-05 17:43:19 -06:00
95fe0c9516 Focus should be more persistent when dealing with the online friends buffer 2019-03-05 16:51:19 -06:00
2908b1449c Fixed small issue in audio player 2019-03-05 13:44:35 -06:00
454b461e89 Added basic support to polls (only voting and seeing results is implemented) 2019-03-05 05:58:41 -06:00
0a8d2ad233 started poll implementation 2019-03-01 17:41:46 -06:00
35e34e44ee Fix libloader stuff 2019-03-01 17:33:54 -06:00
b6ce1f62e0 display poll in attachments for posts (no actions are available, yet) 2019-02-26 16:41:30 -06:00
55eaa85979 Announcement of users typing will be send only when the socializer window is focused 2019-02-26 16:17:53 -06:00
b3f5c532dd Allows uploading audio directly from the 'my audios' buffer 2019-02-26 13:57:37 -06:00
0821565a75 Fixed a typo 2019-02-26 11:18:02 -06:00
d187ad43f3 Updated documentation 2019-02-26 11:08:08 -06:00
b5aff6a8eb display document type properly in buffers 2019-02-26 09:02:18 -06:00
a6291b3ee2 Started the documents menu. For now it just allows to add and remove a document to your documents list 2019-02-26 08:38:49 -06:00
f1f86e04e6 Fixed buffer updates for buffers depending on get_page. That includes wall buffers and everything else which is not the home buffer 2019-02-26 08:35:42 -06:00
06898ca0af Updated context menu for buffers. Now it allows to load and discard audio and video albums 2019-02-25 15:42:59 -06:00
305f8317fe Merge branch 'master' of code.manuelcortez.net:manuelcortez/socializer 2019-02-25 05:31:29 -06:00
d7d13dd523 Fixed call to reply() in comment presenter 2019-02-24 19:40:59 -06:00
84dd9dbcea RepeatingTimer should not raise tracebacks when loading all buffers periodically 2019-02-18 13:45:47 -06:00
a345fa8874 Improved Button's label 2019-02-18 13:41:49 -06:00
5780d3ca21 Added online friends buffer 2019-02-14 13:09:44 -06:00
4c220cbb36 display error if there is an internet connection problem during startup 2019-02-14 08:36:31 -06:00
942f9296a0 Added options in the help menu to go to the logs and config folder 2019-02-13 16:48:00 -06:00
fb50f2783f Improved GUI for topic comments. Authentication errors should be handled gracefully now 2019-02-12 17:49:33 -06:00
a50ddd25b2 Fixed an error when displaying posts in a community wall, if the community had shared another community's post 2019-02-11 05:33:18 -06:00
4b6d5a86b2 It is possible to load previous items in the home buffer properly, and the feature works too in wall buffers and timelines 2019-02-11 04:53:32 -06:00
fbada0c4be Fixed get previous item in newsfeed buffer. Now it should load around 700 items 2019-02-11 03:55:16 -06:00
6a8459cc4e Reorganized source code in main module, added docstrings to lots of functions 2019-02-06 17:47:49 -06:00
fce9e9a73f Removed create-empty_buffer and improved create_buffer for dealing with empty buffers too 2019-02-06 11:35:38 -06:00
8ab3c937b6 Renamed some buffers 2019-02-06 11:35:07 -06:00
f8e431cc2e Fixes in document buffers 2019-02-06 11:34:54 -06:00
3f7c069ce0 Added basic creation of document buffers in communities 2019-02-05 12:20:50 -06:00
21895d307b Added correct unicode representation to chat messages 2019-02-03 21:04:10 -06:00
38b0eec741 Text should be cleaned better in posts, coments and topic comments. Cleaned texts will render properly usernames, group names and render properly certain unicode characters 2019-02-03 20:56:32 -06:00
2496f19bee Updated main controller 2019-02-03 18:55:14 -06:00
21932dc329 Group mentions are displayed properly when mentioned in comments 2019-02-03 18:54:31 -06:00
35fc287d55 Added support for reply to topic comments 2019-02-01 13:25:47 -06:00
3a3623859b Changelog should be displayed properly when opened from the help menu. Fixes #21 2019-02-01 11:03:26 -06:00
f623e78bdc Updated changelog 2019-01-31 16:50:53 -06:00
2bcc14888c Added view and presenter for topic displayer. Needs some more methods yet 2019-01-31 16:48:21 -06:00
7bee6cf1ea Display load topics menu item 2019-01-31 16:47:51 -06:00
eea264a099 Added topic buffer's GUI 2019-01-31 16:47:27 -06:00
b99d872c53 Allow creation of topic buffers, loading and unloading of groups too 2019-01-31 16:46:55 -06:00
f09d1b5da1 Added a buffer for displaying topics. Community buffers will keep group_info on them so we can check for group permissions and available post types 2019-01-31 16:46:26 -06:00
9e3ff74b98 Added renderer for group topics 2019-01-31 16:45:31 -06:00
2e64e31a8f Fixed clean_list for all post interactor dialogs 2019-01-31 16:45:05 -06:00
150f9d6c08 Added actions in community buffers from context menu in the treebook 2019-01-30 15:32:46 -06:00
a6565aae53 Added proxy setting to preferences dialog 2019-01-29 16:23:02 -06:00
ac268c0672 Attaching documents is now supported 2019-01-28 05:36:51 -06:00
94902c661f chat names have been simplified for an easier navigation 2019-01-27 05:37:42 -06:00
0a90e1fe4a Fixed an error when removing audio items from my audios buffer 2019-01-26 18:51:34 -06:00
9f1a09689f Updated changelog 2019-01-26 18:45:07 -06:00
af68d9b0cf Fixed errors in move to album option for audios 2019-01-26 18:44:23 -06:00
d75b7de20b Implemented adding and removing audio albums appropiately 2019-01-26 18:42:50 -06:00
f968e618ac Reenabled create and delete audio albums 2019-01-26 18:42:20 -06:00
fb9717a00f Added more parameters to audio search feature 2019-01-26 17:45:10 -06:00
0acdf41fa3 Switched to a proper context menu handler 2019-01-26 07:11:11 -06:00
f5fddd0369 Fixed issues in post displayer dialogs introduced in previous alpha 2019-01-26 07:10:53 -06:00
660f801afd Replaced bytes object for unicode counterpart 2019-01-25 17:52:59 -06:00
da66118d20 Attempt to fix proxy not working in audio playback 2019-01-25 11:46:15 -06:00
93d1de941c volume for application sounds will not be connected to app volume for audio files 2019-01-25 11:45:45 -06:00
94106a11c0 Improved handling for deleted posts. Now they should display an error 2019-01-25 10:36:28 -06:00
76f0ee3ef0 Documentation and changelog should be included in all builds 2019-01-24 17:11:33 -06:00
712792ac9f Remove friend implementation finished 2019-01-24 17:10:32 -06:00
56424cf0d1 Implemented Ctrl+A to select all in important edit boxes 2019-01-24 16:07:02 -06:00
9230bd8115 fixed an error in community buffers 2019-01-24 13:30:40 -06:00
ab0d34599f Fixed an error in chat messages that was making the program unable to keep sending messages after an attachment file has been sent 2019-01-23 09:17:33 -06:00
0c4ee6a033 Updated russian translation with a few suggestions 2019-01-23 09:16:29 -06:00
f5b80b6e63 Remove None values from sig generation 2019-01-23 08:55:23 -06:00
63f4a8310e Sound player module take volume config properly 2019-01-23 08:54:06 -06:00
53176a9a26 Sound settings are taken from app-settings instead of session settings 2019-01-23 08:22:22 -06:00
8422243465 Volume should be saved across restarts 2019-01-22 17:49:18 -06:00
91317b7a41 Added some modifications to the way the media player works 2019-01-22 17:41:39 -06:00
cbcc6f812a Fixed an error raised when there were attempts to set volume before the URL Player has played something 2019-01-22 16:40:00 -06:00
a53a3d595c Improved notifications a little bit 2019-01-22 16:35:52 -06:00
d741035707 Chats receiving new messages will be moved automatically to the first position in the chats section 2019-01-22 16:20:37 -06:00
bab02110b0 Fixed error in Media player. Now it should not skip the first song if you are in the last track and pressed 'play next' 2019-01-22 10:29:37 -06:00
1db4e10dc8 Load all chats during startup 2019-01-21 17:32:23 -06:00
d6a87bc426 Play is now play/pause in the player menu. Removed stop item 2019-01-21 16:48:51 -06:00
d8096a3695 Added some keystrokes for audio playback. Read changelog for more references 2019-01-21 16:48:09 -06:00
0927695261 Updated requirements to match python 3 only 2019-01-21 16:46:36 -06:00
97380e9833 Started implementation for friends removal 2019-01-21 05:42:21 -06:00
2c64581a2c Changed friends order by rating 2019-01-21 05:31:32 -06:00
05a00e8ce0 Disable alpha for Python 2. Ends support to Python 2 builds. Closes #16 2019-01-21 05:17:42 -06:00
d056bd0bd2 Fixed error when displaying certain user profile info. Closes #29 2019-01-21 05:13:05 -06:00
fa187be88a Updated readme 2019-01-21 05:04:12 -06:00
357ccca819 Don't create socializer.exe.log, save log errors to log file instead. Closes #27 2019-01-21 04:51:59 -06:00
993f49c0a0 Unread messages should be detected appropiately 2019-01-21 04:44:16 -06:00
3b180cda83 Added support to subscribers buffer 2019-01-21 04:42:52 -06:00
1a877bbfa1 Automove to conversation is unchecked by default for new sessions 2019-01-20 12:01:50 -06:00
91 changed files with 1989915 additions and 2357 deletions

View File

@@ -21,31 +21,25 @@ test_py3:
- '%PYTHON3% -m coverage report --omit="test*"'
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
alpha:
documentation:
type: deploy
tags:
- windows
- windows10
before_script:
- '%PYTHON3% -v'
script:
- pip install --upgrade pip
- pip install --upgrade -r requirements.txt
- copy changelog.md doc\changelog.md
- cd doc
- python documentation_importer.py
- '%PYTHON2% documentation_importer.py'
- cd ..\src
- python ..\doc\generator.py
- python write_version_data.py
- python setup.py py2exe
- cd ..
- cd scripts
- python prepare_zipversion.py
- cd ..
- move src\socializer.zip socializer.zip
- '%PYTHON2% ..\doc\generator.py'
- 'move documentation ..\'
only:
- schedules
- master
artifacts:
paths:
- socializer.zip
name: socializer
- documentation
name: socializer_documentation
expire_in: 1 day
alpha_python3:
@@ -56,7 +50,6 @@ alpha_python3:
- '%PYTHON3% -v'
- '%PYTHON3% -m pip install --upgrade pip'
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
- '%PYTHON3% -m pip install --upgrade pyenchant pypubsub'
- '%PYTHON3% -m pip uninstall enum34 -y'
script:
- copy changelog.md doc\changelog.md
@@ -69,13 +62,19 @@ alpha_python3:
- 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:
- schedules
artifacts:
paths:
- socializer.zip
- socializer.pot
- socializer-documentation.pot
name: socializer_py3
expire_in: 1 day
@@ -87,7 +86,6 @@ stable:
- '%PYTHON3% -v'
- '%PYTHON3% -m pip install --upgrade pip'
- '%PYTHON3% -m pip install --upgrade -r requirements.txt'
- '%PYTHON3% -m pip install --upgrade pyenchant pypubsub'
- '%PYTHON3% -m pip uninstall enum34 -y'
script:
- copy changelog.md doc\changelog.md

View File

@@ -6,24 +6,13 @@
A desktop application for handling [vk.com](http://vk.com) in an easy way.
## download the current build
Socializer's functionality is far to be perfect, in fact there are lots of methods of the VK API that this application doesn't support right now, but if you are curious enough, and you want to help by giving me your impressions and making tests for fixing bugs, you can download the last source code, compiled as an application. This is the snapshot build of socializer. This version is only for testing purposes, never think that it can be used for everyday use. This version does not include any documentation, Only the changelog, because it's build with an authomatic process.
Before downloading, take in to account the following: This source code is completely experimental. The current functionality in this application is not very useful. If you decide to use nightly build versions, take into account that this doesn't work as an application for everyday use yet.
Version: 0.16
Build date: Dec 14 2018
[Download socializer](https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=alpha)
I have started this effort as an open source project on Feb 13, 2016. Pull requests and bug reports are welcome.
[See Socializer's website](http://socializer.su)
## dependencies not installed by PIP
For other dependencies, do pip install --upgrade -r requirements.txt
* [Python,](http://python.org) version 2.7.15
* [PyEnchant,](http://pythonhosted.org/pyenchant/) version 1.6.6.
* [Python,](http://python.org) version 3.7.2
## Documentation

View File

@@ -1,6 +1,109 @@
# Changelog
## changes in this version
## News in this version
### 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.

View File

@@ -5,7 +5,7 @@
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:
* Supports two factor authentication (2FA).
* Basic post creation in your wall (including photos).
* Post creation in user and community walls.
* audio support.
* Post comments.
* like, unlike and repost other's posts.
@@ -24,6 +24,8 @@ If this is the first time you have launched socializer, you will see a message a
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.
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.
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.
## General concepts
@@ -32,12 +34,12 @@ Before starting to describe Socializer's usage, we'll explain some concepts that
### Buffer
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.
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.
All buffers will be updated in one of the following ways:
* 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.
* 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.
* 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.
### item
@@ -57,8 +59,8 @@ The following is a brief description of the kind of items socializer can work wi
The graphical user interface of Socializer consists of a window containing:
* a menu bar accomodating five menus (application, Me, buffer, player and help),
* One tree view,
* One list of items
* 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,
* One list of items, which also accepts the menu key to display actions available for the selected item,
* Some buttons, depending which is the focused buffer.
The actions that are available for every item will be described later.
@@ -68,6 +70,7 @@ In summary, the GUI contains two core components. These are the controls you wil
### Buttons in the application
* 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 or audio file 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.
* 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
* 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.
* Play all: In audio buffers, play all songs starting from the focused buffer, until the last item in the list.
* 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.
@@ -80,8 +83,8 @@ Visually, Towards the top of the main application window, A menu bar can be foun
### Application menu
* Create: opens a menu where you can create a new album. At the moment, only video albums are supported.
* Delete: opens a menu where you can delete an already existing album owned by yourself. Only video albums are supported at this time.
* Create: opens a menu where you can create a new album. At the moment, only audio and video albums are supported.
* 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.
* Preferences: Opens a dialogue which lets you configure settings for the entire application.
### Me menu
@@ -117,17 +120,20 @@ Visually, Towards the top of the main application window, A menu bar can be foun
* Documentation: opens up this file, where you can read some useful program concepts.
* 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.
* Changelog: opens up a document with the list of changes from the current version to the earliest.
* Open logs directory: Opens windows explorer in the logs directory, useful to include your logs in a bug report.
* Open config directory: Opens Windows explorer in your config directory.
* 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.
## Keyboard shortcuts
Socializer includes some keyboard shortcuts, available from any buffer (except empty buffers and conversations). Here you have the list of the available shortcuts:
Socializer includes some keyboard shortcuts, available from any buffer. Here you have the list of the available shortcuts:
* 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.
* Control + Enter: Play audio.
* Control + Shift+Enter: pause audio playback.
* F5: Decrease volume by 5%.
* F6: Increase volume by 5%.
* 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.
* Alt+Up/down: Increase and decrease audio volume by 5%.
* 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.
* 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.
* Alt+Left: Play the previous song.
* Alt+Right: Play the next song.
## configuration
@@ -163,7 +169,7 @@ If you still have questions after reading this document, if you wish to collabor
## Credits
Socializer is developed and mantained by [Manuel Cortez,](https://manuelcortez.net) with contributions by [Anibal Hernandez](https://dragodark.com)
Socializer is developed and maintained by [Manuel Cortez,](https://manuelcortez.net) with contributions by [Anibal Hernandez](https://dragodark.com)
We would also like to thank the translators of Socializer, who have allowed the spreading of the application.

View File

@@ -1,11 +1,15 @@
# Stay in wxPython 4.0.3 because 4.0.4 has some regressions in accessibility related components.
wxpython==4.0.3
pywin32
pyenchant
markdown
vk_api
# For the moment we will use the modified vk_api version that does not try to include enum34 and
# already fixed the caption for wall uploaded photos.
# Hopefully I can uncomment this in the near future when my changes will get merged upstream.
#vk_api
bs4
configobj
pypubsub==3.3.0
pypubsub
requests-oauthlib
future
arrow
@@ -17,4 +21,6 @@ mock
git+https://code.manuelcortez.net/manuelcortez/libloader
git+https://code.manuelcortez.net/manuelcortez/platform_utils
git+https://github.com/chrisnorman7/sound_lib
git+https://code.manuelcortez.net/manuelcortez/accessible_output2
git+https://code.manuelcortez.net/manuelcortez/accessible_output2
# Modified vk_api.
git+https://github.com/manuelcortez/vk_api

View File

@@ -1,6 +1,11 @@
[app-settings]
username = string(default="")
password = string(default="")
language = string(default="system")
use_proxy = boolean(default=False)
first_start = boolean(default=True)
first_start = boolean(default=True)
[sound]
volume = integer(default=100)
input_device = string(default="Default")
output_device = string(default="Default")
session_mute = boolean(default=False)
current_soundpack = string(default="default")

View File

@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
name = "Socializer"
version = "0.18"
version = "0.21"
author = "Manuel Cortez"
authorEmail = "manuel@manuelcortez.net"
copyright = "Copyright (C) 2016-2018, Manuel Cortez"
copyright = "Copyright (C) 2016-2019, Manuel Cortez"
description = name+" Is an accessible VK client for Windows."
url = "https://manuelcortez.net/socializer"
url = "http://socializer.su"
# The short name will be used for detecting translation files. See languageHandler for more details.
short_name = "socializer"
translators = ["Darya Ratnikova (Russian)", "Manuel Cortez (Spanish)"]

View File

@@ -4,7 +4,7 @@ import random
import requests
import logging
from hashlib import md5
from .wxUI import two_factor_auth
from .wxUI import two_factor_auth, bad_password
log = logging.getLogger("authenticator.official")
@@ -28,7 +28,9 @@ def get_sig(method, values, secret):
""" Create a signature for parameters passed to VK API. """
postdata = ""
for key in values:
postdata = postdata + "{key}={value}&".format(key=key, value=values[key])
# 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"))
@@ -47,17 +49,18 @@ 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
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)
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.
@@ -87,8 +90,12 @@ def refresh_token(token, secret, device_id):
return perform_request(method, postdata, secret)
def login(user, password):
access_token, secret, device_id = get_non_refreshed(user, password)
response = refresh_token(access_token, secret, device_id)
try:
access_token, secret, device_id = get_non_refreshed(user, password)
response = refresh_token(access_token, secret, device_id)
except AuthenticationError:
bad_password()
raise AuthenticationError("")
try:
return response["response"]["token"], secret, device_id
except KeyError:

View File

@@ -4,21 +4,14 @@ import time
import wx
import widgetUtils
code = None
remember = True
def two_factor_auth():
global code, remember
wx.CallAfter(get_code)
while code == None:
time.sleep(0.5)
return (code, remember)
def get_code():
global code, remember
code = None
dlg = wx.TextEntryDialog(None, _("Please provide the authentication code you have received from VK."), _("Two factor authentication code"))
response = dlg.ShowModal()
if response == widgetUtils.OK:
code = dlg.GetValue()
dlg.Destroy()
dlg.Destroy()
return (code, True)
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()

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
""" A buffer is a (virtual) list of items. All items belong to a category (wall posts, messages, persons...)"""
from __future__ import unicode_literals
import time
import random
import logging
@@ -12,18 +11,20 @@ import views
import interactors
import languageHandler
import widgetUtils
from presenters import player
import output
from . import selector
from pubsub import pub
from vk_api.exceptions import VkApiError
from vk_api import upload
from requests.exceptions import ReadTimeout, ConnectionError
from mutagen.id3 import ID3
from presenters import player
from wxUI.tabs import home
from wxUI.dialogs import timeline
from sessionmanager import session, renderers, utils
from mysc.thread_utils import call_threaded
from wxUI import commonMessages, menus
from sessionmanager.renderers import add_attachment
from . import selector
log = logging.getLogger("controller.buffers")
@@ -79,7 +80,7 @@ class baseBuffer(object):
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."""
item_ = getattr(renderers, self.compose_function)(item, self.session)
self.tab.list.insert_item(reversed, *item_)
wx.CallAfter(self.tab.list.insert_item, reversed, *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.
@@ -93,7 +94,7 @@ class baseBuffer(object):
log.error("Error {0}: {1}".format(err.code, err.error))
retrieved = err.code
return retrieved
except ReadTimeout as ConnectionError:
except:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
if not hasattr(self, "tab"):
@@ -109,7 +110,7 @@ class baseBuffer(object):
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
else:
if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
[self.insert(i, False) for i in self.session.db[self.name]["items"][-num:]]
return retrieved
def get_more_items(self):
@@ -148,8 +149,7 @@ class baseBuffer(object):
def upload_attachments(self, attachments):
""" Upload attachments to VK before posting them.
Returns attachments formatted as string, as required by VK API.
Currently this function only supports photos and audios."""
Returns attachments formatted as string, as required by VK API."""
# To do: Check the caption and description fields for this kind of attachments.
local_attachments = ""
uploader = upload.VkUpload(self.session.vk.session_object)
@@ -175,14 +175,20 @@ class baseBuffer(object):
id = r["id"]
owner_id = r["owner_id"]
local_attachments += "audio{0}_{1},".format(owner_id, id)
elif i["from"] == "local" and i["type"] == "document":
document = i["file"]
title = i["title"]
r = uploader.document(document, title=title, to_wall=True)
id = r["doc"]["id"]
owner_id = r["doc"]["owner_id"]
local_attachments += "doc{0}_{1},".format(owner_id, id)
return local_attachments
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_LIST_ITEM_RIGHT_CLICK, self.show_menu)
widgetUtils.connect_event(self.tab.list.list, wx.EVT_LIST_KEY_DOWN, self.show_menu_by_key)
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):
@@ -219,10 +225,14 @@ class baseBuffer(object):
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"):
@@ -295,11 +305,7 @@ class baseBuffer(object):
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 and ev.ControlDown() and ev.ShiftDown(): event = "pause_audio"
elif ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "play_audio"
elif ev.GetKeyCode() == wx.WXK_RETURN: event = "open_post"
elif ev.GetKeyCode() == wx.WXK_F5: event = "volume_down"
elif ev.GetKeyCode() == wx.WXK_F6: event = "volume_up"
if ev.GetKeyCode() == wx.WXK_RETURN: event = "open_post"
else:
event = None
ev.Skip()
@@ -310,12 +316,12 @@ class baseBuffer(object):
pass
def volume_down(self):
""" Decreases player volume by 5%"""
player.player.volume = player.player.volume-5
""" Decreases player volume by 2%"""
player.player.volume = player.player.volume-2
def volume_up(self):
""" Increases player volume by 5%"""
player.player.volume = player.player.volume+5
""" 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."""
@@ -323,7 +329,7 @@ class baseBuffer(object):
if post == None:
return
if "type" in post and post["type"] == "audio":
pub.sendMessage("play-audio", audio_object=post["audio"]["items"][0])
pub.sendMessage("play", object=post["audio"]["items"][0])
return True
def open_person_profile(self, *args, **kwargs):
@@ -346,13 +352,13 @@ class baseBuffer(object):
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")
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."""
player.player.pause()
pub.sendMessage("pause")
def remove_buffer(self, mandatory):
""" Function for removing a buffer. Returns True if removal is successful, False otherwise"""
@@ -368,7 +374,7 @@ class baseBuffer(object):
else:
return [post["source_id"]]
def onFocus(self, *args,**kwargs):
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()
@@ -377,6 +383,14 @@ class baseBuffer(object):
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)
class feedBuffer(baseBuffer):
""" This buffer represents an user's wall. It may be used either for the current user or someone else."""
@@ -391,7 +405,7 @@ class feedBuffer(baseBuffer):
log.error("Error {0}: {1}".format(err.code, err.error))
retrieved = err.code
return retrieved
except ReadTimeout as ConnectionError:
except:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
if not hasattr(self, "tab"):
@@ -406,6 +420,9 @@ class feedBuffer(baseBuffer):
[self.insert(i, True) for i in v]
else:
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
else:
if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][-num:]]
return retrieved
def remove_buffer(self, mandatory=False):
@@ -445,19 +462,29 @@ class feedBuffer(baseBuffer):
return super(feedBuffer, 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)
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"):
call_threaded(self.do_last, p=p, owner_id=owner_id)
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)
class communityBuffer(feedBuffer):
def __init__(self, *args, **kwargs):
super(communityBuffer, self).__init__(*args, **kwargs)
self.group_id = self.kwargs["owner_id"]
def create_tab(self, parent):
self.tab = home.communityTab(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)
self.tab.post.Enable(False)
def connect_events(self):
super(communityBuffer, self).connect_events()
@@ -469,32 +496,231 @@ class communityBuffer(feedBuffer):
self.tab.load.Enable(False)
wx.CallAfter(self.get_items)
class audioBuffer(feedBuffer):
""" this buffer was supposed to be used with audio elements
but is deprecated as VK removed its audio support for third party apps."""
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(communityBuffer, 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"):
call_threaded(self.do_last, p=p, owner_id=owner_id, from_group=from_group)
class topicBuffer(feedBuffer):
def create_tab(self, parent):
self.tab = home.topicTab(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=""))
if hasattr(p, "text") or hasattr(p, "privacy"):
call_threaded(self.do_last, p=p, group_id=owner_id, from_group=from_group)
def do_last(self, p, *args, **kwargs):
title = p.view.title
msg = p.text
attachments = ""
if hasattr(p, "attachments"):
attachments = self.upload_attachments(p.attachments)
urls = utils.find_urls_in_text(msg)
if len(urls) != 0:
if len(attachments) == 0: attachments = urls[0]
else: attachments += urls[0]
msg = msg.replace(urls[0], "")
if msg != "":
kwargs.update(text=msg, title=title.GetValue())
if attachments != "":
kwargs.update(attachments=attachments)
# Determines the correct functions to call here.
post = self.session.vk.client.board.addTopic(**kwargs)
pub.sendMessage("posted", buffer=self.name)
class documentBuffer(feedBuffer):
can_get_items = False
def create_tab(self, parent):
self.tab = home.documentTab(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(documentBuffer, 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 = 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)
class documentCommunityBuffer(documentBuffer):
can_get_items = True
def create_tab(self, parent):
self.tab = home.documentCommunityTab(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)
class audioBuffer(feedBuffer):
def create_tab(self, parent):
self.tab = home.audioTab(parent)
self.tab.name = self.name
self.connect_events()
if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"):
self.tab.post.Enable(False)
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):
selected = self.tab.list.get_selected()
if selected == -1:
selected = 0
pub.sendMessage("play-audio", audio_object=self.session.db[self.name]["items"][selected])
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 or selected == self.tab.list.get_count()-1:
if selected < 0:
selected = 0
if self.tab.list.get_count() <= selected+1:
newpos = 0
@@ -525,7 +751,7 @@ class audioBuffer(feedBuffer):
if self.name not in self.session.db:
return
audios = [i for i in self.session.db[self.name]["items"][selected:]]
pub.sendMessage("play-audios", audios=audios)
pub.sendMessage("play-all", list_of_songs=audios)
return True
def remove_buffer(self, mandatory=False):
@@ -547,8 +773,8 @@ class audioBuffer(feedBuffer):
# 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, *args, **kwargs):
pass
def onFocus(self, event, *args, **kwargs):
event.Skip()
def add_to_library(self, *args, **kwargs):
post = self.get_post()
@@ -573,6 +799,7 @@ class audioBuffer(feedBuffer):
result = self.session.vk.client.audio.delete(**args)
if int(result) == 1:
output.speak(_("Removed audio from library"))
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
self.tab.list.remove_item(self.tab.list.get_selected())
def move_to_album(self, *args, **kwargs):
@@ -584,7 +811,7 @@ class audioBuffer(feedBuffer):
album = selector.album(_("Select the album where you want to move this song"), self.session)
if album.item == None: return
id = post["id"]
response = self.session.vk.client.audio.moveToAlbum(album_id=album.item, audio_ids=id)
response = self.session.vk.client.audio.add(playlist_id=album.item, audio_id=id, owner_id=post["owner_id"])
if response == 1:
# Translators: Used when the user has moved an audio to an album.
output.speak(_("Moved"))
@@ -604,6 +831,39 @@ class audioBuffer(feedBuffer):
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")
class audioAlbum(audioBuffer):
""" this buffer was supposed to be used with audio albums
@@ -679,8 +939,8 @@ class videoBuffer(feedBuffer):
# 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, *args, **kwargs):
pass
def onFocus(self, event, *args, **kwargs):
event.Skip()
def add_to_library(self, *args, **kwargs):
post = self.get_post()
@@ -727,8 +987,6 @@ class videoBuffer(feedBuffer):
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)
# if owner_id is the current user, the audio is added to the user's audios.
if p["owner_id"] == self.session.user_id:
@@ -738,6 +996,13 @@ class videoBuffer(feedBuffer):
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)
class videoAlbum(videoBuffer):
def create_tab(self, parent):
@@ -759,7 +1024,7 @@ class videoAlbum(videoBuffer):
wx.CallAfter(self.get_items)
self.tab.play.Enable(True)
class empty(object):
class emptyBuffer(object):
def __init__(self, name=None, parent=None, *args, **kwargs):
self.tab = home.empty(parent=parent, name=name)
@@ -782,10 +1047,11 @@ class chatBuffer(baseBuffer):
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])
values = self.tab.add_message(item_[0], reverse=reversed)
self.chats[values] = item["id"]
def get_focused_post(self):
@@ -801,7 +1067,6 @@ class chatBuffer(baseBuffer):
# position[2]+1 is added because line may start with 0, while in wx.TextCtrl.GetNumberLines() that is not possible.
if position[2]+1 >= i[0] and position[2]+1 < i[1]:
id_ = self.chats[i]
# print i
break
# Retrieve here the object based in id_
if id_ != None:
@@ -817,9 +1082,10 @@ class chatBuffer(baseBuffer):
msg = self.get_focused_post()
if msg == False: # Handle the case where the last line of the control cannot be matched to anything.
return
if "read_state" in msg and msg["read_state"] == 0 and msg["id"] not in self.reads and "out" in msg and msg["out"] == 0:
# 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")
self.reads.append(msg["id"])
call_threaded(self.session.vk.client.messages.markAsRead, peer_id=self.kwargs["peer_id"])
self.session.db[self.name]["items"][-1]["read_state"] = 1
if "attachments" in msg and len(msg["attachments"]) > 0:
self.tab.attachments.list.Enable(True)
@@ -855,16 +1121,17 @@ class chatBuffer(baseBuffer):
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, unread=False):
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 # Control variable for handling unauthorised/connection errors.
retrieved = True
try:
num = getattr(self.session, "get_messages")(name=self.name, *self.args, **self.kwargs)
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 ReadTimeout as ConnectionError:
except:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
if not hasattr(self, "tab"):
@@ -872,20 +1139,38 @@ class chatBuffer(baseBuffer):
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]]
# v.reverse()
[self.insert(i, False) for i in v]
[wx.CallAfter(self.insert, i, False) for i in v]
else:
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
[wx.CallAfter(self.insert, i) for i in self.session.db[self.name]["items"][:num]]
else:
if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
if unread == True and 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()
self.tab.history.SetValue("")
v = [i for i in self.session.db[self.name]["items"]]
[wx.CallAfter(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]
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:
@@ -932,10 +1217,17 @@ class chatBuffer(baseBuffer):
id = r["audio_message"]["id"]
owner_id = r["audio_message"]["owner_id"]
local_attachments += "audio_message{0}_{1},".format(owner_id, id)
elif i["from"] == "local" and i["type"] == "document":
document = i["file"]
title = i["title"]
r = uploader.document(document, title=title, message_peer_id=self.kwargs["peer_id"])
id = r["doc"]["id"]
owner_id = r["doc"]["owner_id"]
local_attachments += "doc{0}_{1},".format(owner_id, id)
return local_attachments
def _send_message(self, text, attachments=[]):
if hasattr(self, "attachments_to_be_sent"):
if hasattr(self, "attachments_to_be_sent") and type(self.attachments_to_be_sent) == list:
self.attachments_to_be_sent = self.upload_attachments(self.attachments_to_be_sent)
try:
# Let's take care about the random_id attribute.
@@ -950,10 +1242,13 @@ class chatBuffer(baseBuffer):
except ValueError as ex:
if ex.code == 9:
output.speak(_("You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history."))
finally:
if hasattr(self, "attachments_to_be_sent"):
del self.attachments_to_be_sent
def __init__(self, *args, **kwargs):
def __init__(self, unread=False, *args, **kwargs):
super(chatBuffer, self).__init__(*args, **kwargs)
self.reads = []
self.unread = unread
self.chats = dict()
self.peer_typing = 0
self.last_keypress = time.time()
@@ -978,8 +1273,7 @@ class chatBuffer(baseBuffer):
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"]
output.speak(_("Playing..."))
player.player.play(url=dict(url=link), set_info=False)
pub.sendMessage("play-message", message_url=link)
elif attachment["type"] == "link":
output.speak(_("Opening URL..."), True)
webbrowser.open_new_tab(attachment["link"]["url"])
@@ -1009,6 +1303,8 @@ class chatBuffer(baseBuffer):
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,))
@@ -1029,6 +1325,11 @@ class chatBuffer(baseBuffer):
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)
class peopleBuffer(feedBuffer):
def create_tab(self, parent):
@@ -1055,11 +1356,25 @@ class peopleBuffer(feedBuffer):
return
if ("last_seen" in post) == False: return
original_date = arrow.get(post["last_seen"]["time"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
self.tab.list.list.SetItem(self.tab.list.get_selected(), 1, created_at)
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):
pass
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)"""
@@ -1071,14 +1386,19 @@ class peopleBuffer(feedBuffer):
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)
# It is not allowed to send messages to people who is not your friends, so let's disble it if we're in a pending or outgoing requests folder.
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
# 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
@@ -1091,11 +1411,90 @@ class peopleBuffer(feedBuffer):
pass
def decline_friendship(self, *args, **kwargs):
pass
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 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)
class requestsBuffer(peopleBuffer):
def get_items(self, show_nextpage=False):
@@ -1107,7 +1506,7 @@ class requestsBuffer(peopleBuffer):
log.error("Error {0}: {1}".format(err.code, err.error))
retrieved = err.code
return retrieved
except ReadTimeout as ConnectionError:
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")

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import win32com
import paths
win32com.__gen_path__=paths.com_path()
win32com.__build_path__=paths.com_path()
import sys
import os
sys.path.append(os.path.join(win32com.__gen_path__, "."))

View File

@@ -5,7 +5,7 @@ CRCCheck on
ManifestSupportedOS all
XPStyle on
Name "Socializer"
OutFile "socializer_0.18_setup.exe"
OutFile "socializer_0.21_setup.exe"
InstallDir "$PROGRAMFILES\socializer"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "InstallLocation"
RequestExecutionLevel admin
@@ -14,10 +14,10 @@ SetCompressor /solid lzma
SetDatablockOptimize on
VIAddVersionKey ProductName "Socializer"
VIAddVersionKey LegalCopyright "Copyright 2019 Manuel Cortez."
VIAddVersionKey ProductVersion "0.18"
VIAddVersionKey FileVersion "0.18"
VIProductVersion "0.18.0.0"
VIFileVersion "0.18.0.0"
VIAddVersionKey ProductVersion "0.21"
VIAddVersionKey FileVersion "0.21"
VIProductVersion "0.21.0.0"
VIFileVersion "0.21.0.0"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
var StartMenuFolder
@@ -50,10 +50,10 @@ 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" "InstallLocation" $INSTDIR
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" "Publisher" "Manuel Cortez"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "DisplayVersion" "0.18"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "DisplayVersion" "0.21"
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" "VersionMinor" 18
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "VersionMinor" 19
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\socializer" "NoRepair" 1
SectionEnd

View File

@@ -18,6 +18,7 @@ class attachInteractor(base.baseInteractor):
super(attachInteractor, self).install(*args, **kwargs)
widgetUtils.connect_event(self.view.photo, widgetUtils.BUTTON_PRESSED, self.on_image)
widgetUtils.connect_event(self.view.audio, widgetUtils.BUTTON_PRESSED, self.on_audio)
widgetUtils.connect_event(self.view.document, widgetUtils.BUTTON_PRESSED, self.on_document)
if hasattr(self.view, "voice_message"):
widgetUtils.connect_event(self.view.voice_message, widgetUtils.BUTTON_PRESSED, self.on_upload_voice_message)
widgetUtils.connect_event(self.view.remove, widgetUtils.BUTTON_PRESSED, self.on_remove_attachment)
@@ -44,6 +45,14 @@ class attachInteractor(base.baseInteractor):
widgetUtils.connect_event(m, widgetUtils.MENU, self.on_add_audio, menuitem=m.add)
self.view.PopupMenu(m, self.view.audio.GetPosition())
def on_document(self, *args, **kwargs):
""" display menu for adding document attachments. """
m = attachMenu()
# disable add from VK as it is not supported in documents, yet.
m.add.Enable(False)
widgetUtils.connect_event(m, widgetUtils.MENU, self.on_upload_document, menuitem=m.upload)
self.view.PopupMenu(m, self.view.photo.GetPosition())
def on_upload_image(self, *args, **kwargs):
""" allows uploading an image from the computer.
"""
@@ -57,6 +66,16 @@ class attachInteractor(base.baseInteractor):
if audio != None:
self.presenter.upload_audio(audio)
def on_upload_document(self, *args, **kwargs):
""" allows uploading a document from the computer.
"""
document = self.view.get_document()
if document != None:
if document.endswith(".mp3") or document.endswith(".exe"):
self.view.invalid_attachment()
return
self.presenter.upload_document(document)
def on_upload_voice_message(self, *args, **kwargs):
self.presenter.upload_voice_message()

View File

@@ -2,25 +2,38 @@
from __future__ import unicode_literals
import widgetUtils
from pubsub import pub
from wxUI.commonMessages import restart_program as restart_program_dialog
from . import base
class configurationInteractor(base.baseInteractor):
def create_tab(self, tab):
getattr(self.view, "create_"+tab)()
def create_tab(self, tab, arglist=dict()):
getattr(self.view, "create_"+tab)(**arglist)
def set_setting(self, tab, setting, value):
self.view.set_value(tab, setting, value)
def restart(self):
dlg = restart_program_dialog()
if dlg == widgetUtils.YES:
self.presenter.restart_application()
def set_language(self, language):
self.view.general.language.SetSelection(language)
def install(self, *args, **kwargs):
super(configurationInteractor, self).install(*args, **kwargs)
pub.subscribe(self.create_tab, self.modulename+"_create_tab")
pub.subscribe(self.set_setting, self.modulename+"_set")
pub.subscribe(self.restart, self.modulename+"_restart_program")
pub.subscribe(self.set_language, self.modulename+"_set_language")
def uninstall(self):
super(configurationInteractor, self).uninstall()
pub.unsubscribe(self.create_tab, self.modulename+"_create_tab")
pub.unsubscribe(self.set_setting, self.modulename+"_set")
pub.unsubscribe(self.restart, self.modulename+"_restart_program")
pub.unsubscribe(self.set_language, self.modulename+"_set_language")
def start(self):
self.view.realize()
@@ -46,10 +59,13 @@ class configurationInteractor(base.baseInteractor):
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_offline", value=self.view.get_value("chat", "notify_offline"))
self.presenter.update_setting(section="chat", setting="open_unread_conversations", value=self.view.get_value("chat", "open_unread_conversations"))
self.presenter.update_setting(section="chat", setting="automove_to_conversations", value=self.view.get_value("chat", "automove_to_conversations"))
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="load_at_startup", setting="audio_albums", value=self.view.get_value("startup", "audio_albums"))
self.presenter.update_setting(section="load_at_startup", setting="video_albums", value=self.view.get_value("startup", "video_albums"))
self.presenter.update_setting(section="load_at_startup", setting="communities", value=self.view.get_value("startup", "communities"))
self.presenter.save_settings_file()
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="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.save_app_settings_file()
self.presenter.save_settings_file()

View File

@@ -5,6 +5,7 @@ import widgetUtils
import wx
from pubsub import pub
from wxUI import menus
from wxUI import commonMessages
from .import base
class displayPostInteractor(base.baseInteractor):
@@ -28,6 +29,11 @@ class displayPostInteractor(base.baseInteractor):
for i in items:
getattr(self.view, control).insert_item(False, *i)
def add_item(self, control, item, reversed=False):
if not hasattr(self.view, control):
raise AttributeError("The control is not present in the view.")
getattr(self.view, control).insert_item(reversed, *item)
def enable_attachments(self):
self.view.attachments.list.Enable(True)
@@ -37,7 +43,10 @@ class displayPostInteractor(base.baseInteractor):
def clean_list(self, list):
if not hasattr(self.view, list):
raise AttributeError("The control is not present in the view.")
getattr(self.view, control).clear()
getattr(self.view, list).clear()
def post_deleted(self):
msg = commonMessages.post_deleted()
def install(self, *args, **kwargs):
super(displayPostInteractor, self).install(*args, **kwargs)
@@ -46,26 +55,39 @@ class displayPostInteractor(base.baseInteractor):
widgetUtils.connect_event(self.view.like, widgetUtils.BUTTON_PRESSED, self.on_like)
widgetUtils.connect_event(self.view.comment, widgetUtils.BUTTON_PRESSED, self.on_add_comment)
widgetUtils.connect_event(self.view.tools, widgetUtils.BUTTON_PRESSED, self.on_show_tools_menu)
if hasattr(self.view, "likes"):
widgetUtils.connect_event(self.view.likes, widgetUtils.BUTTON_PRESSED, self.on_show_likes_menu)
if hasattr(self.view, "shares"):
widgetUtils.connect_event(self.view.shares, widgetUtils.BUTTON_PRESSED, self.on_show_shares_menu)
if hasattr(self.view, "repost"):
widgetUtils.connect_event(self.view.repost, widgetUtils.BUTTON_PRESSED, self.on_repost)
self.view.comments.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus)
if hasattr(self.view, "reply"):
widgetUtils.connect_event(self.view.reply, widgetUtils.BUTTON_PRESSED, self.on_reply)
if hasattr(self.view, "load_more_comments"):
widgetUtils.connect_event(self.view.load_more_comments, widgetUtils.BUTTON_PRESSED, self.on_load_more_comments)
# self.view.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.on_show_menu, self.view.comments.list)
# self.view.Bind(wx.EVT_LIST_KEY_DOWN, self.on_show_menu_by_key, self.view.comments.list)
pub.subscribe(self.set, self.modulename+"_set")
pub.subscribe(self.load_image, self.modulename+"_load_image")
pub.subscribe(self.add_items, self.modulename+"_add_items")
pub.subscribe(self.add_item, self.modulename+"_add_item")
pub.subscribe(self.enable_attachments, self.modulename+"_enable_attachments")
pub.subscribe(self.enable_photo_controls, self.modulename+"_enable_photo_controls")
pub.subscribe(self.post_deleted, self.modulename+"_post_deleted")
pub.subscribe(self.clean_list, self.modulename+"_clean_list")
self.view.comments.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_comment_changed)
def uninstall(self):
super(displayPostInteractor, self).uninstall()
pub.unsubscribe(self.set, self.modulename+"_set")
pub.unsubscribe(self.load_image, self.modulename+"_load_image")
pub.unsubscribe(self.add_items, self.modulename+"_add_items")
pub.unsubscribe(self.add_item, self.modulename+"_add_item")
pub.unsubscribe(self.enable_attachments, self.modulename+"_enable_attachments")
pub.unsubscribe(self.enable_photo_controls, self.modulename+"_enable_photo_controls")
pub.unsubscribe(self.post_deleted, self.modulename+"_post_deleted")
pub.unsubscribe(self.clean_list, self.modulename+"_clean_list")
def on_focus(self, *args, **kwargs):
item = self.view.comments.get_selected()
@@ -81,7 +103,7 @@ class displayPostInteractor(base.baseInteractor):
self.presenter.post_repost()
def on_reply(self, *args, **kwargs):
if hasattr(self.view, "repost"):
if hasattr(self.view, "repost") or not hasattr(self, "post_view"):
comment = self.view.comments.get_selected()
self.presenter.reply(comment)
else:
@@ -90,6 +112,10 @@ class displayPostInteractor(base.baseInteractor):
def on_add_comment(self, *args, **kwargs):
self.presenter.add_comment()
def on_load_more_comments(self, *args, **kwargs):
if hasattr(self.presenter, "load_more_comments"):
self.presenter.load_more_comments()
def on_show_tools_menu(self, *args, **kwargs):
menu = menus.toolsMenu()
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.on_open_url, menuitem=menu.url)
@@ -120,6 +146,17 @@ class displayPostInteractor(base.baseInteractor):
comment = self.view.comments.get_selected()
self.presenter.show_comment(comment)
def on_comment_changed(self, *args, **kwargs):
if hasattr(self.presenter, "change_comment"):
comment = self.view.comments.get_selected()
self.presenter.change_comment(comment)
def on_show_likes_menu(self, *args, **kwargs):
self.presenter.show_likes()
def on_show_shares_menu(self, *args, **kwargs):
self.presenter.show_shares()
class displayAudioInteractor(base.baseInteractor):
def set(self, control, value):
@@ -134,6 +171,13 @@ class displayAudioInteractor(base.baseInteractor):
getattr(self.view, control).Append(i)
getattr(self.view, control).SetSelection(0)
def change_label(self, stopped):
if stopped == False:
self.view.play.SetLabel(_("P&ause"))
else:
self.view.play.SetLabel(_("P&lay"))
def install(self, *args, **kwargs):
super(displayAudioInteractor, self).install(*args, **kwargs)
widgetUtils.connect_event(self.view.list, widgetUtils.LISTBOX_CHANGED, self.on_change)
@@ -143,11 +187,13 @@ class displayAudioInteractor(base.baseInteractor):
widgetUtils.connect_event(self.view.remove, widgetUtils.BUTTON_PRESSED, self.on_remove_from_library)
pub.subscribe(self.set, self.modulename+"_set")
pub.subscribe(self.add_items, self.modulename+"_add_items")
pub.subscribe(self.change_label, "playback-changed")
def uninstall(self):
super(displayAudioInteractor, self).uninstall()
pub.unsubscribe(self.set, self.modulename+"_set")
pub.unsubscribe(self.add_items, self.modulename+"_add_items")
pub.unsubscribe(self.change_label, "playback-changed")
def on_change(self, *args, **kwargs):
post = self.view.get_audio()
@@ -171,6 +217,37 @@ class displayAudioInteractor(base.baseInteractor):
post = self.view.get_audio()
self.presenter.remove_from_library(post)
class displayPollInteractor(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 done(self):
self.view.done()
def add_options(self, options, multiple):
self.view.add_options(options, multiple)
def install(self, *args, **kwargs):
super(displayPollInteractor, self).install(*args, **kwargs)
pub.subscribe(self.set, self.modulename+"_set")
pub.subscribe(self.done, self.modulename+"_done")
pub.subscribe(self.add_options, self.modulename+"_add_options")
def uninstall(self):
super(displayPollInteractor, self).uninstall()
pub.unsubscribe(self.set, self.modulename+"_set")
pub.unsubscribe(self.done, self.modulename+"_done")
pub.unsubscribe(self.add_options, self.modulename+"_add_options")
def start(self, *args, **kwargs):
super(displayPollInteractor, self).start(*args, **kwargs)
if self.result == widgetUtils.OK: # USer votd.
answers = self.view.get_answers()
self.presenter.vote(answers)
class displayFriendshipInteractor(base.baseInteractor):
def add_items(self, control, items):
@@ -179,11 +256,30 @@ class displayFriendshipInteractor(base.baseInteractor):
for i in items:
getattr(self.view, control).insert_item(False, *[i])
def install(self, *args, **kwargs):
super(displayFriendshipInteractor, self).install(*args, **kwargs)
pub.subscribe(self.add_items, self.modulename+"_add_items")
self.view.friends.list.Bind(wx.EVT_CONTEXT_MENU, self.on_context_menu)
def uninstall(self):
super(displayFriendshipInteractor, self).uninstall()
pub.unsubscribe(self.add_items, self.modulename+"_add_items")
pub.unsubscribe(self.add_items, self.modulename+"_add_items")
def on_context_menu(self, *args, **kwargs):
item = self.view.friends.get_selected()
if item < 0:
return
menu = menus.peopleMenu(False, False, True)
widgetUtils.connect_event(menu, widgetUtils.MENU, self.on_view_profile, menuitem=menu.view_profile)
widgetUtils.connect_event(menu, widgetUtils.MENU, self.on_open_in_browser, menuitem=menu.open_in_browser)
# Generally message sending is blocked.
menu.message.Enable(False)
self.view.PopupMenu(menu, self.view.friends.list.GetPosition())
def on_view_profile(self, *args, **kwargs):
item = self.view.friends.get_selected()
self.presenter.view_profile(item)
def on_open_in_browser(self, *args, **kwargs):
item = self.view.friends.get_selected()
self.presenter.open_in_browser(item)

View File

@@ -82,7 +82,7 @@ def getAvailableLanguages():
"""
#Make a list of all the locales found in NVDA's locale dir
l=[x for x in os.listdir(paths.locale_path()) if not x.startswith('.')]
l=[x for x in l if os.path.isfile(paths.locale_path('%s/LC_MESSAGES/%s.po' % (x, application.short_name)))]
l=[x for x in l if os.path.isfile(os.path.join(paths.locale_path(), '%s/LC_MESSAGES/%s.po' % (x, application.short_name)))]
#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')

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,8 @@ import output
import logging
import keys
import application
#sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z)))
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

View File

@@ -5,7 +5,9 @@ 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", "."),

View File

@@ -13,7 +13,7 @@
"""
from .attach import *
from .audioRecorder import *
from .postCreation import *
from .postDisplayer import *
from .createPosts import *
from .displayPosts import *
from .configuration import *
from .profiles import *

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
""" A "presenter" in the socializer's terminology is a module that handles business logic in the application's workflow.
All presenter classes should derive from base.basePresenter and will be completely abstracted from views (the GUI elements). It means presenters and views don't know anything about the each other.
Both Presenters and views can communicate through the interactors. Interactors are responsible to receive user input and send requests to the presenters, aswell as receiving presenter requests and render those in the view.
So, in a tipical user interaction made in socializer, the following could happen when someone decides to do something:
1. A new presenter is created, with two mandatory arguments: The corresponding view and interactor.
2. The presenter will call to the install() method in the interactor, to connect all GUI events to their corresponding methods. All of these functions will be present in the interactor only.
3. After install(), the presenter will run the View, which will display the graphical user interface that users can see and interact with. The view is the only layer directly accessible from the user world and does not handle any kind of logic.
4. If the user presses a button or generates an event connected to a function in the interactor side, the function will be executed in the interactor. The interactor is aware of the View, and holds a reference to the presenter. The interactor should call other GUI elements if necessary and handle some logic (related to GUI, like yes/no dialogs). The interactor can call the presenter to retrieve some information, though the interactor cannot perform any business logic (like altering the cache database, retrieving usernames and so on).
5. If the interactor calls something in the presenter, it will be executed. The presenter knows everything about VK and the session object, so it will fetch data, save it in the cache, call other methods from VK and what not. If the presenter wants to change something in the GUI elements (for example, hiding a control or displaying something else), it will send a pubsub event that the interactor will receive and act on accordingly.
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 .attach import *
from .audioRecorder import *
from .postCreation import *
from .postDisplayer import *
from .configuration import *
from .profiles import *

View File

@@ -63,6 +63,16 @@ class attachPresenter(base.basePresenter):
self.send_message("insert_attachment", attachment=info)
self.send_message("enable_control", control="remove")
def upload_document(self, document):
""" allows uploading a document from the computer.
"""
doc_info = {"type": "document", "file": document, "from": "local", "title": os.path.basename(os.path.splitext(document)[0])}
self.attachments.append(doc_info)
# Translators: This is the text displayed in the attachments dialog, when the user adds a document.
info = [_("Document"), os.path.basename(document)]
self.send_message("insert_attachment", attachment=info)
self.send_message("enable_control", control="remove")
def upload_voice_message(self):
a = audioRecorder.audioRecorderPresenter(view=views.audioRecorderDialog(), interactor=interactors.audioRecorderInteractor())
if a.file != None and a.duration != 0:

View File

@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sound_lib.input, sound_lib.output
import config
import languageHandler
from mysc import restart
from . import base
class configurationPresenter(base.basePresenter):
@@ -7,6 +11,8 @@ class configurationPresenter(base.basePresenter):
def __init__(self, session, view, interactor):
self.session = session
super(configurationPresenter, self).__init__(view=view, interactor=interactor, modulename="configuration")
# Control requirement for a restart of the application.
self.needs_restart = False
self.create_config()
self.run()
@@ -39,21 +45,30 @@ class configurationPresenter(base.basePresenter):
return "alpha"
def create_config(self):
self.send_message("create_tab", tab="general")
self.langs = languageHandler.getAvailableLanguages()
langs = [i[1] for i in self.langs]
self.codes = [i[0] for i in self.langs]
id = self.codes.index(config.app["app-settings"]["language"])
self.send_message("create_tab", tab="general", arglist=dict(languages=langs))
self.send_message("set_language", language=id)
self.send_message("set", tab="general", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"])
self.send_message("set", tab="general", setting="video_buffers_count", value=self.session.settings["buffers"]["count_for_video_buffers"])
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="update_channel", value=self.get_update_channel_label(self.session.settings["general"]["update_channel"]))
self.send_message("create_tab", tab="chat")
self.send_message("set", tab="chat", setting="notify_online", value=self.session.settings["chat"]["notify_online"])
self.send_message("set", tab="chat", setting="notify_offline", value=self.session.settings["chat"]["notify_offline"])
self.send_message("set", tab="chat", setting="open_unread_conversations", value=self.session.settings["chat"]["open_unread_conversations"])
self.send_message("set", tab="chat", setting="automove_to_conversations", value=self.session.settings["chat"]["automove_to_conversations"])
self.send_message("set", tab="chat", setting="notifications", value=self.get_notification_label(self.session.settings["chat"]["notifications"]))
self.send_message("create_tab", tab="startup_options")
self.send_message("set", tab="startup", setting="audio_albums", value=self.session.settings["load_at_startup"]["audio_albums"])
self.send_message("set", tab="startup", setting="video_albums", value=self.session.settings["load_at_startup"]["video_albums"])
self.send_message("set", tab="startup", setting="communities", value=self.session.settings["load_at_startup"]["communities"])
self.input_devices = sound_lib.input.Input.get_device_names()
self.output_devices = sound_lib.output.Output.get_device_names()
self.send_message("create_tab", tab="sound", arglist=dict(input_devices=self.input_devices, output_devices=self.output_devices, soundpacks=[]))
self.send_message("set", tab="sound", setting="input", value=config.app["sound"]["input_device"])
self.send_message("set", tab="sound", setting="output", value=config.app["sound"]["output_device"])
def update_setting(self, section, setting, value):
if section not in self.session.settings:
@@ -63,4 +78,24 @@ class configurationPresenter(base.basePresenter):
self.session.settings[section][setting] = value
def save_settings_file(self):
self.session.settings.write()
self.session.settings.write()
def update_app_setting(self, section, setting, value):
if section not in config.app:
raise AttributeError("The configuration section is not present in the spec file.")
if setting not in config.app[section]:
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.
# List of app settings that require a restart after being changed.
settings_needing_restart = ["language", "use_proxy", "input_device", "output_device"]
if value != config.app[section][setting] and setting in settings_needing_restart:
self.needs_restart = True
config.app[section][setting] = value
def save_app_settings_file(self):
config.app.write()
if self.needs_restart:
self.send_message("restart_program")
def restart_application(self):
restart.restart_program()

View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from .basePost import *

View File

@@ -7,8 +7,8 @@ import output
from logging import getLogger
from pubsub import pub
from extra import SpellChecker, translator
from .import attach
from .import base
from presenters import attach
from presenters import base
log = getLogger("controller.message")

View File

@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from .basePost import *
from .audio import *
from .comment import *
from .peopleList import *
from .poll import *
from .topic import *
from .topicComment import *

View File

@@ -0,0 +1,100 @@
# -*- coding: utf-8 -*-
import logging
from sessionmanager import utils
from pubsub import pub
from mysc.thread_utils import call_threaded
from presenters import base, player
log = logging.getLogger(__file__)
class displayAudioPresenter(base.basePresenter):
def __init__(self, session, postObject, view, interactor):
super(displayAudioPresenter, self).__init__(view=view, interactor=interactor, modulename="display_audio")
self.added_audios = {}
self.session = session
self.post = postObject
self.load_audios()
self.fill_information(0)
self.run()
def add_to_library(self, audio_index):
post = self.post[audio_index]
args = {}
args["audio_id"] = post["id"]
if "album_id" in post:
args["album_id"] = post["album_id"]
args["owner_id"] = post["owner_id"]
audio = self.session.vk.client.audio.add(**args)
if audio != None and int(audio) > 21:
self.added_audios[post["id"]] = audio
self.send_message("disable_control", control="add")
self.send_message("enable_control", control="remove")
def remove_from_library(self, audio_index):
post = self.post[audio_index]
args = {}
if post["id"] in self.added_audios:
args["audio_id"] = self.added_audios[post["id"]]
args["owner_id"] = self.session.user_id
else:
args["audio_id"] = post["id"]
args["owner_id"] = post["owner_id"]
result = self.session.vk.client.audio.delete(**args)
if int(result) == 1:
self.send_message("enable_control", control="add")
self.send_message("disable_control", control="remove")
if post["id"] in self.added_audios:
self.added_audios.pop(post["id"])
def fill_information(self, index):
post = self.post[index]
if "artist" in post:
self.send_message("set", control="artist", value=post["artist"])
if "title" in post:
self.send_message("set", control="title", value=post["title"])
if "duration" in post:
self.send_message("set", control="duration", value=utils.seconds_to_string(post["duration"]))
self.send_message("set_title", value="{0} - {1}".format(post["title"], post["artist"]))
call_threaded(self.get_lyrics, index)
if post["owner_id"] == self.session.user_id or (post["id"] in self.added_audios) == True:
self.send_message("enable_control", control="remove")
self.send_message("disable_control", control="add")
else:
self.send_message("enable_control", control="add")
self.send_message("disable_control", control="remove")
def get_lyrics(self, audio_index):
post = self.post[audio_index]
if "lyrics_id" in post:
l = self.session.vk.client.audio.getLyrics(lyrics_id=int(post["lyrics_id"]))
self.send_message("set", control="lyric", value=l["text"])
else:
self.send_message("disable_control", control="lyric")
def get_suggested_filename(self, audio_index):
post = self.post[audio_index]
return "{0} - {1}.mp3".format(post["title"], post["artist"])
def download(self, audio_index, path):
post = self.post[audio_index]
if path != None:
pub.sendMessage("download-file", url=post["url"], filename=path)
def play(self, audio_index):
post = self.post[audio_index]
if player.player.check_is_playing() == True:
return pub.sendMessage("stop")
pub.sendMessage("play", object=post)
def load_audios(self):
audios = []
for i in self.post:
s = "{0} - {1}. {2}".format(i["title"], i["artist"], utils.seconds_to_string(i["duration"]))
audios.append(s)
self.send_message("add_items", control="list", items=audios)
if len(self.post) == 1:
self.send_message("disable_control", control="list")
self.send_message("focus_control", control="title")
def handle_changes(self, audio_index):
self.fill_information(audio_index)

View File

@@ -1,8 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import os
import six
import threading
import arrow
import requests
@@ -17,23 +13,16 @@ from sessionmanager import session, renderers, utils # We'll use some functions
from pubsub import pub
from extra import SpellChecker, translator
from mysc.thread_utils import call_threaded
from .import base
from .postCreation import createPostPresenter
from presenters import base
from presenters.createPosts.basePost import createPostPresenter
from . import audio, poll
log = logging.getLogger(__file__)
def get_user(id, profiles):
""" Returns an user name and last name based in the id receibed."""
for i in profiles:
if i["id"] == id:
return "{0} {1}".format(i["first_name"], i["last_name"])
# Translators: This string is used when socializer can't find the right user information.
return _("Unknown username")
def get_message(status):
message = ""
if "text" in status:
message = renderers.clean_text(status["text"])
message = utils.clean_text(status["text"])
return message
class displayPostPresenter(base.basePresenter):
@@ -56,14 +45,19 @@ class displayPostPresenter(base.basePresenter):
else:
self.user_identifier = "owner_id"
self.post_identifier = "id"
self.worker = threading.Thread(target=self.load_all_components)
self.worker.finished = threading.Event()
self.worker.start()
self.attachments = []
self.load_images = False
# We'll put images here, so it will be easier to work with them.
self.images = []
self.imageIndex = 0
result = self.get_post_information()
# Stop loading everything else if post was deleted.
if result == False:
self.interactor.uninstall()
return
self.worker = threading.Thread(target=self.load_all_components)
self.worker.finished = threading.Event()
self.worker.start()
self.run()
def get_comments(self):
@@ -72,16 +66,21 @@ class displayPostPresenter(base.basePresenter):
id = self.post[self.post_identifier]
self.comments = self.session.vk.client.wall.getComments(owner_id=user, post_id=id, need_likes=1, count=100, extended=1, preview_length=0, thread_items_count=10)
comments_ = []
# Save profiles in session local storage for a future usage.
# Although community objects are returned here, we should not add those because their names are changed.
# For example, self reference to a group is marked as "Administrator", which would ruin this profile to be rendered somewhere else.
data = dict(groups=[], profiles=self.comments["profiles"])
self.session.process_usernames(data)
for i in self.comments["items"]:
# If comment has a "deleted" key it should not be displayed, obviously.
if "deleted" in i:
continue
from_ = get_user(i["from_id"], self.comments["profiles"])
from_ = self.session.get_user(i["from_id"])["user1_nom"]
if "reply_to_user" in i:
extra_info = get_user(i["reply_to_user"], self.comments["profiles"])
extra_info = self.session.get_user(i["reply_to_user"])["user1_nom"]
from_ = _("{0} > {1}").format(from_, extra_info)
# As we set the comment reply properly in the from_ field, let's remove the first username from here if it exists.
fixed_text = re.sub("^\[id\d+\|\D+\], ", "", i["text"])
fixed_text = utils.clean_text(i["text"])
if len(fixed_text) > 140:
text = fixed_text[:141]
else:
@@ -110,6 +109,10 @@ class displayPostPresenter(base.basePresenter):
# Retrieve again the post, so we'll make sure to get the most up to date information.
# And we add a counter for views.
post = self.session.vk.client.wall.getById(posts="{owner_id}_{post_id}".format(owner_id=self.post[self.user_identifier], post_id=self.post[self.post_identifier]))
# If this post has been deleted, let's send an event to the interactor so it won't be displayed.
if len(post) == 0:
self.send_message("post_deleted")
return False
self.post = post[0]
if "views" in self.post and self.post["views"]["count"] > 0:
self.send_message("set", control="views", value=str(self.post["views"]["count"]))
@@ -135,6 +138,7 @@ class displayPostPresenter(base.basePresenter):
def get_attachments(self, post, text):
attachments = []
self.attachments = []
if "attachments" in post:
for i in post["attachments"]:
# We don't need the photos_list attachment, so skip it.
@@ -158,6 +162,8 @@ class displayPostPresenter(base.basePresenter):
if len(self.attachments) > 0:
self.send_message("enable_attachments")
self.send_message("add_items", control="attachments", items=attachments)
else:
self.interactor.view.attachments.list.Enable(False)
def check_image_load(self):
if self.load_images and len(self.images) > 0 and self.session.settings["general"]["load_images"]:
@@ -204,7 +210,6 @@ class displayPostPresenter(base.basePresenter):
return url
def load_all_components(self):
self.get_post_information()
self.get_likes()
self.get_reposts()
self.get_comments()
@@ -289,7 +294,7 @@ class displayPostPresenter(base.basePresenter):
else:
from_ = from_["user1_nom"]
# As we set the comment reply properly in the from_ field, let's remove the first username from here if it exists.
fixed_text = re.sub("^\[id\d+\|\D+\], ", "", comment_object["text"])
fixed_text = utils.clean_text(comment_object["text"])
if len(fixed_text) > 140:
text = fixed_text[:141]
else:
@@ -348,9 +353,10 @@ class displayPostPresenter(base.basePresenter):
call_threaded(self.do_last, comment, owner_id=c["owner_id"], reply_to_comment=c["id"], post_id=c["post_id"], reply_to_user=c["owner_id"])
def show_comment(self, comment_index):
from . import comment
c = self.comments["items"][comment_index]
c["post_id"] = self.post[self.post_identifier]
a = displayCommentPresenter(session=self.session, postObject=c, interactor=interactors.displayPostInteractor(), view=views.displayComment())
a = comment.displayCommentPresenter(session=self.session, postObject=c, interactor=interactors.displayPostInteractor(), view=views.displayComment())
def translate(self, text, language):
msg = translator.translator.translate(text, language)
@@ -368,7 +374,7 @@ class displayPostPresenter(base.basePresenter):
def open_attachment(self, index):
attachment = self.attachments[index]
if attachment["type"] == "audio":
a = displayAudioPresenter(session=self.session, postObject=[attachment["audio"]], interactor=interactors.displayAudioInteractor(), view=views.displayAudio())
a = audio.displayAudioPresenter(session=self.session, postObject=[attachment["audio"]], interactor=interactors.displayAudioInteractor(), view=views.displayAudio())
elif attachment["type"] == "link":
output.speak(_("Opening URL..."), True)
webbrowser.open_new_tab(attachment["link"]["url"])
@@ -398,6 +404,8 @@ class displayPostPresenter(base.basePresenter):
break
if url != "":
webbrowser.open_new_tab(url)
elif attachment["type"] == "poll":
a = poll.displayPollPresenter(session=self.session, poll=attachment, interactor=interactors.displayPollInteractor(), view=views.displayPoll())
else:
log.debug("Unhandled attachment: %r" % (attachment,))
@@ -409,197 +417,17 @@ class displayPostPresenter(base.basePresenter):
self.send_message("clean_list", list="comments")
self.get_comments()
class displayCommentPresenter(displayPostPresenter):
def show_likes(self):
""" show likes for the specified post."""
data = dict(type="post", owner_id=self.post[self.user_identifier], item_id=self.post["id"], extended=True, count=1000, skip_own=True)
result = self.session.vk.client.likes.getList(**data)
if result["count"] > 0:
post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}}
pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who liked this")))
def __init__(self, session, postObject, view, interactor):
self.type = "comment"
self.modulename = "display_comment"
self.interactor = interactor
self.view = view
self.interactor.install(view=view, presenter=self, modulename=self.modulename)
self.session = session
self.post = postObject
self.user_identifier = "from_id"
self.post_identifier = "id"
self.worker = threading.Thread(target=self.load_all_components)
self.worker.finished = threading.Event()
self.worker.start()
self.attachments = []
self.load_images = False
# We'll put images here, so it will be easier to work with them.
self.images = []
self.imageIndex = 0
self.run()
def load_all_components(self):
self.get_post_information()
self.get_likes()
self.send_message("disable_control", control="comment")
self.get_comments()
if self.post["likes"]["can_like"] == 0 and self.post["likes"]["user_likes"] == 0:
self.send_message("disable_control", "like")
elif self.post["likes"]["user_likes"] == 1:
self.send_message("set_label", control="like", label=_("&Dislike"))
def get_post_information(self):
from_ = self.session.get_user(self.post[self.user_identifier])
if ("from_id" in self.post and "owner_id" in self.post):
user2 = self.session.get_user(self.post["owner_id"], "user2")
user2.update(from_)
title = _("Comment from {user1_nom} in the {user2_nom}'s post").format(**user2)
self.send_message("set_title", value=title)
message = ""
message = get_message(self.post)
self.send_message("set", control="post_view", value=message)
self.get_attachments(self.post, message)
self.check_image_load()
def reply(self):
comment = createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Reply to {user1_nom}").format(**self.session.get_user(self.post["from_id"])), message="", text="", mode="comment"))
if hasattr(comment, "text") or hasattr(comment, "privacy"):
call_threaded(self.do_last, comment, owner_id=self.post["owner_id"], reply_to_comment=self.post["id"], post_id=self.post["post_id"], reply_to_user=self.post["owner_id"])
def get_comments(self):
""" Get comments and insert them in a list."""
comments_ = []
if "thread" not in self.post:
return
for i in self.post["thread"]["items"]:
# If comment has a "deleted" key it should not be displayed, obviously.
if "deleted" in i:
continue
from_ = self.session.get_user(i["from_id"])
if "reply_to_user" in i:
extra_info = self.session.get_user(i["reply_to_user"], "user2")
extra_info.update(from_)
from_ = _("{user1_nom} > {user2_nom}").format(**extra_info)
else:
from_ = from_["user1_nom"]
# As we set the comment reply properly in the from_ field, let's remove the first username from here if it exists.
fixed_text = re.sub("^\[id\d+\|\D+\], ", "", i["text"])
if len(fixed_text) > 140:
text = fixed_text[:141]
else:
text = fixed_text
original_date = arrow.get(i["date"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
likes = str(i["likes"]["count"])
replies = ""
comments_.append((from_, text, created_at, likes, replies))
self.send_message("add_items", control="comments", items=comments_)
def show_comment(self, comment_index):
c = self.post["thread"]["items"][comment_index]
c["post_id"] = self.post["post_id"]
a = displayCommentPresenter(session=self.session, postObject=c, interactor=interactors.displayPostInteractor(), view=views.displayComment())
self.clear_comments_list()
class displayAudioPresenter(base.basePresenter):
def __init__(self, session, postObject, view, interactor):
super(displayAudioPresenter, self).__init__(view=view, interactor=interactor, modulename="display_audio")
self.added_audios = {}
self.session = session
self.post = postObject
self.load_audios()
self.fill_information(0)
self.run()
def add_to_library(self, audio_index):
post = self.post[audio_index]
args = {}
args["audio_id"] = post["id"]
if "album_id" in post:
args["album_id"] = post["album_id"]
args["owner_id"] = post["owner_id"]
audio = self.session.vk.client.audio.add(**args)
if audio != None and int(audio) > 21:
self.added_audios[post["id"]] = audio
self.send_message("disable_control", control="add")
self.send_message("enable_control", control="remove")
def remove_from_library(self, audio_index):
post = self.post[audio_index]
args = {}
if post["id"] in self.added_audios:
args["audio_id"] = self.added_audios[post["id"]]
args["owner_id"] = self.session.user_id
else:
args["audio_id"] = post["id"]
args["owner_id"] = post["owner_id"]
result = self.session.vk.client.audio.delete(**args)
if int(result) == 1:
self.send_message("enable_control", control="add")
self.send_message("disable_control", control="remove")
if post["id"] in self.added_audios:
self.added_audios.pop(post["id"])
def fill_information(self, index):
post = self.post[index]
if "artist" in post:
self.send_message("set", control="artist", value=post["artist"])
if "title" in post:
self.send_message("set", control="title", value=post["title"])
if "duration" in post:
self.send_message("set", control="duration", value=utils.seconds_to_string(post["duration"]))
self.send_message("set_title", value="{0} - {1}".format(post["title"], post["artist"]))
call_threaded(self.get_lyrics, index)
if post["owner_id"] == self.session.user_id or (post["id"] in self.added_audios) == True:
self.send_message("enable_control", control="remove")
self.send_message("disable_control", control="add")
else:
self.send_message("enable_control", control="add")
self.send_message("disable_control", control="remove")
def get_lyrics(self, audio_index):
post = self.post[audio_index]
if "lyrics_id" in post:
l = self.session.vk.client.audio.getLyrics(lyrics_id=int(post["lyrics_id"]))
self.send_message("set", control="lyric", value=l["text"])
else:
self.send_message("disable_control", control="lyric")
def get_suggested_filename(self, audio_index):
post = self.post[audio_index]
return "{0} - {1}.mp3".format(post["title"], post["artist"])
def download(self, audio_index, path):
post = self.post[audio_index]
if path != None:
pub.sendMessage("download-file", url=post["url"], filename=path)
def play(self, audio_index):
post = self.post[audio_index]
pub.sendMessage("play-audio", audio_object=post)
def load_audios(self):
audios = []
for i in self.post:
s = "{0} - {1}. {2}".format(i["title"], i["artist"], utils.seconds_to_string(i["duration"]))
audios.append(s)
self.send_message("add_items", control="list", items=audios)
if len(self.post) == 1:
self.send_message("disable_control", control="list")
self.send_message("focus_control", control="title")
def handle_changes(self, audio_index):
self.fill_information(audio_index)
class displayFriendshipPresenter(base.basePresenter):
def __init__(self, session, postObject, view, interactor):
self.session = session
self.post = postObject
super(displayFriendshipPresenter, self).__init__(view=view, interactor=interactor, modulename="display_friendship")
list_of_friends = self.get_friend_names()
from_ = self.session.get_user(self.post["source_id"])
title = _("{user1_nom} added the following friends").format(**from_)
self.send_message("set_title", value=title)
self.set_friends_list(list_of_friends)
self.run()
def get_friend_names(self):
self.friends = self.post["friends"]["items"]
return [self.session.get_user(i["user_id"])["user1_nom"] for i in self.friends]
def set_friends_list(self, friendslist):
self.send_message("add_items", control="friends", items=friendslist)
def show_shares(self):
data = dict(type="post", owner_id=self.post[self.user_identifier], item_id=self.post["id"], extended=True, count=1000, skip_own=True, filter="copies")
result = self.session.vk.client.likes.getList(**data)
if result["count"] > 0:
post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}}
pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who shared this")))

View File

@@ -0,0 +1,105 @@
# -*- coding: utf-8 -*-
import threading
import arrow
import languageHandler
import views
import interactors
import logging
from sessionmanager import renderers, utils # We'll use some functions from there
from mysc.thread_utils import call_threaded
from presenters import base
from presenters.createPosts.basePost import createPostPresenter
from . import basePost
log = logging.getLogger(__file__)
def get_message(status):
message = ""
if "text" in status:
message = utils.clean_text(status["text"])
return message
class displayCommentPresenter(basePost.displayPostPresenter):
def __init__(self, session, postObject, view, interactor):
self.type = "comment"
self.modulename = "display_comment"
self.interactor = interactor
self.view = view
self.interactor.install(view=view, presenter=self, modulename=self.modulename)
self.session = session
self.post = postObject
self.user_identifier = "from_id"
self.post_identifier = "id"
self.worker = threading.Thread(target=self.load_all_components)
self.worker.finished = threading.Event()
self.worker.start()
self.attachments = []
self.load_images = False
# We'll put images here, so it will be easier to work with them.
self.images = []
self.imageIndex = 0
self.run()
def load_all_components(self):
self.get_post_information()
self.get_likes()
self.send_message("disable_control", control="comment")
self.get_comments()
if self.post["likes"]["can_like"] == 0 and self.post["likes"]["user_likes"] == 0:
self.send_message("disable_control", "like")
elif self.post["likes"]["user_likes"] == 1:
self.send_message("set_label", control="like", label=_("&Dislike"))
def get_post_information(self):
from_ = self.session.get_user(self.post[self.user_identifier])
if ("from_id" in self.post and "owner_id" in self.post):
user2 = self.session.get_user(self.post["owner_id"], "user2")
user2.update(from_)
title = _("Comment from {user1_nom} in the {user2_nom}'s post").format(**user2)
self.send_message("set_title", value=title)
message = ""
message = get_message(self.post)
self.send_message("set", control="post_view", value=message)
self.get_attachments(self.post, message)
self.check_image_load()
def reply(self, *args, **kwargs):
comment = createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Reply to {user1_nom}").format(**self.session.get_user(self.post["from_id"])), message="", text="", mode="comment"))
if hasattr(comment, "text") or hasattr(comment, "privacy"):
call_threaded(self.do_last, comment, owner_id=self.post["owner_id"], reply_to_comment=self.post["id"], post_id=self.post["post_id"], reply_to_user=self.post["owner_id"])
def get_comments(self):
""" Get comments and insert them in a list."""
comments_ = []
if "thread" not in self.post:
return
for i in self.post["thread"]["items"]:
# If comment has a "deleted" key it should not be displayed, obviously.
if "deleted" in i:
continue
from_ = self.session.get_user(i["from_id"])
if "reply_to_user" in i:
extra_info = self.session.get_user(i["reply_to_user"], "user2")
extra_info.update(from_)
from_ = _("{user1_nom} > {user2_nom}").format(**extra_info)
else:
from_ = from_["user1_nom"]
# As we set the comment reply properly in the from_ field, let's remove the first username from here if it exists.
fixed_text = utils.clean_text(i["text"])
if len(fixed_text) > 140:
text = fixed_text[:141]
else:
text = fixed_text
original_date = arrow.get(i["date"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
likes = str(i["likes"]["count"])
replies = ""
comments_.append((from_, text, created_at, likes, replies))
self.send_message("add_items", control="comments", items=comments_)
def show_comment(self, comment_index):
c = self.post["thread"]["items"][comment_index]
c["post_id"] = self.post["post_id"]
a = displayCommentPresenter(session=self.session, postObject=c, interactor=interactors.displayPostInteractor(), view=views.displayComment())
self.clear_comments_list()

View File

@@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
import webbrowser
import logging
from pubsub import pub
from presenters import base
log = logging.getLogger(__file__)
class displayFriendshipPresenter(base.basePresenter):
def __init__(self, session, postObject, view, interactor, caption=""):
self.session = session
self.post = postObject
super(displayFriendshipPresenter, self).__init__(view=view, interactor=interactor, modulename="display_friendship")
list_of_friends = self.get_friend_names()
from_ = self.session.get_user(self.post["source_id"])
title = caption.format(**from_)
self.send_message("set_title", value=title)
self.set_friends_list(list_of_friends)
self.run()
def get_friend_names(self):
self.friends = self.post["friends"]["items"]
friends = list()
for i in self.friends:
if "user_id" in i:
friends.append(self.session.get_user(i["user_id"])["user1_nom"])
else:
friends.append(self.session.get_user(i["id"])["user1_nom"])
return friends
def set_friends_list(self, friendslist):
self.send_message("add_items", control="friends", items=friendslist)
def view_profile(self, item):
user = self.friends[item]
if "user_id" in user:
id = user["user_id"]
else:
id = user["id"]
pub.sendMessage("user-profile", person=id)
def open_in_browser(self, item):
user = self.friends[item]
if "user_id" in user:
id = user["user_id"]
else:
id = user["id"]
url = "https://vk.com/id{user_id}".format(user_id=id)
webbrowser.open_new_tab(url)

View File

@@ -0,0 +1,55 @@
# -*- coding: utf-8 -*-
import output
import logging
from presenters import base
log = logging.getLogger(__file__)
class displayPollPresenter(base.basePresenter):
def __init__(self, session, poll, view, interactor, show_results=False):
super(displayPollPresenter, self).__init__(view=view, interactor=interactor, modulename="display_poll")
self.poll = poll["poll"]
self.session = session
self.get_poll()
self.load_poll(show_results)
self.run()
def get_poll(self):
# Retrieve the poll again so we will have a fresh and updated object.
data = dict(owner_id=self.poll["owner_id"], is_board=int(self.poll["is_board"]), poll_id=self.poll["id"])
self.poll = self.session.vk.client.polls.getById(**data)
def load_poll(self, load_results=False):
user = self.session.get_user(self.poll["author_id"])
title = _("Poll from {user1_nom}").format(**user)
self.send_message("set_title", value=title)
self.send_message("set", control="question", value=self.poll["question"])
if len(self.poll["answer_ids"]) > 0 or ("is_closed" in self.poll and self.poll["is_closed"] == True) or load_results == True or ("can_vote" in self.poll and self.poll["can_vote"] == False):
options = []
for i in self.poll["answers"]:
options.append((i["text"], i["votes"], i["rate"]))
self.send_message("add_options", options=options, multiple=self.poll["multiple"])
self.send_message("done")
self.send_message("disable_control", control="ok")
else:
options = []
for i in self.poll["answers"]:
options.append(i["text"])
self.send_message("add_options", options=options, multiple=self.poll["multiple"])
self.send_message("done")
def vote(self, answers):
ids = ""
for i in range(0, len(self.poll["answers"])):
if answers[i] == True:
ids = ids+"{answer_id},".format(answer_id=self.poll["answers"][i]["id"])
if self.poll["multiple"] == False:
break
if ids == "":
log.exception("An error occurred when retrieving answer IDS for the following poll: %r. Provided answer list: %r" % (self.poll, answers))
return
data = dict(owner_id=self.poll["owner_id"], poll_id=self.poll["id"], answer_ids=ids, is_board=int(self.poll["is_board"]))
result = self.session.vk.client.polls.addVote(**data)
if result == 1:
output.speak(_("Your vote has been added to this poll."))

View File

@@ -0,0 +1,168 @@
# -*- coding: utf-8 -*-
import threading
import arrow
import languageHandler
import views
import interactors
import output
import logging
from sessionmanager import utils # We'll use some functions from there
from mysc.thread_utils import call_threaded
from presenters import base
from presenters.createPosts.basePost import createPostPresenter
from . import basePost
from .topicComment import *
log = logging.getLogger(__file__)
class displayTopicPresenter(basePost.displayPostPresenter):
def __init__(self, session, postObject, group_id, view, interactor):
self.type = "topic"
self.modulename = "display_topic"
self.interactor = interactor
self.view = view
self.interactor.install(view=view, presenter=self, modulename=self.modulename)
self.session = session
self.post = postObject
self.group_id = group_id
self.load_images = False
# We'll put images here, so it will be easier to work with them.
self.images = []
self.imageIndex = 0
result = self.get_post_information()
# Stop loading everything else if post was deleted.
if result == False:
self.interactor.uninstall()
return
self.worker = threading.Thread(target=self.load_all_components)
self.worker.finished = threading.Event()
self.worker.start()
self.attachments = []
self.run()
def load_all_components(self):
self.get_comments()
def get_post_information(self):
title = self.post["title"]
self.send_message("set_title", value=title)
return True
def get_comments(self):
""" Get comments and insert them in a list."""
self.comments = self.session.vk.client.board.getComments(group_id=self.group_id, topic_id=self.post["id"], need_likes=1, count=100, extended=1, sort="desc")
comments_ = []
data = dict(profiles=self.comments["profiles"], groups=[])
self.session.process_usernames(data)
self.comments["items"].reverse()
# If there are less than 100 comments in the topic we should disable the "load previous" button.
if self.comments["count"] <= 100:
self.send_message("disable_control", control="load_more_comments")
else:
left_comments = self.comments["count"]-len(self.comments["items"])
if left_comments > 100:
left_comments = 100
self.send_message("set_label", control="load_more_comments", label=_("Load {comments} previous comments").format(comments=left_comments))
for i in self.comments["items"]:
# If comment has a "deleted" key it should not be displayed, obviously.
if "deleted" in i:
continue
from_ = self.session.get_user(i["from_id"])["user1_nom"]
# match user mentions inside text comment.
original_date = arrow.get(i["date"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
likes = str(i["likes"]["count"])
text = utils.clean_text(text=i["text"])
comments_.append((from_, text, created_at, likes))
self.send_message("add_items", control="comments", items=comments_)
def post_like(self):
c = self.interactor.view.comments.get_selected()
id = self.comments["items"][c]["id"]
if self.comments["items"][c]["likes"]["user_likes"] == 1:
l = self.session.vk.client.likes.delete(owner_id=-1*self.group_id, item_id=id, type="topic_comment")
output.speak(_("You don't like this"))
self.comments["items"][c]["likes"]["count"] = l["likes"]
self.comments["items"][c]["likes"]["user_likes"] = 2
self.send_message("set_label", control="like", label=_("&Like"))
else:
l = self.session.vk.client.likes.add(owner_id=-1*self.group_id, item_id=id, type="topic_comment")
output.speak(_("You liked this"))
self.send_message("set_label", control="like", label=_("&Dislike"))
self.comments["items"][c]["likes"]["count"] = l["likes"]
self.comments["items"][c]["likes"]["user_likes"] = 1
self.clear_comments_list()
def change_comment(self, comment):
comment = self.comments["items"][comment]
self.send_message("clean_list", list="attachments")
self.get_attachments(comment, "")
if comment["likes"]["user_likes"] == 1:
self.send_message("set_label", control="like", label=_("&Dislike"))
else:
self.send_message("set_label", control="like", label=_("&Like"))
def add_comment(self):
comment = 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"):
group_id = self.group_id
topic_id = self.post["id"]
call_threaded(self.do_last, comment, group_id=group_id, topic_id=topic_id)
def do_last(self, comment, **kwargs):
msg = comment.text
attachments = ""
if hasattr(comment, "attachments"):
attachments = self.upload_attachments(comment.attachments)
if msg != "":
kwargs.update(message=msg)
if attachments != "":
kwargs.update(attachments=attachments)
if "message" not in kwargs and "attachments" not in kwargs:
return # No comment made here.
result = self.session.vk.client.board.createComment(**kwargs)
self.clear_comments_list()
def reply(self, comment):
c = self.comments["items"][comment]
comment = createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Reply to {user1_nom}").format(**self.session.get_user(c["from_id"])), message="", text="", mode="comment"))
if hasattr(comment, "text") or hasattr(comment, "privacy"):
user = self.session.get_user(c["from_id"])
name = user["user1_nom"].split(" ")[0]
comment.text = "[post{post_id}|{name}], {text}".format(post_id=c["id"], text=comment.text, name=name)
group_id = self.group_id
topic_id = self.post["id"]
call_threaded(self.do_last, comment, group_id=group_id, topic_id=topic_id, reply_to_comment=c["id"])
def show_comment(self, comment_index):
c = self.comments["items"][comment_index]
c["post_id"] = self.post["id"]
a = displayTopicCommentPresenter(session=self.session, postObject=c, interactor=interactors.displayPostInteractor(), view=views.displayComment())
def load_more_comments(self):
offset = len(self.comments["items"])
comments = self.session.vk.client.board.getComments(group_id=self.group_id, topic_id=self.post["id"], need_likes=1, count=100, extended=1, sort="desc", offset=offset)
data = dict(profiles=comments["profiles"], groups=[])
self.session.process_usernames(data)
# If there are less than 100 comments in the topic we should disable the "load previous" button.
for i in comments["items"]:
self.comments["items"].insert(0, i)
for i in comments["items"]:
# If comment has a "deleted" key it should not be displayed, obviously.
if "deleted" in i:
continue
from_ = self.session.get_user(i["from_id"])["user1_nom"]
# match user mentions inside text comment.
original_date = arrow.get(i["date"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
likes = str(i["likes"]["count"])
text = utils.clean_text(text=i["text"])
self.send_message("add_item", control="comments", item=(from_, text, created_at, likes), reversed=True)
if len(self.comments["items"]) == self.comments["count"]:
self.send_message("disable_control", control="load_more_comments")
else:
left_comments = self.comments["count"]-len(self.comments["items"])
if left_comments > 100:
left_comments = 100
self.send_message("set_label", control="load_more_comments", label=_("Load {comments} previous comments").format(comments=left_comments))

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
import logging
from sessionmanager import renderers, utils # We'll use some functions from there
from presenters import base
from presenters.createPosts.basePost import createPostPresenter
from . import comment
log = logging.getLogger(__file__)
def get_message(status):
message = ""
if "text" in status:
message = utils.clean_text(status["text"])
return message
class displayTopicCommentPresenter(comment.displayCommentPresenter):
def get_post_information(self):
from_ = self.session.get_user(self.post[self.user_identifier])
title = from_["user1_nom"]
self.send_message("set_title", value=title)
message = ""
message = get_message(self.post)
self.send_message("set", control="post_view", value=message)
self.get_attachments(self.post, message)
self.check_image_load()
self.send_message("disable_control", control="reply")
self.send_message("disable_control", control="comments")

836
src/presenters/main.py Normal file
View File

@@ -0,0 +1,836 @@
# -*- coding: utf-8 -*-
import time
import os
import webbrowser
import logging
import output
import interactors
import views
import config
from vk_api.exceptions import LoginRequired, VkApiError
from requests.exceptions import ConnectionError
from pubsub import pub
from mysc.repeating_timer import RepeatingTimer
from mysc.thread_utils import call_threaded
from mysc import localization
from sessionmanager import session, utils, renderers
from update import updater
from issueReporter import issueReporter
from controller import buffers, selector
from . import player, longpollthread
from . import base
log = logging.getLogger("controller.main")
class Controller(base.basePresenter):
def search(self, tab_name):
for i in range(0, len(self.buffers)):
if self.buffers[i].name == tab_name:
return self.buffers[i]
return False
def get_all_buffers(self, contains):
results = []
for i in self.buffers:
if contains in i.name:
results.append(i)
return results
def __init__(self, *args, **kwargs):
super(Controller, self).__init__(*args, **kwargs)
log.debug("Starting main controller...")
self.buffers = []
player.setup()
self.session = session.sessions[list(session.sessions.keys())[0]]
self.create_controls()
call_threaded(updater.do_update, update_type=self.session.settings["general"]["update_channel"])
def create_buffer(self, buffer_type="baseBuffer", buffer_title="", parent_tab=None, loadable=False, get_items=False, kwargs={}):
if not hasattr(buffers, buffer_type):
raise AttributeError("Specified buffer type does not exist.")
buffer = getattr(buffers, buffer_type)(**kwargs)
if loadable:
buffer.can_get_items = False
self.buffers.append(buffer)
if parent_tab == None:
self.send_message("add_buffer", widget=buffer.tab, title=buffer_title)
else:
self.send_message("insert_buffer", widget=buffer.tab, title=buffer_title, parent=parent_tab)
if get_items:
call_threaded(buffer.get_items)
def create_empty_buffer(self, buffer_type="empty", buffer_title="", parent_tab=None, kwargs={}):
if not hasattr(buffers, buffer_type):
raise AttributeError("Specified buffer type does not exist.")
buffer = getattr(buffers, buffer_type)(**kwargs)
self.buffers.append(buffer)
if parent_tab == None:
self.window.add_buffer(buffer.tab, buffer_title)
else:
self.window.insert_buffer(buffer.tab, buffer_title, self.window.search(parent_tab))
def create_controls(self):
log.debug("Creating controls for the window...")
pub.sendMessage("create_empty_buffer", buffer_title=_("Posts"), kwargs=dict(parent=self.window.tb, name="posts"))
pub.sendMessage("create_buffer", buffer_type="baseBuffer", buffer_title=_("Home"), parent_tab="posts", kwargs=dict(parent=self.window.tb, name="home_timeline", session=self.session, composefunc="render_newsfeed_item", endpoint="newsfeed", count=self.session.settings["buffers"]["count_for_wall_buffers"]))
pub.sendMessage("create_buffer", buffer_type="feedBuffer", buffer_title=_("My wall"), parent_tab="posts", kwargs=dict(parent=self.window.tb, name="me_feed", composefunc="render_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"]))
pub.sendMessage("create_empty_buffer", buffer_title=_("Music"), kwargs=dict(parent=self.window.tb, name="audios"))
pub.sendMessage("create_buffer", buffer_type="audioBuffer", buffer_title=_("My audios"), parent_tab="audios", kwargs=dict(parent=self.window.tb, name="me_audio", composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio"))
if self.session.settings["vk"]["use_alternative_tokens"] == False:
pub.sendMessage("create_buffer", buffer_type="audioBuffer", buffer_title=_("Populars"), parent_tab="audios", kwargs=dict(parent=self.window.tb, name="popular_audio", composefunc="render_audio", session=self.session, endpoint="getPopular", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"]))
pub.sendMessage("create_buffer", buffer_type="audioBuffer", buffer_title=_("Recommendations"), parent_tab="audios", kwargs=dict(parent=self.window.tb, name="recommended_audio", composefunc="render_audio", session=self.session, endpoint="getRecommendations", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"]))
pub.sendMessage("create_empty_buffer", buffer_type="empty", buffer_title=_("Albums"), parent_tab="audios", kwargs=dict(parent=self.window.tb, name="albums"))
pub.sendMessage("create_empty_buffer", buffer_title=_("Video"), kwargs=dict(parent=self.window.tb, name="videos"))
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_empty_buffer", buffer_title=_("Albums"), parent_tab="videos", kwargs=dict(parent=self.window.tb, name="video_albums"))
pub.sendMessage("create_empty_buffer", buffer_title=_("People"), kwargs=dict(parent=self.window.tb, name="people"))
pub.sendMessage("create_buffer", buffer_type="peopleBuffer", buffer_title=_("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"))
pub.sendMessage("create_empty_buffer", 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))
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))
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))
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_empty_buffer", buffer_title=_("Communities"), kwargs=dict(parent=self.window.tb, name="communities"))
pub.sendMessage("create_empty_buffer", buffer_title=_("Chats"), kwargs=dict(parent=self.window.tb, name="chats"))
pub.sendMessage("create_empty_buffer", buffer_title=_("Timelines"), kwargs=dict(parent=self.window.tb, name="timelines"))
self.window.realize()
self.repeatedUpdate = RepeatingTimer(120, self.update_all_buffers)
self.repeatedUpdate.start()
self.readMarker = RepeatingTimer(60, self.mark_as_read)
self.readMarker.start()
def connect_events(self):
log.debug("Connecting events to responses...")
pub.subscribe(self.in_post, "posted")
pub.subscribe(self.download, "download-file")
pub.subscribe(self.play_audio, "play-audio")
pub.subscribe(self.play_audios, "play-audios")
pub.subscribe(self.view_post, "open-post")
pub.subscribe(self.update_status_bar, "update-status-bar")
pub.subscribe(self.chat_from_id, "new-chat")
pub.subscribe(self.authorisation_failed, "authorisation-failed")
pub.subscribe(self.user_profile, "user-profile")
pub.subscribe(self.user_online, "user-online")
pub.subscribe(self.user_offline, "user-offline")
pub.subscribe(self.notify, "notify")
pub.subscribe(self.handle_longpoll_read_timeout, "longpoll-read-timeout")
pub.subscribe(self.create_buffer, "create_buffer")
pub.subscribe(self.create_empty_buffer, "create_empty_buffer")
pub.subscribe(self.user_typing, "user-typing")
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.check_for_updates, menuitem=self.window.check_for_updates)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.window.about_dialog, menuitem=self.window.about)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.search_audios, menuitem=self.window.search_audios)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.search_videos, menuitem=self.window.search_videos)
widgetUtils.connect_event(self.window, widgetUtils.MENU,self.remove_buffer, menuitem=self.window.remove_buffer_)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.get_more_items, menuitem=self.window.load_previous_items)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.changelog, menuitem=self.window.changelog)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.configuration, menuitem=self.window.settings_dialog)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.new_timeline, menuitem=self.window.timeline)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.create_audio_album, menuitem=self.window.audio_album)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.delete_audio_album, menuitem=self.window.delete_audio_album)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.create_video_album, menuitem=self.window.video_album)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.delete_video_album, menuitem=self.window.delete_video_album)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.check_documentation, menuitem=self.window.documentation)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_play_pause, menuitem=self.window.player_play)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_play_next, menuitem=self.window.player_next)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_play_previous, menuitem=self.window.player_previous)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_play_all, menuitem=self.window.player_play_all)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_volume_down, menuitem=self.window.player_volume_down)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_volume_up, menuitem=self.window.player_volume_up)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.menu_mute, menuitem=self.window.player_mute)
pub.subscribe(self.get_chat, "order-sent-message")
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.view_my_profile, menuitem=self.window.view_profile)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.view_my_profile_in_browser, menuitem=self.window.open_in_browser)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.set_status, menuitem=self.window.set_status)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_report_error, menuitem=self.window.report)
self.window.tb.Bind(wx.EVT_CONTEXT_MENU, self.on_context_menu)
def disconnect_events(self):
log.debug("Disconnecting some events...")
pub.unsubscribe(self.in_post, "posted")
pub.unsubscribe(self.download, "download-file")
pub.unsubscribe(self.play_audio, "play-audio")
pub.unsubscribe(self.authorisation_failed, "authorisation-failed")
pub.unsubscribe(self.play_audios, "play-audios")
pub.unsubscribe(self.view_post, "open-post")
pub.unsubscribe(self.update_status_bar, "update-status-bar")
pub.unsubscribe(self.user_online, "user-online")
pub.unsubscribe(self.user_offline, "user-offline")
pub.unsubscribe(self.notify, "notify")
def on_context_menu(self, event, *args, **kwargs):
""" Handles context menu event in the tree buffers."""
# If the focus is not in the TreeCtrl of the Treebook, then we should not display any menu.
if isinstance(self.window.FindFocus(), wx.TreeCtrl) == False:
event.Skip()
return
menu = None
# Get the current buffer and let's choose a different menu depending on the selected buffer.
current_buffer = self.get_current_buffer()
# Deal with menu for community buffers.
if current_buffer.name.endswith("_community"):
menu = menus.communityBufferMenu()
# disable post loading if the community has already loaded posts.
if current_buffer.can_get_items:
menu.load_posts.Enable(False)
# Disable loading of audios, videos, documents or topics depending in two conditions.
# 1. If the buffer already exists, which means they are already loaded, or
# 2. If the group_info does not have counters for such items, which would indicate there are no items posted yet.
if self.search(current_buffer.name+"_audios") != False:
menu.load_audios.Enable(False)
elif hasattr(current_buffer, "group_info") and "audios" not in current_buffer.group_info["counters"]:
menu.load_audios.Enable(False)
if self.search(current_buffer.name+"_videos") != False:
menu.load_videos.Enable(False)
elif hasattr(current_buffer, "group_info") and "videos" not in current_buffer.group_info["counters"]:
menu.load_videos.Enable(False)
if self.search(current_buffer.name+"_topics") != False:
menu.load_topics.Enable(False)
elif hasattr(current_buffer, "group_info") and "topics" not in current_buffer.group_info["counters"]:
menu.load_topics.Enable(False)
if self.search(current_buffer.name+"_documents") != False:
menu.load_documents.Enable(False)
elif hasattr(current_buffer, "group_info") and "docs" not in current_buffer.group_info["counters"]:
menu.load_documents.Enable(False)
# Connect the rest of the functions.
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_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_documents, menuitem=menu.load_documents)
# Deal with the communities section itself.
if current_buffer.name == "communities":
menu = wx.Menu()
# Insert a different option depending if group buffers are loaded or scheduled to be loaded or not.
if self.session.settings["load_at_startup"]["communities"] == False and not hasattr(self.session, "groups"):
option = menu.Append(wx.NewId(), _("Load groups"))
widgetUtils.connect_event(menu, widgetUtils.MENU, self.load_community_buffers, menuitem=option)
else:
option = menu.Append(wx.NewId(), _("Discard groups"))
widgetUtils.connect_event(menu, widgetUtils.MENU, self.unload_community_buffers, menuitem=option)
if menu != None:
self.window.PopupMenu(menu, self.window.FindFocus().GetPosition())
# If there are no available menus, let's indicate it.
else:
output.speak(_("menu unavailable for this buffer."))
def authorisation_failed(self):
commonMessages.bad_authorisation()
def login(self):
self.window.change_status(_("Logging in VK"))
self.session.login()
self.window.change_status(_("Ready"))
for i in self.buffers:
if hasattr(i, "get_items"):
# Translators: {0} will be replaced with the name of a buffer.
self.window.change_status(_("Loading items for {0}").format(i.name,))
i.get_items()
self.window.change_status(_("Ready"))
self.create_unread_messages()
self.status_setter = RepeatingTimer(280, self.set_online)
self.status_setter.start()
self.set_online(notify=True)
self.get_audio_albums(self.session.user_id)
self.get_video_albums(self.session.user_id)
self.get_communities(self.session.user_id)
self.create_longpoll_thread()
def create_longpoll_thread(self, notify=False):
try:
self.longpoll = longpollthread.worker(self.session)
self.longpoll.start()
if notify:
self.notify(message=_("Chat server reconnected"))
except ConnectionError:
pub.sendMessage("longpoll-read-timeout")
def in_post(self, buffer):
buffer = self.search(buffer)
buffer.get_items()
buffer = self.search("home_timeline")
buffer.get_items()
def update_all_buffers(self):
log.debug("Updating buffers...")
self.get_audio_albums(self.session.user_id, create_buffers=False)
self.get_video_albums(self.session.user_id, create_buffers=False)
for i in self.buffers:
if hasattr(i, "get_items"):
i.get_items()
log.debug("Updated %s" % (i.name))
def download(self, url, filename):
log.debug("downloading %s URL to %s filename" % (url, filename,))
call_threaded(utils.download_file, url, filename, self.window)
def play_audio(self, audio_object):
# Restricted audios don't include an URL paramether.
# Restriction can be due to licensed content to unauthorized countries.
if "url" in audio_object and audio_object["url"] =="":
self.notify(message=_("This file could not be played because it is not allowed in your country"))
return
call_threaded(player.player.play, audio_object, fresh=True)
def play_audios(self, audios):
player.player.play_all(audios, shuffle=self.window.player_shuffle.IsChecked())
def view_post(self, post_object, controller_):
p = getattr(presenters, controller_+"Presenter")(session=self.session, postObject=post_object, interactor=getattr(interactors, controller_+"Interactor")(), view=getattr(views, controller_)())
def exit(self, *args, **kwargs):
log.debug("Receibed an exit signal. closing...")
self.set_offline()
self.disconnect_events()
volume = player.player.volume
config.app["sound"]["volume"] = volume
config.app.write()
self.window.Destroy()
wx.GetApp().ExitMainLoop()
def update_buffer(self, *args, **kwargs):
b = self.get_current_buffer()
b.get_items()
def get_more_items(self, *args, **kwargs):
b = self.get_current_buffer()
b.get_more_items()
def check_for_updates(self, *args, **kwargs):
update = updater.do_update(update_type=self.session.settings["general"]["update_channel"])
if update == False:
commonMessages.no_update_available()
def search_audios(self, *args, **kwargs):
dlg = searchDialogs.searchAudioDialog()
if dlg.get_response() == widgetUtils.OK:
q = dlg.get("term")
auto_complete = True
count = 300
performer_only = dlg.get_state("title")
sort = dlg.get_sort_order()
newbuff = buffers.audioBuffer(parent=self.window.tb, name="{0}_audiosearch".format(q,), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q, auto_complete=auto_complete, count=count, performer_only=performer_only, sort=sort)
self.buffers.append(newbuff)
call_threaded(newbuff.get_items)
# Translators: {0} will be replaced with the search term.
self.window.insert_buffer(newbuff.tab, _("Search for {0}").format(q,), self.window.search("audios"))
def search_videos(self, *args, **kwargs):
dlg = searchDialogs.searchVideoDialog()
if dlg.get_response() == widgetUtils.OK:
params = {}
params["q"] = dlg.get("term")
params["count"] = 200
hd = dlg.get_checkable("hd")
if hd != 0:
params["hd"] = 1
params["adult"] = dlg.get_checkable("safe_search")
params["sort"] = dlg.get_sort_order()
# params["filters"] = "youtube, vimeo, short, long, mp4"
print(params)
newbuff = buffers.videoBuffer(parent=self.window.tb, name="{0}_videosearch".format(params["q"],), session=self.session, composefunc="render_video", parent_endpoint="video", endpoint="search", **params)
self.buffers.append(newbuff)
call_threaded(newbuff.get_items)
# Translators: {0} will be replaced with the search term.
self.window.insert_buffer(newbuff.tab, _("Search for {0}").format(params["q"],), self.window.search("videos"))
def update_status_bar(self, status):
self.window.change_status(status)
def remove_buffer(self, event, mandatory=False, *args, **kwargs):
buffer = self.get_current_buffer()
buff = self.window.search(buffer.name)
answer = buffer.remove_buffer(mandatory)
if answer == False:
return
self.window.remove_buffer(buff)
self.buffers.remove(buffer)
del buffer
def changelog(self, *args, **kwargs):
lang = localization.get("documentation")
os.chdir("documentation/%s" % (lang,))
webbrowser.open("changelog.html")
os.chdir("../../")
def configuration(self, *args, **kwargs):
""" Opens the global settings dialogue."""
presenter = presenters.configurationPresenter(session=self.session, view=views.configurationDialog(title=_("Preferences")), interactor=interactors.configurationInteractor())
def new_timeline(self, *args, **kwargs):
b = self.get_current_buffer()
# If executing this method from an empty buffer we should get the newsfeed buffer.
if not hasattr(b, "get_users"):
b = self.search("home_timeline")
# Get a list of (id, user) objects.
d = []
for i in self.session.db["users"]:
d.append((i, self.session.get_user(i)["user1_gen"]))
# Do the same for communities.
for i in self.session.db["groups"]:
d.append((-i, self.session.get_user(-i)["user1_nom"]))
a = timeline.timelineDialog([i[1] for i in d])
if a.get_response() == widgetUtils.OK:
user = a.get_user()
buffertype = a.get_buffer_type()
user_id = ""
for i in d:
if i[1] == user:
user_id = i[0]
if user_id == "":
user_data = self.session.vk.client.utils.resolveScreenName(screen_name=user)
if type(user_data) == list:
commonMessages.no_user_exist()
return
user_id = user_data["object_id"]
if buffertype == "audio":
buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="render_audio", session=self.session, create_tab=False, endpoint="get", parent_endpoint="audio", owner_id=user_id)
user = self.session.get_user(user_id, key="user1")
name_ = _("{user1_nom}'s audios").format(**user)
elif buffertype == "wall":
buffer = buffers.feedBuffer(parent=self.window.tb, name="{0}_feed".format(user_id,), composefunc="render_status", session=self.session, create_tab=False, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"], owner_id=user_id)
user = self.session.get_user(user_id, key="user1")
name_ = _("{user1_nom}'s posts").format(**user)
elif buffertype == "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)
user = self.session.get_user(user_id, key="user1")
name_ = _("{user1_nom}'s friends").format(**user)
wx.CallAfter(self.complete_buffer_creation, buffer=buffer, name_=name_, position=self.window.search("timelines"))
def complete_buffer_creation(self, buffer, name_, position):
answer = buffer.get_items()
if answer is not True:
commonMessages.show_error_code(answer)
return
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, position)
def search_chat_buffer(self, user_id):
for i in self.buffers:
if "_messages" in i.name:
if "peer_id" in i.kwargs and i.kwargs["peer_id"] == user_id: return i
return None
def chat_from_id(self, user_id, setfocus=True, unread=False):
b = self.search_chat_buffer(user_id)
if b != None:
pos = self.window.search(b.name)
if setfocus:
self.window.change_buffer(pos)
return b.tab.text.SetFocus()
return
# Get name based in the ID.
# for users.
if user_id > 0 and user_id < 2000000000:
user = self.session.get_user(user_id, key="user1")
name = user["user1_nom"]
elif user_id > 2000000000:
chat = self.session.vk.client.messages.getChat(chat_id=user_id-2000000000)
name = chat["title"]
wx.CallAfter(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", session=self.session, unread=unread, count=200, peer_id=user_id, rev=0, extended=True, fields="id, user_id, date, read_state, out, body, attachments, deleted"))
# if setfocus:
# pos = self.window.search(buffer.name)
# self.window.change_buffer(pos)
# call_threaded(buffer.get_items, unread=unread)
# if setfocus: buffer.tab.text.SetFocus()
# return True
def user_online(self, event):
if self.session.settings["chat"]["notify_online"] == False:
return
user_name = self.session.get_user(event.user_id)
msg = _("{user1_nom} is online.").format(**user_name)
sound = "friend_online.ogg"
self.notify(msg, sound, self.session.settings["chat"]["notifications"])
def user_offline(self, event):
if self.session.settings["chat"]["notify_offline"] == False:
return
user_name = self.session.get_user(event.user_id)
msg = _("{user1_nom} is offline.").format(**user_name)
sound = "friend_offline.ogg"
self.notify(msg, sound, self.session.settings["chat"]["notifications"])
def user_typing(self, obj):
buffer = self.search_chat_buffer(obj.user_id)
if buffer != None and buffer == self.get_current_buffer():
user = self.session.get_user(obj.user_id)
output.speak(_("{user1_nom} is typing...").format(**user))
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.
obj vk_api.longpoll.EventType: an event wich defines some data from the vk's long poll server."""
message = {}
uid = obj.peer_id
buffer = self.search_chat_buffer(uid)
if obj.from_me:
message.update(out=0)
# If there is no buffer, we must create one in a wxThread so it will not crash.
if buffer == None:
wx.CallAfter(self.chat_from_id, uid, setfocus=self.session.settings["chat"]["automove_to_conversations"], unread=True)
self.session.soundplayer.play("conversation_opened.ogg")
return
# 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)
# if attachments is true, 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.
if len(message["attachments"]) != 0:
message_ids = message["id"]
results = self.session.vk.client.messages.getById(message_ids=message_ids)
message = results["items"][0]
if obj.from_me:
message["from_id"] = self.session.user_id
else:
message.update(read_state=0, out=0)
message["from_id"] = obj.user_id
data = [message]
# Let's add this to the buffer.
# ToDo: Clean this code and test how is the database working with this set to True.
num = self.session.order_buffer(buffer.name, data, True)
buffer.insert(self.session.db[buffer.name]["items"][-1], False)
self.session.soundplayer.play("message_received.ogg")
wx.CallAfter(self.reorder_buffer, buffer)
# Check if we have to read the message aloud
if buffer == self.get_current_buffer():
rendered_message = renderers.render_message(message, self.session)
output.speak(rendered_message[0])
def set_online(self, notify=False):
try:
r = self.session.vk.client.account.setOnline()
except:
log.error("Error in setting online for the current user")
if notify:
self.window.notify("Socializer", "online now!")
def set_offline(self):
try:
r = self.session.vk.client.account.setOffline()
except:
log.error("Error in setting offline status for the current user")
def create_unread_messages(self):
if self.session.settings["chat"]["open_unread_conversations"] == False:
return
try:
log.debug("Getting possible unread messages.")
msgs = self.session.vk.client.messages.getConversations(count=200)
except VkApiError as ex:
if ex.code == 6:
log.exception("Something went wrong when getting messages. Waiting a second to retry")
for i in msgs["items"]:
call_threaded(self.chat_from_id, i["last_message"]["peer_id"], setfocus=False, unread=False)
time.sleep(0.6)
def mark_as_read(self):
for i in self.buffers:
if hasattr(i, "reads") and len(i.reads) != 0:
response = self.session.vk.client.messages.markAsRead(peer_id=i.kwargs["peer_id"])
i.clear_reads()
i.reads = []
time.sleep(1)
def get_audio_albums(self, user_id=None, create_buffers=True):
if self.session.settings["load_at_startup"]["audio_albums"] == False:
return
log.debug("Create audio albums...")
if self.session.settings["vk"]["use_alternative_tokens"]:
albums = self.session.vk.client_audio.get_albums(owner_id=user_id)
else:
albums = self.session.vk.client.audio.getPlaylists(owner_id=user_id)
albums = albums["items"]
self.session.audio_albums = albums
if create_buffers:
for i in albums:
wx.CallAfter(pub.sendMessage, "create_buffer", buffer_type="audioAlbum", buffer_title=_("Album: {0}").format(i["title"],), parent_tab="albums", loadable=True, kwargs=dict(parent=self.window.tb, name="{0}_audio_album".format(i["id"],), composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", owner_id=user_id, album_id=i["id"]))
time.sleep(0.6)
def get_video_albums(self, user_id=None, create_buffers=True):
if self.session.settings["load_at_startup"]["video_albums"] == False:
return
log.debug("Create video albums...")
albums = self.session.vk.client.video.getAlbums(owner_id=user_id)
self.session.video_albums = albums["items"]
if create_buffers:
for i in albums["items"]:
wx.CallAfter(pub.sendMessage, "create_buffer", buffer_type="videoAlbum", buffer_title=_("Album: {0}").format(i["title"],), parent_tab="video_albums", loadable=True, kwargs=dict(parent=self.window.tb, name="{0}_video_album".format(i["id"],), composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"], user_id=user_id, album_id=i["id"]))
time.sleep(0.15)
def get_communities(self, user_id=None, create_buffers=True, force_action=False):
if self.session.settings["vk"]["invited_to_group"] == False:
self.session.settings["vk"]["invited_to_group"] = True
self.session.settings.write()
socializer_group = self.session.vk.client.groups.getById(group_ids="175825000")[0]
if socializer_group["is_member"] ==False:
d = commonMessages.join_group()
self.session.settings["vk"]["invited_to_group"] = True
self.session.settings.write()
if d == widgetUtils.YES:
result = self.session.vk.client.groups.join(group_id=socializer_group["id"])
if result == 1:
commonMessages.group_joined()
else:
log.error("Invalid result when joining the Socializer's group: %d" % (result))
if self.session.settings["load_at_startup"]["communities"] == False and force_action == False:
return
log.debug("Create community buffers...")
groups= self.session.vk.client.groups.get(user_id=user_id, extended=1, count=1000)
self.session.groups=groups["items"]
# Let's feed the local database cache with new groups coming from here.
data= dict(profiles=[], groups=self.session.groups)
self.session.process_usernames(data)
if create_buffers:
for i in self.session.groups:
wx.CallAfter(pub.sendMessage, "create_buffer", buffer_type="communityBuffer", buffer_title=i["name"], parent_tab="communities", loadable=True, get_items=True, kwargs=dict(parent=self.window.tb, name="{0}_community".format(i["id"],), composefunc="render_status", session=self.session, endpoint="get", parent_endpoint="wall", count=self.session.settings["buffers"]["count_for_wall_buffers"], owner_id=-1*i["id"]))
time.sleep(0.15)
def create_audio_album(self, *args, **kwargs):
d = creation.audio_album()
if d.get_response() == widgetUtils.OK and d.get("title") != "":
response = self.session.vk.client.audio.createPlaylist(owner_id=self.session.user_id, title=d.get("title"))
if "id" not in response:
return
album_id = response["id"]
buffer = buffers.audioAlbum(parent=self.window.tb, name="{0}_audio_album".format(album_id,), composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"], user_id=self.session.user_id, album_id=album_id)
buffer.can_get_items = False
# Translators: {0} will be replaced with an audio album's title.
name_ = _("Album: {0}").format(d.get("title"),)
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("albums"))
buffer.get_items()
self.get_audio_albums(user_id=self.session.user_id, create_buffers=False)
def delete_audio_album(self, *args, **kwargs):
if len(self.session.audio_albums) == 0:
return commonMessages.no_audio_albums()
answer = selector.album(_("Select the album you want to delete"), self.session)
if answer.item == None:
return
response = commonMessages.delete_audio_album()
if response != widgetUtils.YES: return
removal = self.session.vk.client.audio.deletePlaylist(playlist_id=answer.item, owner_id=self.session.user_id)
if removal == 1:
buffer = self.search("{0}_audio_album".format(answer.item,))
buff = self.window.search(buffer.name)
self.window.remove_buffer(buff)
self.buffers.remove(buffer)
del buffer
self.get_audio_albums(user_id=self.session.user_id, create_buffers=False)
def create_video_album(self, *args, **kwargs):
d = creation.audio_album()
if d.get_response() == widgetUtils.OK and d.get("title") != "":
response = self.session.vk.client.video.addAlbum(title=d.get("title"))
if ("album_id" in response) == False: return
album_id = response["album_id"]
buffer = buffers.videoAlbum(parent=self.window.tb, name="{0}_video_album".format(album_id,), composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"], user_id=self.session.user_id, album_id=album_id)
buffer.can_get_items = False
# Translators: {0} will be replaced with a video album's title.
name_ = _("Album: {0}").format(d.get("title"),)
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("video_albums"))
buffer.get_items()
self.session.video_albums = self.session.vk.client.video.getAlbums(owner_id=self.session.user_id)["items"]
def delete_video_album(self, *args, **kwargs):
if len(self.session.video_albums) == 0:
return commonMessages.no_video_albums()
answer = selector.album(_("Select the album you want to delete"), self.session, "video_albums")
if answer.item == None:
return
response = commonMessages.delete_audio_album()
if response != widgetUtils.YES: return
removal = self.session.vk.client.video.deleteAlbum(album_id=answer.item)
buffer = self.search("{0}_video_album".format(answer.item,))
buff = self.window.search(buffer.name)
self.window.remove_buffer(buff)
self.buffers.remove(buffer)
del buffer
self.session.video_albums = self.session.vk.client.video.getAlbums(owner_id=self.session.user_id)["items"]
def check_documentation(self, *args, **kwargs):
lang = localization.get("documentation")
os.chdir("documentation/%s" % (lang,))
webbrowser.open("manual.html")
os.chdir("../../")
def menu_play_pause(self, *args, **kwargs):
if player.player.stream != None:
return player.player.pause()
else:
b = self.get_current_buffer()
if hasattr(b, "play_all"):
b.play_all()
else:
self.search("me_audio").play_all()
def menu_play_next(self, *args, **kwargs):
return player.player.play_next()
# b = self.get_current_buffer()
# if hasattr(b, "play_next"):
# b.play_next()
# else:
# self.search("me_audio").play_next()
def menu_play_previous(self, *args, **kwargs):
return player.player.play_previous()
# b = self.get_current_buffer()
# if hasattr(b, "play_previous"):
# b.play_previous()
# else:
# self.search("me_audio").play_previous()
def menu_play_all(self, *args, **kwargs):
b = self.get_current_buffer()
if hasattr(b, "play_all"):
b.play_all()
else:
self.search("me_audio").play_all()
def menu_volume_down(self, *args, **kwargs):
player.player.volume = player.player.volume-5
def menu_volume_up(self, *args, **kwargs):
player.player.volume = player.player.volume+5
def menu_mute(self, *args, **kwargs):
player.player.volume = 0
def user_profile(self, person):
p = presenters.userProfilePresenter(session=self.session, user_id=person, view=views.userProfileDialog(), interactor=interactors.userProfileInteractor())
def view_my_profile(self, *args, **kwargs):
self.user_profile(self.session.user_id)
def view_my_profile_in_browser(self, *args, **kwargs):
webbrowser.open_new_tab("https://vk.com/id{id}".format(id=self.session.user_id,))
def notify(self, message="", sound="", type="native"):
if type == "native":
self.window.notify(_("Socializer"), message)
else:
if sound != "":
self.session.soundplayer.play(sound)
if message != "":
output.speak(message)
def handle_longpoll_read_timeout(self):
if hasattr(self, "longpoll"):
self.notify(message=_("Chat disconnected. Trying to connect in 60 seconds"))
time.sleep(60)
if hasattr(self, "longpoll"):
del self.longpoll
self.create_longpoll_thread(notify=True)
def set_status(self, *args, **kwargs):
dlg = wx.TextEntryDialog(self.window, _("Write your status message"), _("Set status"))
if dlg.ShowModal() == widgetUtils.OK:
result = dlg.GetValue()
info = self.session.vk.client.account.saveProfileInfo(status=result)
commonMessages.updated_status()
dlg.Destroy()
def on_report_error(self, *args, **kwargs):
r = issueReporter.reportBug()
def reorder_buffer(self, buffer):
""" this puts the chat buffers at the top of the list when there are new incoming messages.
In order to do so, we search for the current buffer's tab, remove the page from the TreeCtrl (without destroying the associated tab)
and reinsert it as a new child of the chat buffer.
Lastly we ensure the user is focused in the same buffer than before."""
buffer_window = self.window.search(buffer.name)
# If buffer window is already in the first position after chat, we should not do anything here because calculations for moving buffers are expensive.
if buffer_window == self.window.search("chats")+1:
return
# Gets buffer title so we don't have to generate it again in future.
buffer_title = self.window.get_buffer_text(buffer_window)
# Determine if the current buffer is the buffer receiving a new message.
if buffer == self.get_current_buffer():
focused_buffer = True
else:
focused_buffer = False
# This call will not destroy the associated tab for the chat buffer, thus allowing us to readd it in other position.
self.window.remove_buffer_from_position(buffer_window)
self.window.insert_chat_buffer(buffer.tab, buffer_title, self.window.search("chats")+1)
# Let's manipulate focus so users will not notice the change in buffers.
if focused_buffer:
new_position = self.window.search(buffer.name)
self.window.change_buffer(new_position)
else:
new_position = self.window.search(self.get_current_buffer().name)
self.window.change_buffer(new_position)
def load_community_posts(self, *args, **kwargs):
""" Load community posts. It just calls to the needed method in the community buffer."""
current_buffer = self.get_current_buffer()
if current_buffer.name.endswith("_community"):
current_buffer.load_community()
def load_community_audios(self, *args, **kwargs):
""" Load community audios if they are not loaded already."""
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 not hasattr(current_buffer, "group_info"):
group_info = self.session.vk.client.groups.getById(group_ids=-1*current_buffer.kwargs["owner_id"], fields="counters")[0]
current_buffer.group_info = group_info
if "audios" not in current_buffer.group_info["counters"]:
commonMessages.community_no_items()
return
new_name = current_buffer.name+"_audios"
wx.CallAfter(pub.sendMessage, "create_buffer", buffer_type="audioBuffer", buffer_title=_("Audios"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=new_name, composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", owner_id=current_buffer.kwargs["owner_id"]))
def load_community_videos(self, *args, **kwargs):
""" Load community videos if they are not loaded already."""
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 not hasattr(current_buffer, "group_info"):
group_info = self.session.vk.client.groups.getById(group_ids=-1*current_buffer.kwargs["owner_id"], fields="counters")[0]
current_buffer.group_info = group_info
if "videos" not in current_buffer.group_info["counters"]:
commonMessages.community_no_items()
return
new_name = current_buffer.name+"_videos"
wx.CallAfter(pub.sendMessage, "create_buffer", buffer_type="videoBuffer", buffer_title=_("Videos"), parent_tab=current_buffer.tab.name, get_items=True, kwargs=dict(parent=self.window.tb, name=new_name, composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"], owner_id=current_buffer.kwargs["owner_id"]))
def load_community_topics(self, *args, **kwargs):
""" Load community topics."""
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 not hasattr(current_buffer, "group_info"):
group_info = self.session.vk.client.groups.getById(group_ids=-1*current_buffer.kwargs["owner_id"], fields="counters")[0]
current_buffer.group_info = group_info
if "topics" not in current_buffer.group_info["counters"]:
commonMessages.community_no_items()
return
new_name = current_buffer.name+"_topics"
wx.CallAfter(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_documents(self, *args, **kwargs):
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 not hasattr(current_buffer, "group_info"):
group_info = self.session.vk.client.groups.getById(group_ids=-1*current_buffer.kwargs["owner_id"], fields="counters")[0]
current_buffer.group_info = group_info
if "docs" not in current_buffer.group_info["counters"]:
commonMessages.community_no_items()
return
new_name = current_buffer.name+"_documents"
wx.CallAfter(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 load_community_buffers(self, *args, **kwargs):
""" 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)
def unload_community_buffers(self, *args, **kwargs):
""" Delete all buffers belonging to groups."""
communities = self.get_all_buffers("_community")
for buffer in communities:
buff = self.window.search(buffer.name)
self.window.remove_buffer(buff)
self.buffers.remove(buffer)
del self.session.groups

View File

@@ -1,16 +1,21 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
""" Audio player module for socializer.
As this player does not have (still) an associated GUI, I have decided to place here the code for the interactor, which connects a bunch of pubsub events, and the presenter itself.
"""
import sys
import time
import random
import output
import sound_lib
import logging
import sound_lib
import output
import config
from sound_lib.config import BassConfig
from sound_lib.stream import URLStream
from sound_lib.main import BassError
from mysc.repeating_timer import RepeatingTimer
from pubsub import pub
from mysc.repeating_timer import RepeatingTimer
from mysc.thread_utils import call_threaded
from sessionmanager import utils
player = None
log = logging.getLogger("player")
@@ -21,67 +26,127 @@ def setup():
player = audioPlayer()
class audioPlayer(object):
""" A media player which will play all passed URLS."""
def __init__(self):
# control variable for checking if another file has been sent to the player before,
# thus avoiding double file playback and other oddities happening in sound_lib from time to time.
self.is_playing = False
# This will be the URLStream handler
self.stream = None
self.vol = 100
self.message = None
self.vol = config.app["sound"]["volume"]
# this variable is set to true when the URLPlayer is decoding something, thus it will block other calls to the play method.
self.is_working = False
# Playback queue.
self.queue = []
# Index of the currently playing track.
self.playing_track = 0
self.playing_all = False
self.worker = RepeatingTimer(5, self.player_function)
self.worker.start()
# Status of the player.
self.stopped = True
# Modify some default settings present in Bass so it will increase timeout connection, thus causing less "connection timed out" errors when playing.
bassconfig = BassConfig()
# Set timeout connection to 30 seconds.
bassconfig["net_timeout"] = 30000
# Adds proxy settings
if config.app["app-settings"]["use_proxy"] == True:
bassconfig["net_proxy"] = b"socializer:socializer@socializer.su:3128"
# subscribe all pubsub events.
pub.subscribe(self.play, "play")
pub.subscribe(self.play_message, "play-message")
pub.subscribe(self.play_all, "play-all")
pub.subscribe(self.pause, "pause")
pub.subscribe(self.stop, "stop")
pub.subscribe(self.play_next, "play-next")
pub.subscribe(self.play_previous, "play-previous")
pub.subscribe(self.seek, "seek")
def play(self, url, set_info=True):
if self.stream != None and self.stream.is_playing == True:
# Stopped has a special function here, hence the decorator
# when stopped will be set to True, it will send a pubsub event to inform other parts of the application about the status change.
# this is useful for changing labels between play and pause, and so on, in buttons.
@property
def stopped(self):
return self._stopped
@stopped.setter
def stopped(self, value):
self._stopped = value
pub.sendMessage("playback-changed", stopped=value)
def play(self, object, set_info=True, fresh=False):
""" Play an URl Stream.
@object dict: typically an audio object as returned by VK, with a "url" component which must be a valid URL to a media file.
@set_info bool: If true, will set information about the currently playing audio in the application status bar.
@fresh bool: If True, will remove everything playing in the queue and start this file only. otherwise it will play the new file but not remove the current queue."""
if "url" in object and object["url"] =="":
pub.sendMessage("notify", message=_("This file could not be played because it is not allowed in your country"))
return
if self.stream != None and (self.stream.is_playing == True or self.stream.is_stalled == True):
try:
self.stream.stop()
except BassError:
log.exception("error when stopping the file")
self.stream = None
self.stopped = True
if hasattr(self, "worker") and self.worker != None:
self.worker.cancel()
self.worker = None
if fresh == True:
self.queue = []
# Make sure that there are no other sounds trying to be played.
if self.is_working == False:
self.is_working = True
# Let's encode the URL as bytes if on Python 3
if sys.version[0] == "3":
url_ = bytes(url["url"], "utf-8")
else:
url_ = url["url"]
url_ = utils.transform_audio_url(object["url"])
url_ = bytes(url_, "utf-8")
try:
self.stream = URLStream(url=url_)
except IndexError:
log.error("Unable to play URL")
log.error(url_)
except:
log.error("Unable to play URL %s" % (url_))
return
# Translators: {0} will be replaced with a song's title and {1} with the artist.
if set_info:
msg = _("Playing {0} by {1}").format(url["title"], url["artist"])
msg = _("Playing {0} by {1}").format(object["title"], object["artist"])
pub.sendMessage("update-status-bar", status=msg)
self.stream.volume = self.vol/100.0
self.stream.play()
self.stopped = False
self.is_working = False
def play_message(self, message_url):
if self.message != None and (self.message.is_playing == True or self.message.is_stalled == True):
return self.stop_message()
output.speak(_("Playing..."))
url_ = utils.transform_audio_url(message_url)
url_ = bytes(url_, "utf-8")
try:
self.message = URLStream(url=url_)
except:
log.error("Unable to play URL %s" % (url_))
return
self.message.volume = self.vol/100.0
self.message.play()
volume_percent = self.volume*0.25
volume_step = self.volume*0.15
while self.stream.volume*100 > volume_percent:
self.stream.volume = self.stream.volume-(volume_step/100)
time.sleep(0.1)
def stop(self):
""" Stop audio playback. """
if self.stream != None and self.stream.is_playing == True:
self.stream.stop()
self.stopped = True
if hasattr(self, "worker") and self.worker != None:
self.worker.cancel()
self.worker = None
self.queue = []
def stop_message(self):
if hasattr(self, "message") and self.message != None and self.message.is_playing == True:
self.message.stop()
volume_step = self.volume*0.15
while self.stream.volume*100 < self.volume:
self.stream.volume = self.stream.volume+(volume_step/100)
time.sleep(0.1)
self.message = None
def pause(self):
""" pause the current playback, without destroying the queue or the current stream. If the stream is already paused this function will resume the playback. """
if self.stream != None:
if self.stream.is_playing == True:
self.stream.pause()
@@ -92,43 +157,101 @@ class audioPlayer(object):
self.stopped = False
except BassError:
pass
if self.playing_all == False and len(self.queue) > 0:
self.playing_all = True
@property
def volume(self):
if self.stream != None:
return self.vol
return self.vol
@volume.setter
def volume(self, vol):
if vol <= 100 and vol >= 0:
self.vol = vol
elif vol < 0:
self.vol = 0
elif vol > 100:
self.vol = 100
if self.stream != None:
self.stream.volume = self.vol/100.0
if self.message != None and self.message.is_playing:
self.stream.volume = (self.vol*0.25)/100.0
self.message.volume = self.vol/100.0
else:
self.stream.volume = self.vol/100.0
def play_all(self, list_of_urls, shuffle=False):
def play_all(self, list_of_songs, shuffle=False):
""" Play all passed songs and adds all of those to the queue.
@list_of_songs list: A list of audio objects returned by VK.
@shuffle bool: If True, the files will be played randomly."""
if self.is_working:
return
self.playing_track = 0
self.stop()
# Skip all country restricted tracks as they are not playable here.
self.queue = [i for i in list_of_urls if i["url"] != ""]
self.queue = [i for i in list_of_songs if i["url"] != ""]
if shuffle:
random.shuffle(self.queue)
self.play(self.queue[0])
self.queue.remove(self.queue[0])
self.worker = RepeatingTimer(5, self.player_function)
self.worker.start()
call_threaded(self.play, self.queue[self.playing_track])
self.playing_all = True
def player_function(self):
""" Check if the stream has reached the end of the file so it will play the next song. """
if self.message != None and self.message.is_playing == False and len(self.message) == self.message.position:
volume_step = self.volume*0.15
while self.stream.volume*100 < self.volume:
self.stream.volume = self.stream.volume+(volume_step/100)
time.sleep(0.1)
if self.stream != None and self.stream.is_playing == False and self.stopped == False and len(self.stream) == self.stream.position:
if len(self.queue) == 0:
self.worker.cancel()
if self.playing_track >= len(self.queue):
self.stopped = True
self.playing_all = False
return
self.play(self.queue[0])
self.queue.remove(self.queue[0])
elif self.playing_all == False:
self.stopped = True
return
elif self.playing_track < len(self.queue):
self.playing_track += 1
self.play(self.queue[self.playing_track])
def play_next(self):
""" Play the next song in the queue. """
if len(self.queue) == 0:
return
if self.is_working:
return
if self.playing_track < len(self.queue)-1:
self.playing_track += 1
else:
self.playing_track = 0
call_threaded(self.play, self.queue[self.playing_track])
def play_previous(self):
""" Play the previous song in the queue. """
if len(self.queue) == 0:
return
if self.is_working:
return
if self.playing_track <= 0:
self.playing_track = len(self.queue)-1
else:
self.playing_track -= 1
call_threaded(self.play, self.queue[self.playing_track])
def seek(self, ms=0):
if self.check_is_playing():
if self.stream.position < 500000 and ms < 0:
self.stream.position = 0
else:
try:
self.stream.position = self.stream.position+ms
except:
pass
def check_is_playing(self):
""" check if the player is already playing a stream. """
if self.stream == None:
return False
if self.stream != None and self.stream.is_playing == False:
if self.stream != None and self.stream.is_playing == False and self.stream.is_stalled == False:
return False
else:
return True
return True

View File

@@ -113,7 +113,10 @@ class userProfilePresenter(base.basePresenter):
elif person["relation"] == 3:
r = _("Engaged with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"])
elif person["relation"] == 4:
r = _("Married with {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"])
if "relation_partner" in person:
r = _("Married to {0} {1}").format(person["relation_partner"]["first_name"], person["relation_partner"]["last_name"])
else:
r = _("Married")
elif person["relation"] == 5:
r = _("It's complicated")
elif person["relation"] == 6:

View File

@@ -17,18 +17,9 @@ count_for_wall_buffers = integer(default=100)
count_for_video_buffers = integer(default=200)
count_for_audio_buffers = integer(default=1000)
[sound]
volume = float(default=1.0)
input_device = string(default="Default")
output_device = string(default="Default")
session_mute = boolean(default=False)
current_soundpack = string(default="default")
[chat]
notify_online = boolean(default=True)
notify_offline = boolean(default=True)
open_unread_conversations = boolean(default=True)
automove_to_conversations = boolean(default=True)
notifications = string(default="custom")
[load_at_startup]

View File

@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
""" this module contains everything used to render different kind of posts (posts in the home buffer,
Chat messages, audios, videos, photos, comments in posts, etc)"""
from __future__ import unicode_literals
from builtins import range
import arrow
import languageHandler
import logging
from . utils import seconds_to_string
from update.utils import convert_bytes
from . utils import seconds_to_string, clean_text
log = logging.getLogger(__file__)
@@ -50,12 +49,6 @@ def clean_audio(audio):
audio["count"] = audio["count"] -1
return audio
def clean_text(text):
""" Replaces all HTML entities and put the plain text equivalent if it's possible."""
text = text.replace("<br>", "\n")
text = text.replace("\\n", "\n")
return text
def add_attachment(attachment):
msg = ""
tpe = ""
@@ -79,6 +72,17 @@ def add_attachment(attachment):
elif attachment["type"] == "audio_message":
msg = "{0}".format(" ".join(render_audio_message(attachment["audio_message"])))
tpe = _("Voice message")
elif attachment["type"] == "poll":
tpe = _("Poll")
msg = attachment["poll"]["question"]
elif attachment["type"] == "wall":
tpe = _("Post")
user = attachment["wall"]["from"]["name"]
if len(attachment["wall"]["text"]) > 140:
text = attachment["wall"]["text"][:145]+"..."
else:
text = attachment["wall"]["text"]
msg = _("{user}: {post}").format(user=user, post=text)
else:
print(attachment)
return [tpe, msg]
@@ -91,12 +95,18 @@ def render_person(status, session):
Reference: https://vk.com/dev/fields"""
if "last_seen" in status:
original_date = arrow.get(status["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
last_seen = _("{0}").format(original_date.humanize(locale=languageHandler.curLang[:2]),)
online_status = _("Last seen {0}").format(original_date.humanize(locale=languageHandler.curLang[:2]),)
# Account suspended or deleted.
elif ("last_seen" in status) == False and "deactivated" in status:
last_seen = _("Account deactivated")
return ["{0} {1}".format(status["first_name"], status["last_name"]), last_seen]
online_status = _("Account deactivated")
return ["{0} {1}".format(status["first_name"], status["last_name"]), online_status]
def render_newsfeed_item(status, session):
""" This me☻thod is used to render an item of the news feed.
@@ -249,4 +259,25 @@ def render_audio_message(audio_message, session=None):
["Voice message", "01:30:28"]"""
if audio_message == False:
return [_("Voice message not available"), "", ""]
return [seconds_to_string(audio_message["duration"])]
return [seconds_to_string(audio_message["duration"])]
def render_topic(topic, session):
""" Render topics for a community.
Reference: https://vk.com/dev/objects/topic"""
user = session.get_user(topic["created_by"])
title = topic["title"]
comments = topic["comments"]
last_commenter = session.get_user(topic["updated_by"])
last_update = arrow.get(topic["updated"]).humanize(locale=languageHandler.curLang[:2])
last_commenter.update(date=last_update)
lastupdate = _("Last post by {user1_nom} {date}").format(**last_commenter)
return [user["user1_nom"], title, str(comments), lastupdate]
def render_document(document, session):
doc_types = {1: _("Text document"), 2: _("Archive"), 3: _("Gif"), 4: _("Image"), 5: _("Audio"), 6: _("Video"), 7: _("Ebook"), 8: _("Unknown document")}
user = session.get_user(document["owner_id"])
title = document["title"]
size = convert_bytes(document["size"])
date = arrow.get(document["date"]).humanize(locale=languageHandler.curLang[:2])
doc_type = doc_types[document["type"]]
return [user["user1_nom"], title, doc_type, size, date]

View File

@@ -6,9 +6,11 @@ import logging
import warnings
import languageHandler
import paths
from . import vkSessionHandler
import config
import sound
from requests.exceptions import ProxyError, ConnectionError
from .config_utils import Configuration, ConfigurationResetException
from . import vkSessionHandler
from pubsub import pub
from vk_api.exceptions import LoginRequired, VkApiError
@@ -53,21 +55,29 @@ class vkSession(object):
@data list: A list with items and some information about cursors.
returns the number of items that has been added in this execution"""
global post_types
# When this method is called by friends.getOnlyne, it gives only friend IDS so we need to retrieve full objects from VK.
# ToDo: It would be nice to investigate whether reusing some existing objects would be a good idea, whenever possible.
if name == "online_friends":
newdata = self.vk.client.users.get(user_ids=",".join([str(z) for z in data]), fields="last_seen")
data = newdata
first_addition = False
num = 0
if (name in self.db) == False:
self.db[name] = {}
self.db[name]["items"] = []
first_addition = True
# Handles chat messages case, as the buffer is inverted
if name.endswith("_messages") and show_nextpage == True:
show_nextpage = False
for i in data:
if "type" in i and (i["type"] == "wall_photo" or i["type"] == "photo_tag" or i["type"] == "photo"):
if "type" in i and not isinstance(i["type"], int) and (i["type"] == "wall_photo" or i["type"] == "photo_tag" or i["type"] == "photo"):
log.debug("Skipping unsupported item... %r" % (i,))
continue
# for some reason, VK sends post data if the post has been deleted already.
# Example of this behaviour is when you upload an audio and inmediately delete the audio, VK still sends the post stating that you uploaded an audio file,
# But without the audio data, making socializer to render an empty post.
# Here we check if the post contains data of the type it advertises.
if i.get("type") != None and post_types.get(i["type"]) not in i:
if i.get("type") != None and isinstance(i["type"], str) and post_types.get(i["type"]) not in i:
log.error("Detected invalid or unsupported post. Skipping...")
log.error(i)
continue
@@ -91,6 +101,7 @@ class vkSession(object):
self.db = {}
self.db["users"] = {}
self.db["groups"] = {}
self.db["group_info"] = {}
@property
def is_logged(self):
@@ -104,25 +115,46 @@ class vkSession(object):
# try:
log.debug("Creating config file %s" % (file_,))
self.settings = Configuration(os.path.join(paths.config_path(), file_), os.path.join(paths.app_path(), "session.defaults"))
self.soundplayer = sound.soundSystem(self.settings["sound"])
self.soundplayer = sound.soundSystem(config.app["sound"])
pub.subscribe(self.play_sound, "play-sound")
# except:
# log.exception("The session configuration has failed.")
def play_sound(self, sound):
self.soundplayer.play(sound)
def login(self):
""" Logging in VK.com. This is basically the first method interacting with VK. """
# If user is already logged in, we should skip this method.
if self.logged == True:
return
try:
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.settings["vk"]["token"] = self.vk.session_object.token["access_token"]
self.settings["vk"]["secret"] = self.vk.session_object.secret
self.settings["vk"]["device_id"] = self.vk.session_object.device_id
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.logged = True
self.get_my_data()
except ValueError:
self.settings["vk"]["user"] = ""
self.settings["vk"]["password"] = ""
self.settings.write()
pub.sendMessage("authorisation-failed")
except VkApiError as error:
if error.code == 5: # this means invalid access token.
self.settings["vk"]["user"] = ""
self.settings["vk"]["password"] = ""
self.settings["vk"]["token"] = ""
self.settings["vk"]["secret"] = ""
self.settings["vk"]["device_id"] = ""
self.settings.write()
pub.sendMessage("authorisation-failed")
else: # print out error so we we will handle it in future versions.
log.exception("Fatal error when authenticating the application.")
log.exception(error.code)
log.exception(error.message)
except (ProxyError, ConnectionError):
pub.sendMessage("connection_error")
def post_wall_status(self, message, *args, **kwargs):
""" Sends a post to an user, group or community wall."""
@@ -137,14 +169,12 @@ class vkSession(object):
log.debug("Params for sending to vk: %r" % (kwargs,))
data = getattr(self.vk.client.newsfeed, "get")(*args, **kwargs)
if data != None:
if show_nextpage == False:
self.process_usernames(data)
# else:
# print data.keys(), len(data["items"]), data["next_from"]
self.process_usernames(data)
num = self.order_buffer(name, data["items"], show_nextpage)
log.debug("Keys of the returned data for debug purposes: %r" % (list(data.keys()),))
if "next_from" in data:
self.db[name]["cursor"] = data["next_from"]
log.debug("Next cursor saved for data: {cursor}".format(cursor=data["next_from"]))
return num
def get_page(self, name="", show_nextpage=False, endpoint="", *args, **kwargs):
@@ -164,11 +194,22 @@ class vkSession(object):
p = getattr(c, p)
except AttributeError:
p = c
if name in self.db and "offset" in self.db[name] and show_nextpage == True:
kwargs.update(offset=self.db[name]["offset"])
else:
kwargs.update(offset=0)
log.debug("Calling endpoint %s with params %r" % (p, kwargs,))
data = getattr(p, endpoint)(*args, **kwargs)
if data != None:
if "count" not in kwargs:
kwargs["count"] = 100
# Let's handle a little exception when dealing with conversation buffers.
# the first results of the query should be reversed before being sent to order_buffer.
if type(data) == dict and "items" in data and endpoint == "getHistory" and kwargs["offset"] == 0:
data["items"].reverse()
if type(data) == dict:
num = self.order_buffer(name, data["items"], show_nextpage)
self.db[name]["offset"] = kwargs["offset"]+kwargs["count"]
if len(data["items"]) > 0 and "first_name" in data["items"][0]:
data2 = {"profiles": [], "groups": []}
for i in data["items"]:
@@ -178,6 +219,7 @@ class vkSession(object):
self.process_usernames(data)
else:
num = self.order_buffer(name, data, show_nextpage)
self.db[name]["offset"] = kwargs["offset"]+kwargs["count"]
return num
def get_messages(self, name="", *args, **kwargs):
@@ -221,6 +263,10 @@ class vkSession(object):
k = "{key}_{case}".format(key=key, case=i)
v = self.db["groups"][abs(user_id)][i]
user_data[k] = v
else:
group = self.vk.client.groups.getById(group_ids=-1*user_id)[0]
self.process_usernames(data=dict(profiles=[], groups=[group]))
return self.get_user(user_id=user_id, key=key)
return user_data
def process_usernames(self, data):
@@ -235,8 +281,9 @@ class vkSession(object):
ids = ids + "{0},".format(i["id"],)
gids = ""
for i in data["groups"]:
self.db["groups"][i["id"]] = dict(nom=i["name"], gen=i["name"], dat=i["name"], acc=i["name"], ins=i["name"], abl=i["name"])
gids = "{0},".format(i["id"],)
if i["id"] not in self.db["groups"]:
self.db["groups"][i["id"]] = dict(nom=i["name"], gen=i["name"], dat=i["name"], acc=i["name"], ins=i["name"], abl=i["name"])
gids = "{0},".format(i["id"],)
user_fields = "first_name_nom, last_name_nom, first_name_gen, last_name_gen, first_name_ins, last_name_ins, first_name_dat, last_name_dat, first_name_abl, last_name_abl, first_name_acc, last_name_acc, sex"
user_fields_list = user_fields.split(", ")
if ids != "":

View File

@@ -2,10 +2,11 @@
import os
import sys
import widgetUtils
from . import wxUI as view
import paths
import time
import logging
from authenticator.official import AuthenticationError
from . import wxUI as view
from . import session
from .config_utils import Configuration
@@ -53,4 +54,9 @@ class sessionManagerController(object):
if dl.ShowModal() == widgetUtils.OK:
c.settings["vk"]["user"] = dl.get_email()
c.settings["vk"]["password"] = dl.get_password()
c.settings.write()
try:
c.login()
except AuthenticationError:
c.settings["vk"]["password"] = ""
c.settings["vk"]["user"]
return self.get_authorisation(c)

View File

@@ -1,17 +1,18 @@
# -*- coding: utf-8 -*-
""" Some utilities. I no have idea how I should put these, so..."""
from __future__ import division
from __future__ import unicode_literals
import os
import requests
import re
import html
import logging
import requests
log = logging.getLogger("utils")
url_re = re.compile("(?:\w+://|www\.)[^ ,.?!#%=+][^ ]*")
bad_chars = '\'\\.,[](){}:;"'
def seconds_to_string(seconds, precision=0):
""" convert a number of seconds in a string representation."""
# ToDo: Improve it to handle properly Russian plurals.
day = seconds // 86400
hour = seconds // 3600
min = (seconds // 60) % 60
@@ -57,3 +58,36 @@ def download_file(url, local_filename, window):
window.change_status(_("Ready"))
return local_filename
def detect_users(text):
""" Detect all users and communities mentionned in any text posted in VK."""
# This regexp gets group and users mentionned in topic comments.
for matched_data in re.finditer("(\[)(id|club)(\d+:bp-\d+_\d+\|)(\D+)(\])", text):
text = re.sub("\[(id|club)\d+:bp-\d+_\d+\|\D+\]", matched_data.groups()[3]+", ", text, count=1)
# This is for users and communities just mentionned in wall comments or posts.
for matched_data in re.finditer("(\[)(id|club)(\d+\|)(\D+)(\])", text):
text = re.sub("\[(id|club)\d+\|\D+\]", matched_data.groups()[3]+", ", text, count=1)
return text
def clean_text(text):
""" Clean text, removing all unneeded HTMl and converting HTML represented characters in their unicode counterparts."""
text = detect_users(text)
text = html.unescape(text)
return text
def transform_audio_url(url):
""" Transforms the URL offered by VK to the unencrypted stream so we can still play it.
This function will be updated every time VK decides to change something in their Audio API'S.
Changelog:
30/04/2019: Re-enabled old methods as VK changed everything as how it was working on 16.04.2019.
17.04.2019: Updated function. Now it is not required to strip anything, just replacing /index.m3u8 with .mp3 should be enough.
16.04.2019: Implemented this function. For now it replaces /index.m3u8 by .mp3, also removes the path component before "/audios" if the URL contains the word /audios, or the last path component before the filename if doesn't.
"""
if "vkuseraudio.net" not in url and "index.m3u8" not in url:
return url
url = url.replace("/index.m3u8", ".mp3")
parts = url.split("/")
if "/audios" not in url:
url = url.replace("/"+parts[-2], "")
else:
url = url.replace("/"+parts[-3], "")
return url

View File

@@ -9,6 +9,7 @@ import logging
import paths
import sound_lib
import output
import config
from sound_lib import recording
from mysc.repeating_timer import RepeatingTimer
from mysc.thread_utils import call_threaded
@@ -16,8 +17,8 @@ from sound_lib import output, input
log = logging.getLogger("sound")
def recode_audio(filename, quality=4.5):
subprocess.call(r'"%s" -q %r "%s"' % (os.path.join(paths.app_path(), 'oggenc2.exe'), quality, filename))
def recode_audio(filename, quality=10):
subprocess.call(r'"%s" --downmix -q %r "%s"' % (os.path.join(paths.app_path(), 'oggenc2.exe'), quality, filename))
def get_recording(filename):
# try:
@@ -61,7 +62,9 @@ class soundSystem(object):
log.error("Error in input or output devices, using defaults...")
self.config["output_device"] = "Default"
self.config["input_device"] = "Default"
# Set proxy for audio.
if config.app["app-settings"]["use_proxy"]:
self.output.set_proxy(b"socializer:socializer@socializer.su:3128")
self.files = []
self.cleaner = RepeatingTimer(60, self.clear_list)
self.cleaner.start()
@@ -81,6 +84,6 @@ class soundSystem(object):
if self.soundpack_OK == False: return
if self.config["session_mute"] == True: return
sound_object = sound_lib.stream.FileStream(file="%s/%s" % (self.path, sound))
sound_object.volume = float(self.config["volume"])
# sound_object.volume = self.config["volume"]/100
self.files.append(sound_object)
sound_object.play()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -8,7 +8,7 @@ from . import utils
progress_dialog = None
def available_update_dialog(version, description):
dialog = wx.MessageDialog(None, _("There's a new %s version available. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, application.name, version, description), _("New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
dialog = wx.MessageDialog(None, _("There's a new {app_name} version available. Would you like to download it now?\n\n {app_name} version: {app_version}\n\nChanges:\n{changes}").format(app_name=application.name, app_version=version, changes=description), _("New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING)
if dialog.ShowModal() == wx.ID_YES:
return True
else:
@@ -28,7 +28,7 @@ def _progress_callback(total_downloaded, total_size):
if total_downloaded == total_size:
progress_dialog.Destroy()
else:
progress_dialog.Update((total_downloaded*100)/total_size, _("Updating... %s of %s") % (utils.convert_bytes(total_downloaded), utils.convert_bytes(total_size)))
progress_dialog.Update((total_downloaded*100)/total_size, _("Updating... {total_transferred} of {total_size}").format(total_transferred=utils.convert_bytes(total_downloaded), total_size=utils.convert_bytes(total_size)))
def update_finished():
return wx.MessageDialog(None, _("The update has been downloaded and installed successfully. Press OK to continue."), _("Done!")).ShowModal()

View File

@@ -14,19 +14,20 @@ class attachDialog(widgetUtils.BaseDialog):
box.Add(lbl1, 0, wx.ALL, 5)
box.Add(self.attachments.list, 0, wx.ALL, 5)
sizer.Add(box, 0, wx.ALL, 5)
static = wx.StaticBox(panel, label=_("Add attachments"))
self.photo = wx.Button(panel, wx.NewId(), _("&Photo"))
self.audio = wx.Button(panel, wx.NewId(), _("Audio file"))
static = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Add attachments"))
self.photo = wx.Button(static.GetStaticBox(), wx.NewId(), _("&Photo"))
self.audio = wx.Button(static.GetStaticBox(), wx.NewId(), _("Audio file"))
self.document = wx.Button(static.GetStaticBox(), wx.NewId(), _("Document"))
if voice_messages:
self.voice_message = wx.Button(panel, wx.NewId(), _("Voice message"))
self.remove = wx.Button(panel, wx.NewId(), _("Remove attachment"))
self.voice_message = wx.Button(static.GetStaticBox(), wx.NewId(), _("Voice message"))
self.remove = wx.Button(static.GetStaticBox(), wx.NewId(), _("Remove attachment"))
self.remove.Enable(False)
btnsizer = wx.StaticBoxSizer(static, wx.HORIZONTAL)
btnsizer.Add(self.photo, 0, wx.ALL, 5)
btnsizer.Add(self.audio, 0, wx.ALL, 5)
static.Add(self.photo, 0, wx.ALL, 5)
static.Add(self.audio, 0, wx.ALL, 5)
static.Add(self.document, 0, wx.ALL, 5)
if voice_messages:
btnsizer.Add(self.voice_message, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
static.Add(self.voice_message, 0, wx.ALL, 5)
sizer.Add(static, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK)
ok.SetDefault()
cancelBtn = wx.Button(panel, wx.ID_CANCEL)
@@ -56,3 +57,12 @@ class attachDialog(widgetUtils.BaseDialog):
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return None
return openFileDialog.GetPath()
def get_document(self):
openFileDialog = wx.FileDialog(self, _("Select the file to be uploaded. All extensions are allowed except .mp3 and .exe."), "", "", _("All files (*.*)|*.*"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return None
return openFileDialog.GetPath()
def invalid_attachment(self):
return wx.MessageDialog(None, _("The file you are trying to upload contains an extension that is not allowed by VK."), _("Error"), style=wx.ICON_ERROR).ShowModal()

View File

@@ -4,9 +4,14 @@ import wx
import widgetUtils
class general(wx.Panel, widgetUtils.BaseDialog):
def __init__(self, panel):
def __init__(self, panel, languages):
super(general, self).__init__(panel)
sizer = wx.BoxSizer(wx.VERTICAL)
langBox = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Language"))
self.language = wx.ListBox(langBox.GetStaticBox(), wx.NewId(), choices=languages)
self.language.SetSize(self.language.GetBestSize())
langBox.Add(self.language, 0, wx.ALL, 5)
sizer.Add(langBox, 0, wx.ALL, 5)
lbl1 = wx.StaticText(self, wx.NewId(), _("Number of items to load for newsfeed and wall buffers (maximun 100)"))
self.wall_buffer_count = wx.SpinCtrl(self, wx.NewId())
self.wall_buffer_count.SetRange(1, 100)
@@ -23,6 +28,8 @@ class general(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(box3, 0, wx.ALL, 5)
self.load_images = wx.CheckBox(self, wx.NewId(), _("Load images in posts"))
sizer.Add(self.load_images, 0, wx.ALL, 5)
self.use_proxy = wx.CheckBox(self, wx.NewId(), _("Use proxy"))
sizer.Add(self.use_proxy, 0, wx.ALL, 5)
lbl4 = wx.StaticText(self, wx.NewId(), _("Update channel"))
self.update_channel = wx.ComboBox(self, wx.NewId(), choices=[_("Stable"), _("Alpha")], value=_("Native"), style=wx.CB_READONLY)
box4 = wx.BoxSizer(wx.HORIZONTAL)
@@ -39,10 +46,6 @@ class chat(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(self.notify_online, 0, wx.ALL, 5)
self.notify_offline = wx.CheckBox(self, wx.NewId(), _("Show notifications when users are offline"))
sizer.Add(self.notify_offline, 0, wx.ALL, 5)
self.open_unread_conversations = wx.CheckBox(self, wx.NewId(), _("Open unread conversations at startup"))
sizer.Add(self.open_unread_conversations, 0, wx.ALL, 5)
self.automove_to_conversations = wx.CheckBox(self, wx.NewId(), _("Move focus to new conversations"))
sizer.Add(self.automove_to_conversations, 0, wx.ALL, 5)
lbl = wx.StaticText(self, wx.NewId(), _("Notification type"))
self.notifications = wx.ComboBox(self, wx.NewId(), choices=[_("Native"), _("Custom"),], value=_("Native"), style=wx.CB_READONLY)
nbox = wx.BoxSizer(wx.HORIZONTAL)
@@ -63,6 +66,48 @@ class loadAtStartup(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(self.communities, 0, wx.ALL, 5)
self.SetSizer(sizer)
class sound(wx.Panel, widgetUtils.BaseDialog):
def __init__(self, panel, input_devices, output_devices, soundpacks):
super(sound, self).__init__(panel)
sizer = wx.BoxSizer(wx.VERTICAL)
output_label = wx.StaticText(self, wx.NewId(), _("Output device"))
self.output = wx.ComboBox(self, wx.NewId(), choices=output_devices, style=wx.CB_READONLY)
self.output.SetSize(self.output.GetBestSize())
outputBox = wx.BoxSizer(wx.HORIZONTAL)
outputBox.Add(output_label, 0, wx.ALL, 5)
outputBox.Add(self.output, 0, wx.ALL, 5)
sizer.Add(outputBox, 0, wx.ALL, 5)
input_label = wx.StaticText(self, wx.NewId(), _("Input device"))
self.input = wx.ComboBox(self, wx.NewId(), choices=input_devices, style=wx.CB_READONLY)
self.input.SetSize(self.input.GetBestSize())
inputBox = wx.BoxSizer(wx.HORIZONTAL)
inputBox.Add(input_label, 0, wx.ALL, 5)
inputBox.Add(self.input, 0, wx.ALL, 5)
sizer.Add(inputBox, 0, wx.ALL, 5)
# soundBox = wx.BoxSizer(wx.VERTICAL)
# soundpack_label = wx.StaticText(self, wx.NewId(), _(u"Sound pack"))
# self.soundpack = wx.ComboBox(self, -1, choices=soundpacks, style=wx.CB_READONLY)
# self.soundpack.SetSize(self.soundpack.GetBestSize())
# soundBox.Add(soundpack_label, 0, wx.ALL, 5)
# soundBox.Add(self.soundpack, 0, wx.ALL, 5)
# sizer.Add(soundBox, 0, wx.ALL, 5)
self.SetSizer(sizer)
def on_keypress(self, event, *args, **kwargs):
""" Invert movement of up and down arrow keys when dealing with a wX Slider.
See https://github.com/manuelcortez/TWBlue/issues/261
and http://trac.wxwidgets.org/ticket/2068
"""
keycode = event.GetKeyCode()
if keycode == wx.WXK_UP:
return self.volumeCtrl.SetValue(self.volumeCtrl.GetValue()+1)
elif keycode == wx.WXK_DOWN:
return self.volumeCtrl.SetValue(self.volumeCtrl.GetValue()-1)
event.Skip()
def get(self, control):
return getattr(self, control).GetStringSelection()
class configurationDialog(widgetUtils.BaseDialog):
def __init__(self, title):
@@ -71,8 +116,8 @@ class configurationDialog(widgetUtils.BaseDialog):
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.notebook = wx.Notebook(self.panel)
def create_general(self):
self.general = general(self.notebook)
def create_general(self, languages):
self.general = general(self.notebook, languages)
self.notebook.AddPage(self.general, _("General"))
self.general.SetFocus()
@@ -84,6 +129,10 @@ class configurationDialog(widgetUtils.BaseDialog):
self.startup = loadAtStartup(self.notebook)
self.notebook.AddPage(self.startup, _("Optional buffers"))
def create_sound(self, input_devices, output_devices, soundpacks):
self.sound = sound(self.notebook, input_devices, output_devices, soundpacks)
self.notebook.AddPage(self.sound, _("Sound settings"))
def realize(self):
self.sizer.Add(self.notebook, 0, wx.ALL, 5)
ok_cancel_box = wx.BoxSizer(wx.HORIZONTAL)

View File

@@ -121,3 +121,51 @@ class createCommentDialog(createTextMessage):
super(createCommentDialog, self).__init__()
self.createControls(message, title, text)
self.SetClientSize(self.mainBox.CalcMin())
self.SetTitle(title)
class createTopicDialog(createCommentDialog):
def createTextArea(self, message="", text=""):
self.panel = wx.Panel(self)
label = wx.StaticText(self.panel, -1, _("Title"))
self.title = wx.TextCtrl(self.panel, wx.NewId())
label2 = wx.StaticText(self.panel, -1, _("Message"))
self.text = wx.TextCtrl(self.panel, -1, text, size=(439, -1), style=wx.TE_MULTILINE)
self.title.SetFocus()
self.textBox = wx.BoxSizer(wx.VERTICAL)
titleb = wx.BoxSizer(wx.HORIZONTAL)
titleb.Add(label, 0, wx.ALL, 5)
titleb.Add(self.title, 0, wx.ALL, 5)
self.textBox.Add(titleb, 0, wx.ALL, 5)
textb = wx.BoxSizer(wx.HORIZONTAL)
textb.Add(label2, 0, wx.ALL, 5)
textb.Add(self.text, 0, wx.ALL, 5)
self.textBox.Add(textb, 0, wx.ALL, 5)
def createControls(self, title, message, text):
self.mainBox = wx.BoxSizer(wx.VERTICAL)
self.createTextArea(message, text)
self.mainBox.Add(self.textBox, 0, wx.ALL, 5)
self.attach = wx.Button(self.panel, -1, _("Attach"), size=wx.DefaultSize)
self.mention = wx.Button(self.panel, wx.NewId(), _("Tag a friend"))
self.spellcheck = wx.Button(self.panel, -1, _("Spelling &correction"), size=wx.DefaultSize)
self.translateButton = wx.Button(self.panel, -1, _("&Translate message"), size=wx.DefaultSize)
self.okButton = wx.Button(self.panel, wx.ID_OK, _("Send"), size=wx.DefaultSize)
self.okButton.SetDefault()
cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _("Close"), size=wx.DefaultSize)
self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL)
self.buttonsBox1.Add(self.attach, 0, wx.ALL, 10)
self.buttonsBox1.Add(self.mention, 0, wx.ALL, 10)
self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10)
self.buttonsBox1.Add(self.translateButton, 0, wx.ALL, 10)
self.mainBox.Add(self.buttonsBox1, 0, wx.ALL, 10)
self.ok_cancelSizer = wx.BoxSizer(wx.HORIZONTAL)
self.ok_cancelSizer.Add(self.okButton, 0, wx.ALL, 10)
self.ok_cancelSizer.Add(cancelButton, 0, wx.ALL, 10)
self.mainBox.Add(self.ok_cancelSizer)
selectId = wx.NewId()
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId),])
self.SetAcceleratorTable(self.accel_tbl)
self.panel.SetSizer(self.mainBox)

View File

@@ -16,11 +16,19 @@ class displayBasicPost(widgetUtils.BaseDialog):
def create_post_view(self, label=_("Message")):
lbl = wx.StaticText(self.panel, -1, label)
self.post_view = wx.TextCtrl(self.panel, -1, size=(730, -1), style=wx.TE_READONLY|wx.TE_MULTILINE)
selectId = wx.NewId()
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([
(wx.ACCEL_CTRL, ord('A'), selectId),])
self.SetAcceleratorTable(self.accel_tbl)
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(lbl, 0, wx.ALL, 5)
box.Add(self.post_view, 0, wx.ALL, 5)
return box
def onSelect(self, event):
self.post_view.SelectAll()
def create_views_control(self):
lbl = wx.StaticText(self.panel, -1, _("Views"))
self.views = wx.TextCtrl(self.panel, -1, style=wx.TE_READONLY|wx.TE_MULTILINE)
@@ -185,6 +193,42 @@ class displayComment(displayBasicPost):
if comment: box.Add(self.comment, 0, wx.ALL, 5)
return box
class displayTopic(displayBasicPost):
def __init__(self, *args, **kwargs):
super(displayTopic, self).__init__(*args, **kwargs)
comments_box = self.create_comments_list()
self.sizer.Add(comments_box, 0, wx.ALL, 5)
attachments_box = self.create_attachments()
self.sizer.Add(attachments_box, 0, wx.ALL, 5)
self.attachments.list.Enable(False)
self.create_photo_viewer()
self.image.Enable(False)
self.create_tools_button()
self.sizer.Add(self.tools, 0, wx.ALL, 5)
actions_box = self.create_action_buttons()
self.sizer.Add(actions_box, 0, wx.ALL, 5)
self.sizer.Add(self.create_dialog_buttons())
self.done()
def create_action_buttons(self, comment=True):
self.like = wx.Button(self.panel, -1, _("&Like"))
if comment: self.comment = wx.Button(self.panel, -1, _("Add comment"))
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(self.like, 0, wx.ALL, 5)
if comment: box.Add(self.comment, 0, wx.ALL, 5)
return box
def create_comments_list(self):
lbl = wx.StaticText(self.panel, -1, _("Posts"))
self.comments = widgetUtils.list(self.panel, _("User"), _("Comment"), _("Date"), _("Likes"), style=wx.LC_REPORT)
self.load_more_comments = wx.Button(self.panel, wx.NewId(), _("Load previous comments"))
self.reply = wx.Button(self.panel, -1, _("Reply"))
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(lbl, 0, wx.ALL, 5)
box.Add(self.comments.list, 0, wx.ALL, 5)
box.Add(self.reply, 0, wx.ALL, 5)
return box
class displayAudio(widgetUtils.BaseDialog):
def __init__(self, *args, **kwargs):
super(displayAudio, self).__init__(parent=None, *args, **kwargs)
@@ -261,4 +305,59 @@ class displayFriendship(widgetUtils.BaseDialog):
btnbox.Add(close, 0, wx.ALL, 5)
sizer.Add(btnbox, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
self.SetClientSize(sizer.CalcMin())
class displayPoll(widgetUtils.BaseDialog):
def __init__(self, question="", *args, **kwargs):
super(displayPoll, self).__init__(parent=None, *args, **kwargs)
self.panel = wx.Panel(self, -1)
self.sizer = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self.panel, wx.NewId(), _("Question"))
self.question = wx.TextCtrl(self.panel, wx.NewId(), question, style=wx.TE_MULTILINE|wx.TE_READONLY, size=(730, -1))
self.sizer.Add(label, 0, wx.ALL, 5)
self.sizer.Add(self.question, 0, wx.ALL, 5)
def add_options(self, options, multiple=False):
if not isinstance(options[0], str):
return self.add_results(options)
self.options = []
sizer = wx.StaticBoxSizer(parent=self.panel, orient=wx.VERTICAL, label=_("Options"))
for i in options:
if multiple == False:
if len(self.options) == 0:
control = wx.RadioButton(sizer.GetStaticBox(), wx.NewId(), i, style=wx.RB_GROUP)
else:
control = wx.RadioButton(sizer.GetStaticBox(), wx.NewId(), i)
else:
control = wx.CheckBox(sizer.GetStaticBox(), wx.NewId(), i)
self.options.append(control)
sizer.Add(control, 0, wx.ALL, 5)
self.sizer.Add(sizer, 0, wx.ALL, 5)
def get_answers(self):
answers = []
for i in self.options:
answers.append(i.GetValue())
return answers
def add_results(self, options):
sizer = wx.StaticBoxSizer(parent=self.panel, orient=wx.VERTICAL, label=_("Poll results"))
for i in options:
sizer2 = wx.StaticBoxSizer(parent=sizer.GetStaticBox(), orient=wx.HORIZONTAL, label=i[0])
staticcontrol = wx.StaticText(sizer2.GetStaticBox(), wx.NewId(), i[0])
control = wx.TextCtrl(sizer2.GetStaticBox(), wx.NewId(), _("{votes} ({rate}%)").format(votes=i[1], rate=i[2]), style=wx.TE_READONLY|wx.TE_MULTILINE)
sizer2.Add(staticcontrol, 0, wx.ALL, 5)
sizer2.Add(control, 0, wx.ALL, 5)
sizer.Add(sizer2, 0, wx.ALL, 5)
self.sizer.Add(sizer, 0, wx.ALL, 5)
def done(self):
self.ok = wx.Button(self.panel, wx.ID_OK, _("Vote"))
cancel = wx.Button(self.panel, wx.ID_CANCEL)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.ok, 0, wx.ALL, 5)
sizer.Add(cancel, 0, wx.ALL, 5)
self.panel.SetSizer(self.sizer)
self.SetClientSize(self.sizer.CalcMin())

View File

@@ -4,7 +4,9 @@ from __future__ import unicode_literals
import languageHandler
import paths
import wx
import wx.lib.mixins.listctrl as listmix
from builtins import range
from pubsub import pub
toolkit = "wx"
@@ -134,48 +136,91 @@ class mainLoopObject(wx.App):
def run(self):
self.app.MainLoop()
class multiselectionBaseList(wx.ListCtrl, listmix.CheckListCtrlMixin):
def __init__(self, *args, **kwargs):
wx.ListCtrl.__init__(self, *args, **kwargs)
listmix.CheckListCtrlMixin.__init__(self)
self.Bind(wx.EVT_CHAR_HOOK, self.on_keydown)
self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus)
def on_focus(self, event):
currentItem = self.GetFocusedItem()
if self.IsChecked(currentItem):
pub.sendMessage("play-sound", sound="selected.ogg")
event.Skip()
def OnCheckItem(self, index, flag):
if flag == True:
pub.sendMessage("play-sound", sound="checked.ogg")
else:
pub.sendMessage("play-sound", sound="unchecked.ogg")
def on_keydown(self, event):
if event.GetKeyCode() == wx.WXK_SPACE:
self.ToggleItem(self.GetFocusedItem())
event.Skip()
class list(object):
def __init__(self, parent, *columns, **listArguments):
self.columns = columns
self.listArguments = listArguments
self.create_list(parent)
def __init__(self, parent, *columns, **listArguments):
self.columns = columns
self.listArguments = listArguments
self.create_list(parent)
def set_windows_size(self, column, characters_max):
self.list.SetColumnWidth(column, characters_max*2)
def set_windows_size(self, column, characters_max):
self.list.SetColumnWidth(column, characters_max*2)
def set_size(self):
self.list.SetSize((self.list.GetBestSize()[0], 1000))
def set_size(self):
self.list.SetSize((self.list.GetBestSize()[0], 1000))
def create_list(self, parent):
self.list = wx.ListCtrl(parent, -1, **self.listArguments)
for i in range(0, len(self.columns)):
self.list.InsertColumn(i, "%s" % (self.columns[i]))
def create_list(self, parent):
self.list = wx.ListCtrl(parent, -1, **self.listArguments)
for i in range(0, len(self.columns)):
self.list.InsertColumn(i, "%s" % (self.columns[i]))
def insert_item(self, reversed, *item):
""" Inserts an item on the list."""
if reversed == False: items = self.list.GetItemCount()
else: items = 0
self.list.InsertItem(items, item[0])
for i in range(1, len(self.columns)):
self.list.SetItem(items, i, item[i])
def insert_item(self, reversed, *item):
""" Inserts an item on the list."""
if reversed == False: items = self.list.GetItemCount()
else: items = 0
self.list.InsertItem(items, item[0])
for i in range(1, len(self.columns)):
self.list.SetItem(items, i, item[i])
def remove_item(self, pos):
""" Deletes an item from the list."""
if pos > 0: self.list.Focus(pos-1)
self.list.DeleteItem(pos)
def remove_item(self, pos):
""" Deletes an item from the list."""
if pos > 0: self.list.Focus(pos-1)
self.list.DeleteItem(pos)
def clear(self):
self.list.DeleteAllItems()
def clear(self):
self.list.DeleteAllItems()
def get_selected(self):
return self.list.GetFocusedItem()
def get_selected(self):
return self.list.GetFocusedItem()
def select_item(self, pos):
self.list.Focus(pos)
def select_item(self, pos):
self.list.Focus(pos)
def get_count(self):
selected = self.list.GetItemCount()
if selected == -1:
return 0
else:
return selected
def get_count(self):
selected = self.list.GetItemCount()
if selected == -1:
return 0
else:
return selected
def Enable(self, value):
return self.list.Enable(value)
class multiselectionList(list):
def create_list(self, parent):
self.list = multiselectionBaseList(parent, -1, **self.listArguments)
for i in range(0, len(self.columns)):
self.list.InsertColumn(i, "%s" % (self.columns[i]))
def get_multiple_selection(self):
selected = []
for item in range(0, self.list.GetItemCount()):
if self.list.IsChecked(item):
selected.append(item)
if len(selected) == 0 and self.list.GetFocusedItem() != -1:
selected.append(self.list.GetFocusedItem())
return selected

View File

@@ -24,7 +24,10 @@ def show_error_code(code):
return wx.MessageDialog(None, message, title, style=wx.ICON_ERROR).ShowModal()
def bad_authorisation():
return wx.MessageDialog(None, _("authorisation failed. Your configuration will not be saved. Please close and open again the application for authorising your account. Make sure you have typed your credentials correctly."), _("Error"), style=wx.ICON_ERROR).ShowModal()
return wx.MessageDialog(None, _("authorisation failed. Your configuration will be deleted. If you recently changed your password in VK, you need to reauthorize Socializer. The application will be restarted and prompt you again for your user and password. Press OK to continue."), _("Error"), style=wx.ICON_ERROR).ShowModal()
def connection_error():
return wx.MessageDialog(None, _("Socializer could not connect to VK due to a connection issue. Be sure you have a working internet connection. The application will be closed when you press the OK button. If your internet connection is working correctly, please try to open socializer in a few minutes. If this problem persists, contact the developers to receive further assistance."), _("Connection Error"), style=wx.ICON_ERROR).ShowModal()
def no_audio_albums():
return wx.MessageDialog(None, _("You do not have audio albums."), _("Error"), style=wx.ICON_ERROR).ShowModal()
@@ -49,3 +52,18 @@ def group_joined():
def proxy_question():
return wx.MessageDialog(None, _("If you live in a country where VK is blocked, you can use a proxy to bypass such restrictions. Socializer includes a working proxy to ensure all users can connect to VK. Do you want to use Socializer through the proxy?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def remove_friend(user):
return wx.MessageDialog(None, _("Are you sure you want to remove {user1_nom} from your friends?").format(**user), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def post_deleted():
return wx.MessageDialog(None, _("This post has been removed."), _("Error"), wx.ICON_ERROR).ShowModal()
def restart_program():
return wx.MessageDialog(None, _("In order to apply the changes you requested, you must restart the program. Do you want to restart Socializer now?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def community_no_items():
return wx.MessageDialog(None, _("There are 0 items for this community."), _("Error"), wx.ICON_ERROR).ShowModal()
def delete_conversation():
return wx.MessageDialog(None, _("do you really want to delete all messages of this conversation in VK?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()

View File

@@ -16,6 +16,16 @@ class searchAudioDialog(widgetUtils.BaseDialog):
self.term.SetSize(dc.GetTextExtent("0"*40))
sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.term, 0, wx.ALL, 5)
radioSizer = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Search by"))
self.title = wx.RadioButton(radioSizer.GetStaticBox(), wx.NewId(), _("Title"), style=wx.RB_GROUP)
self.artist = wx.RadioButton(radioSizer.GetStaticBox(), wx.NewId(), _("Artist"))
radioSizer.Add(self.title, 0, wx.ALL, 5)
radioSizer.Add(self.artist, 0, wx.ALL, 5)
sizer.Add(radioSizer, 0, wx.ALL, 5)
sortBox = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Sort by"))
self.sortorder = wx.ComboBox(sortBox.GetStaticBox(), wx.NewId(), choices=[_("Date added"), _("Duration"), _("Popularity")], value=_("Popularity"), style=wx.CB_READONLY)
sortBox.Add(self.sortorder, 0, wx.ALL, 5)
sizer.Add(sortBox, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
@@ -26,6 +36,15 @@ class searchAudioDialog(widgetUtils.BaseDialog):
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def get_state(self, control):
if getattr(self, control).GetValue() == True:
return 1
else:
return 0
def get_sort_order(self):
return self.sortorder.GetSelection()
class searchVideoDialog(widgetUtils.BaseDialog):
def __init__(self, value=""):
super(searchVideoDialog, self).__init__(None, -1)

View File

@@ -5,16 +5,18 @@ import widgetUtils
class timelineDialog(widgetUtils.BaseDialog):
def __init__(self, users=[]):
def __init__(self, users=[], show_selector=True):
super(timelineDialog, self).__init__(parent=None, title=_("New timeline for {0}").format(users[0],))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.HORIZONTAL)
userLabel = wx.StaticText(panel, -1, _("User"))
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
self.cb.SetFocus()
userSizer = wx.BoxSizer()
userSizer.Add(userLabel, 0, wx.ALL, 5)
userSizer.Add(self.cb, 0, wx.ALL, 5)
if show_selector:
userLabel = wx.StaticText(panel, -1, _("User"))
self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0])
self.cb.SetFocus()
userSizer = wx.BoxSizer()
userSizer.Add(userLabel, 0, wx.ALL, 5)
userSizer.Add(self.cb, 0, wx.ALL, 5)
sizer.Add(userSizer, 0, wx.ALL, 5)
actionsSizer = wx.StaticBoxSizer(parent=panel, orient=wx.VERTICAL, label=_("Buffer type"))
self.wall = wx.RadioButton(actionsSizer.GetStaticBox(), wx.NewId(), _("&Wall posts"), style=wx.RB_GROUP)
self.audio = wx.RadioButton(actionsSizer.GetStaticBox(), wx.NewId(), _("Audio"))

View File

@@ -1,21 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from builtins import range
import wx
import wx.adv
import application
from wx.lib.agw import toasterbox
class mainWindow(wx.Frame):
def makeMenu(self):
mb = wx.MenuBar()
app_ = wx.Menu()
create = wx.Menu()
# self.audio_album = create.Append(wx.NewId(), _("Audio album"))
self.audio_album = create.Append(wx.NewId(), _("Audio album"))
self.video_album = create.Append(wx.NewId(), _("Video album"))
app_.Append(wx.NewId(), _("Create"), create)
delete = wx.Menu()
# self.delete_audio_album = delete.Append(wx.NewId(), _("Audio album"))
self.delete_audio_album = delete.Append(wx.NewId(), _("Audio album"))
self.delete_video_album = delete.Append(wx.NewId(), _("Video album"))
app_.Append(wx.NewId(), _("Delete"), delete)
self.settings_dialog = app_.Append(wx.NewId(), _("Preferences"))
@@ -39,12 +36,13 @@ class mainWindow(wx.Frame):
mb.Append(me, _("Me"))
mb.Append(buffer, _("Buffer"))
player = wx.Menu()
self.player_play = player.Append(wx.NewId(), _("Play"))
self.player_play = player.Append(wx.NewId(), _("Play/Pause"))
self.player_play_all = player.Append(wx.NewId(), _("Play all"))
self.player_stop = player.Append(wx.NewId(), _("Stop"))
self.player_previous = player.Append(wx.NewId(), _("Previous"))
self.player_next = player.Append(wx.NewId(), _("Next"))
self.player_shuffle = player.AppendCheckItem(wx.NewId(), _("Shuffle"))
self.player_seek_left = player.Append(wx.NewId(), _("Seek backwards"))
self.player_seek_right = player.Append(wx.NewId(), _("Seek forwards"))
self.player_volume_up = player.Append(wx.NewId(), _("Volume up"))
self.player_volume_down = player.Append(wx.NewId(), _("Volume down"))
self.player_mute = player.Append(wx.NewId(), _("Mute"))
@@ -53,10 +51,26 @@ class mainWindow(wx.Frame):
self.documentation = help_.Append(wx.NewId(), _("Manual"))
self.check_for_updates = help_.Append(wx.NewId(), _("Check for updates"))
self.changelog = help_.Append(wx.NewId(), _("Chan&gelog"))
self.open_logs = help_.Append(wx.NewId(), _("Open logs directory"))
self.open_config = help_.Append(wx.NewId(), _("Open config directory"))
self.report = help_.Append(wx.NewId(), _("Report an error"))
mb.Append(player, _("Audio player"))
mb.Append(help_, _("Help"))
self.SetMenuBar(mb)
self.accel_tbl = wx.AcceleratorTable([
# Assign keystrokes to control the player object.
(wx.ACCEL_ALT, wx.WXK_LEFT, self.player_previous.GetId()),
(wx.ACCEL_ALT, wx.WXK_RIGHT, self.player_next.GetId()),
(wx.ACCEL_ALT, wx.WXK_DOWN, self.player_volume_down.GetId()),
(wx.ACCEL_ALT, wx.WXK_UP, self.player_volume_up.GetId()),
# Translators: Keystroke used to play/pause the current item in the playback queue. Use the latin alphabet, but you can match a different key here. For example if you want to assign this to the key "П", use G.
(wx.ACCEL_CTRL, ord(_("P")), self.player_play.GetId()),
(wx.ACCEL_CTRL|wx.ACCEL_SHIFT, ord(_("P")), self.player_play_all.GetId()),
(wx.ACCEL_ALT|wx.ACCEL_SHIFT, wx.WXK_LEFT, self.player_seek_left.GetId()),
(wx.ACCEL_ALT|wx.ACCEL_SHIFT, wx.WXK_RIGHT, self.player_seek_right.GetId()),
])
self.SetAcceleratorTable(self.accel_tbl)
def __init__(self):
super(mainWindow, self).__init__(parent=None, id=wx.NewId(), title=application.name)
@@ -89,6 +103,9 @@ class mainWindow(wx.Frame):
def insert_buffer(self, buffer, name, pos):
return self.tb.InsertSubPage(pos, buffer, name)
def insert_chat_buffer(self, buffer, name, pos):
return self.tb.InsertPage(pos, buffer, name)
def search(self, name_):
for i in range(0, self.tb.GetPageCount()):
if self.tb.GetPage(i).name == name_: return i
@@ -105,8 +122,10 @@ class mainWindow(wx.Frame):
def change_buffer(self, position):
self.tb.ChangeSelection(position)
def get_buffer_text(self):
return self.tb.GetPageText(self.tb.GetSelection())
def get_buffer_text(self, pos=None):
if pos == None:
pos = self.tb.GetSelection()
return self.tb.GetPageText(pos)
def get_buffer_by_id(self, id):
return self.nb.FindWindowById(id)
@@ -114,10 +133,14 @@ class mainWindow(wx.Frame):
def advance_selection(self, forward):
self.tb.AdvanceSelection(forward)
def about_dialog(self, *args, **kwargs):
def about_dialog(self, channel="stable", *args, **kwargs):
if channel == "stable":
version = _("{version} (stable)").format(version=application.version)
else:
version = _("{version} (alpha)").format(version=application.update_next_version)
info = wx.adv.AboutDialogInfo()
info.SetName(application.name)
info.SetVersion(application.version)
info.SetVersion(version)
info.SetDescription(application.description)
info.SetCopyright(application.copyright)
info.SetTranslators(application.translators)
@@ -128,9 +151,9 @@ class mainWindow(wx.Frame):
def remove_buffer(self, pos):
self.tb.DeletePage(pos)
def remove_buffer_from_position(self, pos):
return self.tb.RemovePage(pos)
def notify(self, title, text):
try:
self.notification = wx.adv.NotificationMessage(title, text, parent=self)
except AttributeError:
self.notification = wx.NotificationMessage(title, text)
self.notification = wx.adv.NotificationMessage(title=title, message=text, parent=self)
self.notification.Show()

View File

@@ -1,94 +1,98 @@
# -*- coding: utf-8 -*-
""" This module contains all context menus needed to be displayed in different sections. Basically any menu that is bigger than 2 menu items should be here."""
from __future__ import unicode_literals
import wx
class postMenu(wx.Menu):
""" Display a menu with actions related to posts in the news feed or walls. """
def __init__(self, can_delete=False, *args, **kwargs):
super(postMenu, self).__init__(*args, **kwargs)
self.open = wx.MenuItem(self, wx.NewId(), _("Open"))
self.Append(self.open)
self.like = wx.MenuItem(self, wx.NewId(), _("Like"))
self.Append(self.like)
self.dislike = wx.MenuItem(self, wx.NewId(), _("Dislike"))
self.open = self.Append(wx.NewId(), _("Open"))
self.like = self.Append(wx.NewId(), _("Like"))
self.dislike = self.Append(wx.NewId(), _("Dislike"))
self.dislike.Enable(False)
self.Append(self.dislike)
self.comment = wx.MenuItem(self, wx.NewId(), _("Add comment"))
self.Append(self.comment)
self.comment = self.Append(wx.NewId(), _("Add comment"))
if can_delete:
self.delete = wx.MenuItem(self, wx.NewId(), _("Delete"))
self.Append(self.delete)
self.delete = self.Append(wx.NewId(), _("Delete"))
else:
self.post_in_wall = wx.MenuItem(self, wx.NewId(), _("Post to this profile"))
self.post_in_wall = self.Append(wx.NewId(), _("Post to this profile"))
self.post_in_wall.Enable(False)
self.Append(self.post_in_wall)
self.view_profile = wx.MenuItem(self, wx.NewId(), _("View user profile"))
self.Append(self.view_profile)
def create_specific_post_options(self):
self.update = wx.MenuItem(self, wx.NewId(), _("Update"))
self.Append(self.update)
self.delete = wx.MenuItem(self, wx.NewId(), _("Delete"))
self.Append(self.delete)
self.view_profile = self.Append(wx.NewId(), _("View user profile"))
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
class audioMenu(wx.Menu):
def __init__(self, *args, **kwargs):
super(audioMenu, self).__init__(*args, **kwargs)
self.open = wx.MenuItem(self, wx.NewId(), _("&Open"))
self.Append(self.open)
self.play = wx.MenuItem(self, wx.NewId(), _("&Play"))
self.Append(self.play)
self.library = wx.MenuItem(self, wx.NewId(), _("&Add to library"))
self.Append(self.library)
self.move = wx.MenuItem(self, wx.NewId(), _("Move to album"))
self.Append(self.move)
self.open = self.Append(wx.NewId(), _("&Open"))
self.play = self.Append(wx.NewId(), _("&Play"))
self.library = self.Append(wx.NewId(), _("&Add to library"))
self.move = self.Append(wx.NewId(), _("Move to album"))
# self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
class peopleMenu(wx.Menu):
def __init__(self, is_request=False, *args, **kwargs):
def __init__(self, is_request=False, is_subscriber=False, not_friend=False, *args, **kwargs):
super(peopleMenu, self).__init__(*args, **kwargs)
if is_request:
self.create_extra_items()
self.view_profile = wx.MenuItem(self, wx.NewId(), _("View profile"))
self.Append(self.view_profile)
self.message = wx.MenuItem(self, wx.NewId(), _("Send a message"))
self.Append(self.message)
self.timeline = wx.MenuItem(self, wx.NewId(), _("Open timeline"))
self.Append(self.timeline)
self.common_friends = wx.MenuItem(self, wx.NewId(), _("View friends in common"))
self.Append(self.common_friends)
self.create_request_items()
elif is_subscriber:
self.create_subscriber_items()
self.view_profile = self.Append(wx.NewId(), _("View profile"))
self.message = self.Append(wx.NewId(), _("Send a message"))
self.timeline = self.Append(wx.NewId(), _("Open timeline"))
if not_friend == False:
self.common_friends = self.Append(wx.NewId(), _("View friends in common"))
if is_request == False and is_subscriber == False and not_friend == False:
self.decline = self.Append(wx.NewId(), _("Remove from friends"))
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
def create_extra_items(self):
self.accept = wx.MenuItem(self, wx.NewId(), _("Accept"))
self.Append(self.accept)
self.decline = wx.MenuItem(self, wx.NewId(), _("Decline"))
self.Append(self.decline)
self.keep_as_follower = wx.MenuItem(self, wx.NewId(), _("Keep as follower"))
self.Append(self.keep_as_follower)
def create_request_items(self):
self.accept = self.Append(wx.NewId(), _("Accept"))
self.decline = self.Append(wx.NewId(), _("Decline"))
self.keep_as_follower = self.Append(wx.NewId(), _("Keep as follower"))
def create_subscriber_items(self):
self.add = self.Append(wx.NewId(), _("Add to friends"))
class documentMenu(wx.Menu):
def __init__(self, added=False, *args, **kwargs):
super(documentMenu, self).__init__(*args, **kwargs)
self.download = self.Append(wx.NewId(), _("Download document"))
if added == True:
self.action = self.Append(wx.NewId(), _("Remove from my documents"))
else:
self.action = self.Append(wx.NewId(), _("Add to my documents"))
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
class commentMenu(wx.Menu):
def __init__(self, *args, **kwargs):
super(commentMenu, self).__init__(*args, **kwargs)
self.open = wx.MenuItem(self, wx.NewId(), _("Open"))
self.Append(self.open)
self.like = wx.MenuItem(self, wx.NewId(), _("Like"))
self.Append(self.like)
self.unlike = wx.MenuItem(self, -1, _("Unlike"))
self.Append(self.unlike)
def create_specific_comment_options(self):
self.delete = wx.MenuItem(self, wx.NewId(), _("Delete"))
self.Append(self.delete)
class notificationsMenu(wx.Menu):
def __init__(self):
super(notificationsMenu, self).__init__()
self.mark_as_read = wx.MenuItem(self, wx.NewId(), _("Mark as read"))
self.Append(self.mark_as_read)
self.open = self.Append(wx.NewId(), _("Open"))
self.like = self.Append(wx.NewId(), _("Like"))
self.dislike = self.Append(wx.NewId(), _("Dislike"))
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
class attachMenu(wx.Menu):
def __init__(self):
super(attachMenu, self).__init__()
self.upload = wx.MenuItem(self, wx.NewId(), _("Upload from computer"))
self.Append(self.upload)
self.add = wx.MenuItem(self, wx.NewId(), _("Add from VK"))
self.Append(self.add)
self.upload = self.Append(wx.NewId(), _("Upload from computer"))
self.add = self.Append(wx.NewId(), _("Add from VK"))
class communityBufferMenu(wx.Menu):
def __init__(self):
super(communityBufferMenu, self).__init__()
load = wx.Menu()
self.load_posts = load.Append(wx.NewId(), _("Load posts"))
self.load_topics = load.Append(wx.NewId(), _("Load topics"))
self.load_audios = load.Append(wx.NewId(), _("Load audios"))
self.load_videos = load.Append(wx.NewId(), _("Load videos"))
self.load_documents = load.Append(wx.NewId(), _("Load documents"))
self.Append(wx.NewId(), _("Load"), load)
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
class conversationBufferMenu(wx.Menu):
def __init__(self):
super(conversationBufferMenu, self).__init__()
self.delete = self.Append(wx.NewId(), _("Delete conversation"))
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
#from __future__ import unicode_literals
from __future__ import unicode_literals
import wx
import widgetUtils
@@ -57,15 +56,15 @@ class communityTab(feedTab):
def create_post_buttons(self):
self.postBox = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Actions"))
self.load = wx.Button(self.postBox.GetBoxSizer(), wx.NewId(), _("Load community"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Post"))
self.load = wx.Button(self.postBox.GetStaticBox(), wx.NewId(), _("Load buffer"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Post in group"))
self.postBox.Add(self.load, 0, wx.ALL, 5)
self.postBox.Add(self.post, 0, wx.ALL, 5)
class audioTab(homeTab):
def create_list(self):
self.lbl = wx.StaticText(self, wx.NewId(), _("Mu&sic"))
self.list = widgetUtils.list(self, *[_("Title"), _("Artist"), _("Duration")], style=wx.LC_REPORT)
self.list = widgetUtils.multiselectionList(self, *[_("Title"), _("Artist"), _("Duration")], style=wx.LC_REPORT)
self.list.set_windows_size(0, 160)
self.list.set_windows_size(1, 380)
self.list.set_windows_size(2, 80)
@@ -74,18 +73,25 @@ class audioTab(homeTab):
def create_post_buttons(self):
self.postBox = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Actions"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Post"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Upload audio"))
self.post.Enable(False)
self.play = wx.Button(self.postBox.GetStaticBox(), -1, _("P&lay"))
self.play_all = wx.Button(self.postBox.GetStaticBox(), -1, _("Play &All"))
self.postBox.Add(self.post, 0, wx.ALL, 5)
self.postBox.Add(self.play, 0, wx.ALL, 5)
self.postBox.Add(self.play_all, 0, wx.ALL, 5)
def get_file_to_upload(self):
openFileDialog = wx.FileDialog(self, _("Select the audio file to be uploaded"), "", "", _("Audio files (*.mp3)|*.mp3"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return None
return openFileDialog.GetPath()
class audioAlbumTab(audioTab):
def create_post_buttons(self):
self.postBox = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Actions"))
self.load = wx.Button(self.postBox.GetStaticBox(), wx.NewId(), _("Load album"))
self.load = wx.Button(self.postBox.GetStaticBox(), wx.NewId(), _("Load buffer"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Post"))
self.play = wx.Button(self.postBox.GetStaticBox(), -1, _("P&lay"))
self.play_all = wx.Button(self.postBox.GetStaticBox(), -1, _("Play &All"))
@@ -136,6 +142,42 @@ class friendsTab(homeTab):
self.list.set_windows_size(0, 400)
self.list.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnKeyDown)
class topicTab(homeTab):
def create_list(self):
self.lbl = wx.StaticText(self, wx.NewId(), _("Topics"))
self.list = widgetUtils.list(self, *[_("User"), _("Title"), _("Posts"), _("Last")], style=wx.LC_REPORT)
self.list.set_windows_size(0, 200)
self.list.set_windows_size(1, 64)
self.list.set_windows_size(2, 15)
self.list.set_windows_size(2, 250)
self.list.set_size()
self.list.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnKeyDown)
class documentCommunityTab(homeTab):
def create_list(self):
self.lbl = wx.StaticText(self, wx.NewId(), _("Documents"))
self.list = widgetUtils.list(self, *[_("User"), _("Title"), _("Type"), _("Size"), _("Date")], style=wx.LC_REPORT)
self.list.set_windows_size(0, 200)
self.list.set_windows_size(1, 128)
self.list.set_windows_size(2, 35)
self.list.set_windows_size(3, 15)
self.list.set_windows_size(4, 25)
self.list.set_size()
self.list.list.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnKeyDown)
def get_download_path(self, filename):
saveFileDialog = wx.FileDialog(self, _("Save document as"), "", filename, _("All files (*.*)|*.*"), wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
if saveFileDialog.ShowModal() == widgetUtils.OK:
return saveFileDialog.GetPath()
class documentTab(documentCommunityTab):
def create_post_buttons(self):
self.postBox = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Actions"))
self.load = wx.Button(self.postBox.GetStaticBox(), wx.NewId(), _("Load buffer"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Post"))
self.postBox.Add(self.load, 0, wx.ALL, 5)
self.postBox.Add(self.post, 0, wx.ALL, 5)
class empty(wx.Panel):
def __init__(self, parent, name):
super(empty, self).__init__(parent=parent, name=name)
@@ -164,11 +206,22 @@ class chatTab(wx.Panel):
def create_controls(self):
lbl1 = wx.StaticText(self, wx.NewId(), _("History"))
self.history = wx.TextCtrl(self, wx.NewId(), style=wx.TE_READONLY|wx.TE_MULTILINE, size=(500, 300))
selectId = wx.NewId()
self.Bind(wx.EVT_MENU, self.onSelect, id=selectId)
self.accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord('A'), selectId)])
self.SetAcceleratorTable(self.accel_tbl)
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(lbl1, 0, wx.ALL, 5)
box.Add(self.history, 0, wx.ALL, 5)
return box
def onSelect(self, event, *args, **kwargs):
if self.history.HasFocus():
self.history.SelectAll()
else:
self.text.SelectAll()
event.Skip()
def create_attachments(self):
lbl = wx.StaticText(self, -1, _("Attachments"))
self.attachments = widgetUtils.list(self, _("Type"), _("Title"), style=wx.LC_REPORT)
@@ -238,7 +291,7 @@ class videoAlbumTab(videoTab):
def create_post_buttons(self):
self.postBox = wx.BoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Actions"))
self.load = wx.Button(self.postBox.GetStaticBox(), wx.NewId(), _("Load album"))
self.load = wx.Button(self.postBox.GetStaticBox(), wx.NewId(), _("Load buffer"))
self.post = wx.Button(self.postBox.GetStaticBox(), -1, _("&Post"))
self.play = wx.Button(self.postBox.GetStaticBox(), -1, _("P&lay"))
self.postBox.Add(self.post, 0, wx.ALL, 5)

View File

@@ -1,4 +1,4 @@
{"current_version": "0.17",
{"current_version": "0.20",
"description": ".",
"downloads":
{"Windows32": "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/v0.17/raw/socializer.zip?job=stable"}}
{"Windows32": "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/v0.20/raw/socializer.zip?job=stable"}}

View File

@@ -0,0 +1,729 @@
# this is the affix file of the de_DE Hunspell dictionary
# derived from the igerman98 dictionary
#
# Version: 20161207
#
# Copyright (C) 1998-2015 Bjoern Jacke <bjoern@j3e.de>
#
# License: GPLv2, GPLv3
# There should be a copy of both of this licenses included
# with every distribution of this dictionary. Modified
# versions using the GPL may only include the GPL
SET ISO8859-1
TRY esijanrtolcdugmphbyfvkwqxz<78><7A><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ESIJANRTOLCDUGMPHBYFVKWQXZ<58><5A><EFBFBD><EFBFBD>-.
PFX U Y 1
PFX U 0 un .
PFX V Y 1
PFX V 0 ver .
SFX F Y 35
SFX F 0 nen in
SFX F e in e
SFX F e innen e
SFX F 0 in [^i]n
SFX F 0 innen [^i]n
SFX F 0 in [^enr]
SFX F 0 innen [^enr]
SFX F 0 in [^e]r
SFX F 0 innen [^e]r
SFX F 0 in [^r]er
SFX F 0 innen [^r]er
SFX F 0 in [^e]rer
SFX F 0 innen [^e]rer
SFX F 0 in ierer
SFX F 0 innen ierer
SFX F er in [^i]erer
SFX F er innen [^i]erer
SFX F in In in
SFX F in Innen in
SFX F e In e
SFX F e Innen e
SFX F 0 In [^i]n
SFX F 0 Innen [^i]n
SFX F 0 In [^en]
SFX F 0 Innen [^en]
SFX F 0 In [^e]r
SFX F 0 Innen [^e]r
SFX F 0 In [^r]er
SFX F 0 Innen [^r]er
SFX F 0 In [^e]rer
SFX F 0 Innen [^e]rer
SFX F 0 In ierer
SFX F 0 Innen ierer
SFX F er In [^i]erer
SFX F er Innen [^i]erer
#SFX F en innen en
#SFX F en Innen en
SFX L N 12
SFX L 0 tlich n
SFX L 0 tliche n
SFX L 0 tlicher n
SFX L 0 tliches n
SFX L 0 tlichem n
SFX L 0 tlichen n
SFX L 0 lich [^n]
SFX L 0 liche [^n]
SFX L 0 licher [^n]
SFX L 0 liches [^n]
SFX L 0 lichem [^n]
SFX L 0 lichen [^n]
#SFX H N 2
#SFX H 0 heit .
#SFX H 0 heiten .
#SFX K N 2
#SFX K 0 keit .
#SFX K 0 keiten .
SFX M N 10
SFX M 0 chen [^se]
SFX M 0 chens [^se]
SFX M ass <20>sschen ass
SFX M ass <20>sschens ass
SFX M oss <20>sschen oss
SFX M oss <20>sschens oss
SFX M uss <20>sschen uss
SFX M uss <20>sschens uss
SFX M e chen e
SFX M e chens e
SFX A Y 46
SFX A 0 r e
SFX A 0 n e
SFX A 0 m e
SFX A 0 s e
SFX A 0 e [^elr]
SFX A 0 er [^elr]
SFX A 0 en [^elr]
SFX A 0 em [^elr]
SFX A 0 es [^elr]
SFX A 0 e [^e][rl]
SFX A 0 er [^e][rl]
SFX A 0 en [^e][rl]
SFX A 0 em [^e][rl]
SFX A 0 es [^e][rl]
SFX A 0 e [^u]er
SFX A 0 er [^u]er
SFX A 0 en [^u]er
SFX A 0 em [^u]er
SFX A 0 es [^u]er
SFX A er re uer
SFX A er rer uer
SFX A er ren uer
SFX A er rem uer
SFX A er res uer
SFX A 0 e [eil]el
SFX A 0 er [eil]el
SFX A 0 en [eil]el
SFX A 0 em [eil]el
SFX A 0 es [eil]el
SFX A el le [^eil]el
SFX A el ler [^eil]el
SFX A el len [^eil]el
SFX A el lem [^eil]el
SFX A el les [^eil]el
SFX A lig elig [^aeiouhlr<6C><72><EFBFBD>]lig
SFX A lig elige [^aeiouhlr<6C><72><EFBFBD>]lig
SFX A lig eliger [^aeiouhlr<6C><72><EFBFBD>]lig
SFX A lig eligen [^aeiouhlr<6C><72><EFBFBD>]lig
SFX A lig eligem [^aeiouhlr<6C><72><EFBFBD>]lig
SFX A lig eliges [^aeiouhlr<6C><72><EFBFBD>]lig
SFX A erig rig [^hi]erig
SFX A erig rige [^hi]erig
SFX A erig riger [^hi]erig
SFX A erig rigen [^hi]erig
SFX A erig rigem [^hi]erig
SFX A erig riges [^hi]erig
SFX C Y 100
SFX C 0 ere [^elr]
SFX C 0 erer [^elr]
SFX C 0 eren [^elr]
SFX C 0 erem [^elr]
SFX C 0 eres [^elr]
SFX C 0 re e
SFX C 0 rer e
SFX C 0 ren e
SFX C 0 rem e
SFX C 0 res e
SFX C 0 ere [^e][lr]
SFX C 0 erer [^e][lr]
SFX C 0 eren [^e][lr]
SFX C 0 erem [^e][lr]
SFX C 0 eres [^e][lr]
SFX C el lere el
SFX C el lerer el
SFX C el leren el
SFX C el lerem el
SFX C el leres el
SFX C er rere uer
SFX C er rerer uer
SFX C er reren uer
SFX C er rerem uer
SFX C er reres uer
SFX C 0 ere [^u]er
SFX C 0 erer [^u]er
SFX C 0 eren [^u]er
SFX C 0 erem [^u]er
SFX C 0 eres [^u]er
SFX C lig eligere [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligerer [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligeren [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligerem [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligeres [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C erig rigere [^hi]erig
SFX C erig rigerer [^hi]erig
SFX C erig rigeren [^hi]erig
SFX C erig rigerem [^hi]erig
SFX C erig rigeres [^hi]erig
SFX C 0 est [k<>suxz]
SFX C 0 este [k<>suxz]
SFX C 0 ester [k<>suxz]
SFX C 0 esten [k<>suxz]
SFX C 0 estem [k<>suxz]
SFX C 0 estes [k<>suxz]
SFX C 0 st et
SFX C 0 ste et
SFX C 0 ster et
SFX C 0 sten et
SFX C 0 stem et
SFX C 0 stes et
SFX C 0 st igt
SFX C 0 ste igt
SFX C 0 ster igt
SFX C 0 sten igt
SFX C 0 stem igt
SFX C 0 stes igt
SFX C 0 est [^i]gt
SFX C 0 este [^i]gt
SFX C 0 ester [^i]gt
SFX C 0 esten [^i]gt
SFX C 0 estem [^i]gt
SFX C 0 estes [^i]gt
SFX C 0 est [^eg]t
SFX C 0 este [^eg]t
SFX C 0 ester [^eg]t
SFX C 0 esten [^eg]t
SFX C 0 estem [^eg]t
SFX C 0 estes [^eg]t
SFX C 0 st [^k<>stxz]
SFX C 0 ste [^k<>stxz]
SFX C 0 ster [^k<>stxz]
SFX C 0 sten [^k<>stxz]
SFX C 0 stem [^k<>stxz]
SFX C 0 stes [^k<>stxz]
SFX C 0 st nd
SFX C 0 ste nd
SFX C 0 ster nd
SFX C 0 sten nd
SFX C 0 stem nd
SFX C 0 stes nd
SFX C 0 est [^n]d
SFX C 0 este [^n]d
SFX C 0 ester [^n]d
SFX C 0 esten [^n]d
SFX C 0 estem [^n]d
SFX C 0 estes [^n]d
SFX C lig eligst [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligste [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligster [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligsten [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligstem [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C lig eligstes [^aeiouhlr<6C><72><EFBFBD>]lig
SFX C erig rigst [^hi]erig
SFX C erig rigste [^hi]erig
SFX C erig rigster [^hi]erig
SFX C erig rigsten [^hi]erig
SFX C erig rigstem [^hi]erig
SFX C erig rigstes [^hi]erig
SFX E Y 1
SFX E 0 e .
SFX f Y 4
SFX f ph f ph
SFX f ph fen ph
SFX f phie fie phie
SFX f phie fien phie
SFX N Y 1
SFX N 0 n .
SFX P Y 1
SFX P 0 en .
SFX p Y 26
SFX p auf <20>ufe auf
SFX p auf <20>ufen auf
SFX p aus <20>user [hH]aus
SFX p aus <20>usern [hH]aus
SFX p arkt <20>rkte [mM]arkt
SFX p arkt <20>rkten [mM]arkt
SFX p ang <20>nge ang
SFX p ang <20>ngen ang
SFX p u<> <20><>e u<>
SFX p u<> <20><>en u<>
SFX p o<> <20><>e o<>
SFX p o<> <20><>en o<>
SFX p aum <20>ume aum
SFX p aum <20>umen aum
SFX p ag <20>ge ag
SFX p ag <20>gen ag
SFX p ug <20>ge ug
SFX p ug <20>gen ug
SFX p all <20>lle all
SFX p all <20>llen all
SFX p ass <20>sse ass
SFX p ass <20>ssen ass
SFX p uss <20>sse uss
SFX p uss <20>ssen uss
SFX p oss <20>sse oss
SFX p oss <20>ssen oss
# last ...oss rules are for swiss de_CH only - but do not affect de_DE
SFX R Y 3
SFX R 0 er [^e]
SFX R 0 ern [^e]
SFX R 0 r e
SFX S Y 1
SFX S 0 s .
SFX q Y 2
SFX q 0 se s
SFX q 0 sen s
SFX Q Y 1
SFX Q 0 ses s
#SFX Q 0 se s
#SFX Q 0 sen s
SFX T Y 1
SFX T 0 es .
SFX J Y 12
SFX J n ung [bgkp<6B>sz]eln
SFX J n ungen [bgkp<6B>sz]eln
SFX J eln lung eln
SFX J n ung ern
SFX J en ung en
SFX J eln lungen eln
SFX J n ungen ern
SFX J en ungen en
SFX J 0 ung [^n]
SFX J 0 ungen [^n]
SFX J el lung el
SFX J el lungen el
SFX B N 12
SFX B n bar e[lr]n
SFX B n bare e[lr]n
SFX B n baren e[lr]n
SFX B n barer e[lr]n
SFX B n bares e[lr]n
SFX B n barem e[lr]n
SFX B en bar en
SFX B en bare en
SFX B en baren en
SFX B en barer en
SFX B en bares en
SFX B en barem en
SFX D Y 6
SFX D 0 d n
SFX D 0 de n
SFX D 0 den n
SFX D 0 der n
SFX D 0 des n
SFX D 0 dem n
SFX W Y 5
SFX W en 0 en
SFX W n 0 [^e]n
SFX W st 0 [^s]st
SFX W t 0 sst
SFX W t 0 [^s]t
SFX I Y 16
SFX I n 0 en
SFX I eln le eln
SFX I n e eln
SFX I ern re ern
SFX I n e ern
SFX I n t e[lr]n
SFX I n t [dt]en
SFX I en t [^dimnt]en
SFX I en t eien
SFX I n t [^e]ien
SFX I n t chnen
SFX I en t [^c]h[mn]en
SFX I n t [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX I en t [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX I n e un
SFX I n t un
SFX X Y 26
SFX X n t e[lr]n
SFX X n t [dtw]en
SFX X en t eien
SFX X n t [^e]ien
SFX X en t [^ditmnw]en
SFX X n t chnen
SFX X en t [^c]h[mn]en
SFX X n t [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX X en t [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX X n t un
SFX X st 0 tst
SFX X n st e[lr]n
SFX X n st [dtw]en
SFX X en st [^dimn<6D>stwzx]en
SFX X en st eien
SFX X n st [^e]ien
SFX X n st chnen
SFX X en st [^c]h[mn]en
SFX X n st [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX X en st [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX X n st un
SFX X n st [<5B>sxz]en
SFX X n st ssen
SFX X n st schen
SFX X t st [^sz]t
SFX X t est zt
SFX Y Y 36
SFX Y n te e[lr]n
SFX Y n te [dtw]en
SFX Y en te [^dimntw]en
SFX Y en te eien
SFX Y n te [^e]ien
SFX Y n te chnen
SFX Y en te [^c]h[mn]en
SFX Y n te [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX Y en te [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX Y n test e[lr]n
SFX Y n test [dtw]en
SFX Y en test [^dimntw]en
SFX Y en test eien
SFX Y n test [^e]ien
SFX Y n test chnen
SFX Y en test [^c]h[mn]en
SFX Y n test [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX Y en test [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX Y n tet e[lr]n
SFX Y n tet [dtw]en
SFX Y en tet [^dimntw]en
SFX Y en tet eien
SFX Y n tet [^e]ien
SFX Y n tet chnen
SFX Y en tet [^c]h[mn]en
SFX Y n tet [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX Y en tet [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX Y n ten e[lr]n
SFX Y n ten [dtw]en
SFX Y en ten [^dimntw]en
SFX Y en ten eien
SFX Y n ten [^e]ien
SFX Y n ten chnen
SFX Y en ten [^c]h[mn]en
SFX Y n ten [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX Y en ten [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX Z Y 15
SFX Z 0 st [^h<>sz]
SFX Z 0 st [^c]h
SFX Z 0 st [^s]ch
SFX Z 0 est [dfkstz]
SFX Z 0 est ch
SFX Z 0 est [au]<5D>
SFX Z 0 est ie<69>
SFX Z 0 est [io]ss
SFX Z 0 t [^dt]
SFX Z 0 et [dt]
SFX Z 0 n e
SFX Z 0 en ie
SFX Z 0 en [^e]
SFX Z 0 est iess
SFX Z 0 est [au]ss
# last two ...ss rules only used for swiss de_CH - but de_DE is unaffected
SFX O Y 21
SFX O n tes e[lr]n
SFX O n tes [dtw]en
SFX O en tes [^dmntw]en
SFX O n tes chnen
SFX O en tes [^c]h[mn]en
SFX O n tes [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX O en tes [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX O n ter e[lr]n
SFX O n ter [dtw]en
SFX O en ter [^dmntw]en
SFX O n ter chnen
SFX O en ter [^c]h[mn]en
SFX O n ter [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX O en ter [a<>eilmno<6E>u<EFBFBD>r][mn]en
SFX O n tem e[lr]n
SFX O n tem [dtw]en
SFX O en tem [^dmntw]en
SFX O n tem chnen
SFX O en tem [^c]h[mn]en
SFX O n tem [^a<>ehilmno<6E>u<EFBFBD>r][mn]en
SFX O en tem [a<>eilmno<6E>u<EFBFBD>r][mn]en
REP 28
REP f ph
REP ph f
REP <20> ss
REP ss <20>
REP s ss
REP ss s
REP i ie
REP ie i
REP ee e
REP o oh
REP oh o
REP a ah
REP ah a
REP e eh
REP eh e
REP ae <20>
REP oe <20>
REP ue <20>
REP Ae <20>
REP Oe <20>
REP Ue <20>
REP d t
REP t d
REP th t
REP t th
REP r rh
REP ch k
REP k ch
#REP eee ee-E
# this one will allow "-Eltern" - Hunspell 1.1.5 bug, but CHECKSHARPS obsoletes LANG de_DE
#LANG de_DE
CHECKSHARPS
COMPOUNDBEGIN x
COMPOUNDMIDDLE y
COMPOUNDEND z
FORBIDDENWORD d
# Prefixes are allowed at the beginning of compounds,
# suffixes are allowed at the end of compounds by default:
# (prefix)?(root)+(affix)?
# Affixes with COMPOUNDPERMITFLAG may be inside of compounds.
COMPOUNDPERMITFLAG c
ONLYINCOMPOUND o
# my PSEUDOROOT h(elper) flag
NEEDAFFIX h
# forbid uppercase characters at compound word bounds
# BUT I want to take care about it myself ;-)
# CHECKCOMPOUNDCASE
KEEPCASE w
# Affixes signed with CIRCUMFIX flag may be on a word when this word also has a prefix with CIRCUMFIX flag and vice versa.
# for decapitalizing nouns with fogemorphemes
CIRCUMFIX f
# this one would make a separate dict entry "Denkmalsschutz" invalidate the
# compound of "Denkmal"+"schutz". We do not want this feature here...
# CHECKCOMPOUNDREP
# make not all possible suggestions for typos of Flicken or some rare words
NOSUGGEST n
WORDCHARS <20>-.
# - setting this to 2 decreases performance by 1/10 but is needed for "<22>l" and "ei"
# - setting this to 1 for handling Fuge-elements with dashes (Arbeits-) dash will
# be a special word but - is handled as a affix now
COMPOUNDMIN 2
# this ones are for Duden R36 (old orthography)
#CHECKCOMPOUNDPATTERN 2 #oldspell
#CHECKCOMPOUNDPATTERN ee e #oldspell
#CHECKCOMPOUNDPATTERN oo o #oldspell
# also need oo o
# this one needs to be flagable to be used for old orthography
#CHECKCOMPOUNDTRIPLE
PFX i Y 1
PFX i 0 -/coyf .
SFX j Y 3
SFX j 0 0/xoc .
SFX j 0 -/zocf .
SFX j 0 -/cz .
# Female forms for compound/Compound words:
# attention: [^e][^n] does also filter out "...er" !
SFX g Y 12
SFX g 0 innen/xyoc [^n]
SFX g en innen/xyoc en
SFX g 0 Innen/xyoc [^n]
SFX g en Innen/xyoc en
SFX g 0 innen/xyocf [^n]
SFX g en innen/xyocf en
SFX g 0 Innen/xyocf [^n]
SFX g en Innen/xyocf en
SFX g 0 innen-/cz [^n]
SFX g en innen-/cz en
SFX g 0 Innen-/cz [^n]
SFX g en Innen-/cz en
PFX k Y 2
PFX k 0 -/coxf .
PFX k 0 0/coy .
SFX e Y 2
SFX e 0 0/yoc .
SFX e 0 -/zc .
# for Uppercased end-words to prepend - and lowercase: (Tier/EPSm) (EX: Bettbez<65>ge und *-laken*)
# AND
# for lowercased end-words to prepend - and re-uppercase : (tier/EPSozm) (EX: Arbeits*-Tier*)
#PFX m A -a/co A
#PFX m a -/ a
PFX m Y 58
PFX m A -a A
PFX m B -b B
PFX m C -c C
PFX m D -d D
PFX m E -e E
PFX m F -f F
PFX m G -g G
PFX m H -h H
PFX m I -i I
PFX m J -j J
PFX m K -k K
PFX m L -l L
PFX m M -m M
PFX m N -n N
PFX m O -o O
PFX m P -p P
PFX m Q -q Q
PFX m R -r R
PFX m S -s S
PFX m T -t T
PFX m U -u U
PFX m V -v V
PFX m W -w W
PFX m X -x X
PFX m Y -y Y
PFX m Z -z Z
PFX m <20> -<2D> <20>
PFX m <20> -<2D> <20>
PFX m <20> -<2D> <20>
PFX m a -A/co a
PFX m b -B/co b
PFX m c -C/co c
PFX m d -D/co d
PFX m e -E/co e
PFX m f -F/co f
PFX m g -G/co g
PFX m h -H/co h
PFX m i -I/co i
PFX m j -J/co j
PFX m k -K/co k
PFX m l -L/co l
PFX m m -M/co m
PFX m n -N/co n
PFX m o -O/co o
PFX m p -P/co p
PFX m q -Q/co q
PFX m r -R/co r
PFX m s -S/co s
PFX m t -T/co t
PFX m u -U/co u
PFX m v -V/co v
PFX m w -W/co w
PFX m x -X/co x
PFX m y -Y/co y
PFX m z -Z/co z
PFX m <20> -<2D>/co <20>
PFX m <20> -<2D>/co <20>
PFX m <20> -<2D>/co <20>
# Decapitalizing: (not used ATM... )
# /co(f) : compound permit, in coumpount only, (decapitalizing with fogemorphemes)
#PFX l Y 29
#PFX l A a/co A
#PFX l <20> <20>/co <20>
#PFX l B b/co B
#PFX l C c/co C
#PFX l D d/co D
#PFX l E e/co E
#PFX l F f/co F
#PFX l G g/co G
#PFX l H h/co H
#PFX l I i/co I
#PFX l J j/co J
#PFX l K k/co K
#PFX l L l/co L
#PFX l M m/co M
#PFX l N n/co N
#PFX l O o/co O
#PFX l <20> <20>/co <20>
#PFX l P p/co P
#PFX l Q q/co Q
#PFX l R r/co R
#PFX l S s/co S
#PFX l T t/co T
#PFX l U u/co U
#PFX l <20> <20>/co <20>
#PFX l V v/co V
#PFX l W w/co W
#PFX l X x/co X
#PFX l Y y/co Y
#PFX l Z z/co Z
# private hunspell flags:
# --x : not for capmain (rare words)
# With "BREAK -" some wrong forms are accepted but that is needed for US-Wirtschaft etc.
# So enabling this is the lesser evil. No perfect solution found so far...
BREAK 2
BREAK -
BREAK .

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
SET UTF-8
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
ICONV 1
ICONV '
NOSUGGEST !
# ordinal numbers
COMPOUNDMIN 1
# only in compounds: 1th, 2th, 3th
ONLYINCOMPOUND c
# compound rules:
# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
COMPOUNDRULE 2
COMPOUNDRULE n*1t
COMPOUNDRULE n*mp
WORDCHARS 0123456789
PFX A Y 1
PFX A 0 re .
PFX I Y 1
PFX I 0 in .
PFX U Y 1
PFX U 0 un .
PFX C Y 1
PFX C 0 de .
PFX E Y 1
PFX E 0 dis .
PFX F Y 1
PFX F 0 con .
PFX K Y 1
PFX K 0 pro .
SFX V N 2
SFX V e ive e
SFX V 0 ive [^e]
SFX N Y 3
SFX N e ion e
SFX N y ication y
SFX N 0 en [^ey]
SFX X Y 3
SFX X e ions e
SFX X y ications y
SFX X 0 ens [^ey]
SFX H N 2
SFX H y ieth y
SFX H 0 th [^y]
SFX Y Y 1
SFX Y 0 ly .
SFX G Y 2
SFX G e ing e
SFX G 0 ing [^e]
SFX J Y 2
SFX J e ings e
SFX J 0 ings [^e]
SFX D Y 4
SFX D 0 d e
SFX D y ied [^aeiou]y
SFX D 0 ed [^ey]
SFX D 0 ed [aeiou]y
SFX T N 4
SFX T 0 st e
SFX T y iest [^aeiou]y
SFX T 0 est [aeiou]y
SFX T 0 est [^ey]
SFX R Y 4
SFX R 0 r e
SFX R y ier [^aeiou]y
SFX R 0 er [aeiou]y
SFX R 0 er [^ey]
SFX Z Y 4
SFX Z 0 rs e
SFX Z y iers [^aeiou]y
SFX Z 0 ers [aeiou]y
SFX Z 0 ers [^ey]
SFX S Y 4
SFX S y ies [^aeiou]y
SFX S 0 s [aeiou]y
SFX S 0 es [sxzh]
SFX S 0 s [^sxzhy]
SFX P Y 3
SFX P y iness [^aeiou]y
SFX P 0 ness [aeiou]y
SFX P 0 ness [^y]
SFX M Y 1
SFX M 0 's .
SFX B Y 3
SFX B 0 able [^aeiou]
SFX B 0 able ee
SFX B e able [^aeiou]e
SFX L Y 1
SFX L 0 ment .
REP 90
REP a ei
REP ei a
REP a ey
REP ey a
REP ai ie
REP ie ai
REP alot a_lot
REP are air
REP are ear
REP are eir
REP air are
REP air ere
REP ere air
REP ere ear
REP ere eir
REP ear are
REP ear air
REP ear ere
REP eir are
REP eir ere
REP ch te
REP te ch
REP ch ti
REP ti ch
REP ch tu
REP tu ch
REP ch s
REP s ch
REP ch k
REP k ch
REP f ph
REP ph f
REP gh f
REP f gh
REP i igh
REP igh i
REP i uy
REP uy i
REP i ee
REP ee i
REP j di
REP di j
REP j gg
REP gg j
REP j ge
REP ge j
REP s ti
REP ti s
REP s ci
REP ci s
REP k cc
REP cc k
REP k qu
REP qu k
REP kw qu
REP o eau
REP eau o
REP o ew
REP ew o
REP oo ew
REP ew oo
REP ew ui
REP ui ew
REP oo ui
REP ui oo
REP ew u
REP u ew
REP oo u
REP u oo
REP u oe
REP oe u
REP u ieu
REP ieu u
REP ue ew
REP ew ue
REP uff ough
REP oo ieu
REP ieu oo
REP ier ear
REP ear ier
REP ear air
REP air ear
REP w qu
REP qu w
REP z ss
REP ss z
REP shun tion
REP shun sion
REP shun cion
REP size cise

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,205 @@
SET UTF-8
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
ICONV 1
ICONV '
NOSUGGEST !
# ordinal numbers
COMPOUNDMIN 1
# only in compounds: 1th, 2th, 3th
ONLYINCOMPOUND c
# compound rules:
# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
COMPOUNDRULE 2
COMPOUNDRULE n*1t
COMPOUNDRULE n*mp
WORDCHARS 0123456789
PFX A Y 1
PFX A 0 re .
PFX I Y 1
PFX I 0 in .
PFX U Y 1
PFX U 0 un .
PFX C Y 1
PFX C 0 de .
PFX E Y 1
PFX E 0 dis .
PFX F Y 1
PFX F 0 con .
PFX K Y 1
PFX K 0 pro .
SFX V N 2
SFX V e ive e
SFX V 0 ive [^e]
SFX N Y 3
SFX N e ion e
SFX N y ication y
SFX N 0 en [^ey]
SFX X Y 3
SFX X e ions e
SFX X y ications y
SFX X 0 ens [^ey]
SFX H N 2
SFX H y ieth y
SFX H 0 th [^y]
SFX Y Y 1
SFX Y 0 ly .
SFX G Y 2
SFX G e ing e
SFX G 0 ing [^e]
SFX J Y 2
SFX J e ings e
SFX J 0 ings [^e]
SFX D Y 4
SFX D 0 d e
SFX D y ied [^aeiou]y
SFX D 0 ed [^ey]
SFX D 0 ed [aeiou]y
SFX T N 4
SFX T 0 st e
SFX T y iest [^aeiou]y
SFX T 0 est [aeiou]y
SFX T 0 est [^ey]
SFX R Y 4
SFX R 0 r e
SFX R y ier [^aeiou]y
SFX R 0 er [aeiou]y
SFX R 0 er [^ey]
SFX Z Y 4
SFX Z 0 rs e
SFX Z y iers [^aeiou]y
SFX Z 0 ers [aeiou]y
SFX Z 0 ers [^ey]
SFX S Y 4
SFX S y ies [^aeiou]y
SFX S 0 s [aeiou]y
SFX S 0 es [sxzh]
SFX S 0 s [^sxzhy]
SFX P Y 3
SFX P y iness [^aeiou]y
SFX P 0 ness [aeiou]y
SFX P 0 ness [^y]
SFX M Y 1
SFX M 0 's .
SFX B Y 3
SFX B 0 able [^aeiou]
SFX B 0 able ee
SFX B e able [^aeiou]e
SFX L Y 1
SFX L 0 ment .
REP 90
REP a ei
REP ei a
REP a ey
REP ey a
REP ai ie
REP ie ai
REP alot a_lot
REP are air
REP are ear
REP are eir
REP air are
REP air ere
REP ere air
REP ere ear
REP ere eir
REP ear are
REP ear air
REP ear ere
REP eir are
REP eir ere
REP ch te
REP te ch
REP ch ti
REP ti ch
REP ch tu
REP tu ch
REP ch s
REP s ch
REP ch k
REP k ch
REP f ph
REP ph f
REP gh f
REP f gh
REP i igh
REP igh i
REP i uy
REP uy i
REP i ee
REP ee i
REP j di
REP di j
REP j gg
REP gg j
REP j ge
REP ge j
REP s ti
REP ti s
REP s ci
REP ci s
REP k cc
REP cc k
REP k qu
REP qu k
REP kw qu
REP o eau
REP eau o
REP o ew
REP ew o
REP oo ew
REP ew oo
REP ew ui
REP ui ew
REP oo ui
REP ui oo
REP ew u
REP u ew
REP oo u
REP u oo
REP u oe
REP oe u
REP u ieu
REP ieu u
REP ue ew
REP ew ue
REP uff ough
REP oo ieu
REP ieu oo
REP ier ear
REP ear ier
REP ear air
REP air ear
REP w qu
REP qu w
REP z ss
REP ss z
REP shun tion
REP shun sion
REP shun cion
REP size cise

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
SET ISO8859-2
TRY ABCDEFGHIJKLMNOPQRSTUVWXY<58><59><EFBFBD><EFBFBD><EFBFBD>о<EFBFBD>abcdefghijklmnopqrstuvwxy
SFX A Y 13
SFX A 0 a [^aeiou]
SFX A 0 u [^aeiou]
SFX A 0 e [^aeiou]
SFX A 0 om [^aeiou]
SFX A a e a
SFX A a i a
SFX A a om a
SFX A o a o
SFX A o u o
SFX A o om o
SFX A e a e
SFX A e u e
SFX A e em e
SFX B Y 5
SFX B ti m ti
SFX B ti <20> ti
SFX B ti mo ti
SFX B ti te ti
SFX B ti u ti
SFX C Y 4
SFX C ti h ti
SFX C ti smo ti
SFX C ti ste ti
SFX C ti <20>e ti
SFX D Y 5
SFX D ti h ti
SFX D ti <20>e ti
SFX D ti smo ti
SFX D ti ste ti
SFX D ti hu ti
SFX E Y 3
SFX E ti o ti
SFX E ti li ti
SFX E ti la ti
SFX F Y 5
SFX F ti h ti
SFX F ti <20>e ti
SFX F ti smo ti
SFX F ti ste ti
SFX F iti hu ti
SFX G Y 5
SFX G ti m ti
SFX G ti <20> ti
SFX G ti mo ti
SFX G ti te ti
SFX G iti e iti
SFX H Y 6
SFX H 0 a .
SFX H 0 u .
SFX H 0 i .
SFX H 0 ih .
SFX H 0 im .
SFX H 0 e .
SFX I Y 6
SFX I 0 a .
SFX I 0 u .
SFX I 0 i .
SFX I 0 ih .
SFX I 0 ima .
SFX I 0 e .
SFX J Y 6
SFX J 0 a .
SFX J 0 u .
SFX J 0 i .
SFX J 0 ih .
SFX J 0 im .
SFX J 0 o .
SFX K Y 6
SFX K 0 a .
SFX K 0 u .
SFX K 0 i .
SFX K 0 ih .
SFX K 0 ima .
SFX K 0 o .
SFX L Y 2
SFX L 0 oj .
SFX L 0 om .
SFX M Y 4
SFX M a e a
SFX M a i a
SFX M a o a
SFX M a u a

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
SET UTF-8
LANG sr
TRY аиоенртсвумклпјдгзбшчцхћњљжфђџАИОЕНРТСВУМКЛПЈДГЗБШЧЦХЋЊЉЖФЂЏ
KEY љњертжуиопшђж|асдфгхјклчћ|зџцвбнм|жшђ|ћшч|жчђ|ђћж|зж|љањседрфтгжхуј|јиколпч|азсџдцфвгбх|хнјмк
MAP 4
MAP цћ
MAP цч
MAP зж
MAP сш
REP 8
REP дј ђ
REP лј љ
REP нј њ
REP дж џ
REP ц с # Ако хоћу да откуцам слово „С“ могу се залетети за ознаком на тастатури и уписати „Ц“ (C)
REP п р # Ако хоћу да откуцам слово „В“ могу се залетети за ознаком и уписати „Б“ (B)
REP џ х # Ако хоћу да откуцам слово „Р“ могу се залетети за ознаком и уписати „П“ (P)
REP х н # Ако хоћу да откуцам слово „Х“ могу се залетети за ознаком и уписати „Џ“ (X)
# Ако хоћу да откуцам слово „В“ могу се залетети за ознаком и уписати „Б“ (B) (покривено KEY паром „в - б“)
ICONV 3
ICONV ҵ тц
ICONV ҥ нг
ICONV ӕ ае

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long