-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add commandline processing to launch.py #1828
Conversation
The QCoreApplication.instance() handle in get_all_languages() is unnecessary and never used.
This creates the reroute_output() method, allowing the rerouting of stdout and stderr into the logger to be delayed until after commandline arguments are processed and any output displayed
This add standard Python argparse handling for command-line arguments to launch.py, which now responds to `--help` with: ```console src/launch.py --help Loaded modules from current directory: /home/ferd/rpmbuild/REPOS/openshot-qt/src usage: launch.py [-h] [--list-languages] [-V] OpenShot version 2.4.2 optional arguments: -h, --help show this help message and exit --list-languages -V, --version ``` There is also commented out code for another argument, `--lang`, to set the interface language on the command line via language code (as listed using `--list-languages`). That will require the changes from from PR OpenShot#1795 before it can be enabled.
The output of $ src/launch.py --list-lang
Loaded modules from current directory: /home/ferd/rpmbuild/REPOS/openshot-qt/src
Supported Languages:
en_US American English
mk Македонски
hu Magyar
is Íslenska
bg Български
ms Bahasa Melayu
pt_BR Português
gl Galego
ber
ca@valencia Català
pt Português
ko 한국어
ug ئۇيغۇرچە
zh_TW 繁體中文
my မြန်မာ
fr_CA Français Canadien
shn
si සිංහල
lv Latviešu
tr Türkçe
en_CA Canadian English
vi Tiếng Việt
et Eesti
sr@latin Српски
id Indonesia
cy Cymraeg
ne नेपाली
sv Svenska
az Azərbaycan
nl Nederlands
bs Bosanski
gaa
zh_HK 繁體中文
la
be Беларуская
bn বাংলা
ady
es Español De España
ar العربية
ky Кыргызча
af Afrikaans
br Brezhoneg
en_AU Australian English
te తెలుగు
nap
kab Taqbaylit
ja 日本語
ia
ckb کوردیی ناوەندی
jv
da Dansk
sk Slovenčina
tt
de Deutsch
ku
ta தமிழ்
fr Français
lt Lietuvių
am አማርኛ
fy West-Frysk
el Ελληνικά
kn ಕನ್ನಡ
eo
kk Қазақ Тілі
fi Suomi
eu Euskara
uz O‘Zbek
sq Shqip
fo Føroyskt
ast Asturianu
nb Norsk Bokmål
hy Հայերեն
fil Filipino
ml മലയാളം
nn Nynorsk
mn Монгол
uk Українська
sl Slovenščina
ro Română
zh_CN 简体中文
ru Русский
pa ਪੰਜਾਬੀ
he עברית
cs Čeština
se Davvisámegiella
oc
ca Català
th ไทย
fa فارسی
hr Hrvatski
en_GB British English
sr Српски
ka ქართული
it Italiano
hi हिन्दी
pl Polski (But when the new translation-loading code in #1795 gets merged, it'll be sorted English-alphabetically by country code, instead of that random mess you see now.) |
...Aaaand, I just realized this text needs to be translatable. (I guess? Not really sure how that works on the command line. Obviously, the flags can't be localized.. can they? Anyway, the descriptive text probably should be.) |
@ferdnyc - Maybe the descriptive text.. not sure really. 😆 Do you think we need to have those translated before merging or can we just merge to solve the majority of translation problems. |
@DylanC My general thoughts on that, I left in this comment, which was on N3WWN's closed-and-reopened-against-develop "Save Current Frame" PR:
...However, if we were talking about Qt code for the interface, the requirement would have to be that the strings are translat-able, that is, they're properly wrapped in the The strings in this PR are neither, because at the point But because these are purely developer/tester options that aren't intended for enduser use, my feeling is that it's OK for them to go untranslated, the same way the log files OpenShot outputs aren't translated. At least for now. IMHO. (If we do manage to make the output translatable and get translations at some later point, great.) |
@ferdnyc - No problem. I'm familiar with QTranslator and how it works. If we don't have it available yet I don't see any point in holding back this PR for now. 👍 |
Sorry, didn't mean to imply otherwise. I have a tendency to be overly detailed. Not because I feel I'm imparting any great insights, or even that I'm under the impression I'm saying anything that isn't already understood by everyone involved. In fact, that's kind of the whole idea: By laying out my own assumptions and understanding, I can confirm that I'm on the same page as everybody else. And if there's anything I've got wrong I can be challenged or corrected on it, hopefully before I proceed down a wrong path based on that misconception. (Which is why I'll often end up correcting or amending my own posts well after the fact, once I've gotten a better grasp of whatever I was previously discussing and realize that there were wild inaccuracies in my earlier statements.) Heck, you probably know way more about QTranslator than I do, since I still feel like I understand nothing about how and what it really does. I've only just barely managed to grok what I needed in order to break (and hopefully rebuild) the language-selection code in OpenShot. Which reminds me, I should really finish that up. I have to just put the tutorial code down and focus on something else for now, and it would be good to get the translation-handling streamlined and merge-able (or at least merge-ready, since I still think it needs more testing by more people before anyone should consider merging it.) |
@ferdnyc - Its no problem. I wasn't offended or anything like that. I'm only saying that I do know it or know a certain amount about using it. I've developed my own project in C++ and Qt5. Soon my app will be in Debian (Unstable). I have an implementation of translations in my project but its extremely simple. It reads the language from the preferences but if that folder doesn't exist it sets the language based on the system locale as the default. Its nothing fancy but it works for users and users have reported it to "work well", which is good enough for me. My knowledge reaches as far as Qt5 but I don't know Python at all. This is why I feel a bit limited on code contributions to the project. LibOpenShot is also a bit different to using C++ for a frontend, so I'm a bit limited on that aspect too. |
This adds standard Python argparse handling for command-line arguments to
launch.py, which now responds to
--help
with:There is also commented out code for another argument,
--lang
, to set theinterface language on the command line via language code (as listed using
--list-languages
). That will require the changes from from PR #1795before it can be enabled.