Creating a Twitter Client for Blind and Visually Impaired People


Once upon a time

Well, one day last year I was checking my timeline and a tweet caught my attention.

https://twitter.com/homem100medo/status/1043886303455191040

This is from Victor and the important thing to know about Victor is that he’s blind. He used to use software called TheQube to access his tweets. Turns out that Twitter changed the API and he and other users can no longer access their DM’s. Victor was asking Python developers to help.

I thought: I’m a Python developer. API changes? Pfff. Of course I can help! So, let’s dig into this project! At the beginning I didn’t really know what I was doing, so Victor helped me to understand a bit more about the project. No screen, operated mostly via shortcuts. How would be possible to access Twitter like this? The idea totally blew my mind. I started to work on the issue and the truth is: I dug into the code and I spent some time trying to make it run. Was not possible. Going through the Github issues I could see that TheQube was no longer maintained.

Since this was an important software for so many people, I decided to do an experiment: re-writing with the basic functions and using recent technologies.

The experiment

I called this experiment/project Pardal (sparrow in English).

So, I came up with a plan to solve three problems:

  1. Make sure that this new software keeps the basic features of the TheQube. That includes global shortcuts, so they can call a feature from anywhere in their OS; templates: the users should be able to customize their own templates as they like it; text-to-speech: this new software should be able to read things using the local screen reader.
  2. Being multiplatform: Windows, Linux, and MacOS. TheQube only supports Windows. The idea on having a Multiplatform project is making it accessible for more people and making it easy for developers to test.
  3. Low entry barrier to start contributing: must be easy to find things, to run and to test. Apart from that, must be welcoming to everyone who’d like to contribute.

How can I choose the best platform for a project like this?

According to the Internet, writing desktop apps in Python is not the most pleasant thing in the world. Back then, I ignored this and I did implement the basic features. It worked but I found many problems when running it in different OS. So, talking with an ex-coworker he raised many options on Desktop apps. Among these options, Electron. In case you don’t know: Electron is a platform to build cross platform desktop apps with JavaScript, HTML, and CSS. Apps like Atom and VS Code are written in Electron.

Checking what matters

But let’s compare Python and Electron solutions in Pardal’s context.

Global shortcuts

Starting with global shortcuts: I don’t know about you but before this project I had no idea how to create shortcuts in Python. Python have ways to detect keyboard events but it’s not for humans. The most popular libraries available unfortunatelly don’t work well on multi platform apps. I tested libraries like keyboard and pynput. Electron has it out of the box and works like a charm.

Templates

Another important feature is templates. The users must be able to define variables and change the way a tweet or a DM is gonna be read. Something like this:

$screen_name $created_data $text $source

Easy in languages like JS and Python (actually, in almost all programming languages). :)

Text-to-speech

Python doesn’t have a built in solution for it but a lib called espeak works fine for Linux and Windows. Unfortunately, not for MacOS. I got by this by calling say on MacOS.

Electron has native support from Chromium. Meaning: everything that is implemented in the browser, we can access, like Speech Synthesis API.

Multiplatform

To generate installers, pyinstaller seems the most popular in the Python community but requires lots of configuration for each OS. Electron’s got a multiplatform support that works like the apps were native, which is really helpful. We can invest time on delivering features instead of being solving incompatilibities.

Conclusion

My conclusion about this is: it better fail fast. With this experiment I could learn a lot about accessibility and desktop apps. I love working with Python but this time JavaScript won (never thought I would say something like this in my life). 😅

To make a project like this work, we need you. There are many ways of contributing: you can help translating things, giving inputs about packaging, doing code reviews, testing and developing. You can find more at pard.al or on our Github issues.

This is something that can make a difference to people’s lives. I hope you will join us!


comments powered by Disqus