-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclear_settings.py
More file actions
50 lines (40 loc) · 1.65 KB
/
clear_settings.py
File metadata and controls
50 lines (40 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from PySide6 import QtWidgets as qtw
from PySide6 import QtCore as qtc
from pathlib import Path
qapp = qtw.QApplication.instance()
if not qapp:
qapp = qtw.QApplication()
mw = qtw.QWidget()
layout = qtw.QVBoxLayout()
label = qtw.QLabel()
layout.addWidget(label)
mw.setLayout(layout)
APP_DEFINITIONS = {"app_name": "Linecraft",
"version": "0.3.0rc0",
# "version": "Test build " + today.strftime("%Y.%m.%d"),
"description": "Linecraft - Frequency response plotting and statistics",
"copyright": "Copyright (C) 2026 Kerem Basaran",
"icon_path": str(Path("./logo/icon.ico")),
"author": "Kerem Basaran",
"author_short": "kbasaran",
"email": "kbasaran@gmail.com",
"website": "https://github.com/kbasaran",
}
settings_storage_title = (APP_DEFINITIONS["app_name"]
+ " v"
+ (".".join(APP_DEFINITIONS["version"].split(".")[:2])
if "." in APP_DEFINITIONS["version"]
else "???"
)
)
app_settings = qtc.QSettings(APP_DEFINITIONS["author_short"], settings_storage_title)
label_text = f"Storage title: {settings_storage_title}\n"
label_text += "Data:\n\n"
for key, val in app_settings.get_all_as_dict().items():
label_text += f"{key}: {type(app_settings.value(key))}, value: {app_settings.value(key)}\n"
# Clear settings
app_settings.clear()
label_text += "\nAll stored settings cleared."
label.setText(label_text)
mw.show()
qapp.exec()