From 05e57051fb6bf346da7e0700a1262579b346d827 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Thu, 8 Feb 2024 22:06:54 +0100 Subject: Typo --- .gitignore | 74 ++++++++++++++++++++ .vscode/launch.json | 7 ++ 10090.adv | 19 +++++ Mga Advisor.desktop | 17 +++++ mga-advisor.py | 2 +- mga-advisor.pyproject | 3 + mga-advisor.pyproject.user | 168 +++++++++++++++++++++++++++++++++++++++++++++ test.py | 103 +++++++++++++++++++++++++++ 8 files changed, 392 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 10090.adv create mode 100755 Mga Advisor.desktop create mode 100644 mga-advisor.pyproject create mode 100644 mga-advisor.pyproject.user create mode 100644 test.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0a3214f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,7 @@ +{ + // Utilisez IntelliSense pour en savoir plus sur les attributs possibles. + // Pointez pour afficher la description des attributs existants. + // Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [] +} \ No newline at end of file diff --git a/10090.adv b/10090.adv new file mode 100644 index 0000000..8a59626 --- /dev/null +++ b/10090.adv @@ -0,0 +1,19 @@ +ID: MGASA-2013-0161 +pubtime: 1370521473 +type: security +src: + 2: + core: + - krb5-1.9.2-2.6.mga2 + 3: + core: + - krb5-1.11.1-1.2.mga3 +CVE: + - CVE-2002-2443 +subject: Updated krb5 packages fix security vulnerability +description: | + The kpasswd service provided by kadmind was vulnerable to a UDP + ping-pong attack (CVE-2002-2443). +references: +- https://bugzilla.redhat.com/show_bug.cgi?id=962531 +- http://www.mandriva.com/en/support/security/advisories/mbs1/MDVSA-2013:166/ diff --git a/Mga Advisor.desktop b/Mga Advisor.desktop new file mode 100755 index 0000000..4b8d60d --- /dev/null +++ b/Mga Advisor.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Comment[fr_FR]= +Comment= +Exec=python /home/yves/dev/git-mga/mga-advisor/mga-advisor.py +GenericName[fr_FR]= +GenericName= +Icon=mageia-menu +MimeType= +Name[fr_FR]=Mageia Advisor +Name=Mageia Advisor +Path= +StartupNotify=true +Terminal=false +TerminalOptions= +Type=Application +X-KDE-SubstituteUID=false +X-KDE-Username= diff --git a/mga-advisor.py b/mga-advisor.py index 4bf4d26..ef34888 100644 --- a/mga-advisor.py +++ b/mga-advisor.py @@ -262,7 +262,7 @@ class Widget(QWidget): if self.ui.bug_le.text() != "": filename = os.path.join(QDir().homePath()+ default_path, f"{self.ui.bug_le.text()}.adv") if os.path.exists(filename): - response = QMessageBox.question(self, 'File exists', f'The file {filename} already exists. Do you want to override it ?', QMessageBox.Yes | QMessageBox.No) + response = QMessageBox.question(self, 'File exists', f'The file {filename} already exists. Do you want to overwrite it ?', QMessageBox.Yes | QMessageBox.No) if response == QMessageBox.No: return with open(filename, 'w') as f: diff --git a/mga-advisor.pyproject b/mga-advisor.pyproject new file mode 100644 index 0000000..aac4cd4 --- /dev/null +++ b/mga-advisor.pyproject @@ -0,0 +1,3 @@ +{ + "files": ["form.ui","mga-advisor.py"] +} diff --git a/mga-advisor.pyproject.user b/mga-advisor.pyproject.user new file mode 100644 index 0000000..0ca96ea --- /dev/null +++ b/mga-advisor.pyproject.user @@ -0,0 +1,168 @@ + + + + + + EnvironmentId + {8f18dd68-d96e-4e4b-962d-320345646bee} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 2 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Qt 5.15.2 (qt5) + Qt 5.15.2 (qt5) + {560b780a-6f8a-4679-b2bf-6014ad708986} + 0 + 0 + 0 + + /home/yves/dev/mga-advisor + + + true + Python.PysideBuildStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + 0 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + build + Python.PySideBuildConfiguration + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + mga-advisor.py + PythonEditor.RunConfiguration./home/yves/dev/mga-advisor/mga-advisor.py + /home/yves/dev/mga-advisor/mga-advisor.py + {50bd7459-8cb2-47c0-9c74-668b4f3fba0a} + false + true + false + true + /home/yves/dev/git-mga/mga-advisor + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/test.py b/test.py new file mode 100644 index 0000000..fc85fff --- /dev/null +++ b/test.py @@ -0,0 +1,103 @@ +import sys +from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton, QLabel +from PySide6.QtCore import QSettings, QFile + +class MainWindow(QWidget): + def __init__(self): + super().__init__() + + self.init_ui() + + def init_ui(self): + layout = QVBoxLayout() + + self.lbl_path = QLabel() + self.update_path_label() + + btn_browse = QPushButton('Parcourir') + btn_browse.clicked.connect(self.browse_file) + + layout.addWidget(self.lbl_path) + layout.addWidget(btn_browse) + + self.setLayout(layout) + self.setWindowTitle('Lecture de chemin depuis un fichier de configuration') + + def browse_file(self): + settings_file = QFile('settings.ini') + settings = QSettings(settings_file, QSettings.IniFormat) + filepath, _ = QFileDialog.getOpenFileName(self, "Sélectionner un fichier de configuration", "", "Fichiers de configuration (*.ini)") + if filepath: + settings.setValue('Config/path', filepath) + self.update_path_label() + + def update_path_label(self): + settings_file = QFile('settings.ini') + settings = QSettings(settings_file, QSettings.IniFormat) + filepath = settings.value('Config/path') + if filepath: + self.lbl_path.setText(f'Chemin actuel : {filepath}') + else: + self.lbl_path.setText('Aucun chemin défini dans le fichier de configuration') + +if __name__ == '__main__': + app = QApplication(sys.argv) + window = MainWindow() + window.show() + sys.exit(app.exec()) + + +#################### +# autre solution +import sys +from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton, QLabel, QFileDialog +import configparser + +class MainWindow(QWidget): + def __init__(self): + super().__init__() + + self.init_ui() + + def init_ui(self): + layout = QVBoxLayout() + + self.lbl_path = QLabel() + self.update_path_label() + + btn_browse = QPushButton('Parcourir') + btn_browse.clicked.connect(self.browse_file) + + layout.addWidget(self.lbl_path) + layout.addWidget(btn_browse) + + self.setLayout(layout) + self.setWindowTitle('Lecture de chemin depuis un fichier de configuration') + + def browse_file(self): + options = QFileDialog.Options() + file_dialog = QFileDialog() + file_dialog.setFileMode(QFileDialog.ExistingFile) + filepath, _ = file_dialog.getOpenFileName(self, "Sélectionner un fichier de configuration", "", "Fichiers de configuration (*.ini)", options=options) + if filepath: + config = configparser.ConfigParser() + config.read(filepath) + if 'Config' in config and 'path' in config['Config']: + path = config['Config']['path'] + self.lbl_path.setText(f'Chemin actuel : {path}') + + def update_path_label(self): + # Lecture du chemin à partir du fichier de configuration + config = configparser.ConfigParser() + config.read('config.ini') # Assurez-vous d'avoir un fichier config.ini avec la section [Config] et une clé 'path' + if 'Config' in config and 'path' in config['Config']: + path = config['Config']['path'] + self.lbl_path.setText(f'Chemin actuel : {path}') + else: + self.lbl_path.setText('Aucun chemin défini dans le fichier de configuration') + +if __name__ == '__main__': + app = QApplication(sys.argv) + window = MainWindow() + window.show() + sys.exit(app.exec()) -- cgit v1.2.1