diff --git a/src/PYMD/_pymd.py b/src/PYMD/_pymd.py
index f5ef935..1b86690 100644
--- a/src/PYMD/_pymd.py
+++ b/src/PYMD/_pymd.py
@@ -1,9 +1,5 @@
-from ._converter import Converter
-from ._files_manager import FileManager
+from .db_manager import db_manage
from chromologger import Logger as Log
-from .interface import run
-import sys
-
log:Log = Log('./logs/log_pymd')
@@ -13,4 +9,6 @@
class Pymd:
@staticmethod
def run_app():
+ db_manage.database_config()
+ from .interface import run
run()
\ No newline at end of file
diff --git a/src/PYMD/database/_db.py b/src/PYMD/database/_db.py
deleted file mode 100644
index b209f57..0000000
--- a/src/PYMD/database/_db.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from sqlazo import Database
-from chromologger import Logger as Log
-
-log = Log('./log.log')
-
-db = Database('./config.db', False)
-# Query to validate that the table exists
-validate_query = db.get_data_where('config_ui', 'id == 1')
-if validate_query is None:
- cols_config: list[str] = ['id INTEGER PRIMARY KEY', 'name TEXT NOT NULL', 'value TEXT NOT NULL']
- db.create_table('config_ui', cols_config)
- db.insert_data(['current_lang_code', 'es_CO'], ['name', 'value'], 'config_ui')
- db.insert_data(['last_directory_open', 'C:/'], ['name', 'value'], 'config_ui')
- db.insert_data(['last_directory_output', 'C:/'], ['name', 'value'], 'config_ui')
diff --git a/src/PYMD/database/__init__.py b/src/PYMD/db_manager/__init__.py
similarity index 100%
rename from src/PYMD/database/__init__.py
rename to src/PYMD/db_manager/__init__.py
diff --git a/src/PYMD/db_manager/db_manage.py b/src/PYMD/db_manager/db_manage.py
new file mode 100644
index 0000000..a6d4513
--- /dev/null
+++ b/src/PYMD/db_manager/db_manage.py
@@ -0,0 +1,15 @@
+from sqlazo import Database
+from chromologger import Logger as Log
+
+log = Log('./log.log')
+
+def database_config():
+ db = Database('./db_manager/config.db', False)
+ # Query to validate that the table exists
+ validate_query = db.get_data_where('config_ui', 'id == 1')
+ if validate_query is None:
+ cols_config: list[str] = ['id INTEGER PRIMARY KEY', 'name TEXT NOT NULL', 'value TEXT NOT NULL']
+ db.create_table('config_ui', cols_config)
+ db.insert_data(['current_lang_code', 'es_CO'], ['name', 'value'], 'config_ui')
+ db.insert_data(['last_directory_open', 'C:/'], ['name', 'value'], 'config_ui')
+ db.insert_data(['last_directory_output', 'C:/'], ['name', 'value'], 'config_ui')
diff --git a/src/PYMD/interface/_interface.py b/src/PYMD/interface/_interface.py
index 1084e0f..71b9943 100644
--- a/src/PYMD/interface/_interface.py
+++ b/src/PYMD/interface/_interface.py
@@ -15,7 +15,7 @@
# Feature: Change focus order (the exit dialog focus is "ok", should be "cancel")
-db = Database('./database/config.db', False)
+db = Database('./db_manager/config.db', False)
log:Log = Log('./logs/log_interface')
app = QApplication(sys.argv)
@@ -29,8 +29,8 @@ def __init__(self, parent=None):
super().__init__(parent)
self.__closed_ui:bool = False
self.current_lang = lang_manager.lang_code
- lang_manager.set_super_parent(self)
self.ui: Ui_MainWindow = Ui_MainWindow()
+ lang_manager.set_super_parent(self)
self.ui.setupUi(self)
self.__listeners()
# Hide views temporally (to Show initial help)
@@ -71,10 +71,12 @@ def __open_file(self):
# Save last directory
print(self.__filename.absolute().parent.__str__())
db.insert_data(['last_directory_open', self.__filename.absolute().parent.__str__()], ['name', 'value'], 'config_ui')
+
# Feature: Show progress bar
# => Can be a Label image (hide initialHelp if all ok, continue else show initialHelp again)
__converter:Converter = Converter(self.__filename.absolute().__str__())
__content:str | None = __converter.convert_file().data_str
+
if __content is not None:
self.__init_help.hide()
self.ui.frame_views.show()
@@ -113,7 +115,7 @@ def __extensions(self) -> str:
def __exit(self, event_target: QCloseEvent | None = None):
__result:int = self.__box_dialog(self.tr('Close Program'),self.tr('Do you want to close this program?'),{'ok': self.tr('Accept')}).exec()
- print(__result)
+
if __result == 1024:
self.__closed_ui = True
self.close()
@@ -129,11 +131,15 @@ def __language(self):
if self.ui.text_preview_mode.isVisible():
# Show a warning dialog before change language
__result = self.__box_dialog(self.tr('Warning'), self.tr('Extracted content will be deleted once you change the language (unless you have already saved it)'),{'ok': self.tr('Accept')}).exec()
+
if not self.ui.text_preview_mode.isVisible() or __result == 1024:
#Feature: Save content in a temporal file (The content is removed when language change)
lang_manager.show_dialog()
- #Update UI language
+
+ #Update UI language (MainWindow > childs and Language Dialog)
self.ui.retranslateUi(self)
+ lang_manager.lang_dialog.retranslateUi(lang_manager)
+
self.current_lang = lang_manager.lang_code
# When initial info screen is visible
if self.__init_help.info.isVisible(): self.__init_help.load_info(self.current_lang)
@@ -149,10 +155,12 @@ def __box_dialog(self, title:str = '', text:str = '', buttons_cancel_ok:dict | N
__dialog.setWindowIcon(__icon)
__dialog.setWindowTitle(title)
__dialog.setText(text)
+
# Has been received a dict with buttons
if buttons_cancel_ok is not None and type(buttons_cancel_ok) is dict:
if 'ok' in buttons_cancel_ok: __buttons_txt[0] = buttons_cancel_ok['ok']
if 'cancel' in buttons_cancel_ok: __buttons_txt[1] = buttons_cancel_ok['cancel']
+
# Set visible text for each button
__dialog.button(__dialog.StandardButton.Ok).setText(__buttons_txt[0])
__dialog.button(__dialog.StandardButton.Cancel).setText(__buttons_txt[1])
diff --git a/src/PYMD/interface/_lang.py b/src/PYMD/interface/_lang.py
index 0c26148..c7e9902 100644
--- a/src/PYMD/interface/_lang.py
+++ b/src/PYMD/interface/_lang.py
@@ -1,10 +1,10 @@
from PySide6.QtCore import Qt, QTranslator, QLocale
-from PySide6.QtWidgets import QApplication
+from PySide6.QtWidgets import QApplication, QMainWindow
from .ui_dialog_language import Ui_Lang_Dialog
from PySide6.QtWidgets import QDialog
from sqlazo import Database
-db = Database('./database/config.db', False)
+db = Database('./db_manager/config.db', False)
class LanguageManager(QDialog):
def __init__(self, app:QApplication=None):
@@ -14,19 +14,23 @@ def __init__(self, app:QApplication=None):
self.lang_file:str = ''
self.__translator:QTranslator = QTranslator(app)
self.__app:QApplication = app
- self.parent = None
- self.__lang_dialog = None
+ self.parent:QMainWindow | None = None
+ self.lang_dialog:Ui_Lang_Dialog | None = None
def set_super_parent(self, parent):
self.parent = parent
super().__init__(self.parent)
- self.__lang_dialog = Ui_Lang_Dialog()
- self.__lang_dialog.setupUi(self)
+ self.lang_dialog = Ui_Lang_Dialog()
+ self.lang_dialog.setupUi(self)
def show_dialog(self):
+ __buttons_dialog = self.lang_dialog.dialog_btn
+ __buttons_dialog.setStandardButtons(__buttons_dialog.StandardButton.Ok | __buttons_dialog.StandardButton.Cancel)
+ __buttons_dialog.button(__buttons_dialog.StandardButton.Ok).setText(self.tr('Save'))
+ __buttons_dialog.button(__buttons_dialog.StandardButton.Cancel).setText(self.tr('Cancel'))
self.exec()
- if self.result() == 1 and self.__lang_dialog.languages.currentItem() is not None:
- self.lang_code:str = self.__lang_dialog.languages.currentItem().toolTip()
+ if self.result() == 1 and self.lang_dialog.languages.currentItem() is not None:
+ self.lang_code:str = self.lang_dialog.languages.currentItem().toolTip()
# Pending improvement (when 'update_data' is added to 'sqlazo')
db.delete_data('config_ui', 'name == "current_lang_code"')
db.insert_data(['current_lang_code', self.lang_code], ['name', 'value'], 'config_ui')
diff --git a/src/PYMD/interface/translations/locale/pymd_en_GB.qm b/src/PYMD/interface/translations/locale/pymd_en_GB.qm
index ecdf4e7..84f9cbe 100644
Binary files a/src/PYMD/interface/translations/locale/pymd_en_GB.qm and b/src/PYMD/interface/translations/locale/pymd_en_GB.qm differ
diff --git a/src/PYMD/interface/translations/locale/pymd_en_GB.ts b/src/PYMD/interface/translations/locale/pymd_en_GB.ts
index 69a13c3..dda7bc9 100644
--- a/src/PYMD/interface/translations/locale/pymd_en_GB.ts
+++ b/src/PYMD/interface/translations/locale/pymd_en_GB.ts
@@ -19,30 +19,91 @@
Spanish - CO
+
+ LanguageManager
+
+
+ Save
+ Save
+
+
+
+ Cancel
+ Cancel
+
+
MainWindow
-
+
Open File
Open File
-
Select a file (*pdf *html *docx)
- Select a file (*pdf *html *docx)
+ Select a file (*pdf *html *docx)
+
+
+
+ Select a file
+ Select a file
-
+
+
+
+ Warning
+ Warning
+
+
+
+ The file does not contain plain text (make sure the file content is not just images)
+ The file does not contain plain text (make sure the file content is not just images)
+
+
+
+ Select a directory
+ Select a directory
+
+
+
+ The file is empty
+ The file is empty
+
+
+
+
+
+ Accept
+ Accept
+
+
+
Close Program
Close Program
-
+
Do you want to close this program?
Do you want to close this program?
+
+
+ Extracted content will be deleted once you change the language (unless you have already saved it)
+ Extracted content will be deleted once you change the language (unless you have already saved it)
+
+
+
+ Ok
+ Ok
+
+
+
+ Cancel
+ Cancel
+
PYMD - SRM & TRG
@@ -63,18 +124,6 @@
Markdown
Markdown
-
-
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-hr { height: 1px; border-width: 0; }
-li.unchecked::marker { content: "\2610"; }
-li.checked::marker { content: "\2612"; }
-</style></head><body style=" font-family:'Gabriola'; font-size:12pt; font-weight:400; font-style:normal;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html>
-
-
Preview
@@ -110,9 +159,32 @@ li.checked::marker { content: "\2612"; }
Menu
-
Settings
- Settings
+ Settings
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+hr { height: 1px; border-width: 0; }
+li.unchecked::marker { content: "\2610"; }
+li.checked::marker { content: "\2612"; }
+</style></head><body style=" font-family:'Times New Roman'; font-size:12pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Gabriola';"><br /></p></body></html>
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+hr { height: 1px; border-width: 0; }
+li.unchecked::marker { content: "\2610"; }
+li.checked::marker { content: "\2612"; }
+</style></head><body style=" font-family:'Times New Roman'; font-size:12pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Gabriola';"><br /></p></body></html>
+
+
+
+ Preferences
+ Preferences
@@ -170,17 +242,29 @@ li.checked::marker { content: "\2612"; }
Open Source Licences
+
+ OSL
+
+
+ {__name_library.capitalize()} - original: {__links[__name_library.lower()]}
+ {__name_library.capitalize()} - original: {__links[__name_library.lower()]}
+
+
about_dialog
-
+
About
About
-
+
+ <code>pip install pymd</code>
+ <code>pip install pymd</code>
+
+
PYMD
- PYMD
+ PYMD
@@ -207,12 +291,11 @@ li.checked::marker { content: "\2612"; }
PySide6
-
Markdown
- Markdown
+ Markdown
-
+
CREDITS
CREDITS
diff --git a/src/PYMD/interface/translations/locale/pymd_es_CO.qm b/src/PYMD/interface/translations/locale/pymd_es_CO.qm
index cfd4de3..0d0b7a9 100644
Binary files a/src/PYMD/interface/translations/locale/pymd_es_CO.qm and b/src/PYMD/interface/translations/locale/pymd_es_CO.qm differ
diff --git a/src/PYMD/interface/translations/locale/pymd_es_CO.ts b/src/PYMD/interface/translations/locale/pymd_es_CO.ts
new file mode 100644
index 0000000..88d6172
--- /dev/null
+++ b/src/PYMD/interface/translations/locale/pymd_es_CO.ts
@@ -0,0 +1,278 @@
+
+
+
+
+ Lang_Dialog
+
+
+ Select Language
+ Seleccionar Lenguaje
+
+
+
+ English - GB
+ Inglés - GB
+
+
+
+ Spanish - CO
+ Español - CO
+
+
+
+ LanguageManager
+
+
+ Save
+ Guardar
+
+
+
+ Cancel
+ Cancelar
+
+
+
+ MainWindow
+
+
+ Select a file
+ Seleccione un archivo
+
+
+
+
+
+ Open File
+ Abrir Archivo
+
+
+
+
+
+ Warning
+ Precaución
+
+
+
+ The file does not contain plain text (make sure the file content is not just images)
+ El archivo NO contiene text plano (Asegúrate de que el contenido del archivo no sean solo imágenes)
+
+
+
+ Select a directory
+ Seleccione un directorio
+
+
+
+ The file is empty
+ El archivo está vacío
+
+
+
+
+
+ Accept
+ Aceptar
+
+
+
+ Close Program
+ Cerrrar programa
+
+
+
+ Do you want to close this program?
+ ¿Quieres cerrar el programa?
+
+
+
+ Extracted content will be deleted once you change the language (unless you have already saved it)
+ El contenido extraído será eliminado una vez cambie el idioma (a menos que ya lo hayas guardado)
+
+
+
+ Ok
+ Aceptar
+
+
+
+ Cancel
+ Cancelar
+
+
+
+ PYMD - SRM & TRG
+ PYMD - SRM Y TRG
+
+
+
+ Change language
+ Cambiar idioma
+
+
+
+ Ctrl+A
+
+
+
+
+ Markdown
+
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+hr { height: 1px; border-width: 0; }
+li.unchecked::marker { content: "\2610"; }
+li.checked::marker { content: "\2612"; }
+</style></head><body style=" font-family:'Times New Roman'; font-size:12pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Gabriola';"><br /></p></body></html>
+
+
+
+
+ Preview
+ Vista previa
+
+
+
+ Save file to Markdown (.md)
+ Guardar archivo como Markdown
+
+
+
+ Convert
+ Convertir
+
+
+
+ Ctrl+Enter
+ Button to save/convert .md file
+
+
+
+
+ <html><head/><body><p>© 2025 Tutos Rive. Licensed under the <a href="https://github.com/tutosrive/pymd/blob/main/LICENSE"><span style=" text-decoration: underline; color:#27bf73;">MIT License</span></a></p><p><br/></p></body></html>
+ Copyright Notice - Footer
+ <html><head/><body><p>© 2025 Tutos Rive. Bajo <a href="https://github.com/tutosrive/pymd/blob/main/LICENSE"><span style=" text-decoration: underline; color:#27bf73;">Licencia MIT</span></a></p><p><br/></p></body></html>
+
+
+
+ Menu
+ Menú
+
+
+
+ Preferences
+ Preferencias
+
+
+
+ Help
+ Ayuda
+
+
+
+ Ctrl+O
+
+
+
+
+ Exit
+ Salir
+
+
+
+ Ctrl+W
+
+
+
+
+ About
+ Acerca de
+
+
+
+ Ctrl+M
+
+
+
+
+ Language
+ Idioma
+
+
+
+ Ctrl+L
+
+
+
+
+ Theme
+ Tema
+
+
+
+ Ctrl+T
+
+
+
+
+ Open Source Licences
+ Licencias de código abierto
+
+
+
+ OSL
+
+
+ {__name_library.capitalize()} - original: {__links[__name_library.lower()]}
+
+
+
+
+ about_dialog
+
+
+ About
+ Acerca de
+
+
+
+ <code>pip install pymd</code>
+
+
+
+
+ dialog_osl
+
+
+ Open Source Licenses - Notice
+ Lincencias de código abierto - Aviso
+
+
+
+
+ Select a library
+ Seleccione una librería
+
+
+
+ Markitdown
+
+
+
+
+ PySide6
+
+
+
+
+ CREDITS
+ CRÉDITOS
+
+
+