Neue Webseite hinzugefügt
This commit is contained in:
parent
fd49e049ae
commit
acb70ba1e0
@ -1,4 +1,4 @@
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QLineEdit, QPushButton, QCheckBox, QMessageBox
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout,QLabel, QLineEdit, QPushButton, QCheckBox, QMessageBox
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from PyQt5.QtCore import Qt, QThread, pyqtSignal
|
||||
from selenium import webdriver
|
||||
@ -48,7 +48,7 @@ class SearchThread(QThread):
|
||||
self.suche_auf_hornbach()
|
||||
elif webseite =="Contorion":
|
||||
self.suche_auf_contorion()
|
||||
elif webseite == "Gastro Teile Shop":
|
||||
elif webseite == "Gastroteile Shop":
|
||||
self.suche_auf_gastroteileshop()
|
||||
elif webseite == "TiroLED":
|
||||
self.suche_auf_tiroled()
|
||||
@ -82,6 +82,8 @@ class SearchThread(QThread):
|
||||
self.suche_auf_boettcher()
|
||||
elif webseite == "Büroshop24":
|
||||
self.suche_auf_bueroshop24()
|
||||
elif webseite == "Buchhandlung am Markt":
|
||||
self.suche_buchhandlung_am_markt()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Fehler bei der Suche auf {webseite}: {e}")
|
||||
@ -444,34 +446,37 @@ class SearchThread(QThread):
|
||||
# Enter-Taste drücken, um die Suche zu starten (falls notwendig)
|
||||
search_box.send_keys(Keys.RETURN)
|
||||
|
||||
def suche_buchhandlung_am_markt(self):
|
||||
# URL für die Suche generieren
|
||||
search_url = 'https://bam-mr.buchkatalog.de/'
|
||||
|
||||
# Webseite aufrufen und auf das vollständige Laden warten
|
||||
self.driver.get(search_url)
|
||||
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.ID, "mobile-search")))
|
||||
|
||||
# Suchbegriff eingeben und Suche starten
|
||||
search_box = self.driver.find_element(By.ID, "mobile-search")
|
||||
search_box.clear() # Falls vorheriger Text vorhanden ist
|
||||
search_box.send_keys(self.search_term)
|
||||
|
||||
# Enter-Taste drücken, um die Suche zu starten
|
||||
search_box.send_keys(Keys.RETURN)
|
||||
|
||||
categories = ["IT/EDV", "Haustechnik","Küche", "Verwaltung"]
|
||||
webpages = [
|
||||
["Reichelt", "Conrad", "Kosatec"],
|
||||
["Hornbach", "Contorion", "Gastroteile Shop", "TiroLED", "Megabad", "IPS", "Brewes", "Delker", "Knauss", "Schildershop24", "Häfele"],
|
||||
["Esmeyer", "Papstar", "Lusini", "Hygi", "Schafferer", "Gastronomie Kaufhaus"],
|
||||
["Böttcher", "Büroshop24", "Buchhandlung am Markt"]
|
||||
]
|
||||
|
||||
class WebseitenSucheApp(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.selected_webpages = {
|
||||
"Reichelt": False,
|
||||
"Conrad": False,
|
||||
"Kosatec": False,
|
||||
"Hornbach": False,
|
||||
"Contorion": False,
|
||||
"Gastro Teile Shop": False,
|
||||
"TiroLED": False,
|
||||
"Megabad": False,
|
||||
"IPS": False,
|
||||
"Brewes": False,
|
||||
"Delker": False,
|
||||
"Knauss": False,
|
||||
"Schildershop24": False,
|
||||
"Häfele": False,
|
||||
"Esmeyer": False,
|
||||
"Papstar": False,
|
||||
"Lusini": False,
|
||||
"Hygi": False,
|
||||
"Schafferer": False,
|
||||
"Gastronomie Kaufhaus": False,
|
||||
"Böttcher": False,
|
||||
"Büroshop24": False
|
||||
}
|
||||
self.category_webpages_mapping = {category: webpages for category, webpages in zip(categories, webpages)}
|
||||
|
||||
self.selected_webpages = {webpage: False for category_webpages in webpages for webpage in category_webpages}
|
||||
|
||||
self.search_term = ""
|
||||
self.driver = None
|
||||
@ -481,14 +486,16 @@ class WebseitenSucheApp(QWidget):
|
||||
def init_ui(self):
|
||||
layout = QVBoxLayout()
|
||||
|
||||
# Webseiten-Auswahl
|
||||
layout.addWidget(QLabel("Wählen Sie die Webseiten aus:"))
|
||||
for webpage, checked in self.selected_webpages.items():
|
||||
checkbox = QCheckBox(webpage)
|
||||
checkbox.setChecked(checked)
|
||||
checkbox.stateChanged.connect(lambda state, page=webpage: self.update_webpage_state(page, state))
|
||||
layout.addWidget(checkbox)
|
||||
# Kategorien und Webseiten in vertikalen Spalten
|
||||
for category, category_webpages in zip(categories, webpages):
|
||||
category_label = QLabel(category)
|
||||
layout.addWidget(category_label)
|
||||
|
||||
for webpage in category_webpages:
|
||||
checkbox = QCheckBox(webpage)
|
||||
checkbox.setChecked(self.selected_webpages[webpage])
|
||||
checkbox.stateChanged.connect(self.make_checkbox_callback(webpage))
|
||||
layout.addWidget(checkbox)
|
||||
# Suchbegriff-Eingabe
|
||||
search_label = QLabel("Geben Sie den Suchbegriff ein:")
|
||||
layout.addWidget(search_label)
|
||||
@ -512,6 +519,12 @@ class WebseitenSucheApp(QWidget):
|
||||
self.setWindowTitle('Webseiten Suche App')
|
||||
self.show()
|
||||
|
||||
|
||||
def make_checkbox_callback(self, webpage):
|
||||
def checkbox_callback(state):
|
||||
self.update_webpage_state(webpage, state)
|
||||
return checkbox_callback
|
||||
|
||||
def update_webpage_state(self, webpage, state):
|
||||
self.selected_webpages[webpage] = state == 2 # 2 entspricht dem Zustand "ausgewählt"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user