Projeto python/Gnome construído com Builder em fedora 41. Tenho o arquivo do banco de dados chamado ‘CAsqlite.db’, um arquivo ‘conectar.py’ para realizar a conexão e enfermedad_window.ui para chamar outra janela desde a janela principal.
Tenho a seguinte linha de código para conectar uma base de dados sqlite:
with sqlite3.connect(database='/com/github/thorhent/CA/CAsqlite.db') as conn:
A minha dúvida é como trabalhar com as rotas ou caminhos aos arquivos extras, como CAsqlite.db. Entendi que o enfermedad_window.ui deve estar adicionada no arquivo gresource.xml do projeto e os arquivos .py dentro de meson.build.
No arquivo window.py, tenho um método para chamar ler enfermedad_window.ui com a seguinte instrução:
builder.add_from_file('/com/github/thorhent/CA/enfermedad_window.ui')
Se eu coloco a direção literal dos arquivos na pasta do meu projeto (‘/home/user/Projects/clinicalayudante/src/arquivo’), então funciona a partir do gnome-builder, somente. Qual a forma correta de definir os caminhos ou que outras configurações devem ser feitas?
Espero que eu tenha conseguido explicar o meu problema. Obrigado.
Google English Translation:
Python/Gnome project built with Builder on Fedora 41. I have a database file called ‘CAsqlite.db’, a ‘connect.py’ file to make the connection and enfermedad_window.ui to call another window from the main window.
I have the following line of code to connect to a sqlite database:
with sqlite3.connect(database='/com/github/thorhent/CA/CAsqlite.db') as conn:
My question is how to work with the routes or paths to the extra files, such as CAsqlite.db. I understood that enfermedad_window.ui must be added to the project’s gresource.xml file and the .py files inside meson.build.
In the window.py file, I have a method to call read nursing_window.ui with the following instruction:
builder.add_from_file('/com/github/thorhent/CA/enfermedad_window.ui')
If I put the literal path of the files in my project folder (‘/home/user/Projects/clinicalayudante/src/file’), then it works from gnome-builder, only. What is the correct way to define the paths or what other configurations should be made?
I hope I was able to explain my problem. Thank you.