initial commit

This commit is contained in:
helldh 2026-01-20 21:48:18 +03:00
commit d559fc128e
10 changed files with 150 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.venv

3
.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml generated Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.13 (pyqtsix)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (pyqtsix)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pyqtsix.iml" filepath="$PROJECT_DIR$/.idea/pyqtsix.iml" />
</modules>
</component>
</project>

10
.idea/pyqtsix.iml generated Normal file
View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.13 (pyqtsix)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
apple.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

87
task1.py Normal file
View file

@ -0,0 +1,87 @@
import sys
from PyQt6.QtGui import QPixmap
from PyQt6.QtWidgets import (
QApplication, QMainWindow,
QWidget, QLabel,
QHBoxLayout, QVBoxLayout
)
from PyQt6.QtCore import Qt
class TaskOne(QMainWindow):
def __init__(self, path_to_image: str):
super().__init__()
self.original_pixmap = QPixmap(path_to_image)
self._init_ui()
self.setFixedSize(900, 250)
def _init_ui(self):
root = QWidget(self)
main_layout = QHBoxLayout(root)
# Отступы как на макете
main_layout.setSpacing(15)
main_layout.setContentsMargins(15, 15, 15, 15)
# ---------- Фото ----------
self.image_label = QLabel()
self.image_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.image_label.setMinimumSize(180, 180)
self.image_label.setStyleSheet("border: 1px solid black;")
# ---------- Текстовая информация ----------
info_layout = QVBoxLayout()
info_layout.setSpacing(5)
title = QLabel("Категория товара | Наименование товара")
title.setStyleSheet("font-weight: bold;")
info_layout.addWidget(title)
info_layout.addWidget(QLabel("Описание товара:"))
info_layout.addWidget(QLabel("Производитель:"))
info_layout.addWidget(QLabel("Поставщик:"))
info_layout.addWidget(QLabel("Цена:"))
info_layout.addWidget(QLabel("Единица измерения:"))
info_layout.addWidget(QLabel("Количество на складе:"))
info_layout.addStretch()
# ---------- Скидка ----------
discount_label = QLabel("Действующая\nскидка")
discount_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
discount_label.setFixedWidth(120)
discount_label.setStyleSheet("""
QLabel {
border: 1px solid black;
font-weight: bold;
}
""")
# ---------- Добавление в основной layout ----------
main_layout.addWidget(self.image_label, stretch=0)
main_layout.addLayout(info_layout, stretch=1)
main_layout.addWidget(discount_label, stretch=0)
self.setCentralWidget(root)
self._update_pixmap()
def resizeEvent(self, event):
self._update_pixmap()
super().resizeEvent(event)
def _update_pixmap(self):
if self.original_pixmap.isNull():
return
scaled = self.original_pixmap.scaled(
self.image_label.size(),
Qt.AspectRatioMode.KeepAspectRatio,
Qt.TransformationMode.SmoothTransformation
)
self.image_label.setPixmap(scaled)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = TaskOne("apple.webp")
window.show()
sys.exit(app.exec())

22
task2.py Normal file
View file

@ -0,0 +1,22 @@
from PyQt6.QtWidgets import (
QApplication,
QLineEdit,
QLabel,
QMainWindow,
QWidget,
QFormLayout,
QGroupBox
)
from PyQt6.QtCore import Qt
class TaskTwo(QMainWindow):
def __init__(self):
super().__init__()
self._init_ui()
def _init_ui(self):
self.root = QWidget()
self.form = QFormLayout()
self.group = QGroupBox("Калькулятор скидки")
self.form