V3.4.1 — Integration Windows depuis le menu Aide
- Aide > Integrer a Windows : enregistre en 1 clic - Association fichier PDF (Ouvrir avec) - Menu contextuel (clic droit > CopyDev Impose) - Sous-menu : Ouvrir, Livret A4, Livret A3, 2x2, Delivretiser - Aide > Retirer l'integration Windows : nettoie le registre Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,6 +264,9 @@ class MainWindow(QMainWindow):
|
||||
help_menu = menubar.addMenu("Aide")
|
||||
self._add_action(help_menu, "Rechercher une mise a jour...", None, self._do_check_update)
|
||||
help_menu.addSeparator()
|
||||
self._add_action(help_menu, "Integrer a Windows (menu contextuel + association PDF)", None, self._do_register_windows)
|
||||
self._add_action(help_menu, "Retirer l'integration Windows", None, self._do_unregister_windows)
|
||||
help_menu.addSeparator()
|
||||
self._add_action(help_menu, "A propos de CopyDev Imposing Tool", None, self._show_about)
|
||||
|
||||
def _add_action(self, menu, text, shortcut, callback):
|
||||
@@ -1281,6 +1284,61 @@ class MainWindow(QMainWindow):
|
||||
self._open_pdf(output)
|
||||
self._status_label.setText(f"Document test de {num} pages cree")
|
||||
|
||||
def _do_register_windows(self):
|
||||
if sys.platform != "win32":
|
||||
QMessageBox.information(self, "Windows uniquement", "Cette fonction est reservee a Windows.")
|
||||
return
|
||||
import subprocess
|
||||
exe = sys.executable if getattr(sys, 'frozen', False) else os.path.abspath("main.py")
|
||||
try:
|
||||
cmds = [
|
||||
# Association PDF
|
||||
f'reg add "HKCU\\Software\\Classes\\.pdf\\OpenWithProgids" /v "CopyDevImpose" /t REG_SZ /d "" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\CopyDevImpose" /ve /d "CopyDev Imposing Tool" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\CopyDevImpose\\shell\\open\\command" /ve /d "\\"{exe}\\" \\"%1\\"" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\CopyDevImpose\\DefaultIcon" /ve /d "{exe},0" /f',
|
||||
# Menu contextuel
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose" /ve /d "CopyDev Impose" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose" /v "SubCommands" /t REG_SZ /d "" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose" /v "Icon" /t REG_SZ /d "{exe},0" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\open" /ve /d "Ouvrir avec CopyDev" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\open\\command" /ve /d "\\"{exe}\\" \\"%1\\"" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\bookletA4" /ve /d "Livret A4" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\bookletA4\\command" /ve /d "\\"{exe}\\" --action booklet_a4 \\"%1\\"" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\bookletA3" /ve /d "Livret A3" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\bookletA3\\command" /ve /d "\\"{exe}\\" --action booklet_a3 \\"%1\\"" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\nup2x2" /ve /d "2x2 par feuille" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\nup2x2\\command" /ve /d "\\"{exe}\\" --action nup_2x2 \\"%1\\"" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\unbooklet" /ve /d "Delivretiser" /f',
|
||||
f'reg add "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose\\shell\\unbooklet\\command" /ve /d "\\"{exe}\\" --action unbooklet \\"%1\\"" /f',
|
||||
]
|
||||
for cmd in cmds:
|
||||
subprocess.run(cmd, shell=True, capture_output=True)
|
||||
QMessageBox.information(self, "Integration Windows",
|
||||
"CopyDev Imposing Tool est maintenant integre a Windows !\n\n"
|
||||
"- Clic droit sur un PDF > CopyDev Impose\n"
|
||||
"- Ouvrir avec > CopyDev Imposing Tool")
|
||||
self._status_label.setText("Integration Windows effectuee")
|
||||
except Exception as e:
|
||||
QMessageBox.critical(self, "Erreur", f"Echec de l'integration :\n{e}")
|
||||
|
||||
def _do_unregister_windows(self):
|
||||
if sys.platform != "win32":
|
||||
return
|
||||
import subprocess
|
||||
try:
|
||||
cmds = [
|
||||
'reg delete "HKCU\\Software\\Classes\\CopyDevImpose" /f',
|
||||
'reg delete "HKCU\\Software\\Classes\\.pdf\\OpenWithProgids" /v "CopyDevImpose" /f',
|
||||
'reg delete "HKCU\\Software\\Classes\\SystemFileAssociations\\.pdf\\shell\\CopyDevImpose" /f',
|
||||
]
|
||||
for cmd in cmds:
|
||||
subprocess.run(cmd, shell=True, capture_output=True)
|
||||
QMessageBox.information(self, "Integration Windows", "Integration Windows retiree.")
|
||||
self._status_label.setText("Integration Windows retiree")
|
||||
except Exception as e:
|
||||
QMessageBox.critical(self, "Erreur", str(e))
|
||||
|
||||
def _do_check_update(self):
|
||||
from app.updater import check_for_update, do_update, VERSION
|
||||
self._status_label.setText("Recherche de mises a jour...")
|
||||
|
||||
@@ -14,7 +14,7 @@ REPO = "jules/copydev-imposing-tool"
|
||||
BRANCH = "master"
|
||||
|
||||
# Version actuelle (incrementee a chaque release)
|
||||
VERSION = "3.4.0"
|
||||
VERSION = "3.4.1"
|
||||
|
||||
|
||||
def get_remote_version():
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.4.0
|
||||
3.4.1
|
||||
|
||||
Reference in New Issue
Block a user