├── README.md ├── menu.py ├── res ├── fonts │ ├── LICENSE.txt │ ├── Roboto-Black.ttf │ └── Roboto-Light.ttf └── img │ ├── back.jpg │ └── icons │ ├── calls.png │ ├── contacts.png │ ├── group.png │ ├── megaphone.png │ ├── moon.png │ ├── settings.png │ └── user.png └── ui ├── content.py ├── overlay.py └── sidemenu.py /README.md: -------------------------------------------------------------------------------- 1 | ![Screenshot_1](https://user-images.githubusercontent.com/73961037/112700435-35e3d500-8e9f-11eb-9121-55e1d403f0f2.png) 2 | -------------------------------------------------------------------------------- /menu.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtGui import QFontDatabase 2 | from PySide6.QtWidgets import QApplication, QMainWindow, QMdiArea 3 | 4 | from ui.sidemenu import SideMenu 5 | from ui.content import Content 6 | from ui.overlay import Overlay 7 | 8 | 9 | class MdiArea(QMdiArea): 10 | def __init__(self): 11 | super(MdiArea, self).__init__() 12 | self.menu = SideMenu() 13 | self.content= Content(self) 14 | self.overlay = Overlay(self) 15 | 16 | self.addSubWindow(self.content) 17 | self.addSubWindow(self.overlay) 18 | self.addSubWindow(self.menu) 19 | 20 | def resizeEvent(self, event): 21 | self.content.resize(self.width(), self.height()) 22 | self.overlay.resize(self.width(), self.height()) 23 | self.menu.resize(270, self.height()) 24 | 25 | class MainWindow(QMainWindow): 26 | def __init__(self): 27 | super(MainWindow, self).__init__() 28 | self.mdi = MdiArea() 29 | self.setCentralWidget(self.mdi) 30 | 31 | if __name__ == "__main__": 32 | import sys 33 | 34 | app = QApplication([]) 35 | 36 | font_db = QFontDatabase() 37 | font_db.addApplicationFont("res/fonts/Roboto-Black.ttf") 38 | font_db.addApplicationFont("res/fonts/Roboto-Light.ttf") 39 | 40 | w = MainWindow() 41 | w.resize(800, 600) 42 | w.show() 43 | 44 | sys.exit(app.exec_()) -------------------------------------------------------------------------------- /res/fonts/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /res/fonts/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/fonts/Roboto-Black.ttf -------------------------------------------------------------------------------- /res/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /res/img/back.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/back.jpg -------------------------------------------------------------------------------- /res/img/icons/calls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/calls.png -------------------------------------------------------------------------------- /res/img/icons/contacts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/contacts.png -------------------------------------------------------------------------------- /res/img/icons/group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/group.png -------------------------------------------------------------------------------- /res/img/icons/megaphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/megaphone.png -------------------------------------------------------------------------------- /res/img/icons/moon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/moon.png -------------------------------------------------------------------------------- /res/img/icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/settings.png -------------------------------------------------------------------------------- /res/img/icons/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dryerem19/SideMenu/29694491e1d38359d3374b380b2bc526cd3121e8/res/img/icons/user.png -------------------------------------------------------------------------------- /ui/content.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import Qt, QPropertyAnimation, QSize 2 | from PySide6.QtGui import QPainter 3 | from PySide6.QtWidgets import QMdiSubWindow, QWidget, QHBoxLayout, QPushButton, QStyleOption, QStyle 4 | 5 | class WidgetContent(QWidget): 6 | def __init__(self, mdi): 7 | super(WidgetContent, self).__init__() 8 | self.mdi = mdi 9 | self.layout = QHBoxLayout() 10 | self.layout.setContentsMargins(0, 0, 0, 0) 11 | self.layout.setSpacing(0) 12 | self.setLayout(self.layout) 13 | 14 | self.menu_btn = QPushButton("Menu") 15 | self.menu_btn.clicked.connect(self.show_menu) 16 | self.layout.addWidget(self.menu_btn) 17 | 18 | def show_menu(self): 19 | self.animation = QPropertyAnimation(self.mdi.menu, b"size") 20 | self.animation.setDuration(150) 21 | self.animation.setStartValue(QSize(0, self.mdi.height())) 22 | self.animation.setEndValue(QSize(270, self.mdi.height())) 23 | self.animation.start() 24 | 25 | self.mdi.overlay.show() 26 | self.mdi.menu.show() 27 | self.mdi.setActiveSubWindow(self.mdi.overlay) 28 | self.mdi.setActiveSubWindow(self.mdi.menu) 29 | 30 | def paintEvent(self, event): 31 | opt = QStyleOption() 32 | opt.initFrom(self) 33 | p = QPainter(self) 34 | self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self) 35 | 36 | class Content(QMdiSubWindow): 37 | def __init__(self, parent): 38 | super(Content, self).__init__() 39 | self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint) 40 | self.widget = WidgetContent(parent) 41 | self.setWidget(self.widget) -------------------------------------------------------------------------------- /ui/overlay.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import Qt, QPropertyAnimation, QSize 2 | from PySide6.QtWidgets import QMdiSubWindow 3 | 4 | 5 | class Overlay(QMdiSubWindow): 6 | def __init__(self, parent): 7 | super(Overlay, self).__init__() 8 | self.parent = parent 9 | self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint) 10 | self.setStyleSheet("background: rgba(0, 0, 0, 15%);") 11 | self.hide() 12 | 13 | def mousePressEvent(self, event): 14 | self.animation = QPropertyAnimation(self.parent.menu, b"size") 15 | self.animation.setDuration(150) 16 | self.animation.setStartValue(QSize(270, self.parent.height())) 17 | self.animation.setEndValue(QSize(0, self.parent.height())) 18 | self.animation.start() 19 | self.animation.finished.connect(self.animation_end) 20 | self.hide() 21 | 22 | def animation_end(self): 23 | self.parent.menu.hide() -------------------------------------------------------------------------------- /ui/sidemenu.py: -------------------------------------------------------------------------------- 1 | from PySide6.QtCore import Qt, QAbstractListModel, QSize, QRect 2 | from PySide6.QtGui import QPainter, QPixmap, QFont, QColor 3 | from PySide6.QtWidgets import (QMdiSubWindow, QWidget, QGraphicsDropShadowEffect, QStyleOption, QStyle, QVBoxLayout, QListView, QFrame, 4 | QStyledItemDelegate, QLabel) 5 | 6 | 7 | class Delegate(QStyledItemDelegate): 8 | def __init__(self, height=None): 9 | super(Delegate, self).__init__() 10 | if height is None: 11 | self._height = 45 12 | else: 13 | self._height = height 14 | 15 | def paint(self, painter, option, index): 16 | super(Delegate, self).paint(painter, option, index) 17 | 18 | # HOVER 19 | if option.state & QStyle.State_MouseOver: 20 | painter.fillRect(option.rect, QColor("#F1F1F1")) 21 | else: 22 | painter.fillRect(option.rect, Qt.transparent) 23 | 24 | # SELECTED 25 | if option.state & QStyle.State_Selected: 26 | painter.fillRect(option.rect, QColor("#F1F1F1")) 27 | 28 | # DRAW ICON 29 | icon = QPixmap() 30 | icon.load(index.data()[1]) 31 | icon = icon.scaled(24, 24, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) 32 | 33 | left = 24 # margin left 34 | icon_pos = QRect(left, ((self._height - icon.height()) / 2) + option.rect.y(), icon.width(), icon.height()) 35 | painter.setRenderHint(QPainter.Antialiasing) 36 | painter.setRenderHint(QPainter.SmoothPixmapTransform) 37 | painter.drawPixmap(icon_pos, icon) 38 | 39 | # DRAW TEXT 40 | font = QFont("Roboto Black", 12) 41 | text_pos = QRect((left * 2) + icon.width(), option.rect.y(), option.rect.width(), option.rect.height()) 42 | painter.setFont(font) 43 | painter.setPen(Qt.black) 44 | painter.drawText(text_pos, Qt.AlignVCenter, index.data()[0]) 45 | 46 | def sizeHint(self, option, index): 47 | return QSize(0, self._height) 48 | 49 | 50 | class Model(QAbstractListModel): 51 | def __init__(self, data=None): 52 | super(Model, self).__init__() 53 | if data is None: 54 | data = [ 55 | ("Создать группу", "res/img/icons/group.png"), 56 | ("Создать канал", "res/img/icons/megaphone.png"), 57 | ("Контакты", "res/img/icons/contacts.png"), 58 | ("Звонки", "res/img/icons/calls.png"), 59 | ("Настройки", "res/img/icons/settings.png"), 60 | ("Сменить тему", "res/img/icons/moon.png") 61 | ] 62 | self._data = data 63 | 64 | def rowCount(self, index): 65 | return len(self._data) 66 | 67 | def data(self, index, role=Qt.DisplayRole): 68 | if index.isValid() and role == Qt.DisplayRole: 69 | return self._data[index.row()] 70 | 71 | 72 | class ListView(QListView): 73 | def __init__(self): 74 | super(ListView, self).__init__() 75 | self.setMouseTracking(True) 76 | 77 | def mouseMoveEvent(self, event): 78 | # CHANGE CURSOR HOVERING 79 | if self.indexAt(event.pos()).row() >= 0: 80 | self.setCursor(Qt.PointingHandCursor) 81 | else: 82 | self.setCursor(Qt.ArrowCursor) 83 | 84 | 85 | class LinkLabel(QLabel): 86 | def __init__(self, parent=None, leave=None, enter=None): 87 | super(LinkLabel, self).__init__(parent) 88 | if leave is not None and enter is not None: 89 | self.setStyleSheet(leave) 90 | self.leave = leave 91 | self.enter = enter 92 | else: 93 | self.leave = "color: rgba(0, 0, 0, 100%);" 94 | self.enter = "color: rgba(0, 0, 0, 100%);" 95 | self.setStyleSheet(self.leave) 96 | self.setCursor(Qt.PointingHandCursor) 97 | 98 | def enterEvent(self, event): 99 | self.setStyleSheet("{}; text-decoration: underline;".format(self.enter)) 100 | 101 | def leaveEvent(self, event): 102 | self.setStyleSheet("{}; text-decoration: none;".format(self.leave)) 103 | 104 | 105 | class Profile(QWidget): 106 | def __init__(self, height=None): 107 | super(Profile, self).__init__() 108 | if height is None: 109 | self.setFixedHeight(150) 110 | else: 111 | self.setFixedHeight(height) 112 | self.paintAvatar() 113 | 114 | def paintAvatar(self): 115 | # DRAW PROFILE IMAGE 116 | image = QPixmap() 117 | image.load("res/img/icons/user.png") 118 | image = image.scaled(54, 54, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) 119 | 120 | _margin = 16 121 | _margin_text = 24 122 | 123 | self.avatar = QLabel(self) 124 | self.avatar.setCursor(Qt.PointingHandCursor) 125 | self.avatar.setAttribute(Qt.WA_TranslucentBackground) 126 | self.avatar.setPixmap(image) 127 | self.avatar.move(self.rect().x() + _margin, self.rect().y() + _margin) 128 | 129 | self.username = QLabel(self) 130 | self.username.setStyleSheet("color: white;") 131 | self.username.setFont(QFont("Roboto Light", 14)) 132 | self.username.setCursor(Qt.PointingHandCursor) 133 | self.username.setAttribute(Qt.WA_TranslucentBackground) 134 | self.username.setText("dryerem19") 135 | self.username.move(self.rect().x() + _margin_text, self.height() - 50) 136 | 137 | def paintEvent(self, event): 138 | super(Profile, self).paintEvent(event) 139 | 140 | # DRAW BACKGROUND IMAGE 141 | p = QPainter(self) 142 | p.setRenderHint(QPainter.Antialiasing) 143 | 144 | image = QPixmap() 145 | image.load("res/img/back.jpg") 146 | image = image.scaled(self.width(), self.height(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation) 147 | p.drawPixmap(self.rect(), image) 148 | 149 | 150 | class SideMenuWidget(QWidget): 151 | def __init__(self): 152 | super(SideMenuWidget, self).__init__() 153 | self.layout = QVBoxLayout() 154 | self.layout.setContentsMargins(0, 0, 0, 0) 155 | self.layout.setSpacing(12) 156 | self.setLayout(self.layout) 157 | 158 | # PROFILE 159 | self.layout.addWidget(Profile()) 160 | 161 | # BUTTONS 162 | self.listview = ListView() 163 | self.listview.setFrameStyle(QFrame.NoFrame) 164 | self.listview.setFocusPolicy(Qt.NoFocus) 165 | self.listview.setModel(Model()) 166 | self.listview.setItemDelegate(Delegate()) 167 | self.layout.addWidget(self.listview) 168 | 169 | # LABELS 170 | self.labels = QWidget() 171 | self.labels.setFixedHeight(60) 172 | self.layout.addWidget(self.labels) 173 | 174 | _margins = 16 # left margin 175 | 176 | self.app_name = LinkLabel(self.labels, "color: rgba(0, 0, 0, 80%)", "color: rgba(0, 0, 0, 60%)") 177 | self.app_name.setText("sidemenu app") 178 | self.app_name.setFont(QFont("Roboto Light", 12)) 179 | self.app_name.move(self.labels.x() + _margins, self.labels.y()) 180 | 181 | self.app_ver = LinkLabel(self.labels, "color: rgba(0, 0, 0, 60%)", "color: rgba(0, 0, 0, 60%)") 182 | self.app_ver.setText("Версия 1.0.0") 183 | self.app_ver.setFont(QFont("Roboto Light", 11)) 184 | self.app_ver.move(self.labels.x() + _margins, self.labels.y() + _margins * 2) 185 | 186 | self.lbl = QLabel(self.labels) 187 | self.lbl.setText("-") 188 | self.lbl.setStyleSheet("color: rgba(0, 0, 0, 60%)") 189 | self.lbl.setFont(QFont("Roboto Light", 11)) 190 | self.lbl.move(self.labels.x() + _margins * 7, self.labels.y() + _margins * 2) 191 | 192 | self.app_about = LinkLabel(self.labels, "color: rgba(0, 0, 0, 60%)", "color: rgba(0, 0, 0, 60%)") 193 | self.app_about.setText("О программе") 194 | self.app_about.setFont(QFont("Roboto Light", 11)) 195 | self.app_about.move(self.labels.x() + _margins * 8, self.labels.y() + _margins * 2) 196 | 197 | self.setStyleSheet("background: white;") 198 | 199 | def paintEvent(self, event): 200 | opt = QStyleOption() 201 | opt.initFrom(self) 202 | p = QPainter(self) 203 | self.style().drawPrimitive(QStyle.PE_Widget, opt, p, self) 204 | 205 | class SideMenu(QMdiSubWindow): 206 | def __init__(self): 207 | super(SideMenu, self).__init__() 208 | self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint) 209 | self.setAttribute(Qt.WA_TranslucentBackground) 210 | 211 | self.shadow = QGraphicsDropShadowEffect() 212 | self.shadow.setBlurRadius(50) 213 | self.setGraphicsEffect(self.shadow) 214 | 215 | self.widget = SideMenuWidget() 216 | self.setWidget(self.widget) 217 | self.hide() 218 | 219 | --------------------------------------------------------------------------------