Exemplo n.º 1
0
 def on_set(self):
     data.add_autofill(self.lineEdit_login.text(), self.lineEdit_password.text(), self.lineEdit_email.text(), int(self.lineEdit_time.text()))
     auto_login, auto_pwd, auto_email, auto_time = data.get_autofill()
     self.parent.pageAllegroAdd.lineEdit_login.setText(auto_login)
     self.parent.pageAllegroAdd.lineEdit_password.setText(auto_pwd)
     self.parent.pageAllegroAdd.lineEdit_email.setText(auto_email)
     self.parent.pageAllegroAdd.lineEdit_time.setText(str(auto_time))
Exemplo n.º 2
0
    def __init__(self, parent=None):
        QWidget.__init__(self)
        self.parent = parent
        self.parent.addWidget(self)
        self.auto_login, self.auto_pwd, self.auto_email, self.auto_time = data.get_autofill()
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setColumnStretch(0, 3)
        self.gridLayout.setColumnStretch(1, 7)

        self.pushButton_auto = QPushButton(self)
        self.pushButton_auto.setText("Autofill")
        self.pushButton_auto.setStyleSheet(styles.btn_allegro_ops_auto)
        self.pushButton_auto.setCheckable(True)
        self.pushButton_auto.setChecked(True)
        self.pushButton_auto.clicked.connect(lambda: self.on_auto())
        self.gridLayout.addWidget(self.pushButton_auto, 0, 0, 1, 1)

        self.pushButton_help = QPushButton(self)
        self.pushButton_help.setText("Help")
        self.pushButton_help.setStyleSheet(styles.btn_allegro_ops_auto)
        self.pushButton_help.setCheckable(True)
        self.pushButton_help.setChecked(False)
        self.pushButton_help.clicked.connect(lambda: self.on_help())
        self.gridLayout.addWidget(self.pushButton_help, 1, 0, 1, 1)

        self.spacer_btn_d = QSpacerItem(40, 20, QSizePolicy.Expanding)
        self.gridLayout.addItem(self.spacer_btn_d, 2, 0, 1, 1)

        self.stackedWidget = QStackedWidget(self)
        self.stackedWidget.setStyleSheet("""QStackedWidget{background-color: #fff;}""")
        self.gridLayout.addWidget(self.stackedWidget, 0, 1, 3, 1)

        self.widget_auto = QWidget(self.stackedWidget)
        self.widget_auto.setStyleSheet("""QWidget{background-color: #fff;}""")
        self.stackedWidget.addWidget(self.widget_auto)

        self.widget_help = QWidget(self.stackedWidget)
        self.widget_help.setStyleSheet("""QWidget{background-color: #fff;}""")
        self.stackedWidget.addWidget(self.widget_help)

        self.gridLayout_help = QVBoxLayout(self.widget_help)
        self.gridLayout_help.setContentsMargins(50, 50, 50, 50)
        self.gridLayout_help.setSpacing(50)

        self.label_help = QLabel(self.widget_help)
        self.label_help.setStyleSheet(styles.label_lineEdit)
        self.label_help.setWordWrap(True)
        self.label_help.setText(styles.help_text)
        self.gridLayout_help.addWidget(self.label_help)

        self.spacer_help = QSpacerItem(40, 20, QSizePolicy.Expanding)
        self.gridLayout_help.addItem(self.spacer_help)

        self.gridLayout_auto = QGridLayout(self.widget_auto)
        self.gridLayout_auto.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_auto.setSpacing(20)
        self.gridLayout_auto.setColumnStretch(0, 1)
        self.gridLayout_auto.setColumnStretch(1, 1)
        self.gridLayout_auto.setColumnStretch(2, 1)
        self.gridLayout_auto.setColumnStretch(3, 1)
        self.gridLayout_auto.setRowStretch(0, 3)
        self.gridLayout_auto.setRowStretch(1, 1)
        self.gridLayout_auto.setRowStretch(2, 1)
        self.gridLayout_auto.setRowStretch(3, 1)
        self.gridLayout_auto.setRowStretch(4, 1)
        self.gridLayout_auto.setRowStretch(5, 1)
        self.gridLayout_auto.setRowStretch(6, 3)

        self.lineEdit_login = QLineEdit(self.widget_auto)
        self.lineEdit_login.setMinimumSize(QSize(0, 60))
        self.lineEdit_login.setSizeIncrement(QSize(40, 40))
        self.lineEdit_login.setStyleSheet(styles.lineEdit_opt)
        self.gridLayout_auto.addWidget(self.lineEdit_login, 1, 2, 1, 1)
        self.lineEdit_login.setPlaceholderText("login or email of your account")
        self.lineEdit_login.setText(self.auto_login)

        self.lineEdit_password = QLineEdit(self.widget_auto)
        self.lineEdit_password.setMinimumSize(QSize(20, 60))
        self.lineEdit_password.setStyleSheet(styles.lineEdit_opt)
        self.lineEdit_password.setEchoMode(QLineEdit.Password)
        self.lineEdit_password.setReadOnly(False)
        self.gridLayout_auto.addWidget(self.lineEdit_password, 2, 2, 1, 1)
        self.lineEdit_password.setPlaceholderText("password of your account")
        self.lineEdit_password.setText(self.auto_pwd)

        self.lineEdit_email = QLineEdit(self.widget_auto)
        self.lineEdit_email.setMinimumSize(QSize(0, 60))
        self.lineEdit_email.setStyleSheet(styles.lineEdit_opt)
        self.lineEdit_email.setFrame(True)
        self.lineEdit_email.setEchoMode(QLineEdit.Normal)
        self.gridLayout_auto.addWidget(self.lineEdit_email, 3, 2, 1, 1)
        self.lineEdit_email.setPlaceholderText("email to which the notification will be sent")
        self.lineEdit_email.setText(self.auto_email)

        self.lineEdit_time = QLineEdit(self.widget_auto)
        self.lineEdit_time.setMinimumSize(QSize(0, 60))
        self.lineEdit_time.setStyleSheet(styles.lineEdit)
        self.gridLayout_auto.addWidget(self.lineEdit_time, 4, 2, 1, 1)
        self.lineEdit_time.setPlaceholderText("interval between refreshes")
        self.lineEdit_time.setText(str(self.auto_time))

        self.label_login = QLabel("Allegro login", self)
        self.label_login.setStyleSheet(styles.label_lineEdit)
        self.gridLayout_auto.addWidget(self.label_login, 1, 1, 1, 1)

        self.label_password = QLabel("Allegro password", self)
        self.label_password.setStyleSheet(styles.label_lineEdit)
        self.gridLayout_auto.addWidget(self.label_password, 2, 1, 1, 1)

        self.label_email = QLabel("Email to notificate", self)
        self.label_email.setStyleSheet(styles.label_lineEdit)
        self.gridLayout_auto.addWidget(self.label_email, 3, 1, 1, 1)

        self.label_time = QLabel("Refresh time[s]", self)
        self.label_time.setStyleSheet(styles.label_lineEdit)
        self.gridLayout_auto.addWidget(self.label_time, 4, 1, 1, 1)

        self.pushButton_set = QPushButton("Set", self.widget_auto)
        self.pushButton_set.clicked.connect(lambda: self.on_set())
        self.pushButton_set.setMinimumSize(QSize(0, 40))
        self.pushButton_set.setStyleSheet(styles.btn_dark)
        self.gridLayout_auto.addWidget(self.pushButton_set, 5, 2, 1, 1)

        self.spacer_auto_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout_auto.addItem(self.spacer_auto_l, 1, 1, 1, 1)

        self.spacer_auto_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout_auto.addItem(self.spacer_auto_r, 1, 3, 1, 1)

        self.spacer_auto_t = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout_auto.addItem(self.spacer_auto_t, 0, 0, 1, 1)

        self.spacer_auto_b = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout_auto.addItem(self.spacer_auto_b, 6, 0, 1, 1)
