def _after_zoom(self): new_size = QSize(self.sprites_horiz * Block.WIDTH * self.zoom, self.sprites_vert * Block.HEIGHT * self.zoom) self.setFixedSize(new_size)
def calculate_proper_size(self, from_size: QSize): minimum_length = min(from_size.width(), from_size.height()) return QSize(minimum_length - self.spacing(), minimum_length - self.spacing())
def sizeHint(self): return QSize(500, 500)
class RandomWalker(object): MOVE_UP = 0 MOVE_DOWN = 1 MOVE_RIGHT = 2 MOVE_LEFT = 3 def __init__(self): self.rect = QRect() self.path = [] self.start_pos = QVector2D() self.pos = QVector2D() self.resolution = QSize() self.up_vector = QVector2D(0, -1) self.down_vector = QVector2D(0, 1) self.left_vector = QVector2D(-1, 0) self.right_vector = QVector2D(1, 0) self.head_color = QColor(250, 60, 50) self.tail_color = QColor(70, 70, 70) def reset(self): self.path = [] self.pos = self.start_pos def setup(self): self.reset() def get_option(self): choice = random.randint(0, 3) pos_copy = QVector2D(self.pos) if choice == self.MOVE_UP: pos_copy += self.up_vector elif choice == self.MOVE_DOWN: pos_copy += self.down_vector elif choice == self.MOVE_LEFT: pos_copy += self.left_vector elif choice == self.MOVE_RIGHT: pos_copy += self.right_vector return pos_copy def tick(self): """ Tick the random walker to do something """ while True: pos = self.get_option() is_valid = True if pos.x() > self.resolution.width(): is_valid = False elif pos.x() < 0: is_valid = False elif pos.y() > self.resolution.height(): is_valid = False elif pos.y() < 0: is_valid = False if is_valid: self.path.append(pos) self.pos = pos break def paint_cell(self, painter, pos, color): chunk_x = float(self.rect.width()) / self.resolution.width() chunk_y = float(self.rect.height()) / self.resolution.height() x = pos.x() * chunk_x y = pos.y() * chunk_y painter.fillRect(x - chunk_x / 2, y - chunk_y - 2, math.ceil(chunk_x), math.ceil(chunk_y), color) def paint(self, painter): for p in self.path: self.paint_cell(painter, p, self.tail_color) self.paint_cell(painter, self.pos, self.head_color)
def setupSettingsUI(self, Settings): if not Settings.objectName(): Settings.setObjectName(u"Settings") Settings.resize(251, 161) Settings.setMinimumSize(QSize(251, 161)) Settings.setMaximumSize(QSize(251, 161)) icon = QIcon() icon.addFile(u"icons/favicon.ico", QSize(), QIcon.Normal, QIcon.Off) Settings.setWindowIcon(icon) #Font 10 font = QFont() font.setFamily(u"Yandex Sans Text") font.setPointSize(10) #Font 8 font1 = QFont() font1.setFamily(u"Yandex Sans Text") #Save self.savebtn = QPushButton(Settings) self.savebtn.setObjectName(u"savebtn") self.savebtn.setGeometry(QRect(80, 130, 81, 23)) self.savebtn.setFont(font) #API Yandex.Weather self.apiweather = QLineEdit(Settings) self.apiweather.setObjectName(u"apiweather") self.apiweather.setGeometry(QRect(10, 20, 231, 20)) self.apiweather.setFont(font1) self.apiweather.setStyleSheet(u"") self.apiweather.setFrame(True) self.apiweather.setAlignment(Qt.AlignCenter) #API Yandex.Geocoder self.apigeocoder = QLineEdit(Settings) self.apigeocoder.setObjectName(u"apigeocoder") self.apigeocoder.setGeometry(QRect(10, 60, 231, 20)) self.apigeocoder.setFont(font1) self.apigeocoder.setStyleSheet(u"") self.apigeocoder.setFrame(True) self.apigeocoder.setAlignment(Qt.AlignCenter) #Labels self.apiglbl = QLabel(Settings) self.apiglbl.setObjectName(u"apiglbl") self.apiglbl.setGeometry(QRect(10, 40, 231, 21)) self.apiglbl.setFont(font) self.apiglbl.setAlignment(Qt.AlignCenter) self.apiwlbl = QLabel(Settings) self.apiwlbl.setObjectName(u"apiwlbl") self.apiwlbl.setGeometry(QRect(10, 0, 231, 21)) self.apiwlbl.setFont(font) self.apiwlbl.setAlignment(Qt.AlignCenter) self.langlbl = QLabel(Settings) self.langlbl.setObjectName(u"langlbl") self.langlbl.setGeometry(QRect(10, 80, 231, 21)) self.langlbl.setFont(font) self.langlbl.setAlignment(Qt.AlignCenter) #languages self.langbox = QComboBox(Settings) self.langbox.setObjectName(u"langbox") self.langbox.setGeometry(QRect(10, 100, 231, 22)) self.langbox.setFont(font1) if language == "ru": self.TextSettingsRu(Settings) else: self.TextSettingsEn(Settings) QMetaObject.connectSlotsByName(Settings)
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(484, 433) self.centralWidget = QWidget(MainWindow) sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.centralWidget.sizePolicy().hasHeightForWidth()) self.centralWidget.setSizePolicy(sizePolicy) self.centralWidget.setObjectName("centralWidget") self.verticalLayout_2 = QVBoxLayout(self.centralWidget) self.verticalLayout_2.setContentsMargins(11, 11, 11, 11) self.verticalLayout_2.setSpacing(6) self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName("verticalLayout") self.lcdNumber = QLCDNumber(self.centralWidget) self.lcdNumber.setDigitCount(10) self.lcdNumber.setObjectName("lcdNumber") self.verticalLayout.addWidget(self.lcdNumber) self.gridLayout = QGridLayout() self.gridLayout.setSpacing(6) self.gridLayout.setObjectName("gridLayout") self.pushButton_n4 = QPushButton(self.centralWidget) self.pushButton_n4.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n4.setFont(font) self.pushButton_n4.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n4.setObjectName("pushButton_n4") self.gridLayout.addWidget(self.pushButton_n4, 3, 0, 1, 1) self.pushButton_n1 = QPushButton(self.centralWidget) self.pushButton_n1.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n1.setFont(font) self.pushButton_n1.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n1.setObjectName("pushButton_n1") self.gridLayout.addWidget(self.pushButton_n1, 4, 0, 1, 1) self.pushButton_n8 = QPushButton(self.centralWidget) self.pushButton_n8.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n8.setFont(font) self.pushButton_n8.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n8.setObjectName("pushButton_n8") self.gridLayout.addWidget(self.pushButton_n8, 2, 1, 1, 1) self.pushButton_mul = QPushButton(self.centralWidget) self.pushButton_mul.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_mul.setFont(font) self.pushButton_mul.setObjectName("pushButton_mul") self.gridLayout.addWidget(self.pushButton_mul, 2, 3, 1, 1) self.pushButton_n7 = QPushButton(self.centralWidget) self.pushButton_n7.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n7.setFont(font) self.pushButton_n7.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n7.setObjectName("pushButton_n7") self.gridLayout.addWidget(self.pushButton_n7, 2, 0, 1, 1) self.pushButton_n6 = QPushButton(self.centralWidget) self.pushButton_n6.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n6.setFont(font) self.pushButton_n6.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n6.setObjectName("pushButton_n6") self.gridLayout.addWidget(self.pushButton_n6, 3, 2, 1, 1) self.pushButton_n5 = QPushButton(self.centralWidget) self.pushButton_n5.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n5.setFont(font) self.pushButton_n5.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n5.setObjectName("pushButton_n5") self.gridLayout.addWidget(self.pushButton_n5, 3, 1, 1, 1) self.pushButton_n0 = QPushButton(self.centralWidget) self.pushButton_n0.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n0.setFont(font) self.pushButton_n0.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n0.setObjectName("pushButton_n0") self.gridLayout.addWidget(self.pushButton_n0, 5, 0, 1, 1) self.pushButton_n2 = QPushButton(self.centralWidget) self.pushButton_n2.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n2.setFont(font) self.pushButton_n2.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n2.setObjectName("pushButton_n2") self.gridLayout.addWidget(self.pushButton_n2, 4, 1, 1, 1) self.pushButton_n9 = QPushButton(self.centralWidget) self.pushButton_n9.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n9.setFont(font) self.pushButton_n9.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n9.setObjectName("pushButton_n9") self.gridLayout.addWidget(self.pushButton_n9, 2, 2, 1, 1) self.pushButton_n3 = QPushButton(self.centralWidget) self.pushButton_n3.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_n3.setFont(font) self.pushButton_n3.setStyleSheet("QPushButton {\n" "color: #1976D2;\n" "}") self.pushButton_n3.setObjectName("pushButton_n3") self.gridLayout.addWidget(self.pushButton_n3, 4, 2, 1, 1) self.pushButton_div = QPushButton(self.centralWidget) self.pushButton_div.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_div.setFont(font) self.pushButton_div.setObjectName("pushButton_div") self.gridLayout.addWidget(self.pushButton_div, 1, 3, 1, 1) self.pushButton_sub = QPushButton(self.centralWidget) self.pushButton_sub.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_sub.setFont(font) self.pushButton_sub.setObjectName("pushButton_sub") self.gridLayout.addWidget(self.pushButton_sub, 3, 3, 1, 1) self.pushButton_add = QPushButton(self.centralWidget) self.pushButton_add.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_add.setFont(font) self.pushButton_add.setObjectName("pushButton_add") self.gridLayout.addWidget(self.pushButton_add, 4, 3, 1, 1) self.pushButton_ac = QPushButton(self.centralWidget) self.pushButton_ac.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_ac.setFont(font) self.pushButton_ac.setStyleSheet("QPushButton {\n" " color: #f44336;\n" "}") self.pushButton_ac.setObjectName("pushButton_ac") self.gridLayout.addWidget(self.pushButton_ac, 1, 0, 1, 1) self.pushButton_mr = QPushButton(self.centralWidget) self.pushButton_mr.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_mr.setFont(font) self.pushButton_mr.setStyleSheet("QPushButton {\n" " color: #FFC107;\n" "}") self.pushButton_mr.setObjectName("pushButton_mr") self.gridLayout.addWidget(self.pushButton_mr, 1, 2, 1, 1) self.pushButton_m = QPushButton(self.centralWidget) self.pushButton_m.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_m.setFont(font) self.pushButton_m.setStyleSheet("QPushButton {\n" " color: #FFC107;\n" "}") self.pushButton_m.setObjectName("pushButton_m") self.gridLayout.addWidget(self.pushButton_m, 1, 1, 1, 1) self.pushButton_pc = QPushButton(self.centralWidget) self.pushButton_pc.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(False) font.setWeight(50) self.pushButton_pc.setFont(font) self.pushButton_pc.setObjectName("pushButton_pc") self.gridLayout.addWidget(self.pushButton_pc, 5, 1, 1, 1) self.pushButton_eq = QPushButton(self.centralWidget) self.pushButton_eq.setMinimumSize(QSize(0, 50)) font = QFont() font.setPointSize(27) font.setBold(True) font.setWeight(75) self.pushButton_eq.setFont(font) self.pushButton_eq.setStyleSheet("QPushButton {\n" "color: #4CAF50;\n" "}") self.pushButton_eq.setObjectName("pushButton_eq") self.gridLayout.addWidget(self.pushButton_eq, 5, 2, 1, 2) self.verticalLayout.addLayout(self.gridLayout) self.verticalLayout_2.addLayout(self.verticalLayout) MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QMenuBar(MainWindow) self.menuBar.setGeometry(QRect(0, 0, 484, 22)) self.menuBar.setObjectName("menuBar") self.menuFile = QMenu(self.menuBar) self.menuFile.setObjectName("menuFile") MainWindow.setMenuBar(self.menuBar) self.statusBar = QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.actionExit = QAction(MainWindow) self.actionExit.setObjectName("actionExit") self.actionReset = QAction(MainWindow) self.actionReset.setObjectName("actionReset") self.menuFile.addAction(self.actionReset) self.menuFile.addAction(self.actionExit) self.menuBar.addAction(self.menuFile.menuAction()) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, name, link, is_done, price, xpath, time, is_monitoring, parent=None, shared_dict=None): QFrame.__init__(self, parent) self.shared_dict = shared_dict self.setMinimumSize(QSize(0, 300)) self.setStyleSheet("""QFrame{border-bottom: 0.5px solid #aaa;}""") self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self) # create description frame and layout self.frame_description = QFrame(self) self.frame_description.setMinimumSize(QSize(440, 16777215)) self.frame_description.setStyleSheet("""QFrame{border: none;}""") self.frame_description.setFrameShape(QFrame.StyledPanel) self.frame_description.setFrameShadow(QFrame.Raised) self.gridLayout_description = QGridLayout(self.frame_description) self.horizontalLayout.addWidget(self.frame_description) self.gridLayout_description.setColumnStretch(0, 1) self.gridLayout_description.setColumnStretch(1, 2) self.gridLayout_description.setColumnStretch(2, 3) self.gridLayout_description.setColumnStretch(3, 1) self.gridLayout_description.setColumnStretch(4, 6) # fill description layout self.label_name = QLabel(name, self.frame_description) self.label_name.setStyleSheet(styles.label_allegro_monitored_name) self.label_name.setTextFormat(Qt.MarkdownText) self.label_name.setAlignment(Qt.AlignJustify | Qt.AlignVCenter) self.label_name.setWordWrap(False) self.gridLayout_description.addWidget(self.label_name, 0, 0, 1, 5) url_link = "<a href=\"" + link + "\" style = \" color: #838836; text-decoration: none; font-family:corbel; title=\"Go to monitored page\"\">check product</a>" self.label_monitored_link = QLabel(url_link, self.frame_description) self.label_monitored_link.setStyleSheet( styles.label_allegro_monitored_link) self.gridLayout_description.addWidget(self.label_monitored_link, 1, 1, 2, 2) self.label_monitored_link.setOpenExternalLinks(True) self.label_stat = QLabel(self.frame_description) self.label_stat.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_stat, 1, 4, 1, 1) self.label_is_on = QLabel(self.frame_description) self.label_is_on.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_is_on, 5, 0, 1, 2) self.label_new_time = QLabel( "Actual refresh time[s]: " + str(time) + " s", self.frame_description) self.label_new_time.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_new_time, 4, 0, 1, 3) self.lineEdit_new_time = QLineEdit(self.frame_description) self.lineEdit_new_time.setMinimumSize(QSize(0, 33)) self.lineEdit_new_time.setStyleSheet(styles.lineEdit) self.gridLayout_description.addWidget(self.lineEdit_new_time, 4, 3, 1, 2) self.lineEdit_new_time.setPlaceholderText("Set new interval") self.label_new_price = QLabel("Actual price: " + str(price), self) self.label_new_price.setStyleSheet(styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_new_price, 3, 0, 1, 3) self.lineEdit_new_price = QLineEdit(self) self.lineEdit_new_price.setMinimumSize(QSize(0, 35)) self.lineEdit_new_price.setStyleSheet(styles.lineEdit) self.gridLayout_description.addWidget(self.lineEdit_new_price, 3, 3, 1, 2) self.lineEdit_new_price.setPlaceholderText("Set new price") self.label_img_link = QLabel(self.frame_description) self.label_img_link.setMaximumSize(QSize(20, 20)) self.label_img_link.setStyleSheet("""QLabel{border: none;}""") self.label_img_link.setPixmap( QPixmap(os.path.join(path, "img/link.png"))) self.label_img_link.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_link, 1, 0, 2, 1) self.label_img_stat = QLabel("done", self.frame_description) if is_done: self.label_stat.setText("done") self.label_img_stat.setPixmap( QPixmap(os.path.join(path, "img/check.png"))) else: self.label_stat.setText("in progress") self.label_img_stat.setPixmap( QPixmap(os.path.join(path, "img/loading.png"))) self.label_img_stat.setMaximumSize(QSize(20, 20)) self.label_img_stat.setStyleSheet("""QLabel{border: none;}""") self.label_img_stat.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_stat, 1, 3, 1, 1) self.label_img_monitor = QLabel("done", self.frame_description) if is_monitoring: monitor_text = "I am just monitoring" self.label_img_monitor.setPixmap( QPixmap(os.path.join(path, "img/monitoring.png"))) else: monitor_text = "I am going to buy" self.label_img_monitor.setPixmap( QPixmap(os.path.join(path, "img/buy.png"))) self.label_is_monitoring = QLabel(monitor_text, self) self.label_is_monitoring.setStyleSheet( styles.label_allegro_monitored_stat) self.gridLayout_description.addWidget(self.label_is_monitoring, 2, 4, 1, 1) self.label_img_monitor.setMaximumSize(QSize(20, 20)) self.label_img_monitor.setStyleSheet("""QLabel{border: none;}""") self.label_img_monitor.setScaledContents(True) self.gridLayout_description.addWidget(self.label_img_monitor, 2, 3, 1, 1) # create spacer and delete btn self.spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.spacer) self.pushButton_delete = QPushButton(self) # self.pushButton_delete.clicked.connect( lambda: self.deleteLater()) self.pushButton_delete.clicked.connect(lambda: self.on_delete(link)) icon = QIcon() icon.addFile(os.path.join(path, "img/delete.png"), QSize(), QIcon.Selected, QIcon.Off) # icon.Active.addFile(os.path.join(path, "img/icon.png"), QSize(), QIcon.Selected, QIcon.Off) self.pushButton_delete.setIcon(icon) self.pushButton_delete.setIconSize(QSize(50, 50)) self.pushButton_delete.setStyleSheet("""QPushButton{border:none; }""") self.pushButton_delete.setCursor(QCursor(Qt.PointingHandCursor)) # self.pushButton_delete.ico self.horizontalLayout.addWidget(self.pushButton_delete) self.is_on = data.get_switch_state(link) self.pushButton_switch = QPushButton(self) self.pushButton_switch.clicked.connect(lambda: self.on_switch(link)) self.icon_on = QIcon() self.icon_off = QIcon() self.icon_on.addFile(os.path.join(path, "img/switch_on.png"), QSize(), QIcon.Selected, QIcon.On) self.icon_off.addFile(os.path.join(path, "img/switch_off.png"), QSize(), QIcon.Selected, QIcon.Off) if self.is_on: self.label_is_on.setText("Disable") self.pushButton_switch.setIcon(self.icon_on) else: self.label_is_on.setText("Enable") self.pushButton_switch.setIcon(self.icon_off) self.pushButton_switch.setIconSize(QSize(100, 40)) self.pushButton_switch.setStyleSheet("""QPushButton{border:none; }""") self.pushButton_switch.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout_description.addWidget(self.pushButton_switch, 5, 2, 1, 1) self.pushButton_save_changes = QPushButton("Save", self) self.pushButton_save_changes.clicked.connect( lambda: self.on_save_changes(link)) self.pushButton_save_changes.setIconSize(QSize(100, 20)) self.pushButton_save_changes.setStyleSheet(styles.btn_dark) self.pushButton_save_changes.setCursor(QCursor(Qt.PointingHandCursor)) self.gridLayout_description.addWidget(self.pushButton_save_changes, 5, 3, 1, 2)
def initUi(self): self.layout = QGridLayout() self.categoryList = QListView() self.right_layout = QStackedLayout() self.categoryList.setMaximumWidth(175) self.categoryModel = QStandardItemModel(self.categoryList) self.categoryList.setIconSize(QSize(32, 32)) self.initDifficultyLayout() difficulty = QStandardItem("Difficulty") difficulty.setIcon(CONST.ICONS["Missile"]) difficulty.setEditable(False) difficulty.setSelectable(True) self.categoryModel.appendRow(difficulty) self.right_layout.addWidget(self.difficultyPage) self.initGeneratorLayout() generator = QStandardItem("Mission Generator") generator.setIcon(CONST.ICONS["Generator"]) generator.setEditable(False) generator.setSelectable(True) self.categoryModel.appendRow(generator) self.right_layout.addWidget(self.generatorPage) self.initCheatLayout() cheat = QStandardItem("Cheat Menu") cheat.setIcon(CONST.ICONS["Cheat"]) cheat.setEditable(False) cheat.setSelectable(True) self.categoryModel.appendRow(cheat) self.right_layout.addWidget(self.cheatPage) self.pluginsPage = PluginsPage() plugins = QStandardItem("LUA Plugins") plugins.setIcon(CONST.ICONS["Plugins"]) plugins.setEditable(False) plugins.setSelectable(True) self.categoryModel.appendRow(plugins) self.right_layout.addWidget(self.pluginsPage) self.pluginsOptionsPage = PluginOptionsPage() pluginsOptions = QStandardItem("LUA Plugins Options") pluginsOptions.setIcon(CONST.ICONS["PluginsOptions"]) pluginsOptions.setEditable(False) pluginsOptions.setSelectable(True) self.categoryModel.appendRow(pluginsOptions) self.right_layout.addWidget(self.pluginsOptionsPage) self.categoryList.setSelectionBehavior(QAbstractItemView.SelectRows) self.categoryList.setModel(self.categoryModel) self.categoryList.selectionModel().setCurrentIndex( self.categoryList.indexAt(QPoint(1, 1)), QItemSelectionModel.Select) self.categoryList.selectionModel().selectionChanged.connect( self.onSelectionChanged) self.layout.addWidget(self.categoryList, 0, 0, 1, 1) self.layout.addLayout(self.right_layout, 0, 1, 5, 1) self.setLayout(self.layout)
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))
def __init__(self, parent=None): QFrame.__init__(self, parent) self.setStyleSheet("""QFrame{ background-color:#43454f;}""") self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.frame_nav = QFrame(self) self.frame_nav.setMinimumSize(QSize(220, 300)) self.frame_nav.setStyleSheet("""QFrame{ background-color:#43454f;}""") self.frame_nav.setFrameShape(QFrame.StyledPanel) self.frame_nav.setFrameShadow(QFrame.Raised) self.gridLayout = QGridLayout(self) self.gridLayout.setContentsMargins(11, -1, 11, -1) self.gridLayout.addWidget(self.frame_nav, 3, 0, 1, 4) # set program img and name self.label_img = QLabel(self) self.label_img.setFixedSize(QSize(60, 60)) self.label_img.setPixmap(QPixmap(os.path.join(path, 'img/icon.png'))) # self.label_img.setPixmap(QPixmap("../img/icon.png")) self.label_img.setScaledContents(True) self.gridLayout.addWidget(self.label_img, 2, 1, 1, 1) self.label_name = QLabel("WebCheck ", self) self.label_name.setStyleSheet(styles.label_icon_name) self.gridLayout.addWidget(self.label_name, 2, 2, 1, 1) self.spacer_name_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_name_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_name_t = QSpacerItem(20, 70, QSizePolicy.Minimum, QSizePolicy.Maximum) self.gridLayout.addItem(self.spacer_name_l, 2, 0, 1, 1) self.gridLayout.addItem(self.spacer_name_r, 2, 3, 1, 1) self.gridLayout.addItem(self.spacer_name_t, 1, 1, 1, 2) # set bottom layout for keeping gb in it self.gridLayout_b = QGridLayout(self.frame_nav) self.spacer_gb_l = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_gb_r = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.spacer_gb_t = QSpacerItem(0, 20, QSizePolicy.Minimum, QSizePolicy.Maximum) self.spacer_gb_b = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.gridLayout_b.addItem(self.spacer_gb_l, 1, 2, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_r, 1, 0, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_t, 0, 1, 1, 1) self.gridLayout_b.addItem(self.spacer_gb_b, 2, 1, 1, 1) # set gb and radio buttons self.groupBox = QGroupBox("", self.frame_nav) self.gridLayout_b.addWidget(self.groupBox, 1, 1, 1, 1) self.groupBox.setMinimumSize(QSize(220, 350)) self.groupBox.setStyleSheet( """QGroupBox{background-image: url(ui/img/radioline.png); border: none;}""" ) self.verticalLayout_gb = QVBoxLayout(self.groupBox) self.radioButton_add = QRadioButton(" Add", self.groupBox) self.radioButton_add.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_add) self.radioButton_monitored = QRadioButton(" Monitored", self.groupBox) self.radioButton_monitored.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_monitored) self.radioButton_options = QRadioButton(" Options", self.groupBox) self.radioButton_options.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_options) self.radioButton_about = QRadioButton(" About", self.groupBox) self.radioButton_about.setStyleSheet(styles.btn_radio) self.verticalLayout_gb.addWidget(self.radioButton_about)
def setupUi(self, guiDlg): if not guiDlg.objectName(): guiDlg.setObjectName(u"guiDlg") guiDlg.resize(1042, 819) self.verticalLayout = QVBoxLayout(guiDlg) self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalSpacer_5 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer_5) self.configuration = QPushButton(guiDlg) self.configuration.setObjectName(u"configuration") self.configuration.setCheckable(True) self.horizontalLayout.addWidget(self.configuration) self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer) self.regenerate = QPushButton(guiDlg) self.regenerate.setObjectName(u"regenerate") self.horizontalLayout.addWidget(self.regenerate) self.horizontalSpacer_4 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer_4) self.label_2 = QLabel(guiDlg) self.label_2.setObjectName(u"label_2") self.horizontalLayout.addWidget(self.label_2) self.contributor = QLineEdit(guiDlg) self.contributor.setObjectName(u"contributor") self.horizontalLayout.addWidget(self.contributor) self.horizontalSpacer_3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer_3) self.quit = QPushButton(guiDlg) self.quit.setObjectName(u"quit") self.horizontalLayout.addWidget(self.quit) self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer_2) self.verticalLayout.addLayout(self.horizontalLayout) self.label = QLabel(guiDlg) self.label.setObjectName(u"label") sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy) self.label.setMinimumSize(QSize(1024, 768)) self.label.setMaximumSize(QSize(10240, 7680)) self.label.setSizeIncrement(QSize(1, 1)) self.label.setScaledContents(True) self.verticalLayout.addWidget(self.label) self.retranslateUi(guiDlg) QMetaObject.connectSlotsByName(guiDlg)
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(500, 700) MainWindow.setMinimumSize(QSize(500, 700)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setSpacing(0) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.frame_sup = QFrame(self.centralwidget) self.frame_sup.setObjectName(u"frame_sup") self.frame_sup.setMaximumSize(QSize(16777215, 45)) self.frame_sup.setStyleSheet(u"background-color: rgb(110, 110, 110);") self.frame_sup.setFrameShape(QFrame.NoFrame) self.frame_sup.setFrameShadow(QFrame.Raised) self.horizontalLayout_2 = QHBoxLayout(self.frame_sup) self.horizontalLayout_2.setSpacing(0) self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.horizontalLayout_2.setContentsMargins(0, 5, 0, 0) self.frame_error = QFrame(self.frame_sup) self.frame_error.setObjectName(u"frame_error") self.frame_error.setMaximumSize(QSize(450, 16777215)) self.frame_error.setStyleSheet(u"background-color: rgb(236, 85, 88);\n" "border-radius: 5px;") self.frame_error.setFrameShape(QFrame.NoFrame) self.frame_error.setFrameShadow(QFrame.Raised) self.horizontalLayout_3 = QHBoxLayout(self.frame_error) self.horizontalLayout_3.setSpacing(3) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.horizontalLayout_3.setContentsMargins(10, 3, 10, 3) self.label_error = QLabel(self.frame_error) self.label_error.setObjectName(u"label_error") self.label_error.setMinimumSize(QSize(450, 0)) self.label_error.setMaximumSize(QSize(450, 16777215)) self.label_error.setAlignment(Qt.AlignCenter) self.horizontalLayout_3.addWidget(self.label_error) self.botao_sair = QPushButton(self.frame_error) self.botao_sair.setObjectName(u"botao_sair") self.botao_sair.setMaximumSize(QSize(25, 25)) self.botao_sair.setStyleSheet(u"Qpushbutton{\n" " border-radius: 5px;\n" "}\n" "Qpushbutton:hover{\n" " background-color: rgb(0, 0, 0);\n" "}") self.horizontalLayout_3.addWidget(self.botao_sair) self.horizontalLayout_2.addWidget(self.frame_error) self.verticalLayout.addWidget(self.frame_sup) self.frame_med = QFrame(self.centralwidget) self.frame_med.setObjectName(u"frame_med") self.frame_med.setStyleSheet(u"background-color: rgb(110, 110, 110);") self.frame_med.setFrameShape(QFrame.NoFrame) self.frame_med.setFrameShadow(QFrame.Raised) self.horizontalLayout = QHBoxLayout(self.frame_med) self.horizontalLayout.setSpacing(0) self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalLayout.setContentsMargins(0, 2, 0, 0) self._interior = QFrame(self.frame_med) self._interior.setObjectName(u"_interior") self._interior.setMaximumSize(QSize(450, 550)) font = QFont() font.setPointSize(14) self._interior.setFont(font) self._interior.setStyleSheet(u"background-color: rgb(50, 50, 50);\n" "border-radius: 10px;") self._interior.setFrameShape(QFrame.NoFrame) self._interior.setFrameShadow(QFrame.Raised) self.frame = QFrame(self._interior) self.frame.setObjectName(u"frame") self.frame.setGeometry(QRect(160, 20, 120, 80)) self.frame.setStyleSheet(u"image: url(:/logo/Dugui_1.png);") self.frame.setFrameShape(QFrame.StyledPanel) self.frame.setFrameShadow(QFrame.Raised) self.campo_user = QLineEdit(self._interior) self.campo_user.setObjectName(u"campo_user") self.campo_user.setGeometry(QRect(30, 200, 390, 50)) font1 = QFont() font1.setFamily(u"Trebuchet MS") font1.setPointSize(14) self.campo_user.setFont(font1) self.campo_user.setMouseTracking(False) self.campo_user.setLayoutDirection(Qt.LeftToRight) self.campo_user.setStyleSheet(u"QLineEdit {\n" "border-radius: 20px;\n" "background-color: rgb(255, 255, 255);\n" "}\n" "\n" "") self.campo_user.setMaxLength(35) self.campo_user.setCursorPosition(0) self.campo_senha = QLineEdit(self._interior) self.campo_senha.setObjectName(u"campo_senha") self.campo_senha.setGeometry(QRect(30, 290, 390, 50)) self.campo_senha.setFont(font1) self.campo_senha.setMouseTracking(False) self.campo_senha.setLayoutDirection(Qt.LeftToRight) self.campo_senha.setStyleSheet(u"QLineEdit {\n" "border-radius: 20px;\n" "background-color: rgb(255, 255, 255);\n" "}\n" "") self.campo_senha.setMaxLength(18) self.campo_senha.setCursorPosition(0) self.campo_entrar = QLineEdit(self._interior) self.campo_entrar.setObjectName(u"campo_entrar") self.campo_entrar.setGeometry(QRect(30, 380, 180, 50)) self.campo_entrar.setFont(font1) self.campo_entrar.setMouseTracking(False) self.campo_entrar.setLayoutDirection(Qt.LeftToRight) self.campo_entrar.setStyleSheet(u"QLineEdit {\n" "border-radius: 20px;\n" "background-color: rgb(255, 255, 255);\n" "background-color: rgb(20, 255, 130);\n" "}\n" "") self.campo_entrar.setMaxLength(18) self.campo_entrar.setCursorPosition(6) self.campo_entrar.setAlignment(Qt.AlignCenter) self.campo_senha_3 = QLineEdit(self._interior) self.campo_senha_3.setObjectName(u"campo_senha_3") self.campo_senha_3.setGeometry(QRect(240, 380, 180, 50)) self.campo_senha_3.setFont(font1) self.campo_senha_3.setMouseTracking(False) self.campo_senha_3.setLayoutDirection(Qt.LeftToRight) self.campo_senha_3.setStyleSheet(u"QLineEdit {\n" "border-radius: 20px;\n" "background-color: rgb(255, 255, 255);\n" "background-color: rgb(20, 255, 130);\n" "}\n" "") self.campo_senha_3.setMaxLength(18) self.campo_senha_3.setCursorPosition(9) self.campo_senha_3.setAlignment(Qt.AlignCenter) self.label_login = QLabel(self._interior) self.label_login.setObjectName(u"label_login") self.label_login.setGeometry(QRect(140, 130, 171, 41)) font2 = QFont() font2.setFamily(u"Trebuchet MS") font2.setPointSize(16) self.label_login.setFont(font2) self.label_login.setStyleSheet(u"color: rgb(255, 255, 255);") self.horizontalLayout.addWidget(self._interior) self.verticalLayout.addWidget(self.frame_med) self.frame_inf = QFrame(self.centralwidget) self.frame_inf.setObjectName(u"frame_inf") self.frame_inf.setMaximumSize(QSize(16777215, 30)) self.frame_inf.setStyleSheet(u"background-color: rgb(110, 110, 110);") self.frame_inf.setFrameShape(QFrame.NoFrame) self.frame_inf.setFrameShadow(QFrame.Raised) self.label = QLabel(self.frame_inf) self.label.setObjectName(u"label") self.label.setGeometry(QRect(180, 3, 161, 20)) font3 = QFont() font3.setFamily(u"Trebuchet MS") font3.setPointSize(9) self.label.setFont(font3) self.verticalLayout.addWidget(self.frame_inf) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 500, 26)) MainWindow.setMenuBar(self.menubar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, Register): if not Register.objectName(): Register.setObjectName(u"Register") Register.resize(410, 630) Register.setStyleSheet( u"*{\n" "font-family: century gothic;\n" "}\n" "\n" "QWidget{\n" "background-image: url(:/images/images/background_register.png);\n" "}\n" "\n" "QFrame#contenedor{\n" "background:#1d1d1d;\n" "border-radius:15px;\n" "}\n" "\n" "QToolButton{\n" "background:#2d89ef;\n" "border-radius:15px;\n" "}\n" "\n" "QLabel#registro{\n" "color:white;\n" "font-size:24px;\n" "}\n" "\n" "QLabel{\n" "font-weight:bold;\n" "color:white;\n" "}\n" "\n" "QLineEdit{\n" "background:transparent;\n" "border:none;\n" "border-bottom:1px solid white;\n" "color:white;\n" "}\n" "\n" "QPushButton{\n" "background:#2d89ef;\n" "color:white;\n" "border-radius:15px;\n" "}\n" "\n" "QPushButton:hover{\n" "background:#2b5797;\n" "color:white;\n" "border-radius:15px;\n" "font-weight: bold;\n" "}\n" "") self.centralwidget = QWidget(Register) self.centralwidget.setObjectName(u"centralwidget") self.contenedor = QFrame(self.centralwidget) self.contenedor.setObjectName(u"contenedor") self.contenedor.setGeometry(QRect(20, 10, 371, 611)) self.contenedor.setFrameShape(QFrame.StyledPanel) self.contenedor.setFrameShadow(QFrame.Raised) self.toolButton = QToolButton(self.contenedor) self.toolButton.setObjectName(u"toolButton") self.toolButton.setGeometry(QRect(164, 20, 51, 51)) icon = QIcon() icon.addFile(u":/images/images/icon.png", QSize(), QIcon.Normal, QIcon.Off) self.toolButton.setIcon(icon) self.toolButton.setIconSize(QSize(30, 30)) self.registro = QLabel(self.contenedor) self.registro.setObjectName(u"registro") self.registro.setGeometry(QRect(30, 120, 111, 21)) self.label = QLabel(self.contenedor) self.label.setObjectName(u"label") self.label.setGeometry(QRect(30, 170, 151, 19)) self.lineEdit = QLineEdit(self.contenedor) self.lineEdit.setObjectName(u"lineEdit") self.lineEdit.setGeometry(QRect(30, 200, 321, 25)) self.lineEdit.setMaxLength(16) self.label_2 = QLabel(self.contenedor) self.label_2.setObjectName(u"label_2") self.label_2.setGeometry(QRect(30, 250, 151, 19)) self.lineEdit_2 = QLineEdit(self.contenedor) self.lineEdit_2.setObjectName(u"lineEdit_2") self.lineEdit_2.setGeometry(QRect(30, 280, 321, 25)) self.lineEdit_2.setMaxLength(16) self.label_3 = QLabel(self.contenedor) self.label_3.setObjectName(u"label_3") self.label_3.setGeometry(QRect(30, 330, 151, 19)) self.lineEdit_3 = QLineEdit(self.contenedor) self.lineEdit_3.setObjectName(u"lineEdit_3") self.lineEdit_3.setGeometry(QRect(30, 360, 321, 25)) self.lineEdit_3.setMaxLength(25) self.label_4 = QLabel(self.contenedor) self.label_4.setObjectName(u"label_4") self.label_4.setGeometry(QRect(30, 410, 151, 19)) self.lineEdit_4 = QLineEdit(self.contenedor) self.lineEdit_4.setObjectName(u"lineEdit_4") self.lineEdit_4.setGeometry(QRect(30, 440, 321, 25)) self.lineEdit_4.setMaxLength(12) self.lineEdit_4.setEchoMode(QLineEdit.Password) self.pushButton = QPushButton(self.contenedor) self.pushButton.setObjectName(u"pushButton") self.pushButton.setGeometry(QRect(30, 530, 321, 34)) self.retranslateUi(Register) QMetaObject.connectSlotsByName(Register)
def __init__(self): QWidget.__init__(self) self.theme = 2 screen = QDesktopWidget() logging.info("screen size:" + str(screen.width()) + "," + str(screen.height())) self.m_width = screen.height() / 2 self.m_height = screen.height() / 2 self.resize(self.m_width, self.m_height) # self.setFixedSize(self.m_width, self.m_height) size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) # delete title box self.setWindowFlags(Qt.FramelessWindowHint) # self.setAttribute(Qt.WA_TranslucentBackground) logging.info("login widget size:" + str(self.size())) self.bitmap = QBitmap(self.size()) painter = QPainter(self.bitmap) painter.fillRect(self.rect(), Qt.white) painter.setBrush(QColor(0, 0, 0)) painter.setRenderHint(QPainter.Antialiasing, True) painter.drawRoundedRect(self.rect(), 10, 10) self.setMask(self.bitmap) self.layout = QVBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, self.m_height / 15) self.layout.setSpacing(self.m_height / 15) self.topframe = QFrame(self) self.topframe.setObjectName("topframe") if self.theme == 1: self.topframe.setStyleSheet( "#topframe{background-color:qlineargradient(" "spread:pad," "x1:0,y1:0,x2:1,y2:1," "stop:0 #5efce8," "stop:1 #736efe);}") elif self.theme == 2: self.topframe.setStyleSheet( "#topframe{background-color:qlineargradient(" "spread:pad," "x1:0,y1:0,x2:1,y2:0," "stop:0 #3a6186," "stop:1 #89253e);}") elif self.theme == 3: self.topframe.setStyleSheet( "#topframe{background-color:qlineargradient(" "spread:pad," "x1:0,y1:0,x2:0,y2:1," "stop:0 #19547b," "stop:1 #ffd89b);}") else: self.topframe.setStyleSheet( "#topframe{background-color:qlineargradient(" "spread:pad," "x1:0,y1:0,x2:1,y2:1," "stop:0 #ff8177," "stop:1 #b12a5b);}") self.layout.addWidget(self.topframe) # setup checkbox self.combobox = QComboBox(self) self.combobox.setObjectName("combobox") self.combobox.setFixedSize(self.m_width / 1.5, self.m_height / 10) self.combobox.setStyleSheet( "QComboBox{border: 2px solid gray;" "border-radius:5px;" "background-color:rgb(255, 255, 255);" "color:rgb(0, 0, 0);" "padding: 1px 20px;}" "QComboBox:drop-down{subcontrol-origin: padding;" "subcontrol-position: top right;" "width: 50px;border-left-style:solid;" "border-top-right-radius: 3px;" "border-bottom-right-radius: 3px;" "border-left: 2px solid gray;" "background-color: rgba(100, 25, 100, 0);}" "QComboBox:down-arrow{border-image:url(icon/arrow-1.png);}" "QComboBox:item:selected{background: rgb(232, 241, 250);color: rgb(2, 65, 132);}" "QStyledItemDelegate{border: 100px solid rgb(161,161,161);}") # self.combobox.move(200, 200) self.layout.addWidget(self.combobox, 0, Qt.AlignHCenter) # setup login button self.loginbtn = QPushButton("ENTER", self) self.loginbtn.setObjectName("loginbtn") self.loginbtn.setFixedSize(self.m_width / 1.5, self.m_height / 10) self.loginbtn.setContentsMargins(200, 20, 20, 20) self.loginbtn.clicked.connect(self.login_event) self.loginbtn.setStyleSheet( "QPushButton{border-radius:%dpx;" "background-color:#89253e;" "color:rgb(0, 0, 0);}" "QPushButton:hover{color:rgb(0, 255, 0);}" % (self.m_height / 20)) self.layout.addWidget(self.loginbtn, 0, Qt.AlignHCenter) # setup exit button self.exitbtn = QPushButton(self) # self.exitbtn.setText("Close") self.exitbtn.setToolTip("Close the widget") self.exitbtn.setFixedSize(40, 40) self.exitbtn.setIcon(QIcon("icon/close.png")) self.exitbtn.setIconSize(QSize(40, 40)) self.exitbtn.clicked.connect(self.exit_event) logging.info("topframesize:" + str(self.topframe.size())) self.exitbtn.move(self.width() - 40, 0) # self.exitbtn.setGeometry(self.topframe.width()-40, 0, 100, 40) self.exitbtn.setStyleSheet("background-color: #600") self.exitbtn.setStyleSheet("background-color: transparent") self.exitbtn.isEnabled() self.logoImage = QPixmap("icon/silabslogo.png") self.logo = self.logoImage.scaled(self.m_width / 5, self.m_height / 5, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.logoLable = QLabel(self) self.logoLable.setObjectName("logoLable") self.logoLable.setAlignment(Qt.AlignCenter) self.logoLable.setPixmap(self.logo) self.logoLable.setFixedSize(self.m_width / 4, self.m_height / 4) # self.logo.setScaledContents(True) self.logoLable.setStyleSheet("#logoLable{border: 2px solid gray;" "border-radius:75px;" "background-color:rgb(100, 100, 100);" "color:rgb(0, 0, 0);}") self.logoLable.move(self.m_width / 2 - self.m_width / 8, self.m_height / 6) self.m_drag = False self.m_DragPosition = 0 self.MainWindow = 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)
def sizeHint(self, *args, **kwargs): return QSize(1200, 800)
def sizeHint(self): return QSize(800, 800)
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(524, 464) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout_2 = QGridLayout(self.centralwidget) self.gridLayout_2.setObjectName(u"gridLayout_2") self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(u"verticalLayout") self.horizontalLayout_5 = QHBoxLayout() self.horizontalLayout_5.setObjectName(u"horizontalLayout_5") self.label_3 = QLabel(self.centralwidget) self.label_3.setObjectName(u"label_3") self.label_3.setMinimumSize(QSize(60, 0)) self.label_3.setAlignment(Qt.AlignCenter) self.horizontalLayout_5.addWidget(self.label_3) self.textEdit_3 = QTextEdit(self.centralwidget) self.textEdit_3.setObjectName(u"textEdit_3") self.textEdit_3.setPlaceholderText("Default = 1") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.textEdit_3.sizePolicy().hasHeightForWidth()) self.textEdit_3.setSizePolicy(sizePolicy) self.textEdit_3.setMaximumSize(QSize(16777215, 25)) self.horizontalLayout_5.addWidget(self.textEdit_3) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout_3 = QHBoxLayout() self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") self.label = QLabel(self.centralwidget) self.label.setObjectName(u"label") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.label.sizePolicy().hasHeightForWidth()) self.label.setSizePolicy(sizePolicy1) self.label.setMinimumSize(QSize(60, 0)) self.label.setAlignment(Qt.AlignCenter) self.horizontalLayout_3.addWidget(self.label) self.textEdit = QTextEdit(self.centralwidget) self.textEdit.setObjectName(u"textEdit") self.textEdit.setPlaceholderText("Default = 100") sizePolicy.setHeightForWidth( self.textEdit.sizePolicy().hasHeightForWidth()) self.textEdit.setSizePolicy(sizePolicy) self.textEdit.setMaximumSize(QSize(16777215, 25)) self.horizontalLayout_3.addWidget(self.textEdit) self.verticalLayout.addLayout(self.horizontalLayout_3) self.horizontalLayout_4 = QHBoxLayout() self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") self.label_2 = QLabel(self.centralwidget) self.label_2.setObjectName(u"label_2") self.label_2.setMinimumSize(QSize(60, 0)) self.label_2.setAlignment(Qt.AlignCenter) self.horizontalLayout_4.addWidget(self.label_2) self.textEdit_2 = QTextEdit(self.centralwidget) self.textEdit_2.setObjectName(u"textEdit_2") self.textEdit_2.setPlaceholderText("Default = 1000") sizePolicy.setHeightForWidth( self.textEdit_2.sizePolicy().hasHeightForWidth()) self.textEdit_2.setSizePolicy(sizePolicy) self.textEdit_2.setMaximumSize(QSize(16777215, 25)) self.horizontalLayout_4.addWidget(self.textEdit_2) self.verticalLayout.addLayout(self.horizontalLayout_4) self.gridLayout_2.addLayout(self.verticalLayout, 1, 0, 1, 1) self.gridLayout = QGridLayout() self.gridLayout.setObjectName(u"gridLayout") self.textBrowser = QTextBrowser(self.centralwidget) self.textBrowser.setObjectName(u"textBrowser") self.gridLayout.addWidget(self.textBrowser, 2, 1, 1, 1) self.textBrowser_2 = QTextBrowser(self.centralwidget) self.textBrowser_2.setObjectName(u"textBrowser_2") self.gridLayout.addWidget(self.textBrowser_2, 2, 0, 1, 1) self.label_5 = QLabel(self.centralwidget) self.label_5.setObjectName(u"label_5") self.label_5.setAlignment(Qt.AlignCenter) self.gridLayout.addWidget(self.label_5, 0, 0, 1, 1) self.label_4 = QLabel(self.centralwidget) self.label_4.setObjectName(u"label_4") self.label_4.setAlignment(Qt.AlignCenter) self.gridLayout.addWidget(self.label_4, 0, 1, 1, 1) self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1) self.pushButton = QPushButton(self.centralwidget) self.pushButton.setObjectName(u"pushButton") self.gridLayout_2.addWidget(self.pushButton, 2, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 524, 21)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, MainWindow): if MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(1345, 1429) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName(u"gridLayout") self.gridLayout.setVerticalSpacing(6) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(10) self.verticalLayout.setObjectName(u"verticalLayout") self.tabs = QTabWidget(self.centralwidget) self.tabs.setObjectName(u"tabs") font = QFont() font.setPointSize(10) self.tabs.setFont(font) self.tabs.setTabShape(QTabWidget.Rounded) self.tabs.setIconSize(QSize(16, 16)) self.tabs.setElideMode(Qt.ElideNone) self.editor_tab = QWidget() self.editor_tab.setObjectName(u"editor_tab") self.gridLayout_2 = QGridLayout(self.editor_tab) self.gridLayout_2.setObjectName(u"gridLayout_2") self.gridLayout_2.setContentsMargins(0, 6, 0, 0) self.code_editor = CodeEditor(self.editor_tab) self.code_editor.setObjectName(u"code_editor") self.gridLayout_2.addWidget(self.code_editor, 1, 0, 1, 1) self.tabs.addTab(self.editor_tab, "") self.render_tab = QWidget() self.render_tab.setObjectName(u"render_tab") self.gridLayout_3 = QGridLayout(self.render_tab) self.gridLayout_3.setObjectName(u"gridLayout_3") self.gridLayout_3.setContentsMargins(0, 6, 0, 0) self.render_view = CodeEditor(self.render_tab) self.render_view.setObjectName(u"render_view") self.render_view.setReadOnly(True) self.gridLayout_3.addWidget(self.render_view, 0, 0, 1, 1) self.tabs.addTab(self.render_tab, "") self.verticalLayout.addWidget(self.tabs) self.compile = QPushButton(self.centralwidget) self.compile.setObjectName(u"compile") font1 = QFont() font1.setPointSize(14) self.compile.setFont(font1) self.verticalLayout.addWidget(self.compile) self.console_output = QPlainTextEdit(self.centralwidget) self.console_output.setObjectName(u"console_output") self.verticalLayout.addWidget(self.console_output) self.verticalLayout.setStretch(0, 4) self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.tabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(MainWindow)
def setupWeatherUI(self, Weather): if not Weather.objectName(): Weather.setObjectName(u"Weather") Weather.resize(400, 190) Weather.setMinimumSize(QSize(400, 190)) Weather.setMaximumSize(QSize(400, 190)) icon = QIcon() icon.addFile(u"icons/favicon.ico", QSize(), QIcon.Normal, QIcon.Off) Weather.setWindowIcon(icon) #Palette palette = QPalette() brush = QBrush(QColor(255, 255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Active, QPalette.WindowText, brush) palette.setBrush(QPalette.Inactive, QPalette.WindowText, brush) #Font 25 font = QFont() font.setFamily(u"Yandex Sans Text Medium") font.setPointSize(25) #Font 20 font1 = QFont() font1.setFamily(u"Yandex Sans Text Medium") font1.setPointSize(20) #Font 14 font2 = QFont() font2.setFamily(u"Yandex Sans Text Medium") font2.setPointSize(14) #City self.citylbl = QLabel(Weather) self.citylbl.setObjectName(u"citylbl") self.citylbl.setGeometry(QRect(0, 0, 400, 50)) self.citylbl.setPalette(palette) self.citylbl.setFont(font) self.citylbl.setTextFormat(Qt.AutoText) self.citylbl.setAlignment(Qt.AlignCenter) #Temperature self.templbl = QLabel(Weather) self.templbl.setObjectName(u"templbl") if language == "ru": self.templbl.setGeometry(QRect(59, 70, 71, 31)) else: self.templbl.setGeometry(QRect(4, 70, 161, 31)) self.templbl.setPalette(palette) self.templbl.setFont(font1) self.templbl.setAlignment(Qt.AlignRight) #Weather self.weatherlbl = QLabel(Weather) self.weatherlbl.setObjectName(u"weatherlbl") self.weatherlbl.setGeometry(QRect(0, 40, 400, 31)) self.weatherlbl.setPalette(palette) self.weatherlbl.setFont(font2) self.weatherlbl.setAlignment(Qt.AlignCenter) #Feels like self.feelslbl = QLabel(Weather) self.feelslbl.setObjectName(u"feelslbl") if language == "ru": self.feelslbl.setGeometry(QRect(135, 75, 251, 21)) else: self.feelslbl.setGeometry(QRect(170, 75, 231, 21)) self.feelslbl.setPalette(palette) self.feelslbl.setFont(font2) self.feelslbl.setAlignment(Qt.AlignLeft) #Background self.bg = QLabel(Weather) self.bg.setObjectName(u"bg") self.bg.setGeometry(QRect(0, 0, 411, 211)) self.bg.setPixmap(QPixmap(u"icons/background.jpg")) self.bg.setScaledContents(True) #Windspeed self.windspeed = QLabel(Weather) self.windspeed.setObjectName(u"windspeed") if language == "ru": self.windspeed.setGeometry(QRect(13, 110, 211, 21)) else: self.windspeed.setGeometry(QRect(2, 110, 191, 21)) self.windspeed.setPalette(palette) self.windspeed.setFont(font2) self.windspeed.setAlignment(Qt.AlignRight) #Air Humidity self.airhumidity = QLabel(Weather) self.airhumidity.setObjectName(u"airhumidity") if language == "ru": self.airhumidity.setGeometry(QRect(233, 110, 161, 20)) else: self.airhumidity.setGeometry(QRect(221, 110, 181, 20)) self.airhumidity.setPalette(palette) self.airhumidity.setFont(font2) self.airhumidity.setAlignment(Qt.AlignLeft) #Pressure self.pressure = QLabel(Weather) self.pressure.setObjectName(u"pressure") self.pressure.setGeometry(QRect(4, 140, 391, 20)) self.pressure.setPalette(palette) self.pressure.setFont(font2) self.pressure.setAlignment(Qt.AlignCenter) self.bg.raise_() self.citylbl.raise_() self.feelslbl.raise_() self.templbl.raise_() self.weatherlbl.raise_() self.windspeed.raise_() self.airhumidity.raise_() self.pressure.raise_() QMetaObject.connectSlotsByName(Weather)
def __init__(self, platforms, parent=None): super(InputWindow, self).__init__(parent=parent) self.setContentsMargins(5, 5, 5, 5) self._platforms = ['1292 Advanced Programmable Video System', '3DO', 'APF MP1000/Imagination Machine', 'Acorn 32-bit', 'Adventure Vision', 'Alice 32/90', 'Altair 680', 'Altair 8800', 'Amazon Alexa', 'Amiga', 'Amiga CD32', 'Amstrad CPC', 'Amstrad PCW', 'Android', 'Apple I', 'Apple II', 'Apple IIgs', 'Arcade', 'Arcadia 2001', 'Arduboy', 'Astral 2000', 'Atari 2600', 'Atari 5200', 'Atari 7800', 'Atari 8-bit', 'Atari ST', 'Atom', 'BBC Micro', 'BREW', 'Bally Astrocade', 'BeOS', 'BlackBerry', 'Blu-ray Disc Player', 'Browser', 'Bubble', 'CD-i', 'CDTV', 'CP/M', 'Camputers Lynx', 'Casio Loopy', 'Casio PV-1000', 'ClickStart', 'Coleco Adam', 'ColecoVision', 'Colour Genie', 'Commodore 128', 'Commodore 16, Plus/4', 'Commodore 64', 'Commodore PET/CBM', 'Compal 80', 'Compucolor I', 'Compucolor II', 'Compucorp Programmable Calculator', 'CreatiVision', 'DOS', 'DVD Player', 'Dedicated console', 'Dedicated handheld', 'Didj', 'DoJa', 'Dragon 32/64', 'ECD Micromind', 'Electron', 'Enterprise', 'Epoch Cassette Vision', 'Epoch Game Pocket Computer', 'Epoch Super Cassette Vision', 'ExEn', 'Exelvision', 'Exidy Sorcerer', 'Fairchild Channel F', 'Famicom Disk System', 'FM Towns', 'FM-7', 'FRED/COSMAC', 'Fire OS', 'Freebox', 'GIMINI', 'GNEX', 'GP2X', 'GP2X Wiz', 'GP32', 'GVM', 'Galaksija', 'Game Boy', 'Game Boy Advance', 'Game Boy Color', 'Game Gear', 'Game Wave', 'Game.Com', 'GameCube', 'GameStick', 'Genesis', 'Gizmondo', 'Glulx', 'HD DVD Player', 'HP 9800', 'HP Programmable Calculator', 'Heath/Zenith H8/H89', 'Heathkit H11', 'Hitachi S1', 'Hugo', 'HyperScan', 'IBM 5100', 'Ideal-Computer', 'Intel 8008', 'Intel 8080', 'Intellivision', 'Interton Video 2000', 'J2ME', 'Jaguar', 'Jolt', 'Jupiter Ace', 'KIM-1', 'Kindle Classic', 'Laser 200', 'LaserActive', 'LeapFrog Explorer', 'LeapTV', 'Leapster', 'Linux', 'Lynx', 'MOS Technology 6502', 'MRE', 'MSX', 'MSX 2', 'Macintosh', 'Maemo', 'Mainframe', 'Mattel Aquarius', 'MeeGo', 'Mega Drive', 'Memotech MTX', 'Microbee', 'Microtan 65', 'Microvision', 'Mophun', 'Motorola 6800', 'Motorola 68k', 'N-Gage', 'N-Gage (service)', 'NES', 'Nascom', 'Neo Geo AES', 'Neo Geo CD', 'Neo Geo MVS', 'Neo Geo Pocket', 'Neo Geo Pocket Color', 'Neo Geo X', 'New Nintendo 3DS', 'NewBrain', 'Newton', 'Nintendo 3DS', 'Nintendo 64', 'Nintendo DS', 'Nintendo DSi', 'Nintendo Switch', 'North Star', 'Noval 760', 'Nuon', 'OS/2', 'Oculus Go', 'Oculus Quest', 'Odyssey', 'Odyssey 2', 'Ohio Scientific', 'OnLive', 'Orao', 'Oric', 'Ouya', 'PC Booter', 'PC-6001', 'PC-8000', 'PC-88', 'PC-98', 'PC-FX', 'PS Vita', 'PSP', 'Palm OS', 'Philips VG 5000', 'Photo CD', 'Pippin', 'PlayStation', 'PlayStation 2', 'PlayStation 3', 'PlayStation 4', 'Playdia', 'Pokémon Mini', 'Pokitto', 'Poly-88', 'RCA Studio II', 'Roku', 'SAM Coupé', 'SC/MP', 'SD-200/270/290', 'SEGA 32X', 'SEGA CD', 'SEGA Dreamcast', 'SEGA Master System', 'SEGA Pico', 'SEGA Saturn', 'SG-1000', 'SK-VM', 'SMC-777', 'SNES', 'SRI-500/1000', 'SWTPC 6800', 'Sharp MZ-80B/2000/2500', 'Sharp MZ-80K/700/800/1500', 'Sharp X1', 'Sharp X68000', 'Sharp Zaurus', 'Signetics 2650', 'Sinclair QL', 'Sol-20', 'Sord M5', 'Spectravideo', 'Stadia', "Super A'can", 'SuperGrafx', 'Supervision', 'Symbian', 'TADS', 'TI Programmable Calculator', 'TI-99/4A', 'TIM', 'TRS-80', 'TRS-80 CoCo', 'TRS-80 MC-10', 'Taito X-55', 'Tatung Einstein', 'Tektronix 4050', 'Tele-Spiel ES-2201', 'Telstar Arcade', 'Terminal', 'Thomson MO', 'Thomson TO', 'Tiki 100', 'Timex Sinclair 2068', 'Tizen', 'Tomahawk F1', 'Tomy Tutor', 'TurboGrafx CD', 'TurboGrafx-16', 'V.Flash', 'V.Smile', 'VIC-20', 'VIS', 'Vectrex', 'VideoBrain', 'Videopac+ G7400', 'Virtual Boy', 'WIPI', 'Wang 2200', 'Wii', 'Wii U', 'Windows', 'Windows 3.x', 'Windows Apps', 'Windows Mobile', 'Windows Phone', 'WonderSwan', 'WonderSwan Color', 'XaviXPORT', 'Xbox', 'Xbox 360', 'Xbox One', 'Xerox Alto', 'Z-machine', 'ZX Spectrum', 'ZX Spectrum Next', 'ZX80', 'ZX81', 'Zeebo', 'Zilog Z80', 'Zilog Z8000', 'Zodiac', 'Zune', 'bada', 'digiBlast', 'iPad', 'iPhone', 'iPod Classic', 'tvOS', 'watchOS', 'webOS'] # Add any platforms in user's collection that doesn't exist in the platform list for platform in platforms: if platform not in self._platforms: self._platforms.append(platform) self._platforms.sort() # For holding the internal platforms column's data self._platformsData = "" self._dataTypes = ["Game", "Console", "Accessory"] self._dataTypeLabel = QLabel("Type\t ") self._dataType = QComboBox() self._dataType.addItems(self._dataTypes) self._dataType.currentIndexChanged.connect(self._changeWidgets) self._nameLabel = QLabel("Name\t ") self._name = QLineEdit() self._name.textChanged.connect(self._changeWidgets) self._platformLabel = QLabel("Platform\t ") self._platform = QComboBox() self._platform.view().setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) self._platform.addItems(["", "(New platform)"]) self._platform.addItems(self._platforms) self._platform.currentIndexChanged.connect(self._addPlatform) self._autofillButton = QPushButton("Autofill") self._autofillButton.clicked.connect(self._autofill) self._autofillButton.setEnabled(False) self._regionLabel = QLabel("Region\t ") self._region = QComboBox() self._region.addItems(["NTSC (JP)", "NTSC (NA)", "PAL"]) self._countryLabel = QLabel("Country\t ") self._countryLabel.setEnabled(True) self._country = QLineEdit() self._country.setEnabled(True) self._publisherLabel = QLabel("Publisher\t") self._publisherLabel.setEnabled(True) self._publisher = QLineEdit() self._publisher.setEnabled(True) self._developerLabel = QLabel("Developer") self._developer = QLineEdit() self._developer.setEnabled(True) self._codeLabel = QLabel("Code\t ") self._code = QLineEdit() self._itemLabel = QLabel("Game") self._item = QCheckBox() self._boxLabel = QLabel("Box") self._box = QCheckBox() self._manualLabel = QLabel("Manual") self._manual = QCheckBox() self._yearLabel = QLabel("Year\t ") self._year = QLineEdit() self._genreLabel = QLabel("Genre\t ") self._genre = QLineEdit() self._paidLabel = QLabel("Paid price ") self._paid = QLineEdit("$0") self._commentLabel = QLabel("Comment") self._comment = QLineEdit() self._okButton = QPushButton() self._okButton.setText("OK") self._okButton.setMaximumSize(self._okButton.sizeHint()) self._okButton.clicked.connect(self.accept) self._cnclButton = QPushButton() self._cnclButton.setText("Cancel") self._cnclButton.setMaximumSize(self._cnclButton.sizeHint()) self._cnclButton.clicked.connect(self.reject) self._vbox = QVBoxLayout() self._vbox.addStretch() self._hboxType = QHBoxLayout() self._hboxType.addStretch() self._hboxName = QHBoxLayout() self._hboxName.addStretch() self._hboxPlatform = QHBoxLayout() self._hboxRegion = QHBoxLayout() self._hboxRegion.addStretch() self._hboxCode = QHBoxLayout() self._hboxCode.addStretch() self._hboxCountry = QHBoxLayout() self._hboxCountry.addStretch() self._hboxPublisher = QHBoxLayout() self._hboxDeveloper = QHBoxLayout() self._hboxBoxMan = QHBoxLayout() self._hboxYear = QHBoxLayout() self._hboxGenre = QHBoxLayout() self._hboxPaid = QHBoxLayout() self._hboxComment = QHBoxLayout() self._hboxComment.addStretch() self._hboxBtn = QHBoxLayout() self._hboxBtn.addStretch() self._hboxType.addWidget(self._dataTypeLabel, 0) self._hboxType.addWidget(self._dataType, 1) self._hboxName.addWidget(self._nameLabel, 0) self._hboxName.addWidget(self._name, 1) self._hboxPlatform.addWidget(self._platformLabel, 0) self._hboxPlatform.addWidget(self._platform, 1) self._hboxRegion.addWidget(self._regionLabel, 0) self._hboxRegion.addWidget(self._region, 1) self._hboxCountry.addWidget(self._countryLabel, 0) self._hboxCountry.addWidget(self._country, 1) self._hboxPublisher.addWidget(self._publisherLabel, 0) self._hboxPublisher.addSpacing(5) self._hboxPublisher.addWidget(self._publisher, 1) self._hboxDeveloper.addWidget(self._developerLabel, 0) self._hboxDeveloper.addWidget(self._developer, 1) self._hboxCode.addWidget(self._codeLabel, 0) self._hboxCode.addWidget(self._code, 1) self._hboxYear.addWidget(self._yearLabel, 0) self._hboxYear.addWidget(self._year, 1) self._hboxGenre.addWidget(self._genreLabel, 0) self._hboxGenre.addWidget(self._genre, 1) self._hboxPaid.addWidget(self._paidLabel, 0) self._hboxPaid.addWidget(self._paid, 1) self._hboxComment.addWidget(self._commentLabel, 0) self._hboxComment.addSpacing(2) self._hboxComment.addWidget(self._comment, 1) self._hboxBoxMan.addStretch(10) self._hboxBoxMan.addWidget(self._itemLabel, 0) self._hboxBoxMan.addWidget(self._item, 1) self._hboxBoxMan.addStretch(5) self._hboxBoxMan.addWidget(self._boxLabel, 2) self._hboxBoxMan.addWidget(self._box, 3) self._hboxBoxMan.addStretch(5) self._hboxBoxMan.addWidget(self._manualLabel, 4) self._hboxBoxMan.addWidget(self._manual, 5) self._hboxBoxMan.addStretch(10) self._hboxBtn.addWidget(self._autofillButton, 0, Qt.AlignLeft) self._hboxBtn.addStretch(10) self._hboxBtn.addWidget(self._okButton, 1) self._hboxBtn.addWidget(self._cnclButton, 2) self._vbox.addLayout(self._hboxType, 0) self._vbox.addLayout(self._hboxName, 1) self._vbox.addLayout(self._hboxPlatform, 2) self._vbox.addLayout(self._hboxRegion, 3) self._vbox.addLayout(self._hboxPublisher, 4) self._vbox.addLayout(self._hboxDeveloper, 5) self._vbox.addLayout(self._hboxCountry, 6) self._vbox.addLayout(self._hboxCode, 7) self._vbox.addLayout(self._hboxYear, 8) self._vbox.addLayout(self._hboxGenre, 9) self._vbox.addLayout(self._hboxPaid, 10) self._vbox.addLayout(self._hboxComment, 11) self._vbox.addLayout(self._hboxBoxMan, 12) self._vbox.addLayout(self._hboxBtn, 13) self.setLayout(self._vbox) self.setWindowTitle("Add to collection") self.setFixedSize(QSize(500, 340)) self._center()
def setupUi(self, MainWindow): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(774, 531) sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QSize(774, 531)) MainWindow.setContextMenuPolicy(Qt.NoContextMenu) icon = QIcon() icon.addFile(u"plot-icon.png", QSize(), QIcon.Normal, QIcon.Off) MainWindow.setWindowIcon(icon) MainWindow.setIconSize(QSize(50, 50)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.functionPattern = QLineEdit(self.centralwidget) self.functionPattern.setObjectName(u"functionPattern") self.functionPattern.setGeometry(QRect(580, 80, 151, 31)) font = QFont() font.setPointSize(9) self.functionPattern.setFont(font) self.functionRange = QLineEdit(self.centralwidget) self.functionRange.setObjectName(u"functionRange") self.functionRange.setGeometry(QRect(580, 120, 151, 31)) self.functionRange.setFont(font) self.functionRange.setStyleSheet(u"") self.label = QLabel(self.centralwidget) self.label.setObjectName(u"label") self.label.setGeometry(QRect(530, 80, 47, 31)) font1 = QFont() font1.setPointSize(11) font1.setBold(True) font1.setWeight(75) self.label.setFont(font1) self.label_2 = QLabel(self.centralwidget) self.label_2.setObjectName(u"label_2") self.label_2.setGeometry(QRect(180, 20, 401, 31)) font2 = QFont() font2.setPointSize(18) font2.setBold(True) font2.setWeight(75) self.label_2.setFont(font2) self.label_3 = QLabel(self.centralwidget) self.label_3.setObjectName(u"label_3") self.label_3.setGeometry(QRect(530, 120, 47, 31)) self.label_3.setFont(font1) self.cleanButton = QPushButton(self.centralwidget) self.cleanButton.setObjectName(u"cleanButton") self.cleanButton.setGeometry(QRect(650, 170, 91, 41)) font3 = QFont() font3.setPointSize(12) font3.setBold(True) font3.setWeight(75) self.cleanButton.setFont(font3) self.drawButton = QPushButton(self.centralwidget) self.drawButton.setObjectName(u"drawButton") self.drawButton.setGeometry(QRect(530, 170, 91, 41)) self.drawButton.setFont(font3) self.widget = QWidget(self.centralwidget) self.widget.setObjectName(u"widget") self.widget.setGeometry(QRect(40, 90, 451, 381)) sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy(sizePolicy1) self.verticalLayout = QVBoxLayout(self.widget) self.verticalLayout.setObjectName(u"verticalLayout") self.userCommunication = QTextEdit(self.centralwidget) self.userCommunication.setObjectName(u"userCommunication") self.userCommunication.setGeometry(QRect(530, 230, 211, 191)) self.userCommunication.setFont(font) self.userCommunication.setReadOnly(True) self.userCommunication.setAcceptRichText(True) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") self.menubar.setGeometry(QRect(0, 0, 774, 21)) MainWindow.setMenuBar(self.menubar) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(u"statusbar") MainWindow.setStatusBar(self.statusbar) QWidget.setTabOrder(self.functionPattern, self.functionRange) QWidget.setTabOrder(self.functionRange, self.drawButton) QWidget.setTabOrder(self.drawButton, self.cleanButton) QWidget.setTabOrder(self.cleanButton, self.userCommunication) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def minimumSizeHint(self): return QSize(300, 300)
def sizeHint(self, *args, **kwargs): return QSize(self.width_hint, self.height_hint)
def mouse(self, event, size: QSize): self.mouse_x = (2.0 * event.x() - size.width()) / size.width() self.mouse_y = (size.height() - 2.0 * event.y()) / size.height() self.button = event.button() self.modifiers = event.modifiers() self.updated.emit()
def minimumSizeHint(self): # pylint: disable=C0103,R0201 """Return widget size to ensure unifrom sidebar width.""" return QSize(int(settings["ui"]["sidebar_size"]), 100)
def sizeHint(self): return QSize(1200, 600)
def minimumSize(self): return self.item.minimumSize() if self.item is not None else QSize()
def sizeHint(self): return QSize(self.browser.lineNumberAreaWidth(), 0)
def testQSizeToTuple(self): s = QSize(1, 2) self.assertEqual((1, 2), s.toTuple())
def __init__(self): image = Reader.readfile('/home/abdul/Comics/images.rar') QMainWindow.__init__(self) self.ui = Ui_MainWindow() self.ui.setupUi(self) ## PRINT ==> SYSTEM print('System: ' + platform.system()) print('Version: ' + platform.release()) ######################################################################## ## START - WINDOW ATTRIBUTES ######################################################################## ## REMOVE ==> STANDARD TITLE BAR UIFunctions.removeTitleBar(True) ## ==> END ## ## SET ==> WINDOW TITLE self.setWindowTitle('Comic Reader') UIFunctions.labelTitle(self, '') UIFunctions.labelDescription(self, 'current comic path') ## ==> END ## ## WINDOW SIZE ==> DEFAULT SIZE startSize = QSize(1000, 720) self.resize(startSize) self.setMinimumSize(startSize) # UIFunctions.enableMaximumSize(self, 500, 720) ## ==> END ## ## ==> CREATE MENUS ######################################################################## ## ==> TOGGLE MENU SIZE self.ui.btn_toggle_menu.clicked.connect( lambda: UIFunctions.toggleMenu(self, 220, True)) ## ==> END ## ## ==> ADD CUSTOM MENUS self.ui.stackedWidget.setMinimumWidth(20) UIFunctions.addNewMenu(self, "HOME", "btn_home", "url(:/16x16/icons/16x16/cil-home.png)", True) UIFunctions.addNewMenu(self, "THUMBNAILS", "btn_thumbnails", "url(:/16x16/icons/16x16/cil-view-module.png)", True) UIFunctions.addNewMenu(self, "SETTINGS", "btn_widgets", "url(:/16x16/icons/16x16/cil-equalizer.png)", False) ## ==> END ## # START MENU => SELECTION UIFunctions.selectStandardMenu(self, "btn_home") ## ==> END ## ## ==> START PAGE self.ui.stackedWidget.setCurrentWidget(self.ui.page_home) ## ==> END ## ## USER ICON ==> SHOW HIDE #UIFunctions.userIcon(self, "WM", "", True) ## ==> END ## ## ==> MOVE WINDOW / MAXIMIZE / RESTORE ######################################################################## def moveWindow(event): # IF MAXIMIZED CHANGE TO NORMAL if UIFunctions.returStatus() == 1: UIFunctions.maximize_restore(self) # MOVE WINDOW if event.buttons() == Qt.LeftButton: self.move(self.pos() + event.globalPos() - self.dragPos) self.dragPos = event.globalPos() event.accept() # WIDGET TO MOVE self.ui.frame_label_top_btns.mouseMoveEvent = moveWindow ## ==> END ## ## ==> LOAD DEFINITIONS ######################################################################## UIFunctions.uiDefinitions(self) ## ==> END ## ######################################################################## ## END - WINDOW ATTRIBUTES ############################## ---/--/--- ############################## ######################################################################## # # ## START -------------- WIDGETS FUNCTIONS/PARAMETERS ---------------- ## # # ## ==> USER CODES BELLOW ## ######################################################################## qim = ImageQt(image) pixmap = QPixmap('modified.png') self.ui.scroll_label.setPixmap(pixmap) ## ==> QTableWidget RARAMETERS ######################################################################## #self.ui.verticalScrollBar().setSectionResizeMode(QtWidgets.QHeaderView.Stretch) ## ==> END ## ######################################################################## # # ## END --------------- WIDGETS FUNCTIONS/PARAMETERS ----------------- ## # # ############################## ---/--/--- ############################## ## SHOW ==> MAIN WINDOW ######################################################################## self.show()