Compare commits
13 Commits
35c977c89e
...
55a35d0931
| Author | SHA256 | Date | |
|---|---|---|---|
| 55a35d0931 | |||
| f61f1e5c8f | |||
| 4c07689a4a | |||
| 5bf1d8de08 | |||
| 09a0daad66 | |||
| 5b031e9d8d | |||
| 155794e489 | |||
| 712df39383 | |||
| f5b32d6621 | |||
| c132b6830a | |||
| a6bed81aaf | |||
| 78ede0fad8 | |||
| 26759be1cb |
@@ -111,4 +111,17 @@ ColumnLayout
|
|||||||
{
|
{
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
var c = config.getCompanyInfo()
|
||||||
|
if (Object.keys(c).length)
|
||||||
|
{
|
||||||
|
companyName.text = c['NAME']
|
||||||
|
street.text = c['STREET']
|
||||||
|
houseno.text = c['HOUSE']
|
||||||
|
zipcode.editText = c['ZIPCODE']
|
||||||
|
city.editText = c['CITY']
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ Item
|
|||||||
|
|
||||||
Text
|
Text
|
||||||
{
|
{
|
||||||
text: model.display === null? "": model.display
|
text: (model.display === null || model.display === undefined)? "": model.display
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|||||||
@@ -249,8 +249,12 @@ class ConfigLoader(QObject):
|
|||||||
self.__saveConfig()
|
self.__saveConfig()
|
||||||
|
|
||||||
@Slot(result = dict)
|
@Slot(result = dict)
|
||||||
def getCompanyInfo():
|
def getCompanyInfo(self):
|
||||||
return self.__config['company']
|
try:
|
||||||
|
return self.__config['company']
|
||||||
|
except KeyError as ex:
|
||||||
|
print(f"Missing company info: {ex}")
|
||||||
|
return None
|
||||||
|
|
||||||
@Slot(dict)
|
@Slot(dict)
|
||||||
def saveMiscConf(self, misc_conf = None):
|
def saveMiscConf(self, misc_conf = None):
|
||||||
@@ -259,7 +263,11 @@ class ConfigLoader(QObject):
|
|||||||
|
|
||||||
@Slot(result = bool)
|
@Slot(result = bool)
|
||||||
def systray(self):
|
def systray(self):
|
||||||
return self.__config['misc']['SYSTRAY']
|
try:
|
||||||
|
return self.__config['misc']['SYSTRAY']
|
||||||
|
except KeyError as ex:
|
||||||
|
print(f"Missing configuration: {ex}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@Slot(str, str)
|
@Slot(str, str)
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ class EmployeeModel(QAbstractTableModel):
|
|||||||
if applicant_col == 2 and self.__everyone:
|
if applicant_col == 2 and self.__everyone:
|
||||||
tr = 'Ja' if tr == 1 else 'Nein'
|
tr = 'Ja' if tr == 1 else 'Nein'
|
||||||
else:
|
else:
|
||||||
tr = re.sub("Keine Angabe ","", tr)
|
if tr:
|
||||||
|
tr = re.sub("Keine Angabe ","", tr)
|
||||||
#print(f"Data: {tr}")
|
#print(f"Data: {tr}")
|
||||||
# return row[index.column() + 2]
|
# return row[index.column() + 2]
|
||||||
return tr
|
return tr
|
||||||
|
|||||||
21
main.py
21
main.py
@@ -2,10 +2,11 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
from PySide6.QtNetwork import QLocalServer, QLocalSocket
|
||||||
from PySide6.QtWidgets import QSystemTrayIcon
|
from PySide6.QtWidgets import QSystemTrayIcon
|
||||||
from PySide6.QtGui import QGuiApplication, QIcon
|
from PySide6.QtGui import QGuiApplication, QIcon
|
||||||
from PySide6.QtQml import QQmlApplicationEngine
|
from PySide6.QtQml import QQmlApplicationEngine
|
||||||
#from PySide6.QtCore import QResource
|
from PySide6.QtCore import QIODevice #, QResource
|
||||||
from lib.ConfigLoader import ConfigLoader
|
from lib.ConfigLoader import ConfigLoader
|
||||||
from lib.DB.BusinessModel import BusinessModel
|
from lib.DB.BusinessModel import BusinessModel
|
||||||
import rc_pyqcrm
|
import rc_pyqcrm
|
||||||
@@ -34,6 +35,7 @@ os.environ['QML_XHR_ALLOW_FILE_READ'] = '1'
|
|||||||
# name=""
|
# name=""
|
||||||
# type=""
|
# type=""
|
||||||
|
|
||||||
|
|
||||||
bad_config = False
|
bad_config = False
|
||||||
db_con = False
|
db_con = False
|
||||||
address_model = None
|
address_model = None
|
||||||
@@ -85,6 +87,19 @@ if __name__ == "__main__":
|
|||||||
app = QGuiApplication(sys.argv)
|
app = QGuiApplication(sys.argv)
|
||||||
engine = QQmlApplicationEngine()
|
engine = QQmlApplicationEngine()
|
||||||
|
|
||||||
|
|
||||||
|
pyq_sok = QLocalSocket()
|
||||||
|
pyq_sok.connectToServer("PYQCRM_INSTANCE", QIODevice.ReadOnly)
|
||||||
|
|
||||||
|
if pyq_sok.state() == QLocalSocket.ConnectedState:
|
||||||
|
print("PYQCRM already running..")
|
||||||
|
print("Stop the running instance before running the application..")
|
||||||
|
sys.exit(-1)
|
||||||
|
else:
|
||||||
|
print("Starting PYQCRM_INSTANCE")
|
||||||
|
pyq_server = QLocalServer()
|
||||||
|
pyq_server.listen("PYQCRM_INSTANCE")
|
||||||
|
|
||||||
engine.addImportPath("qrc:/");
|
engine.addImportPath("qrc:/");
|
||||||
|
|
||||||
# qml_file = Path(__file__).resolve().parent / "Gui/main.qml"
|
# qml_file = Path(__file__).resolve().parent / "Gui/main.qml"
|
||||||
@@ -92,7 +107,7 @@ if __name__ == "__main__":
|
|||||||
qml_file = "qrc:/Gui/main.qml"
|
qml_file = "qrc:/Gui/main.qml"
|
||||||
|
|
||||||
icon = QIcon(":/images/tero.jpg")
|
icon = QIcon(":/images/tero.jpg")
|
||||||
app.setWindowIcon(QIcon(icon))
|
app.setWindowIcon(icon)
|
||||||
|
|
||||||
tray = QSystemTrayIcon()
|
tray = QSystemTrayIcon()
|
||||||
tray.setIcon(icon)
|
tray.setIcon(icon)
|
||||||
@@ -106,10 +121,10 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
initializeProgram()
|
initializeProgram()
|
||||||
|
|
||||||
|
engine.rootContext().setContextProperty("config", config)
|
||||||
engine.rootContext().setContextProperty("sys_printers", printers)
|
engine.rootContext().setContextProperty("sys_printers", printers)
|
||||||
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||||
engine.rootContext().setContextProperty("db_con", db_con)
|
engine.rootContext().setContextProperty("db_con", db_con)
|
||||||
engine.rootContext().setContextProperty("config", config)
|
|
||||||
engine.rootContext().setContextProperty("systray", tray)
|
engine.rootContext().setContextProperty("systray", tray)
|
||||||
|
|
||||||
engine.load(qml_file)
|
engine.load(qml_file)
|
||||||
|
|||||||
Reference in New Issue
Block a user