mirror of
https://github.com/Anjok07/ultimatevocalremovergui.git
synced 2025-02-23 05:29:02 +01:00
Added annotations
This commit is contained in:
parent
ec1dda493c
commit
674d796b23
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"python.pythonPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python37_64\\python.exe"
|
||||||
|
}
|
1
main.py
1
main.py
@ -4,5 +4,6 @@ Run the application
|
|||||||
from src import app
|
from src import app
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run()
|
app.run()
|
||||||
|
@ -4,5 +4,7 @@ librosa==0.7.2
|
|||||||
opencv-python
|
opencv-python
|
||||||
numba==0.48.0
|
numba==0.48.0
|
||||||
numpy==1.19.3
|
numpy==1.19.3
|
||||||
|
PySide2==5.15.2
|
||||||
|
torch
|
||||||
SoundFile
|
SoundFile
|
||||||
soundstretch
|
soundstretch
|
||||||
|
31
src/app.py
31
src/app.py
@ -40,7 +40,7 @@ class CustomApplication(QtWidgets.QApplication):
|
|||||||
|
|
||||||
The class contains instances of all windows and performs
|
The class contains instances of all windows and performs
|
||||||
general tasks like setting up the windows, saving data,
|
general tasks like setting up the windows, saving data,
|
||||||
or improving the functionality of widgets across all windows
|
or improving the functionality of widgets, across all windows.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -77,7 +77,6 @@ class CustomApplication(QtWidgets.QApplication):
|
|||||||
self.logger.info('--- Setting up application ---',
|
self.logger.info('--- Setting up application ---',
|
||||||
indent_forwards=True)
|
indent_forwards=True)
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
# self.windows['main'].pushButton_seperate_clicked()
|
|
||||||
self.logger.indent_backwards()
|
self.logger.indent_backwards()
|
||||||
self.logger.info('--- Finished setup ---')
|
self.logger.info('--- Finished setup ---')
|
||||||
|
|
||||||
@ -284,17 +283,33 @@ class CustomApplication(QtWidgets.QApplication):
|
|||||||
|
|
||||||
|
|
||||||
class Translator:
|
class Translator:
|
||||||
|
"""Localizer for the application
|
||||||
|
|
||||||
|
Manages the languages for the applications
|
||||||
|
|
||||||
|
Args:
|
||||||
|
loaded_language (str):
|
||||||
|
Currently loaded language in the application. To change, run method load_language.
|
||||||
|
"""
|
||||||
def __init__(self, app: CustomApplication):
|
def __init__(self, app: CustomApplication):
|
||||||
self.app = app
|
self.app = app
|
||||||
self.logger = app.logger
|
self.logger = app.logger
|
||||||
self.loaded_language: str
|
self.loaded_language: str
|
||||||
self._translator = QtCore.QTranslator(self.app)
|
self._translator = QtCore.QTranslator(self.app)
|
||||||
|
|
||||||
def load_language(self, language: QtCore.QLocale.Language = QtCore.QLocale.English):
|
def load_language(self, language: QtCore.QLocale.Language = QtCore.QLocale.English) -> bool:
|
||||||
"""
|
"""Load a language on the application
|
||||||
Load specified language by file name
|
|
||||||
|
|
||||||
Default is english
|
Note:
|
||||||
|
language arg info:
|
||||||
|
If the language given is not supported, a warning message will be reported to the logger
|
||||||
|
and the language will be set to english
|
||||||
|
|
||||||
|
Args:
|
||||||
|
language (QtCore.QLocale.Language, optional): Language to load. Defaults to English.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: Whether the applications language was successfully changed to the given language
|
||||||
"""
|
"""
|
||||||
language_str = QtCore.QLocale.languageToString(language).lower()
|
language_str = QtCore.QLocale.languageToString(language).lower()
|
||||||
self.logger.info(f'Translating to {language_str}...',
|
self.logger.info(f'Translating to {language_str}...',
|
||||||
@ -308,7 +323,7 @@ class Translator:
|
|||||||
self.logger.warning(f'Translation file does not exist! Switching to English. Language: {language_str}')
|
self.logger.warning(f'Translation file does not exist! Switching to English. Language: {language_str}')
|
||||||
self.logger.indent_backwards()
|
self.logger.indent_backwards()
|
||||||
self.load_language()
|
self.load_language()
|
||||||
return
|
return False
|
||||||
# get language name to later store in settings
|
# get language name to later store in settings
|
||||||
self.loaded_language = QtCore.QLocale(language).name()
|
self.loaded_language = QtCore.QLocale(language).name()
|
||||||
# Load language
|
# Load language
|
||||||
@ -319,7 +334,6 @@ class Translator:
|
|||||||
self._translator.load(translation_path)
|
self._translator.load(translation_path)
|
||||||
self.app.installTranslator(self._translator)
|
self.app.installTranslator(self._translator)
|
||||||
|
|
||||||
if hasattr(self.app, 'windows'):
|
|
||||||
# -Windows are initialized-
|
# -Windows are initialized-
|
||||||
# Update translation on all windows
|
# Update translation on all windows
|
||||||
for window in self.app.windows.values():
|
for window in self.app.windows.values():
|
||||||
@ -336,6 +350,7 @@ class Translator:
|
|||||||
button.setChecked(False)
|
button.setChecked(False)
|
||||||
|
|
||||||
self.logger.indent_backwards()
|
self.logger.indent_backwards()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Placeholder file so that the log folder gets added when commiting
|
|
Loading…
x
Reference in New Issue
Block a user