В фреймворке PyQt (и PySide тоже) часто встречается настройка чего-либо с помощью так называемых флагов.
widget.setWindowFlags(Qt.Window)
Взаимодействие нескольких флагов делается с помощью бинарных (или побитовых) операторов.
Несколько флагов можно указать с помощью оператора "|"
list_item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
исключить флаг из уже имеющегося набора можно так
list_item.setFlags(list_item.flags() ^ Qt.ItemIsEnabled)
Добавить новый флаг к имеющимся можно так
list_item.setFlags(list_item.flags() | Qt.ItemIsEnabled)
А проверка наличия делается так
is_enabled = item.flags() & Qt.ItemIsEnabled > 0
Почему именно так? Всё дело в том как именно работают побитовые операторы. Но об этом в следующем посте.
#qt
@SubtitleEricBot
Qué puede hacer este bot?
Envie el nombre de la película. Utilice @imdb inline para obtener el nombre correcto de la película.
- Buscaré ese subtítulo.
- A continuación, seleccione el idioma
- Entonces el bot te enviará ese archivo de subtítulos.
Idioma: Inglés
(visto en @BotsGram_cu)
#download, #subtitle
@SubtitleDLbot
Qué puede hacer este bot?
Este bot encuentra y descarga subtítulos
Idioma: Inglés
(visto en @BotsGram_cu)
#subtitle, #subs, #movie, #film, #cinema
#python#asr#captions#cli#python#subtitle#subtitles#transcript#transcripts#translating_transcripts#youtube#youtube_api#youtube_asr#youtube_captions#youtube_subtitles#youtube_transcript#youtube_transcripts#youtube_video
The YouTube Transcript API is a tool that helps you get the text from YouTube videos. It's fast and easy to use, saving you time compared to watching the whole video. You can use it to make subtitles, translate text, and even analyze what's being said in videos. This is helpful for content creators who want to make their videos more accessible and for researchers who need to study video content quickly. It also supports multiple languages, making it useful for a wide range of users.
https://github.com/jdepoix/youtube-transcript-api