Bei einigen Dateien kann ich den Montageort nicht bearbeiten, da sie auf einmal Zahlen sind

This commit is contained in:
Sven Riwoldt
2024-10-25 19:35:37 +02:00
parent 56fbc57072
commit a8d5f65438
3 changed files with 203 additions and 147 deletions

View File

@@ -17,13 +17,14 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>450</x> <x>450</x>
<y>10</y> <y>0</y>
<width>250</width> <width>171</width>
<height>31</height> <height>31</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Arial Unicode MS</family>
<pointsize>18</pointsize> <pointsize>18</pointsize>
</font> </font>
</property> </property>
@@ -40,6 +41,11 @@
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="font">
<font>
<family>Arial Unicode MS</family>
</font>
</property>
<property name="text"> <property name="text">
<string>Speichern unter</string> <string>Speichern unter</string>
</property> </property>
@@ -50,9 +56,15 @@
<x>300</x> <x>300</x>
<y>60</y> <y>60</y>
<width>331</width> <width>331</width>
<height>16</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="font">
<font>
<family>Arial Unicode MS</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="layoutDirection"> <property name="layoutDirection">
<enum>Qt::RightToLeft</enum> <enum>Qt::RightToLeft</enum>
</property> </property>
@@ -77,6 +89,7 @@
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="font"> <property name="font">
<font> <font>
<family>Arial Unicode MS</family>
<pointsize>12</pointsize> <pointsize>12</pointsize>
</font> </font>
</property> </property>
@@ -90,12 +103,17 @@
<widget class="QPushButton" name="openBtn"> <widget class="QPushButton" name="openBtn">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>160</x> <x>150</x>
<y>30</y> <y>30</y>
<width>85</width> <width>121</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="font">
<font>
<family>Arial Unicode MS</family>
</font>
</property>
<property name="text"> <property name="text">
<string>Öffnen</string> <string>Öffnen</string>
</property> </property>
@@ -111,6 +129,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Arial Unicode MS</family>
<pointsize>13</pointsize> <pointsize>13</pointsize>
</font> </font>
</property> </property>

View File

