-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
34 lines (28 loc) · 1.26 KB
/
config.py
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
from calibre.utils.config import JSONConfig
from PyQt5.Qt import QWidget, QLabel, QLineEdit, QGridLayout
prefs = JSONConfig("plugins/rmapi_device_plugin")
prefs.defaults["rmapi"] = "rmapi"
prefs.defaults["export_path"] = "calibre_export"
class ConfigWidget(QWidget):
def __init__(self):
QWidget.__init__(self)
self.layout = QGridLayout()
self.layout.setSpacing(10)
# rMAPI path
self.rmapi_label = QLabel("rMAPI Path:")
self.layout.addWidget(self.rmapi_label, 1, 0)
self.rmapi_label_edit = QLineEdit(self)
self.rmapi_label_edit.setText(prefs["rmapi"])
self.layout.addWidget(self.rmapi_label_edit, 1, 1)
# Export path
self.export_path_label = QLabel("rMAPI Path:")
self.layout.addWidget(self.export_path_label, 2, 0)
self.export_path_label_edit = QLineEdit(self)
self.export_path_label_edit.setText(prefs["export_path"])
self.layout.addWidget(self.export_path_label_edit, 2, 1)
self.setLayout(self.layout)
self.setGeometry(150, 150, 150, 150)
self.setWindowTitle("rMAPI Device Driver Config")
def save_settings(self):
prefs["rmapi"] = self.rmapi_label_edit.text()
prefs["export_path"] = self.export_path_label_edit.text()