def initUI(self): self.setStyleSheet(get_styles('style') + get_styles('payment')) self.setObjectName('payment') self.to_pay_title.setObjectName('to_pay_title') self.surrender_title.setObjectName('surrender_title') self.to_pay_value.setObjectName('to_pay_value') self.surrender_value.setObjectName('surrender_value') self.to_pay_currency.setObjectName('to_pay_currency') self.surrender_currency.setObjectName('surrender_currency') self.total_title.setObjectName('total_title') self.total_value.setObjectName('total_value') self.total_currency.setObjectName('total_currency') self.pay.setObjectName('pay_btn') self.to_pay_value.setMaximum(2147483647) self.to_pay_title.setText('К оплате') self.surrender_title.setText('Сдача') self.total_title.setText('Итого') self.to_pay_currency.setText('руб') self.surrender_currency.setText('руб') self.total_currency.setText('руб') self.pay.setText('Оплатить') layout = QVBoxLayout() to_pay_layout = QHBoxLayout() surrender_layout = QHBoxLayout() total_layout = QHBoxLayout() to_pay_layout.addWidget(self.to_pay_title, 1) to_pay_layout.addWidget(self.to_pay_value, 1) to_pay_layout.addWidget(self.to_pay_currency) self.to_pay_value.setAlignment(Qt.AlignRight) surrender_layout.addWidget(self.surrender_title, 1) surrender_layout.addWidget(self.surrender_value, 1) surrender_layout.addWidget(self.surrender_currency) self.surrender_value.setAlignment(Qt.AlignRight) total_layout.addWidget(self.total_title, 1) total_layout.addWidget(self.total_value, 1) total_layout.addWidget(self.total_currency) self.total_value.setAlignment(Qt.AlignRight) # self.pay.setAlignment(Qt.AlignRight) layout.addLayout(to_pay_layout) layout.addLayout(surrender_layout) layout.addLayout(total_layout) pay_layout = QHBoxLayout() pay_layout.addStretch(2) pay_layout.addWidget(self.pay, 1) self.pay.setMinimumWidth(130) layout.addLayout(pay_layout) self.setLayout(layout)
def initUI(self): self.layout = QVBoxLayout() self.layout.setContentsMargins(10, 13, 10, 0) self.layout.setSpacing(0) self.layout.addWidget(ProductTableHeaderWidget()) self.products_layout = QVBoxLayout() table = QWidget() # table.setStyleSheet('border: none; background: transparent') table.setLayout(self.products_layout) scroll = QScrollArea() scroll.setWidgetResizable(True) scroll.setWidget(table) # scroll.setStyleSheet('border: none; background: transparent') self.layout.addWidget(scroll, 1) table.setLayout(self.products_layout) self.products_layout.addStretch(1) self.setLayout(self.layout) self.setStyleSheet(get_styles('style')) self.setStyleSheet(get_styles('product-table'))
def initUI(self): self.setWindowTitle('Koala') self.setObjectName('mainWindow') self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.layout.addWidget(self.navbar) content = QHBoxLayout() content.setContentsMargins(0, 0, 0, 0) content.setSpacing(0) self.sidebar.setObjectName('sidebar') self.setLayout(self.layout) self.side_layout.setContentsMargins(0, 0, 0, 0) self.side_layout.setSpacing(0) self.side_layout.addWidget(self.table, 1) self.side_layout.addWidget(self.payment) self.side.setLayout(self.side_layout) self.side.setObjectName('content') content.addWidget(self.sidebar, 1) content.addWidget(self.side, 2) self.layout.addLayout(content) self.setLayout(self.layout) self.setMinimumHeight(300) self.setMinimumWidth(600) self.resize(800, 400) self.show() for i in range(self.sidebar.products_layout.count() - 1): self.sidebar.products_layout.itemAt(i).widget().clicked.connect( self.add2cart) self.add_product_form.closed.connect(self.close_add_product_form) self.login_form.closed.connect(self.close_login_form) QtCore.QMetaObject.connectSlotsByName(self) self.setStyleSheet(get_styles('style') + get_styles('modal-container'))
def initUI(self): self.title.setText('Введите имя БД') self.input.setPlaceholderText('Название...') self.accept_btn.setText('Принять') self.title.setObjectName('login_title') self.input.setObjectName('login_input') self.accept_btn.clicked.connect(self.on_login_accept_clicked) # self.accept_btn.setObjectName('login_accept') self.layout.setContentsMargins(40, 40, 40, 40) self.layout.addWidget(self.title) self.layout.addWidget(self.input) self.layout.addWidget(self.accept_btn) self.setObjectName("add_product") self.setStyleSheet(get_styles('style')) self.setStyleSheet(get_styles('create-product'))
def initUI(self): self.title.setObjectName('sidebar_title') self.title.setText('Товары') self.plus.setObjectName('plus') self.plus.setText('+') self.header.setContentsMargins(0, 0, 0, 17) self.header.setSpacing(0) self.header.addWidget(self.title) self.header.addStretch(1) self.header.addWidget(self.plus, 0) self.header.setObjectName('header') self.search.setObjectName('search') self.search.setPlaceholderText('Поиск...') self.layout.setContentsMargins(10, 15, 10, 0) self.layout.setSpacing(0) self.layout.addLayout(self.header) self.layout.addWidget(self.search) self.products_layout.setContentsMargins(0, 0, 0, 0) self.products_layout.setSpacing(0) self.products.setLayout(self.products_layout) self.scroll.setWidgetResizable(True) self.scroll.setWidget(self.products) self.layout.addWidget(self.scroll) self.products_layout.addStretch(1) self.setFixedWidth(300) self.setLayout(self.layout) self.setObjectName('sidebar') load_fonts() self.setStyleSheet(get_styles('style') + get_styles('sidebar'))
def initUI(self): self.setStyleSheet(get_styles('style')) self.setStyleSheet(get_styles('navbar')) self.setObjectName('navbar') self.layout.setSpacing(22) self.products_btn.setText("") self.layout.addWidget(self.products_btn) self.products_btn.setProperty('class', 'navbar_btn') self.history_btn.setText("") self.layout.addWidget(self.history_btn) self.history_btn.setProperty('class', 'navbar_btn') self.receipt_btn.setText("") self.layout.addWidget(self.receipt_btn) self.receipt_btn.setProperty('class', 'navbar_btn') self.settings_btn.setText("") self.layout.addWidget(self.settings_btn) self.settings_btn.setProperty('class', 'navbar_btn') self.layout.addStretch(1) self.user.setText("CASHIER NAME") self.user.setObjectName('user') self.layout.addWidget(self.user) self.layout.addStretch(1) self.shop.setObjectName('shop') self.shop.setText("SHOP NAME") self.layout.addWidget(self.shop) self.setLayout(self.layout)
# generate content image and features. content_x, content_y = utils.get_contents( net=net, ctx=ctx, content_img=content_img, image_shape=args.image_shape, content_layers=args.content_layers, style_layers=args.style_layers) # content_x is the content image, content_y is the features of content image(list of features). # Our need is content_y. Features. # content_x is NDArray. # generate style image and features. style_x, style_y = utils.get_styles(net=net, ctx=ctx, style_img=style_img, image_shape=args.image_shape, content_layers=args.content_layers, style_layers=args.style_layers) # style_x is the style image, style_y is the features of style image(list of features). # Our need is style_y. Features. # style_x is NDArray. x = content_x.copyto(ctx) # content_x is the content image # x is the content image. # In the process of training, it will learn x, w.t. the content image. # The content image to content + style image. x.attach_grad() # call x.attach_grad() to allocation ram space for gradient. w.t. # x[:] -= args.lr * x.grad to learn content image to content+style image.