@@ -5,13 +5,15 @@ from pathlib import Path
import pandas as pd import pandas as pd
from icecream import ic from icecream import ic
import numpy as np import numpy as np
class MainUI(QDialog): # erbt von QDialog
class MainUI(QDialog): # erbt von QDialog
def __init__(self): def __init__(self):
#super (MainUI, self).__init__() #Aufrufen des Konstruktors von QDialog # super (MainUI, self).__init__() #Aufrufen des Konstruktors von QDialog
super().__init__() super().__init__()
loadUi ("Aufbaumaster2CSV.ui", self) loadUi("Aufbaumaster2CSV.ui", self)
self.filename = None self.filename = None
self.path = None self.path = None
self.df_vte = None self.df_vte = None
self.df_cmdb = None self.df_cmdb = None
self.dfb = None self.dfb = None
@@ -21,13 +23,6 @@ class MainUI(QDialog): # erbt von QDialog
self.group = None self.group = None
self.typ = None self.typ = None
def changegroup(self):
self.group = self.gruppierung.currentText()
# ic("Gruppen: ", self.group)
def changegtyp(self):
self.typ = self.geraetetyp.currentText()
# ic("Typ: ", self.typ)
def open_file_dialog(self): def open_file_dialog(self):
self.filename, _ = QFileDialog.getOpenFileName( self.filename, _ = QFileDialog.getOpenFileName(
@@ -42,29 +37,29 @@ class MainUI(QDialog): # erbt von QDialog
if self.filename: if self.filename:
self.path = Path(self.filename) self.path = Path(self.filename)
#self.changetable() self.collect_grundgeraete()
self.collectdata()
# self.collect_erweiterung()
def onClicked(self): def onClicked(self):
pass pass
def collect_grundgeraete(self):
def collectdata(self):
# Einlesen der Sheets # Einlesen der Sheets
self.df_vte = pd.read_excel(self.filename,header=7,na_filter=False,sheet_name="VTE-Input",engine='pyxlsb',usecols=['Hostname','Gruppierung','CONFIG-ID','CMDB Status']) self.df_vte = pd.read_excel(self.filename, header=7, na_filter=False, sheet_name="VTE-Input", engine='pyxlsb',
#print(self.df_vte.head) usecols=['Hostname', 'Gruppierung', 'CONFIG-ID', 'CMDB Status'])
self.df_cmdb = pd.read_excel(self.filename,header=2,sheet_name="CMDB", engine='pyxlsb') # print(self.df_vte.head)
#self.df_sw_asset = pd.read_excel(self.filename,sheet_name="SW-Asset", engine='pyxlsb') self.df_cmdb = pd.read_excel(self.filename, header=2, sheet_name="CMDB", engine='pyxlsb')
# self.df_sw_asset = pd.read_excel(self.filename,sheet_name="SW-Asset", engine='pyxlsb')
# Nach relevanten Spalten filtern # Nach relevanten Spalten filtern
self.df_vte = self.df_vte[self.df_vte['Gruppierung']=='Grundgerät'] self.df_vte = self.df_vte[self.df_vte['Gruppierung'] == 'Grundgerät']
#self.df_vte = self.df_vte.drop(columns=['RAM','Bestelldatum','Hersteller','Lieferant','SAP-Nr.','Lieferdatum','Lieferschein-Nr.','WV-Start','WV-Ende','Aufgaben Schritt','Verkehrsart','Anz.\nHE ']) # self.df_vte = self.df_vte.drop(columns=['RAM','Bestelldatum','Hersteller','Lieferant','SAP-Nr.','Lieferdatum','Lieferschein-Nr.','WV-Start','WV-Ende','Aufgaben Schritt','Verkehrsart','Anz.\nHE '])
self.df_cmdb = self.df_cmdb[self.df_cmdb['Filter'].isin(['Grundgerät','Erweiterung'])] self.df_cmdb = self.df_cmdb[self.df_cmdb['Filter'].isin(['Grundgerät', 'Erweiterung'])]
self.df_cmdb = self.df_cmdb.drop(columns=['WV-Start','WV-Ende','CMDB-Status','Aufgabe Schritt','Filter','Waermeabgabe [BTU/h]','kalk. Strom [A]'])
self.df_cmdb = self.df_cmdb.drop(
columns=['WV-Start', 'WV-Ende', 'CMDB-Status', 'Aufgabe Schritt', 'Filter', 'Waermeabgabe [BTU/h]',
'kalk. Strom [A]'])
# Einfügen von Spalten in die CMDB-Tabelle # Einfügen von Spalten in die CMDB-Tabelle
self.dfb = self.df_vte.merge(self.df_cmdb, on=['Hostname'], how='left') self.dfb = self.df_vte.merge(self.df_cmdb, on=['Hostname'], how='left')
@@ -96,7 +91,9 @@ class MainUI(QDialog): # erbt von QDialog
# Führende Leerzeichen in allen Spalten entfernen # Führende Leerzeichen in allen Spalten entfernen
self.dfb = self.dfb.apply(lambda x: x.str.lstrip() if x.dtype == "object" else x) self.dfb = self.dfb.apply(lambda x: x.str.lstrip() if x.dtype == "object" else x)
self.dfb = self.dfb.apply(self.suche_Einschub, axis=1)
self.dfb = self.dfb.apply(self.montageort, axis=1)
self.dfb = self.dfb.apply(self.prüfe_und_setze_wert, axis=1) self.dfb = self.dfb.apply(self.prüfe_und_setze_wert, axis=1)
@@ -105,35 +102,44 @@ class MainUI(QDialog): # erbt von QDialog
self.dfb['belegte\nHE'] = self.dfb['belegte\nHE'].apply(lambda x: x if pd.isnull(x) else str(int(x))) self.dfb['belegte\nHE'] = self.dfb['belegte\nHE'].apply(lambda x: x if pd.isnull(x) else str(int(x)))
##############################################################################################
#def collect_erweiterung(self):
def suche_Einschub(self, einschub):
if einschub['Montageort'][-1] in ('v' 'h'):
print (einschub['Montageort'])
einschub['Einschub'] = einschub['Montageort'][-1]
return einschub
def prüfe_und_setze_wert(self, zeile): def montageort(self, montage):
ic(zeile)
# Fehlerbereinigung # Fehlerbereinigung
if zeile['ID\nStandort'] not in ("Ber-PS","Bon-BTW"): if montage['ID\nStandort'] not in ("Ber-PS", "Bon-BTW"):
print("Kein Standort P40 oder BTW") print("Kein Standort P40 oder BTW")
sys.exit(0) sys.exit(0)
else: else:
if len((zeile['Montageort'][8:13])) !=2: if len((montage['Montageort'][8:13])) != 2:
zeile['HE'] = zeile['Montageort'][8:10] montage['HE'] = montage['Montageort'][8:10]
zeile['Montageort'] = zeile['Montageort'][0:7] montage['Montageort'] = montage['Montageort'][0:7]
else: else:
zeile['HE'] = zeile['Montageort'][8:10] montage['HE'] = montage['Montageort'][8:10]
zeile['Montageort'] = zeile['Montageort'][0:7] montage['Montageort'] = montage['Montageort'][0:7]
# TODO:
# Einschub vorn/hinten einbauen return montage
def korrektur_hersteller(self, hersteller):
if hersteller['Hersteller'].lower() == "cisco":
hersteller['Hersteller'] = "Cisco Systems"
elif hersteller['Hersteller'].lower() == "genua":
hersteller['Hersteller'] = "genua GmbH"
elif hersteller['Hersteller'].lower() == "digi":
hersteller['Hersteller'] = "Digi International Inc."
return hersteller
if zeile['Hersteller'].lower() == "cisco":
zeile['Hersteller'] = "Cisco Systems"
elif zeile['Hersteller'].lower() == "genua":
zeile['Hersteller'] = "genua GmbH"
elif zeile['Hersteller'].lower() == "digi":
zeile['Hersteller'] = "Digi International Inc."
else:
pass
def prüfe_und_setze_wert(self, zeile):
#ic(zeile)
################################################################ ################################################################
if zeile['Hostname'][4:6] == "10": if zeile['Hostname'][4:6] == "10":
zeile['ID\nMandanten'] = 'm10 CMP Plattform / iM.0 / iM.4 / PAP sIMCP' zeile['ID\nMandanten'] = 'm10 CMP Plattform / iM.0 / iM.4 / PAP sIMCP'
@@ -145,7 +151,7 @@ class MainUI(QDialog): # erbt von QDialog
zeile['Domain'] = 'mgmt.t-cmp.de' zeile['Domain'] = 'mgmt.t-cmp.de'
elif zeile['Hostname'][4:6] == "19": elif zeile['Hostname'][4:6] == "19":
zeile['ID\nMandanten'] = 'm19 Testumgebung' zeile['ID\nMandanten'] = 'm19 Testumgebung'
if zeile['Hostname'][4:8].isin("1920","1921"): if zeile['Hostname'][4:8].isin("1920", "1921"):
zeile['Domain'] = 'm19.t-cmp.de' zeile['Domain'] = 'm19.t-cmp.de'
else: else:
zeile['Domain'] = 'm193.t-cmp.de' zeile['Domain'] = 'm193.t-cmp.de'
@@ -193,117 +199,117 @@ class MainUI(QDialog): # erbt von QDialog
if zeile['Hostname'][6:8] == "00": if zeile['Hostname'][6:8] == "00":
zeile['Segment'] = 'm10 mgmt CMP Core' zeile['Segment'] = 'm10 mgmt CMP Core'
elif zeile['Hostname'][6:8] == "01": elif zeile['Hostname'][6:8] == "01":
zeile['Segment'] = 'm10 mgmt Infrastructure' zeile['Segment'] = 'm10 mgmt Infrastructure'
elif zeile['Hostname'][6:8] == "02": elif zeile['Hostname'][6:8] == "02":
zeile['Segment'] = 'm10 mgmt Administration' zeile['Segment'] = 'm10 mgmt Administration'
elif zeile['Hostname'][6:8] == "03": elif zeile['Hostname'][6:8] == "03":
zeile['Segment'] = 'm10 mgmt zLightsOut' zeile['Segment'] = 'm10 mgmt zLightsOut'
elif zeile['Hostname'][6:8] == "04": elif zeile['Hostname'][6:8] == "04":
zeile['Segment'] = 'm10 CTS' zeile['Segment'] = 'm10 CTS'
elif zeile['Hostname'][6:8] == "05": elif zeile['Hostname'][6:8] == "05":
zeile['Segment'] = 'm10-OSS' zeile['Segment'] = 'm10-OSS'
elif zeile['Hostname'][6:8] == "10": elif zeile['Hostname'][6:8] == "10":
zeile['Segment'] = 'm10 CMP2sIM' zeile['Segment'] = 'm10 CMP2sIM'
elif zeile['Hostname'][6:8] == "11": elif zeile['Hostname'][6:8] == "11":
zeile['Segment'] = 'm10 Intern-CMP iM0' zeile['Segment'] = 'm10 Intern-CMP iM0'
elif zeile['Hostname'][6:8] == "12": elif zeile['Hostname'][6:8] == "12":
zeile['Segment'] = 'm20 iM.1 Interner Mandant 1 (SB sehr hoch)' zeile['Segment'] = 'm20 iM.1 Interner Mandant 1 (SB sehr hoch)'
elif zeile['Hostname'][6:8] == "13": elif zeile['Hostname'][6:8] == "13":
zeile['Segment'] = 'm21 iM.2 Interner Mandant 2 (SB normal)' zeile['Segment'] = 'm21 iM.2 Interner Mandant 2 (SB normal)'
elif zeile['Hostname'][6:8] == "14": elif zeile['Hostname'][6:8] == "14":
zeile['Segment'] = 'm22 iM.3 Interner Mandant 3 (SB hoch)' zeile['Segment'] = 'm22 iM.3 Interner Mandant 3 (SB hoch)'
elif zeile['Hostname'][6:8] == "15": elif zeile['Hostname'][6:8] == "15":
zeile['Segment'] = 'm10 iM.4 Interner Mandant 4 (CNMS2CMP)' zeile['Segment'] = 'm10 iM.4 Interner Mandant 4 (CNMS2CMP)'
elif zeile['Hostname'][6:8] == "20": elif zeile['Hostname'][6:8] == "20":
zeile['Segment'] = 'VRD-Plattform (PAP-Anbindung)' zeile['Segment'] = 'VRD-Plattform (PAP-Anbindung)'
elif zeile['Hostname'][6:8] == "21": elif zeile['Hostname'][6:8] == "21":
zeile['Segment'] = 'VRD-Plattform (LightsOut + Basisinfrastruktur + Cache)' zeile['Segment'] = 'VRD-Plattform (LightsOut + Basisinfrastruktur + Cache)'
elif zeile['Hostname'][6:8] == "22": elif zeile['Hostname'][6:8] == "22":
zeile['Segment'] = 'VRD-Plattform (Admin)' zeile['Segment'] = 'VRD-Plattform (Admin)'
elif zeile['Hostname'][6:8] == "23": elif zeile['Hostname'][6:8] == "23":
zeile['Segment'] = 'VRD-Plattform (Basisinfrastruktur Mandant zentral)' zeile['Segment'] = 'VRD-Plattform (Basisinfrastruktur Mandant zentral)'
elif zeile['Hostname'][6:8] == "24": elif zeile['Hostname'][6:8] == "24":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "25": elif zeile['Hostname'][6:8] == "25":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "26": elif zeile['Hostname'][6:8] == "26":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "27": elif zeile['Hostname'][6:8] == "27":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "28": elif zeile['Hostname'][6:8] == "28":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "29": elif zeile['Hostname'][6:8] == "29":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "30": elif zeile['Hostname'][6:8] == "30":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "31": elif zeile['Hostname'][6:8] == "31":
zeile['Segment'] = 'VRD-Mandant (Infrastruktur)' zeile['Segment'] = 'VRD-Mandant (Infrastruktur)'
elif zeile['Hostname'][6:8] == "32": elif zeile['Hostname'][6:8] == "32":
zeile['Segment'] = 'VRD-Mandant (Admin)' zeile['Segment'] = 'VRD-Mandant (Admin)'
elif zeile['Hostname'][6:8] == "33": elif zeile['Hostname'][6:8] == "33":
zeile['Segment'] = 'VRD-Mandant (Anbindung)' zeile['Segment'] = 'VRD-Mandant (Anbindung)'
elif zeile['Hostname'][6:8] == "34": elif zeile['Hostname'][6:8] == "34":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "35": elif zeile['Hostname'][6:8] == "35":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "36": elif zeile['Hostname'][6:8] == "36":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "37": elif zeile['Hostname'][6:8] == "37":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "38": elif zeile['Hostname'][6:8] == "38":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "39": elif zeile['Hostname'][6:8] == "39":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "40": elif zeile['Hostname'][6:8] == "40":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "41": elif zeile['Hostname'][6:8] == "41":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "42": elif zeile['Hostname'][6:8] == "42":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "43": elif zeile['Hostname'][6:8] == "43":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "44": elif zeile['Hostname'][6:8] == "44":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "45": elif zeile['Hostname'][6:8] == "45":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "46": elif zeile['Hostname'][6:8] == "46":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "47": elif zeile['Hostname'][6:8] == "47":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "48": elif zeile['Hostname'][6:8] == "48":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "49": elif zeile['Hostname'][6:8] == "49":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "50": elif zeile['Hostname'][6:8] == "50":
zeile['Segment'] = 'Spare' zeile['Segment'] = 'Spare'
elif zeile['Hostname'][6:8] == "51": elif zeile['Hostname'][6:8] == "51":
zeile['Segment'] = 'VRD-Mandant (Kundensegment Infra)' zeile['Segment'] = 'VRD-Mandant (Kundensegment Infra)'
elif zeile['Hostname'][6:8] == "52": elif zeile['Hostname'][6:8] == "52":
zeile['Segment'] = 'VRD-Mandant (Kundensegment Admin)' zeile['Segment'] = 'VRD-Mandant (Kundensegment Admin)'
elif zeile['Hostname'][6:8] == "53": elif zeile['Hostname'][6:8] == "53":
zeile['Segment'] = 'VRD-Mandant (Kundensegment)' zeile['Segment'] = 'VRD-Mandant (Kundensegment)'
elif zeile['Hostname'][6:8] == "b0": elif zeile['Hostname'][6:8] == "b0":
zeile['Segment'] = 'mgmt BS Übergang zum CMP Core' zeile['Segment'] = 'mgmt BS Übergang zum CMP Core'
elif zeile['Hostname'][6:8] == "ba": elif zeile['Hostname'][6:8] == "ba":
zeile['Segment'] = 'mgmt BS Bon BTW' zeile['Segment'] = 'mgmt BS Bon BTW'
elif zeile['Hostname'][6:8] == "bb": elif zeile['Hostname'][6:8] == "bb":
zeile['Segment'] = 'mgmt BS Bon LRS' zeile['Segment'] = 'mgmt BS Bon LRS'
elif zeile['Hostname'][6:8] == "bc": elif zeile['Hostname'][6:8] == "bc":
zeile['Segment'] = 'mgmt BS Ber W55' zeile['Segment'] = 'mgmt BS Ber W55'
elif zeile['Hostname'][6:8] == "bd": elif zeile['Hostname'][6:8] == "bd":
zeile['Segment'] = 'mgmt BS Ber PS' zeile['Segment'] = 'mgmt BS Ber PS'
elif zeile['Hostname'][6:8] == "be": elif zeile['Hostname'][6:8] == "be":
zeile['Segment'] = 'mgmt BS Ber NDA' zeile['Segment'] = 'mgmt BS Ber NDA'
elif zeile['Hostname'][6:8] == "bf": elif zeile['Hostname'][6:8] == "bf":
zeile['Segment'] = 'mgmt BS HanTMX' zeile['Segment'] = 'mgmt BS HanTMX'
elif zeile['Hostname'][6:8] == "bg": elif zeile['Hostname'][6:8] == "bg":
zeile['Segment'] = 'mgmt BS Ber DS' zeile['Segment'] = 'mgmt BS Ber DS'
elif zeile['Hostname'][6:8] == "c0": elif zeile['Hostname'][6:8] == "c0":
zeile['Segment'] = 'mgmt CMP Übergang Internet' zeile['Segment'] = 'mgmt CMP Übergang Internet'
elif zeile['Hostname'][6:8] == "x1": elif zeile['Hostname'][6:8] == "x1":
zeile['Segment'] = 'm10 SecA2sIM' zeile['Segment'] = 'm10 SecA2sIM'
################################################################ ################################################################
# Genucenter - # Genucenter -
# HW Appliance - # HW Appliance -
@@ -318,8 +324,7 @@ class MainUI(QDialog): # erbt von QDialog
# Switch C__OBJTYPE__SWITCH - # Switch C__OBJTYPE__SWITCH -
# virtuelle Maschine Objekttyp = C__OBJTYPE__VIRTUAL_SERVER # virtuelle Maschine Objekttyp = C__OBJTYPE__VIRTUAL_SERVER
# Terminalserver Objekttyp = C__OBJTYPE__TERMINALSERVER - # Terminalserver Objekttyp = C__OBJTYPE__TERMINALSERVER -
# wenn vho dann Objekttyp = C__OBJTYPE__VIRTUAL_HOST - # wenn vho dann Objekttyp = C__OBJTYPE__VIRTUAL_HOST -
if zeile['Objekttyp (CMDB)'] == 'Genucenter': if zeile['Objekttyp (CMDB)'] == 'Genucenter':
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__APPLIANCE' zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__APPLIANCE'
@@ -346,35 +351,25 @@ class MainUI(QDialog): # erbt von QDialog
elif zeile['Objekttyp (CMDB)'] == 'Router': elif zeile['Objekttyp (CMDB)'] == 'Router':
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__ROUTER' zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__ROUTER'
if zeile['Hostname'][1:3] == "vho": if zeile['Hostname'][1:3] == "vho":
zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__VIRTUAL_HOST' zeile['Objekttyp (CMDB)'] = 'C__OBJTYPE__VIRTUAL_HOST'
################################################################
# Einschub
if zeile['Montageort'][-1].isin('v', 'h'):
zeile['Einschub'] = zeile['Montageort'][-1]
################################################################
return zeile return zeile
def save_file_dialog(self): def save_file_dialog(self):
ic(self.dfb) ic(self.dfb)
options = QFileDialog.Options() options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog options |= QFileDialog.DontUseNativeDialog
self.savefilename, _ = QFileDialog.getSaveFileName(self, self.savefilename, _ = QFileDialog.getSaveFileName(self,
"Save File", "", "CSV(*.csv);;CSV Files(*.csv)", options = options) "Save File", "", "CSV(*.csv);;CSV Files(*.csv)",
options=options)
self.dfb.to_csv(self.savefilename, index=None, header=True, encoding='utf-8') self.dfb.to_csv(self.savefilename, index=None, header=True, encoding='utf-8')
print("Datei wurde gespeichert:", self.savefilename) print("Datei wurde gespeichert:", self.savefilename)
if __name__ == "__main__" : if __name__ == "__main__":
app = QApplication (sys.argv) app = QApplication(sys.argv)
ui = MainUI() ui = MainUI()
ui.show() ui.show()
app.exec_() app.exec_()

42
Fehler.ui Normal file
View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Fehler</class>
<widget class="QDialog" name="Fehler">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>569</width>
<height>294</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>430</x>
<y>230</y>
<width>113</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>511</width>
<height>191</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>