Exemplo n.º 3
0
    def __init__(self, parent=None, shared_dict=None):
        QWidget.__init__(self, parent)
        parent.addWidget(self)
        self.shared_dict = shared_dict
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setRowStretch(0, 1)
        self.gridLayout.setRowStretch(1, 1)
        self.gridLayout.setRowStretch(2, 1)
        self.gridLayout.setRowStretch(3, 1)
        self.gridLayout.setRowStretch(4, 1)
        self.gridLayout.setRowStretch(5, 1)
        self.gridLayout.setRowStretch(6, 1)
        self.gridLayout.setRowStretch(7, 1)
        self.gridLayout.setRowStretch(8, 1)
        self.gridLayout.setRowStretch(9, 1)
        self.gridLayout.setRowStretch(10, 1)
        self.gridLayout.setRowStretch(11, 1)
        self.gridLayout.setRowStretch(12, 1)
        self.gridLayout.setRowStretch(13, 1)
        self.gridLayout.setRowStretch(14, 2)
        self.gridLayout.setRowStretch(15, 1)
        self.gridLayout.setColumnStretch(0, 5)
        self.gridLayout.setColumnStretch(1, 5)
        self.gridLayout.setColumnStretch(2, 1)
        self.gridLayout.setColumnStretch(3, 2)
        self.gridLayout.setColumnStretch(4, 1)
        self.gridLayout.setColumnStretch(5, 2)
        self.gridLayout.setColumnStretch(6, 1)
        self.gridLayout.setColumnStretch(7, 2)
        self.gridLayout.setColumnStretch(8, 3)
        self.gridLayout.setColumnStretch(9, 5)

        # create lineEdits
        self.lineEdit_login = QLineEdit(self)
        self.lineEdit_login.setMinimumSize(QSize(0, 60))
        self.lineEdit_login.setSizeIncrement(QSize(40, 40))
        self.lineEdit_login.setStyleSheet(styles.lineEdit)
        self.lineEdit_login.setMaxLength(32767)
        self.gridLayout.addWidget(self.lineEdit_login, 4, 1, 1, 3)
        self.lineEdit_login.setPlaceholderText("login or email of your account")

        self.lineEdit_password = QLineEdit(self)
        self.lineEdit_password.setMinimumSize(QSize(20, 60))
        self.lineEdit_password.setStyleSheet(styles.lineEdit)
        self.lineEdit_password.setEchoMode(QLineEdit.Password)
        self.lineEdit_password.setReadOnly(False)
        self.gridLayout.addWidget(self.lineEdit_password, 7, 1, 1, 3)
        self.lineEdit_password.setPlaceholderText("password of your account")

        self.lineEdit_email = QLineEdit(self)
        self.lineEdit_email.setMinimumSize(QSize(0, 60))
        self.lineEdit_email.setStyleSheet(styles.lineEdit)
        self.lineEdit_email.setFrame(True)
        self.lineEdit_email.setEchoMode(QLineEdit.Normal)
        self.gridLayout.addWidget(self.lineEdit_email, 7, 5, 1, 4)
        self.lineEdit_email.setPlaceholderText("email to which the notification will be sent")

        self.lineEdit_link = QLineEdit(self)
        self.lineEdit_link.setMinimumSize(QSize(0, 60))
        self.lineEdit_link.setStyleSheet(styles.lineEdit)
        self.gridLayout.addWidget(self.lineEdit_link, 10, 1, 1, 8)
        self.lineEdit_link.setPlaceholderText("link to the page that you want to monitor")

        self.lineEdit_price = QLineEdit(self)
        self.lineEdit_price.setMinimumSize(QSize(0, 60))
        self.lineEdit_price.setStyleSheet(styles.lineEdit)
        self.gridLayout.addWidget(self.lineEdit_price, 13, 1, 1, 1)
        self.lineEdit_price.setPlaceholderText("Price below which to notificate")

        self.lineEdit_xpath = QLineEdit(self)
        self.lineEdit_xpath.setMinimumSize(QSize(0, 60))
        self.lineEdit_xpath.setStyleSheet(styles.lineEdit)
        self.gridLayout.addWidget(self.lineEdit_xpath, 13, 3, 1, 3)
        self.lineEdit_xpath.setPlaceholderText("XPATH of element with the price")

        self.lineEdit_time = QLineEdit(self)
        self.lineEdit_time.setMinimumSize(QSize(0, 60))
        self.lineEdit_time.setStyleSheet(styles.lineEdit)
        self.gridLayout.addWidget(self.lineEdit_time, 13, 7, 1, 2)
        self.lineEdit_time.setPlaceholderText("interval between refreshes")

        # Create Labels
        self.label_title = QLabel("Add new monitoring object", self)
        self.label_title.setStyleSheet(styles.label_title)
        self.label_title.setAlignment(Qt.AlignCenter)
        self.gridLayout.addWidget(self.label_title, 0, 1, 1, 8)

        self.label_info = QLabel("", self)
        self.label_info.setStyleSheet(styles.label_info_wrong)
        self.label_info.setAlignment(Qt.AlignCenter)
        self.gridLayout.addWidget(self.label_info, 1, 1, 1, 8)

        self.label_login = QLabel("Allegro login", self)
        self.label_login.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_login, 3, 1, 1, 3)

        self.label_password = QLabel("Allegro password", self)
        self.label_password.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_password, 6, 1, 1, 3)

        self.label_email = QLabel("Email to notificate", self)
        self.label_email.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_email, 6, 5, 1, 4)

        self.label_link = QLabel("Product link", self)
        self.label_link.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_link, 9, 1, 1, 8)

        self.label_price = QLabel("Price", self)
        self.label_price.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_price, 12, 1, 1, 1)

        self.label_xpath = QLabel("Monitored element", self)
        self.label_xpath.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_xpath, 12, 3, 1, 3)

        self.label_time = QLabel("Refresh time[s]", self)
        self.label_time.setStyleSheet(styles.label_lineEdit)
        self.gridLayout.addWidget(self.label_time, 12, 7, 1, 2)

        self.pushButton_search = QPushButton(self)
        self.pushButton_search.clicked.connect(lambda: webbrowser.open('https://allegro.pl/'))
        icon = QIcon()
        icon.addFile(os.path.join(path, "img/search.png"), QSize(), QIcon.Selected, QIcon.Off)
        self.pushButton_search.setIcon(icon)
        self.pushButton_search.setIconSize(QSize(100, 100))
        self.pushButton_search.setStyleSheet("""QPushButton{border:none;}""")
        self.pushButton_search.setCursor(QCursor(Qt.PointingHandCursor))
        self.gridLayout.addWidget(self.pushButton_search, 3, 7, 3, 1)

        # Create spacers
        self.spacer_search_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout.addItem(self.spacer_search_l, 5, 5, 1, 2)

        self.spacer_search_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout.addItem(self.spacer_search_r, 5, 8, 1, 1)

        self.spacer_search_t = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.gridLayout.addItem(self.spacer_search_t, 2, 1, 1, 8)

        self.spacer_search_b = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.gridLayout.addItem(self.spacer_search_b, 5, 1, 1, 8)

        self.spacer_email_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout.addItem(self.spacer_email_l, 7, 4, 1, 1)

        self.spacer_link_l = QSpacerItem(40, 20, QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
        self.gridLayout.addItem(self.spacer_link_l, 13, 0, 1, 1)

        self.spacer_link_r = QSpacerItem(40, 20, QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
        self.gridLayout.addItem(self.spacer_link_r, 13, 9, 1, 1)

        self.spacer_link_t = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.gridLayout.addItem(self.spacer_link_t, 8, 1, 1, 8)

        self.spacer_link_b = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.gridLayout.addItem(self.spacer_link_b, 11, 1, 1, 8)

        self.spacer_price_b = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.gridLayout.addItem(self.spacer_price_b, 14, 1, 1, 7)

        # create frame bottom
        self.frame_bottom = QFrame(self)
        self.frame_bottom.setStyleSheet("""QFrame{background-color: #fff; padding: 10px;}""")
        self.frame_bottom.setFrameShape(QFrame.StyledPanel)
        self.frame_bottom.setFrameShadow(QFrame.Raised)
        self.gridLayout.addWidget(self.frame_bottom, 15, 0, 1, 10)
        self.horizontalLayout_frame_bottom = QHBoxLayout(self.frame_bottom)

        self.spacer_frame_bottom_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_frame_bottom.addItem(self.spacer_frame_bottom_l)

        self.pushButton_bn = QPushButton("Buy when price drops", self.frame_bottom)
        self.pushButton_bn.setMinimumSize(QSize(0, 40))
        self.pushButton_bn.setStyleSheet(styles.btn_light)
        self.horizontalLayout_frame_bottom.addWidget(self.pushButton_bn)
        self.pushButton_bn.setShortcut("Return")

        self.spacer_frame_bottom_c = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_frame_bottom.addItem(self.spacer_frame_bottom_c)

        self.pushButton_monitor = QPushButton("Monitor", self.frame_bottom)
        self.pushButton_monitor.clicked.connect(lambda: self.new_link_handler(True))
        self.pushButton_monitor.setMinimumSize(QSize(0, 40))
        self.pushButton_monitor.setStyleSheet(styles.btn_dark)
        self.horizontalLayout_frame_bottom.addWidget(self.pushButton_monitor)

        self.spacer_frame_bottom_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.horizontalLayout_frame_bottom.addItem(self.spacer_frame_bottom_r)

        self.horizontalLayout_frame_bottom.setStretch(0, 1)
        self.horizontalLayout_frame_bottom.setStretch(1, 1)
        self.horizontalLayout_frame_bottom.setStretch(2, 2)
        self.horizontalLayout_frame_bottom.setStretch(3, 1)
        self.horizontalLayout_frame_bottom.setStretch(4, 1)
        self.timer = QTimer(self)

        auto_login, auto_pwd, auto_email, auto_time = data.get_autofill()
        self.lineEdit_login.setText(auto_login)
        self.lineEdit_password.setText(auto_pwd)
        self.lineEdit_email.setText(auto_email)
        self.lineEdit_time.setText(str(auto_time))