Пример #1
0
        def __init__(self, parent=None, **kwargs):
            if not parent:
                from artella import dcc
                parent = dcc.get_main_window()

            self._use_artella_header = kwargs.pop('use_artella_header', True)

            super(BaseDialog, self).__init__(parent, **kwargs)

            self._pos_anim = QtCore.QPropertyAnimation(self)
            self._pos_anim.setTargetObject(self)
            self._pos_anim.setEasingCurve(QtCore.QEasingCurve.OutCubic)
            self._pos_anim.setDuration(300)
            self._pos_anim.setPropertyName(b'pos')

            self._opacity_anim = QtCore.QPropertyAnimation()
            self._opacity_anim.setTargetObject(self)
            self._opacity_anim.setEasingCurve(QtCore.QEasingCurve.OutCubic)
            self._opacity_anim.setDuration(300)
            self._opacity_anim.setPropertyName(b'windowOpacity')
            self._opacity_anim.setStartValue(0.0)
            self._opacity_anim.setEndValue(1.0)

            self.setup_ui()
            theme.theme().apply(self)

            self._fade_in()
Пример #2
0
        def error(cls,
                  text,
                  title='',
                  parent=None,
                  duration=None,
                  closable=None):
            inst = cls(text,
                       title=title,
                       artella_type=SnackBarTypes.ERROR,
                       duration=duration,
                       closable=closable,
                       parent=parent)
            theme.theme().apply(inst)
            inst.show()

            return inst
Пример #3
0
        def __init__(self, parent=None):
            super(ArtellaImage, self).__init__(parent)

            self._default_pixmap = resource.pixmap('artella')
            self._pixmap = self._default_pixmap
            self._artella_size = 0
            self.set_artella_size(theme.theme().default_size)
Пример #4
0
 def _polish_icon(self, *args, **kwargs):
     if self._artella_image:
         if self.isCheckable() and self.isChecked():
             self.setIcon(
                 resource.icon(self._artella_image,
                               color=theme.theme().main_color))
         else:
             self.setIcon(resource.icon(self._artella_image))
Пример #5
0
        def __init__(self, parent=None):
            super(ArtellaToolButton, self).__init__(parent=parent)

            self._artella_image = None
            self._artella_size = theme.theme().default_size

            self.setAutoExclusive(False)
            self.setAutoRaise(True)
            self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                               QtWidgets.QSizePolicy.Minimum)

            self._polish_icon()
            self.toggled.connect(self._polish_icon)
Пример #6
0
 def huge(cls, image=None):
     inst = cls()
     inst.set_artella_size(theme.theme().huge)
     inst.set_artella_image(image)
     return inst
Пример #7
0
 def medium(cls, image=None):
     inst = cls()
     inst.set_artella_size(theme.theme().medium)
     inst.set_artella_image(image)
     return inst
Пример #8
0
 def small(cls, image=None):
     inst = cls()
     inst.set_artella_size(theme.theme().small)
     inst.set_artella_image(image)
     return inst
Пример #9
0
 def tiny(cls, image=None):
     inst = cls()
     inst.set_artella_size(theme.theme().tiny)
     inst.set_artella_image(image)
     return inst
Пример #10
0
 def tiny(self):
     self.set_artella_size(theme.theme().tiny)
     return self
Пример #11
0
 def small(self):
     self.set_artella_size(theme.theme().small)
     return self
Пример #12
0
 def medium(self):
     self.set_artella_size(theme.theme().medium)
     return self
Пример #13
0
 def large(self):
     self.set_artella_size(theme.theme().large)
     return self
Пример #14
0
 def huge(self):
     self.set_artella_size(theme.theme().huge)
     return self
Пример #15
0
 def enterEvent(self, event):
     if self._artella_image:
         self.setIcon(
             resource.icon(self._artella_image,
                           color=theme.theme().main_color))
     return super(ArtellaToolButton, self).enterEvent(event)
Пример #16
0
        def __init__(self,
                     text='',
                     title='',
                     duration=None,
                     artella_type=None,
                     closable=False,
                     parent=None):

            if parent is None:
                parent = dcc.get_main_window()
            current_type = artella_type or SnackBarTypes.ARTELLA

            super(SnackBarMessage, self).__init__(parent)

            self.setWindowFlags(QtCore.Qt.FramelessWindowHint
                                | QtCore.Qt.Dialog
                                | QtCore.Qt.WA_DeleteOnClose)
            self.setAttribute(QtCore.Qt.WA_StyledBackground)
            self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

            main_layout = QtWidgets.QVBoxLayout()
            main_layout.setContentsMargins(2, 2, 2, 2)
            main_layout.setSpacing(2)
            self.setLayout(main_layout)

            main_frame = QtWidgets.QFrame()
            main_frame.setObjectName('mainFrame')
            frame_layout = QtWidgets.QVBoxLayout()
            frame_layout.setContentsMargins(5, 5, 5, 5)
            frame_layout.setSpacing(5)

            main_frame.setLayout(frame_layout)
            main_layout.addWidget(main_frame)

            info_layout = QtWidgets.QHBoxLayout()

            artella_label_layout = QtWidgets.QHBoxLayout()
            artella_label = image.ArtellaImage.small()
            artella_label.set_artella_image(resource.pixmap('artella_white'))
            self._close_btn = button.ArtellaToolButton(
                parent=self).image('close').tiny().icon_only()
            self._close_btn.setVisible(closable or False)
            self._close_btn.clicked.connect(self.close)
            if closable:
                artella_label_layout.addSpacing(20)
            artella_label_layout.addStretch()
            artella_label_layout.addWidget(artella_label)
            artella_label_layout.addStretch()
            artella_label_layout.addWidget(self._close_btn)
            title_layout = QtWidgets.QHBoxLayout()
            self._title_label = label.ArtellaLabel(parent=self).strong()
            self._title_label.setText(title)
            self._title_label.setVisible(bool(text))
            title_layout.addStretch()
            title_layout.addWidget(self._title_label)
            title_layout.addStretch()

            self._icon_label = image.ArtellaImage.small()
            self._icon_label.set_artella_image(
                resource.pixmap('{}'.format(current_type),
                                color=vars(theme.theme()).get(current_type +
                                                              '_color')))

            self._content_label = label.ArtellaLabel(parent=self)
            self._content_label.setText(text)
            info_layout.addStretch()
            info_layout.addWidget(self._icon_label)
            info_layout.addWidget(self._content_label)
            info_layout.addStretch()

            frame_layout.addLayout(artella_label_layout)
            frame_layout.addWidget(divider.ArtellaDivider())
            frame_layout.addLayout(title_layout)
            frame_layout.addLayout(info_layout)

            self._setup_timers(duration)

            self._on_fade_in()