rebase codebase, delete trunk, move threads to backend
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
from src import Icon, settings
|
||||
from src import Icon, settings, logger
|
||||
from .dialog_sources.Ui_settings import Ui_Dialog as _settings
|
||||
from src.ui.widgets.iconLine import IconWidget
|
||||
|
||||
base = """'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
|
||||
@@ -67,10 +67,12 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
self.toolBox.setItemIcon(2, Icon("mail").icon)
|
||||
self.toolBox.setItemIcon(3, Icon("icons").icon)
|
||||
|
||||
logger.info("Settings dialog opened, data loaded")
|
||||
|
||||
def load_config(self):
|
||||
self.db_name.setText(settings.database.name)
|
||||
self.db_path.setText(settings.database.path)
|
||||
self.save_path.setText(settings.save_path)
|
||||
self.save_path.setText(settings.database.temp)
|
||||
self.smtp_address.setText(settings.mail.smtp_server)
|
||||
self.smtp_port.setText(str(settings.mail.port))
|
||||
self.sender_email.setText(settings.mail.sender)
|
||||
@@ -81,7 +83,7 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
)
|
||||
self.editSignature.setHtml(settings.mail.signature)
|
||||
self.zotero_api_key.setText(settings.zotero.api_key)
|
||||
self.zotero_library_id.setText(settings.zotero.library_id)
|
||||
self.zotero_library_id.setText(str(settings.zotero.library_id))
|
||||
self.zotero_library_type.setText(settings.zotero.library_type)
|
||||
for row, color in enumerate(settings.icons.colors):
|
||||
# add a label with the color name, a lineedit with the color value and a button to change the color
|
||||
@@ -94,17 +96,13 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
self.gridLayout_4.addWidget(button, row, 2)
|
||||
for i in range(self.gridLayout_4.count()):
|
||||
self.gridLayout_4.itemAt(i).widget().setFont(QtGui.QFont("Segoe UI", 9))
|
||||
# set scrollarea layout to be a form layout
|
||||
# label = QtWidgets.QLabel("Icon Name")
|
||||
# filename = QtWidgets.QLabel("Dateiname")
|
||||
# self.formLayout.addRow(label, filename)
|
||||
|
||||
for row, icon in enumerate(settings.icons.icons):
|
||||
label = QtWidgets.QLabel(icon)
|
||||
lineedit = QtWidgets.QLineEdit(settings.icons.icons[icon])
|
||||
self.formLayout.addRow(label, lineedit)
|
||||
icon_widget = IconWidget(icon, settings.icons.icons[icon])
|
||||
self.vertical_icons.addWidget(icon_widget)
|
||||
|
||||
def change_color(self, lineedit):
|
||||
logger.debug("Changing color for {}", lineedit.text())
|
||||
colorDialog = QtWidgets.QColorDialog()
|
||||
colorDialog.setSizePolicy()
|
||||
color = colorDialog.getColor()
|
||||
@@ -178,7 +176,7 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
self.save_path.setText(file_dialog.selectedFiles()[0])
|
||||
|
||||
def debug_mode(self):
|
||||
print(self.editSignature.toHtml())
|
||||
logger.debug(self.editSignature.toHtml())
|
||||
|
||||
def return_data(self):
|
||||
port = self.smtp_port.text()
|
||||
@@ -209,10 +207,10 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
|
||||
for color in self.get_colors():
|
||||
settings.icons.colors[color] = self.get_colors()[color]
|
||||
print(color)
|
||||
# print(color)
|
||||
for icon in self.get_icons():
|
||||
settings.icons.icons[icon] = self.get_icons()[icon]
|
||||
settings.icons.save()
|
||||
|
||||
return settings
|
||||
|
||||
def get_colors(self) -> dict:
|
||||
@@ -225,15 +223,16 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
|
||||
def get_icons(self):
|
||||
icons = {}
|
||||
for row in range(self.formLayout.count()):
|
||||
widget = self.formLayout.itemAt(row).widget()
|
||||
if isinstance(widget, QtWidgets.QLineEdit):
|
||||
icons[self.formLayout.itemAt(row - 1).widget().text()] = widget.text()
|
||||
for row in range(self.vertical_icons.count()):
|
||||
widget = self.vertical_icons.itemAt(row).widget()
|
||||
if isinstance(widget, IconWidget):
|
||||
data = widget.return_data()
|
||||
icons[data[0]] = data[1]
|
||||
return icons
|
||||
|
||||
def save(self):
|
||||
config = self.return_data()
|
||||
# print(config)
|
||||
# #print(config)
|
||||
|
||||
config.save()
|
||||
self.accept()
|
||||
|
||||
Reference in New Issue
Block a user