-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7e1323
commit 2f25cba
Showing
4 changed files
with
18 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,14 @@ | ||
import os | ||
import sys | ||
from watchdog.observers import Observer | ||
from watchdog.events import FileSystemEventHandler | ||
from PySide6.QtCore import Signal, QObject, QCoreApplication | ||
# reload.py | ||
from PySide6.QtWidgets import QApplication | ||
from src.core.main import MyWindow | ||
|
||
def reload_application(): | ||
app = QApplication([]) | ||
|
||
class ReloadSignal(QObject): | ||
reload_signal = Signal() | ||
window = MyWindow() | ||
window.show() | ||
|
||
def __init__(self): | ||
super().__init__() | ||
app.exec() | ||
|
||
def reload_app(self): | ||
# Fecha a aplicação e reinicia | ||
print("Reiniciando a aplicação...") | ||
QCoreApplication.quit() | ||
os.execv(sys.executable, ["python"] + sys.argv) | ||
|
||
|
||
# Classe de monitoramento de arquivos | ||
class ReloadHandler(FileSystemEventHandler): | ||
def __init__(self, reload_signal): | ||
self.reload_signal = reload_signal | ||
|
||
def on_modified(self, event): | ||
if event.src_path.endswith(".py"): | ||
print("Mudança detectada! Recarregando...") | ||
self.reload_signal.reload_signal.emit() | ||
|
||
|
||
# Função para configurar o monitoramento | ||
def setup_reload_signal(): | ||
reload_signal = ReloadSignal() | ||
return reload_signal | ||
if __name__ == "__main__": | ||
reload_application() |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters