34 lines
931 B
Python
34 lines
931 B
Python
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QToolButton, QLayout
|
|
from PyQt5.QtGui import QFont
|
|
|
|
class RecentProjectWidget(QWidget):
|
|
def __init__(self, recentProject):
|
|
super().__init__()
|
|
self.setupUi()
|
|
self.setProject(recentProject)
|
|
|
|
def setupUi(self):
|
|
layout = QHBoxLayout()
|
|
|
|
# label
|
|
self.__text = QLabel()
|
|
layout.addWidget(self.__text)
|
|
|
|
# space
|
|
layout.addStretch()
|
|
|
|
# pin button
|
|
self.__button = QToolButton()
|
|
self.__button.setFont(QFont("Font Awesome 5 Free"))
|
|
self.__button.setText("\uf08d")
|
|
self.__button.setCheckable(True)
|
|
layout.addWidget(self.__button)
|
|
|
|
# done
|
|
layout.setSizeConstraint(QLayout.SetMinimumSize)
|
|
self.setLayout(layout)
|
|
|
|
def setProject(self, project):
|
|
self.__text = project['name']
|
|
self.__button.setChecked(project['pinned'])
|