Exemplo n.º 1
0
 def edit(self,event):
     self.edit_dialog = CreateDialog()
     self.edit_dialog.addtask_btn.clicked.connect(self.update_task)
     self.edit_dialog.taskcount_spinbox.hide()
     self.edit_dialog.profile_box.clear()
     self.edit_dialog.proxies_box.clear()
     profile_combobox = self.parent().parent().parent().parent().parent().parent().parent().createdialog.profile_box
     for profile in [profile_combobox.itemText(i) for i in range(profile_combobox.count())]:
         self.edit_dialog.profile_box.addItem(profile)
     proxies_combobox = self.parent().parent().parent().parent().parent().parent().parent().createdialog.proxies_box
     for proxy in [proxies_combobox.itemText(i) for i in range(proxies_combobox.count())]:
         self.edit_dialog.proxies_box.addItem(proxy)
     self.edit_dialog.load_data(self)
     self.edit_dialog.show()
Exemplo n.º 2
0
 def setupUi(self, MainWindow):
     MainWindow.setFixedSize(1109, 600)
     # background color for main UI
     MainWindow.setStyleSheet("background-color: {};".format(
         globalStyles["backgroundDark"]))
     MainWindow.setWindowTitle("Phoenix Bot")
     self.centralwidget = QtWidgets.QWidget(MainWindow)
     self.centralwidget.setStyleSheet(
         "QMessageBox QLabel { color: #FFFFFF; }QMessageBox QPushButton { background-color: %s;color: #FFFFFF;}"
         % (globalStyles["primary"]))
     self.sidebar = QtWidgets.QWidget(self.centralwidget)
     self.sidebar.setGeometry(QtCore.QRect(0, 0, 61, 601))
     # SIDE BAR COLOR
     self.sidebar.setStyleSheet(
         'background-color: {};border-right: 1px solid #2e2d2d;'.format(
             globalStyles['backgroundLight']))
     self.home_tab = QtWidgets.QWidget(self.sidebar)
     self.home_tab.setGeometry(QtCore.QRect(0, 85, 60, 45))
     self.home_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     #initial selected color background
     self.home_tab.setStyleSheet(
         "background-color: {};border: none;".format(
             globalStyles['primaryAscent']))
     self.home_active_tab = QtWidgets.QWidget(self.home_tab)
     self.home_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     #initial selected color side bar
     self.home_active_tab.setStyleSheet(
         "background-color: {};border: none;".format(
             globalStyles["primary"]))
     self.home_active_tab.setCursor(
         QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.home_icon = QtWidgets.QLabel(self.home_tab)
     self.home_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.home_icon.setStyleSheet("border: none;")
     self.home_icon.setText("")
     self.home_icon.setPixmap(QtGui.QPixmap("images/home_alt.png"))
     self.home_icon.setScaledContents(True)
     self.home_icon.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.profiles_tab = QtWidgets.QWidget(self.sidebar)
     self.profiles_tab.setGeometry(QtCore.QRect(0, 130, 60, 45))
     self.profiles_tab.setCursor(QtGui.QCursor(
         QtCore.Qt.PointingHandCursor))
     self.profiles_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.profiles_active_tab = QtWidgets.QWidget(self.profiles_tab)
     self.profiles_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.profiles_active_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.profiles_active_tab.setCursor(
         QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.profiles_icon = QtWidgets.QLabel(self.profiles_tab)
     self.profiles_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.profiles_icon.setStyleSheet("border: none;")
     self.profiles_icon.setText("")
     self.profiles_icon.setPixmap(QtGui.QPixmap("images/profiles.png"))
     self.profiles_icon.setScaledContents(True)
     self.profiles_icon.setCursor(
         QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.proxies_tab = QtWidgets.QWidget(self.sidebar)
     self.proxies_tab.setGeometry(QtCore.QRect(0, 175, 60, 45))
     self.proxies_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.proxies_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.proxies_active_tab = QtWidgets.QWidget(self.proxies_tab)
     self.proxies_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.proxies_active_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.proxies_icon = QtWidgets.QLabel(self.proxies_tab)
     self.proxies_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.proxies_icon.setStyleSheet("border: none;")
     self.proxies_icon.setPixmap(QtGui.QPixmap("images/proxies.png"))
     self.proxies_icon.setScaledContents(True)
     self.settings_tab = QtWidgets.QWidget(self.sidebar)
     self.settings_tab.setGeometry(QtCore.QRect(0, 220, 60, 45))
     self.settings_tab.setCursor(QtGui.QCursor(
         QtCore.Qt.PointingHandCursor))
     self.settings_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.settings_active_tab = QtWidgets.QWidget(self.settings_tab)
     self.settings_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.settings_active_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.settings_icon = QtWidgets.QLabel(self.settings_tab)
     self.settings_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.settings_icon.setStyleSheet("border: none;")
     self.settings_icon.setPixmap(QtGui.QPixmap("images/settings.png"))
     self.settings_icon.setScaledContents(True)
     self.logo = QtWidgets.QLabel(self.sidebar)
     self.logo.setGeometry(QtCore.QRect(10, 23, 41, 41))
     self.logo.setStyleSheet("border: none;color:red;")
     self.logo.setText("")
     self.logo.setPixmap(QtGui.QPixmap("images/birdbot.png"))
     self.logo.setScaledContents(True)
     self.homepage = HomePage(self.centralwidget)
     self.createdialog = CreateDialog(self)
     self.createdialog.addtask_btn.clicked.connect(self.create_task)
     self.createdialog.setWindowIcon(QtGui.QIcon("images/birdbot.png"))
     self.createdialog.hide()
     self.profilespage = ProfilesPage(self.centralwidget)
     self.profilespage.hide()
     self.proxiespage = ProxiesPage(self.centralwidget)
     self.proxiespage.hide()
     self.settingspage = SettingsPage(self.centralwidget)
     self.settingspage.hide()
     MainWindow.setCentralWidget(self.centralwidget)
     QtCore.QMetaObject.connectSlotsByName(MainWindow)
     self.set_functions()
Exemplo n.º 3
0
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent=parent)
        self.setupUi(self)
        self.show()

    def setupUi(self, MainWindow):
        MainWindow.setFixedSize(1109, 600)
        # background color for main UI
        MainWindow.setStyleSheet("background-color: {};".format(
            globalStyles["backgroundDark"]))
        MainWindow.setWindowTitle("Phoenix Bot")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setStyleSheet(
            "QMessageBox QLabel { color: #FFFFFF; }QMessageBox QPushButton { background-color: %s;color: #FFFFFF;}"
            % (globalStyles["primary"]))
        self.sidebar = QtWidgets.QWidget(self.centralwidget)
        self.sidebar.setGeometry(QtCore.QRect(0, 0, 61, 601))
        # SIDE BAR COLOR
        self.sidebar.setStyleSheet(
            'background-color: {};border-right: 1px solid #2e2d2d;'.format(
                globalStyles['backgroundLight']))
        self.home_tab = QtWidgets.QWidget(self.sidebar)
        self.home_tab.setGeometry(QtCore.QRect(0, 85, 60, 45))
        self.home_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        #initial selected color background
        self.home_tab.setStyleSheet(
            "background-color: {};border: none;".format(
                globalStyles['primaryAscent']))
        self.home_active_tab = QtWidgets.QWidget(self.home_tab)
        self.home_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        #initial selected color side bar
        self.home_active_tab.setStyleSheet(
            "background-color: {};border: none;".format(
                globalStyles["primary"]))
        self.home_active_tab.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.home_icon = QtWidgets.QLabel(self.home_tab)
        self.home_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.home_icon.setStyleSheet("border: none;")
        self.home_icon.setText("")
        self.home_icon.setPixmap(QtGui.QPixmap("images/home_alt.png"))
        self.home_icon.setScaledContents(True)
        self.home_icon.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_tab = QtWidgets.QWidget(self.sidebar)
        self.profiles_tab.setGeometry(QtCore.QRect(0, 130, 60, 45))
        self.profiles_tab.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.profiles_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.profiles_active_tab = QtWidgets.QWidget(self.profiles_tab)
        self.profiles_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.profiles_active_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.profiles_active_tab.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_icon = QtWidgets.QLabel(self.profiles_tab)
        self.profiles_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.profiles_icon.setStyleSheet("border: none;")
        self.profiles_icon.setText("")
        self.profiles_icon.setPixmap(QtGui.QPixmap("images/profiles.png"))
        self.profiles_icon.setScaledContents(True)
        self.profiles_icon.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.proxies_tab = QtWidgets.QWidget(self.sidebar)
        self.proxies_tab.setGeometry(QtCore.QRect(0, 175, 60, 45))
        self.proxies_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.proxies_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.proxies_active_tab = QtWidgets.QWidget(self.proxies_tab)
        self.proxies_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.proxies_active_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.proxies_icon = QtWidgets.QLabel(self.proxies_tab)
        self.proxies_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.proxies_icon.setStyleSheet("border: none;")
        self.proxies_icon.setPixmap(QtGui.QPixmap("images/proxies.png"))
        self.proxies_icon.setScaledContents(True)
        self.settings_tab = QtWidgets.QWidget(self.sidebar)
        self.settings_tab.setGeometry(QtCore.QRect(0, 220, 60, 45))
        self.settings_tab.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.settings_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.settings_active_tab = QtWidgets.QWidget(self.settings_tab)
        self.settings_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.settings_active_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.settings_icon = QtWidgets.QLabel(self.settings_tab)
        self.settings_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.settings_icon.setStyleSheet("border: none;")
        self.settings_icon.setPixmap(QtGui.QPixmap("images/settings.png"))
        self.settings_icon.setScaledContents(True)
        self.logo = QtWidgets.QLabel(self.sidebar)
        self.logo.setGeometry(QtCore.QRect(10, 23, 41, 41))
        self.logo.setStyleSheet("border: none;color:red;")
        self.logo.setText("")
        self.logo.setPixmap(QtGui.QPixmap("images/birdbot.png"))
        self.logo.setScaledContents(True)
        self.homepage = HomePage(self.centralwidget)
        self.createdialog = CreateDialog(self)
        self.createdialog.addtask_btn.clicked.connect(self.create_task)
        self.createdialog.setWindowIcon(QtGui.QIcon("images/birdbot.png"))
        self.createdialog.hide()
        self.profilespage = ProfilesPage(self.centralwidget)
        self.profilespage.hide()
        self.proxiespage = ProxiesPage(self.centralwidget)
        self.proxiespage.hide()
        self.settingspage = SettingsPage(self.centralwidget)
        self.settingspage.hide()
        MainWindow.setCentralWidget(self.centralwidget)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.set_functions()

    def set_functions(self):
        self.current_page = "home"
        self.home_tab.mousePressEvent = lambda event: self.change_page(
            event, "home")
        self.profiles_tab.mousePressEvent = lambda event: self.change_page(
            event, "profiles")
        self.proxies_tab.mousePressEvent = lambda event: self.change_page(
            event, "proxies")
        self.settings_tab.mousePressEvent = lambda event: self.change_page(
            event, "settings")
        self.homepage.newtask_btn.clicked.connect(self.createdialog.show)

    def change_page(self, event, current_page):
        eval(
            'self.{}_active_tab.setStyleSheet("background-color: transparent;border: none;")'
            .format(self.current_page))
        # reseting image after deselect
        eval('self.{}_icon.setPixmap(QtGui.QPixmap("images/{}.png"))'.format(
            self.current_page, self.current_page))
        eval(
            'self.{}_tab.setStyleSheet("background-color: transparent;border: none;")'
            .format(self.current_page))
        eval("self.{}page.hide()".format(self.current_page))
        self.current_page = current_page
        # after initial tab side color
        eval(
            'self.{}_active_tab.setStyleSheet("background-color: {};border: none;")'
            .format(self.current_page, globalStyles["primary"]))
        # grabing same image for selected tab
        eval('self.{}_icon.setPixmap(QtGui.QPixmap("images/{}_alt.png"))'.
             format(self.current_page, self.current_page))
        # after initial tab side background color
        eval('self.{}_tab.setStyleSheet("background-color: {};border: none;")'.
             format(self.current_page, globalStyles["primaryAscent"]))
        eval("self.{}page.show()".format(self.current_page))

    def create_task(self):
        site = self.createdialog.site_box.currentText()
        product = self.createdialog.input_edit.text()
        profile = self.createdialog.profile_box.currentText()
        proxies = self.createdialog.proxies_box.currentText()
        monitor_delay = self.createdialog.monitor_edit.text()
        error_delay = self.createdialog.error_edit.text()
        max_price = self.createdialog.price_edit.text(
        ) if self.createdialog.maxprice_checkbox.isChecked() else ""
        if site != "Site" and product != "" and profile != "Profile" and monitor_delay != "" and error_delay != "":
            for i in range(self.createdialog.taskcount_spinbox.value()):
                self.homepage.verticalLayout.takeAt(
                    self.homepage.verticalLayout.count() - 1)
                tab = TaskTab(site, product, profile, proxies, monitor_delay,
                              error_delay, max_price,
                              self.homepage.stop_all_tasks,
                              self.homepage.scrollAreaWidgetContents)
                self.homepage.verticalLayout.addWidget(tab)
                spacerItem = QtWidgets.QSpacerItem(
                    20, 40, QtWidgets.QSizePolicy.Minimum,
                    QtWidgets.QSizePolicy.Expanding)
                self.homepage.verticalLayout.addItem(spacerItem)
Exemplo n.º 4
0
class TaskTab(QtWidgets.QWidget):
    def __init__(self,
                 site,
                 product,
                 profile,
                 proxies,
                 monitor_delay,
                 error_delay,
                 max_price,
                 stop_all,
                 parent=None):
        super(TaskTab, self).__init__(parent)
        self.task_id = str(int(tasks_total_count.text()) + 1)
        tasks_total_count.setText(self.task_id)
        self.site, self.product, self.profile, self.proxies, self.monitor_delay, self.error_delay, self.max_price, self.stop_all = site, product, profile, proxies, monitor_delay, error_delay, max_price, stop_all
        self.setupUi(self)
        tasks.append(self)
        tasks_data = return_data("./data/tasks.json")
        task_data = {
            "task_id": self.task_id,
            "site": self.site,
            "product": self.product,
            "profile": self.profile,
            "proxies": self.proxies,
            "monitor_delay": self.monitor_delay,
            "error_delay": self.error_delay,
            "max_price": self.max_price
        }
        tasks_data.append(task_data)
        write_data("./data/tasks.json", tasks_data)

    def setupUi(self, TaskTab):
        self.running = False

        self.TaskTab = TaskTab
        self.TaskTab.setMinimumSize(QtCore.QSize(0, 50))
        self.TaskTab.setMaximumSize(QtCore.QSize(16777215, 50))
        self.TaskTab.setStyleSheet("border-radius: none;")
        self.product_label = QtWidgets.QLabel(self.TaskTab)
        self.product_label.setGeometry(QtCore.QRect(222, 10, 331, 31))
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(
            13) if platform.system() == "Darwin" else font.setPointSize(13 *
                                                                        .75)
        font.setBold(False)
        font.setWeight(50)
        self.product_label.setFont(font)
        self.product_label.setStyleSheet("color: rgb(234, 239, 239);")
        self.profile_label = QtWidgets.QLabel(self.TaskTab)
        self.profile_label.setGeometry(QtCore.QRect(571, 10, 51, 31))
        self.profile_label.setFont(font)
        self.profile_label.setStyleSheet("color: rgb(234, 239, 239);")
        self.status_label = QtWidgets.QLabel(self.TaskTab)
        self.status_label.setGeometry(QtCore.QRect(632, 10, 231, 31))
        self.status_label.setFont(font)
        self.status_label.setStyleSheet("color: rgb(234, 239, 239);")
        self.browser_label = QtWidgets.QLabel(self.TaskTab)
        self.browser_label.setGeometry(QtCore.QRect(632, 10, 231, 31))
        self.browser_label.setFont(font)
        self.browser_label.setStyleSheet("color: rgb(163, 149, 255);")
        self.browser_label.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.browser_label.mousePressEvent = self.open_browser
        self.browser_label.hide()
        self.start_btn = QtWidgets.QLabel(self.TaskTab)
        self.start_btn.setGeometry(QtCore.QRect(870, 15, 16, 16))
        self.start_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.start_btn.setPixmap(QtGui.QPixmap(":/images/play.png"))
        self.start_btn.setScaledContents(True)
        self.start_btn.mousePressEvent = self.start
        self.stop_btn = QtWidgets.QLabel(self.TaskTab)
        self.stop_btn.setGeometry(QtCore.QRect(870, 15, 16, 16))
        self.stop_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.stop_btn.setPixmap(QtGui.QPixmap(":/images/stop.png"))
        self.stop_btn.setScaledContents(True)
        self.stop_btn.mousePressEvent = self.stop
        self.delete_btn = QtWidgets.QLabel(self.TaskTab)
        self.delete_btn.setGeometry(QtCore.QRect(920, 15, 16, 16))
        self.delete_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.delete_btn.setPixmap(QtGui.QPixmap(":/images/trash.png"))
        self.delete_btn.setScaledContents(True)
        self.delete_btn.mousePressEvent = self.delete
        self.edit_btn = QtWidgets.QLabel(self.TaskTab)
        self.edit_btn.setGeometry(QtCore.QRect(895, 15, 16, 16))
        self.edit_btn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.edit_btn.setPixmap(QtGui.QPixmap(":/images/edit.png"))
        self.edit_btn.setScaledContents(True)
        self.edit_btn.mousePressEvent = self.edit
        self.image = QtWidgets.QLabel(self.TaskTab)
        self.image.setGeometry(QtCore.QRect(20, 0, 50, 50))
        self.image.setPixmap(QtGui.QPixmap(":/images/no_image.png"))
        self.image.setScaledContents(True)
        self.site_label = QtWidgets.QLabel(self.TaskTab)
        self.site_label.setGeometry(QtCore.QRect(140, 10, 61, 31))
        self.site_label.setFont(font)
        self.site_label.setStyleSheet("color: rgb(234, 239, 239);")
        self.id_label = QtWidgets.QLabel(self.TaskTab)
        self.id_label.setGeometry(QtCore.QRect(90, 10, 31, 31))
        self.id_label.setFont(font)
        self.id_label.setStyleSheet("color: rgb(234, 239, 239);")
        self.stop_btn.raise_()
        self.product_label.raise_()
        self.profile_label.raise_()
        self.browser_label.raise_()
        self.start_btn.raise_()
        self.delete_btn.raise_()
        self.image.raise_()
        self.site_label.raise_()
        self.monitor_delay_label = QtWidgets.QLabel(self.TaskTab)
        self.monitor_delay_label.hide()
        self.error_delay_label = QtWidgets.QLabel(self.TaskTab)
        self.error_delay_label.hide()
        self.max_price_label = QtWidgets.QLabel(self.TaskTab)
        self.max_price_label.hide()
        self.proxies_label = QtWidgets.QLabel(self.TaskTab)
        self.proxies_label.hide()
        self.load_labels()

    def load_labels(self):
        self.id_label.setText(self.task_id)
        self.product_label.setText(self.product)
        self.profile_label.setText(self.profile)
        self.proxies_label.setText(self.proxies)
        self.status_label.setText("Idle")
        self.browser_label.setText("Click To Open Browser")
        self.site_label.setText(self.site)
        self.monitor_delay_label.setText(self.monitor_delay)
        self.error_delay_label.setText(self.error_delay)
        self.max_price_label.setText(self.max_price)

    def update_status(self, msg):
        self.status_label.setText(msg["msg"])
        if msg["msg"] == "Browser Ready":
            self.browser_url, self.browser_cookies = msg["url"], msg["cookies"]
            self.running = False
            self.start_btn.raise_()
            self.browser_label.show()
            logger.alt(self.task_id, msg["msg"])
            loop = QtCore.QEventLoop()
            QtCore.QTimer.singleShot(1000, loop.quit)
            loop.exec_()
            self.task.stop()
            return
        if msg["status"] == "idle":
            self.status_label.setStyleSheet("color: rgb(255, 255, 255);")
            logger.normal(self.task_id, msg["msg"])
        elif msg["status"] == "normal":
            self.status_label.setStyleSheet("color: rgb(163, 149, 255);")
            logger.normal(self.task_id, msg["msg"])
        elif msg["status"] == "alt":
            self.status_label.setStyleSheet("color: rgb(242, 166, 137);")
            logger.alt(self.task_id, msg["msg"])
        elif msg["status"] == "error":
            self.status_label.setStyleSheet("color: rgb(252, 81, 81);")
            logger.error(self.task_id, msg["msg"])
        elif msg["status"] == "success":
            self.status_label.setStyleSheet("color: rgb(52, 198, 147);")
            logger.success(self.task_id, msg["msg"])
            self.running = False
            self.start_btn.raise_()
            if settings.buy_one:
                self.stop_all()
            checkouts_count.setText(str(int(checkouts_count.text()) + 1))
        elif msg["status"] == "carted":
            self.status_label.setStyleSheet("color: rgb(163, 149, 255);")
            logger.alt(self.task_id, msg["msg"])
            carted_count.setText(str(int(carted_count.text()) + 1))

    def update_image(self, image_url):
        self.image_thread = ImageThread(image_url)
        self.image_thread.finished_signal.connect(self.set_image)
        self.image_thread.start()

    def set_image(self, pixmap):
        self.image.setPixmap(pixmap)

    def start(self, event):
        if not self.running:
            self.browser_label.hide()
            self.task = TaskThread()
            self.task.status_signal.connect(self.update_status)
            self.task.image_signal.connect(self.update_image)
            self.task.set_data(self.task_id, self.site_label.text(),
                               self.product_label.text(),
                               self.profile_label.text(),
                               self.proxies_label.text(),
                               self.monitor_delay_label.text(),
                               self.error_delay_label.text(),
                               self.max_price_label.text())
            self.task.start()
            self.running = True
            self.stop_btn.raise_()

    def stop(self, event):
        self.task.stop()
        self.running = False
        self.update_status({"msg": "Stopped", "status": "idle"})
        self.start_btn.raise_()

    def edit(self, event):
        self.edit_dialog = CreateDialog()
        self.edit_dialog.addtask_btn.clicked.connect(self.update_task)
        self.edit_dialog.taskcount_spinbox.hide()
        self.edit_dialog.profile_box.clear()
        self.edit_dialog.proxies_box.clear()
        profile_combobox = self.parent().parent().parent().parent().parent(
        ).parent().parent().createdialog.profile_box
        for profile in [
                profile_combobox.itemText(i)
                for i in range(profile_combobox.count())
        ]:
            self.edit_dialog.profile_box.addItem(profile)
        proxies_combobox = self.parent().parent().parent().parent().parent(
        ).parent().parent().createdialog.proxies_box
        for proxy in [
                proxies_combobox.itemText(i)
                for i in range(proxies_combobox.count())
        ]:
            self.edit_dialog.proxies_box.addItem(proxy)
        self.edit_dialog.load_data(self)
        self.edit_dialog.show()

    def update_task(self):
        self.site = self.edit_dialog.site_box.currentText()
        self.product = self.edit_dialog.input_edit.text()
        self.profile = self.edit_dialog.profile_box.currentText()
        self.proxies = self.edit_dialog.proxies_box.currentText()
        self.monitor_delay = self.edit_dialog.monitor_edit.text()
        self.error_delay = self.edit_dialog.error_edit.text()
        self.max_price = self.edit_dialog.price_edit.text()
        self.load_labels()
        self.delete_json()
        tasks_data = return_data("./data/tasks.json")
        task_data = {
            "task_id": self.task_id,
            "site": self.site,
            "product": self.product,
            "profile": self.profile,
            "proxies": self.proxies,
            "monitor_delay": self.monitor_delay,
            "error_delay": self.error_delay,
            "max_price": self.max_price
        }
        tasks_data.append(task_data)
        write_data("./data/tasks.json", tasks_data)
        self.edit_dialog.deleteLater()

    def delete_json(self):
        tasks_data = return_data("./data/tasks.json")
        for task in tasks_data:
            if task["task_id"] == self.task_id:
                tasks_data.remove(task)
                break
        write_data("./data/tasks.json", tasks_data)

    def delete(self, event):
        tasks_total_count.setText(str(int(tasks_total_count.text()) - 1))
        self.delete_json()
        self.TaskTab.deleteLater()

    def open_browser(self, event):
        self.browser_thread = BrowserThread()
        self.browser_thread.set_data(self.browser_url, self.browser_cookies)
        self.browser_thread.start()
Exemplo n.º 5
0
 def setupUi(self, MainWindow):
     MainWindow.setFixedSize(1109, 600)
     MainWindow.setStyleSheet("background-color: #1E1E1E;")
     MainWindow.setWindowTitle("Bird Bot")
     self.centralwidget = QtWidgets.QWidget(MainWindow)
     self.centralwidget.setStyleSheet(
         "QMessageBox QLabel { color: #FFFFFF; }QMessageBox QPushButton { background-color: #5D43FB;color: #FFFFFF;}"
     )
     self.sidebar = QtWidgets.QWidget(self.centralwidget)
     self.sidebar.setGeometry(QtCore.QRect(0, 0, 61, 601))
     self.sidebar.setStyleSheet(
         "background-color: #232323;border-right: 1px solid #2e2d2d;")
     self.home_tab = QtWidgets.QWidget(self.sidebar)
     self.home_tab.setGeometry(QtCore.QRect(0, 85, 60, 45))
     self.home_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.home_tab.setStyleSheet("background-color: #272342;border: none;")
     self.home_active_tab = QtWidgets.QWidget(self.home_tab)
     self.home_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.home_active_tab.setStyleSheet(
         "background-color: #5D43FB;border: none;")
     self.home_active_tab.setCursor(
         QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.home_icon = QtWidgets.QLabel(self.home_tab)
     self.home_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.home_icon.setStyleSheet("border: none;")
     self.home_icon.setText("")
     self.home_icon.setPixmap(QtGui.QPixmap(":/images/home_alt.png"))
     self.home_icon.setScaledContents(True)
     self.home_icon.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.profiles_tab = QtWidgets.QWidget(self.sidebar)
     self.profiles_tab.setGeometry(QtCore.QRect(0, 130, 60, 45))
     self.profiles_tab.setCursor(QtGui.QCursor(
         QtCore.Qt.PointingHandCursor))
     self.profiles_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.profiles_active_tab = QtWidgets.QWidget(self.profiles_tab)
     self.profiles_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.profiles_active_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.profiles_active_tab.setCursor(
         QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.profiles_icon = QtWidgets.QLabel(self.profiles_tab)
     self.profiles_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.profiles_icon.setStyleSheet("border: none;")
     self.profiles_icon.setText("")
     self.profiles_icon.setPixmap(QtGui.QPixmap(":/images/profiles.png"))
     self.profiles_icon.setScaledContents(True)
     self.profiles_icon.setCursor(
         QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.proxies_tab = QtWidgets.QWidget(self.sidebar)
     self.proxies_tab.setGeometry(QtCore.QRect(0, 175, 60, 45))
     self.proxies_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
     self.proxies_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.proxies_active_tab = QtWidgets.QWidget(self.proxies_tab)
     self.proxies_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.proxies_active_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.proxies_icon = QtWidgets.QLabel(self.proxies_tab)
     self.proxies_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.proxies_icon.setStyleSheet("border: none;")
     self.proxies_icon.setPixmap(QtGui.QPixmap(":/images/proxies.png"))
     self.proxies_icon.setScaledContents(True)
     self.settings_tab = QtWidgets.QWidget(self.sidebar)
     self.settings_tab.setGeometry(QtCore.QRect(0, 220, 60, 45))
     self.settings_tab.setCursor(QtGui.QCursor(
         QtCore.Qt.PointingHandCursor))
     self.settings_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.settings_active_tab = QtWidgets.QWidget(self.settings_tab)
     self.settings_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
     self.settings_active_tab.setStyleSheet(
         "background-color: transparent;border: none;")
     self.settings_icon = QtWidgets.QLabel(self.settings_tab)
     self.settings_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
     self.settings_icon.setStyleSheet("border: none;")
     self.settings_icon.setPixmap(QtGui.QPixmap(":/images/settings.png"))
     self.settings_icon.setScaledContents(True)
     self.logo = QtWidgets.QLabel(self.sidebar)
     self.logo.setGeometry(QtCore.QRect(10, 23, 41, 41))
     self.logo.setStyleSheet("border: none;")
     self.logo.setText("")
     self.logo.setPixmap(QtGui.QPixmap(":/images/birdbot.png"))
     self.logo.setScaledContents(True)
     self.homepage = HomePage(self.centralwidget)
     self.createdialog = CreateDialog(self)
     self.createdialog.addtask_btn.clicked.connect(self.create_task)
     self.createdialog.setWindowIcon(QtGui.QIcon("images/birdbot.png"))
     self.createdialog.hide()
     self.profilespage = ProfilesPage(self.centralwidget)
     self.profilespage.hide()
     self.proxiespage = ProxiesPage(self.centralwidget)
     self.proxiespage.hide()
     self.settingspage = SettingsPage(self.centralwidget)
     self.settingspage.hide()
     MainWindow.setCentralWidget(self.centralwidget)
     QtCore.QMetaObject.connectSlotsByName(MainWindow)
     self.set_functions()
Exemplo n.º 6
0
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent=parent)
        self.setupUi(self)
        self.show()

    def setupUi(self, MainWindow):
        MainWindow.setFixedSize(1109, 600)
        MainWindow.setStyleSheet("background-color: #1E1E1E;")
        MainWindow.setWindowTitle("Bird Bot Redux")

        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setStyleSheet(
            "QMessageBox QLabel { color: #FFFFFF; }QMessageBox QPushButton { background-color: #5D43FB;color: #FFFFFF;}"
        )

        self.sidebar = QtWidgets.QWidget(self.centralwidget)
        self.sidebar.setGeometry(QtCore.QRect(0, 0, 61, 601))
        self.sidebar.setStyleSheet(
            "background-color: #232323;border-right: 1px solid #2e2d2d;"
        )

        # sidebar tabs
        # it seems when you do this you're saying embed the following component in another component.
        # in this case the parent component is self.sidebar and the child component is self.home_tab
        self.home_tab = QtWidgets.QWidget(self.sidebar)
        self.home_tab.setGeometry(QtCore.QRect(0, 85, 60, 45))  # (x, y, width, height)
        self.home_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.home_tab.setStyleSheet("background-color: #272342; border: none;")
        self.home_active_tab = QtWidgets.QWidget(self.home_tab)
        # the coordinates are relative to the parent
        self.home_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.home_active_tab.setStyleSheet("background-color: #5D43FB;border: none;")
        self.home_active_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.home_icon = QtWidgets.QLabel(self.home_tab)
        self.home_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.home_icon.setStyleSheet("border: none;")
        self.home_icon.setText("")
        self.home_icon.setPixmap(QtGui.QPixmap(":/images/home_alt.png"))
        self.home_icon.setScaledContents(True)
        self.home_icon.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_tab = QtWidgets.QWidget(self.sidebar)
        self.profiles_tab.setGeometry(QtCore.QRect(0, 130, 60, 45))
        self.profiles_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_tab.setStyleSheet("background-color: transparent;border: none;")
        self.profiles_active_tab = QtWidgets.QWidget(self.profiles_tab)
        self.profiles_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.profiles_active_tab.setStyleSheet(
            "background-color: transparent;border: none;"
        )
        self.profiles_active_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_icon = QtWidgets.QLabel(self.profiles_tab)
        self.profiles_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.profiles_icon.setStyleSheet("border: none;")
        self.profiles_icon.setText("")
        self.profiles_icon.setPixmap(QtGui.QPixmap(":/images/profiles.png"))
        self.profiles_icon.setScaledContents(True)
        self.profiles_icon.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.proxies_tab = QtWidgets.QWidget(self.sidebar)
        self.proxies_tab.setGeometry(QtCore.QRect(0, 175, 60, 45))
        self.proxies_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.proxies_tab.setStyleSheet("background-color: transparent;border: none;")
        self.proxies_active_tab = QtWidgets.QWidget(self.proxies_tab)
        self.proxies_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.proxies_active_tab.setStyleSheet(
            "background-color: transparent;border: none;"
        )
        self.proxies_icon = QtWidgets.QLabel(self.proxies_tab)
        self.proxies_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.proxies_icon.setStyleSheet("border: none;")
        self.proxies_icon.setPixmap(QtGui.QPixmap(":/images/proxies.png"))
        self.proxies_icon.setScaledContents(True)
        self.settings_tab = QtWidgets.QWidget(self.sidebar)
        self.settings_tab.setGeometry(QtCore.QRect(0, 220, 60, 45))
        self.settings_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.settings_tab.setStyleSheet("background-color: transparent;border: none;")
        self.settings_active_tab = QtWidgets.QWidget(self.settings_tab)
        self.settings_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.settings_active_tab.setStyleSheet(
            "background-color: transparent;border: none;"
        )
        self.settings_icon = QtWidgets.QLabel(self.settings_tab)
        self.settings_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.settings_icon.setStyleSheet("border: none;")
        self.settings_icon.setPixmap(QtGui.QPixmap(":/images/settings.png"))
        self.settings_icon.setScaledContents(True)

        # main logo
        self.logo = QtWidgets.QLabel(self.sidebar)
        self.logo.setGeometry(QtCore.QRect(10, 23, 41, 41))
        self.logo.setStyleSheet("border: none;")
        self.logo.setText("")
        self.logo.setPixmap(QtGui.QPixmap(":/images/birdbot.png"))
        self.logo.setScaledContents(True)

        self.homepage = HomePage(self.centralwidget)
        self.createdialog = CreateDialog(self)
        self.createdialog.addtask_btn.clicked.connect(self.create_task)
        self.createdialog.setWindowIcon(QtGui.QIcon("images/birdbot.png"))
        self.createdialog.hide()
        self.profilespage = ProfilesPage(self.centralwidget)
        self.profilespage.hide()
        self.proxiespage = ProxiesPage(self.centralwidget)
        self.proxiespage.hide()
        self.settingspage = SettingsPage(self.centralwidget)
        self.settingspage.hide()

        # add centralwidget to MainWindow
        MainWindow.setCentralWidget(self.centralwidget)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.set_functions()

    def set_functions(self):
        self.current_page = "home"
        self.home_tab.mousePressEvent = lambda event: self.change_page(event, "home")
        self.profiles_tab.mousePressEvent = lambda event: self.change_page(
            event, "profiles"
        )
        self.proxies_tab.mousePressEvent = lambda event: self.change_page(
            event, "proxies"
        )
        self.settings_tab.mousePressEvent = lambda event: self.change_page(
            event, "settings"
        )
        self.homepage.newtask_btn.clicked.connect(self.createdialog.show)

    def change_page(self, event, current_page):
        # remove tab styling from previous current page tab
        eval(
            'self.{}_active_tab.setStyleSheet("background-color: transparent;border: none;")'.format(
                self.current_page
            )
        )
        eval(
            'self.{}_icon.setPixmap(QtGui.QPixmap(":/images/{}.png"))'.format(
                self.current_page, self.current_page
            )
        )
        eval(
            'self.{}_tab.setStyleSheet("background-color: transparent;border: none;")'.format(
                self.current_page
            )
        )
        eval("self.{}page.hide()".format(self.current_page))

        # add tab styling to new current page
        self.current_page = current_page
        eval(
            'self.{}_active_tab.setStyleSheet("background-color: #5D43FB;border: none;")'.format(
                self.current_page
            )
        )
        eval(
            'self.{}_icon.setPixmap(QtGui.QPixmap(":/images/{}_alt.png"))'.format(
                self.current_page, self.current_page
            )
        )
        eval(
            'self.{}_tab.setStyleSheet("background-color: #272342;border: none;")'.format(
                self.current_page
            )
        )
        eval("self.{}page.show()".format(self.current_page))

    def create_task(self):
        site = self.createdialog.site_box.currentText()
        product = self.createdialog.input_edit.text()
        profile = self.createdialog.profile_box.currentText()
        proxies = self.createdialog.proxies_box.currentText()
        monitor_delay = self.createdialog.monitor_edit.text()
        error_delay = self.createdialog.error_edit.text()
        max_price = (
            self.createdialog.price_edit.text()
            if self.createdialog.maxprice_checkbox.isChecked()
            else ""
        )
        if (
            site != "Site"
            and product != ""
            and profile != "Profile"
            and monitor_delay != ""
            and error_delay != ""
        ):
            for i in range(self.createdialog.taskcount_spinbox.value()):
                self.homepage.verticalLayout.takeAt(
                    self.homepage.verticalLayout.count() - 1
                )
                tab = TaskTab(
                    site,
                    product,
                    profile,
                    proxies,
                    monitor_delay,
                    error_delay,
                    max_price,
                    self.homepage.stop_all_tasks,
                    self.homepage.scrollAreaWidgetContents,
                )
                self.homepage.verticalLayout.addWidget(tab)
                spacerItem = QtWidgets.QSpacerItem(
                    20,
                    40,
                    QtWidgets.QSizePolicy.Minimum,
                    QtWidgets.QSizePolicy.Expanding,
                )
                self.homepage.verticalLayout.addItem(spacerItem)
Exemplo n.º 7
0
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent=parent)
        self.setupUi(self)
        self.show()

    def setupUi(self, MainWindow):
        MainWindow.setFixedSize(1109, 600)
        MainWindow.setStyleSheet("background-color: #1E1E1E;")
        MainWindow.setWindowTitle("Bird Bot")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setStyleSheet(
            "QMessageBox QLabel { color: #FFFFFF; }QMessageBox QPushButton { background-color: #5D43FB;color: #FFFFFF;}"
        )
        self.sidebar = QtWidgets.QWidget(self.centralwidget)
        self.sidebar.setGeometry(QtCore.QRect(0, 0, 61, 601))
        self.sidebar.setStyleSheet(
            "background-color: #232323;border-right: 1px solid #2e2d2d;")
        self.home_tab = QtWidgets.QWidget(self.sidebar)
        self.home_tab.setGeometry(QtCore.QRect(0, 85, 60, 45))
        self.home_tab.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.home_tab.setStyleSheet("background-color: #272342;border: none;")
        self.home_active_tab = QtWidgets.QWidget(self.home_tab)
        self.home_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.home_active_tab.setStyleSheet(
            "background-color: #5D43FB;border: none;")
        self.home_active_tab.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.home_icon = QtWidgets.QLabel(self.home_tab)
        self.home_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.home_icon.setStyleSheet("border: none;")
        self.home_icon.setText("")
        self.home_icon.setPixmap(QtGui.QPixmap(":/images/home_alt.png"))
        self.home_icon.setScaledContents(True)
        self.home_icon.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_tab = QtWidgets.QWidget(self.sidebar)
        self.profiles_tab.setGeometry(QtCore.QRect(0, 130, 60, 45))
        self.profiles_tab.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.profiles_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.profiles_active_tab = QtWidgets.QWidget(self.profiles_tab)
        self.profiles_active_tab.setGeometry(QtCore.QRect(0, 0, 4, 45))
        self.profiles_active_tab.setStyleSheet(
            "background-color: transparent;border: none;")
        self.profiles_active_tab.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.profiles_icon = QtWidgets.QLabel(self.profiles_tab)
        self.profiles_icon.setGeometry(QtCore.QRect(21, 13, 20, 20))
        self.profiles_icon.setStyleSheet("border: none;")
        self.profiles_icon.setText("")
        self.profiles_icon.setPixmap(QtGui.QPixmap(":/images/profiles.png"))
        self.profiles_icon.setScaledContents(True)
        self.profiles_icon.setCursor(
            QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.logo = QtWidgets.QLabel(self.sidebar)
        self.logo.setGeometry(QtCore.QRect(10, 23, 41, 41))
        self.logo.setStyleSheet("border: none;")
        self.logo.setText("")
        self.logo.setPixmap(QtGui.QPixmap(":/images/birdbot.png"))
        self.logo.setScaledContents(True)
        self.homepage = HomePage(self.centralwidget)
        self.createdialog = CreateDialog(self)
        self.createdialog.addtask_btn.clicked.connect(self.create_task)
        self.createdialog.setWindowIcon(QtGui.QIcon("images/birdbot.png"))
        self.createdialog.hide()
        self.profilespage = ProfilesPage(self.centralwidget)
        self.profilespage.hide()
        MainWindow.setCentralWidget(self.centralwidget)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.set_functions()

    def set_functions(self):
        self.current_page = "home"
        self.home_tab.mousePressEvent = lambda event: self.change_page(
            event, "home")
        self.profiles_tab.mousePressEvent = lambda event: self.change_page(
            event, "profiles")
        self.homepage.newtask_btn.clicked.connect(self.createdialog.show)

    def change_page(self, event, current_page):
        eval(
            'self.{}_active_tab.setStyleSheet("background-color: transparent;border: none;")'
            .format(self.current_page))
        eval('self.{}_icon.setPixmap(QtGui.QPixmap(":/images/{}.png"))'.format(
            self.current_page, self.current_page))
        eval(
            'self.{}_tab.setStyleSheet("background-color: transparent;border: none;")'
            .format(self.current_page))
        eval("self.{}page.hide()".format(self.current_page))
        self.current_page = current_page
        eval(
            'self.{}_active_tab.setStyleSheet("background-color: #5D43FB;border: none;")'
            .format(self.current_page))
        eval('self.{}_icon.setPixmap(QtGui.QPixmap(":/images/{}_alt.png"))'.
             format(self.current_page, self.current_page))
        eval(
            'self.{}_tab.setStyleSheet("background-color: #272342;border: none;")'
            .format(self.current_page))
        eval("self.{}page.show()".format(self.current_page))

    def create_task(self):
        site = self.createdialog.site_box.currentText()
        product = self.createdialog.input_edit.text()
        profile = self.createdialog.profile_box.currentText()
        monitor_delay = self.createdialog.monitor_edit.text()
        error_delay = self.createdialog.error_edit.text()
        max_price = self.createdialog.price_edit.text(
        ) if self.createdialog.maxprice_checkbox.isChecked() else ""
        if site != "Site" and product != "" and profile != "Profile" and monitor_delay != "" and error_delay != "":
            self.homepage.verticalLayout.takeAt(
                self.homepage.verticalLayout.count() - 1)
            tab = TaskTab(site, product, profile, monitor_delay, error_delay,
                          max_price, self.homepage.scrollAreaWidgetContents)
            self.homepage.verticalLayout.addWidget(tab)
            spacerItem = QtWidgets.QSpacerItem(20, 40,
                                               QtWidgets.QSizePolicy.Minimum,
                                               QtWidgets.QSizePolicy.Expanding)
            self.homepage.verticalLayout.addItem(spacerItem)