Пример #1
0
    def setup_ui(self):
        super(ProgressSplashDialog, self).setup_ui()

        self._stack = stack.SlidingOpacityStackedWidget(parent=self)
        self._splash_layout.addStretch()
        self._splash_layout.addWidget(self._stack)

        progress_widget = QtWidgets.QWidget(parent=self)
        progress_layout = QtWidgets.QVBoxLayout()
        progress_widget.setLayout(progress_layout)
        self._progress = ProgressCricle()
        progress_lyt = QtWidgets.QHBoxLayout()
        progress_lyt.addStretch()
        progress_lyt.addWidget(self._progress)
        progress_lyt.addStretch()
        self._progress_text = QtWidgets.QLabel('Wait please ...')
        progress_txt_lyt = QtWidgets.QHBoxLayout()
        progress_txt_lyt.addStretch()
        progress_txt_lyt.addWidget(self._progress_text)
        progress_txt_lyt.addStretch()
        progress_layout.addStretch()
        progress_layout.addLayout(progress_lyt)
        progress_layout.addLayout(progress_txt_lyt)

        self._stack.addWidget(progress_widget)
Пример #2
0
        def _add_package_tab(self, package_name):
            package_widget = QtWidgets.QWidget()
            package_layout = QtWidgets.QVBoxLayout()
            package_layout.setContentsMargins(2, 2, 2, 2)
            package_layout.setSpacing(2)
            package_widget.setLayout(package_layout)
            package_scroll = QtWidgets.QScrollArea()
            package_scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
            package_scroll.setWidgetResizable(True)
            package_scroll.setWidget(package_widget)

            self._package_tabs.addTab(package_widget, package_name)

            return package_layout
Пример #3
0
    def setup_ui(self):
        super(DownloadSplashDialog, self).setup_ui()

        main_widget = QtWidgets.QWidget()
        main_layout = QtWidgets.QVBoxLayout()
        main_widget.setLayout(main_layout)
        self._stack.addWidget(main_widget)

        download_widget = QtWidgets.QWidget()
        download_layout = QtWidgets.QVBoxLayout()
        download_widget.setLayout(download_layout)
        content_area = QtWidgets.QScrollArea(parent=self)
        content_area.setMinimumHeight(qtutils.dpi_scale(150))
        content_area.setWidgetResizable(True)
        content_area.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        # content_area.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
        content_area.setWidget(download_widget)
        content_area.setStyleSheet(
            'background-color: transparent; border: none;')
        self._download_layout = QtWidgets.QVBoxLayout()
        download_layout.addLayout(self._download_layout)

        main_layout.addStretch()
        main_layout.addWidget(content_area)
Пример #4
0
    def setup_ui(self):
        super(SplashDialog, self).setup_ui()

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

        splash_pixmap = resource.pixmap('artella_splash')
        splash = SplashScreen(splash_pixmap)
        splash.setMask(splash_pixmap.mask())
        self._splash_layout = QtWidgets.QVBoxLayout()
        self._splash_layout.setAlignment(QtCore.Qt.AlignBottom)
        splash.setLayout(self._splash_layout)
        self.main_layout.addWidget(splash)

        size_width = splash_pixmap.size().width() + 20
        size_height = splash_pixmap.size().height() + 20
        self.setFixedSize(QtCore.QSize(size_width, size_height))

        shadow_effect = QtWidgets.QGraphicsDropShadowEffect(self)
        shadow_effect.setBlurRadius(qtutils.dpi_scale(15))
        shadow_effect.setColor(QtGui.QColor(0, 0, 0, 150))
        shadow_effect.setOffset(qtutils.dpi_scale(0))
        self.setGraphicsEffect(shadow_effect)
Пример #5
0
        def get_main_layout(self):
            main_layout = QtWidgets.QVBoxLayout()
            main_layout.setContentsMargins(0, 0, 0, 0)
            main_layout.setSpacing(0)

            return main_layout
Пример #6
0
        def __init__(self,
                     id,
                     name,
                     package,
                     version,
                     author,
                     email,
                     summary,
                     latest_version,
                     upload_date,
                     size,
                     url,
                     icon_pixmap=None,
                     parent=None):
            super(PluginVersionWidget, self).__init__(parent)

            self._id = id
            self._name = name
            self._package = package
            self._version = version
            self._author = author
            self._email = email
            self._summary = summary
            self._latest_version = latest_version
            self._upload_date = upload_date
            self._size = size
            self._url = url

            icon_pixmap = (icon_pixmap or resource.pixmap('artella')
                           or QtGui.QPixmap()).scaled(
                               QtCore.QSize(30, 30),
                               QtCore.Qt.KeepAspectRatio,
                               transformMode=QtCore.Qt.SmoothTransformation)

            self.setFrameShape(QtWidgets.QFrame.StyledPanel)
            self.setFrameShadow(QtWidgets.QFrame.Raised)
            self.setMinimumHeight(130)

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

            main_info_layout = QtWidgets.QVBoxLayout()
            main_info_layout.setContentsMargins(2, 2, 2, 2)
            main_info_layout.setSpacing(2)

            top_layout = QtWidgets.QHBoxLayout()
            top_layout.setContentsMargins(2, 2, 2, 2)
            top_layout.setSpacing(5)
            self._icon_label = QtWidgets.QLabel()
            self._icon_label.setPixmap(icon_pixmap)
            self._icon_label.setAlignment(QtCore.Qt.AlignTop)

            self._plugin_name_label = QtWidgets.QLabel(name)
            self._plugin_version_label = QtWidgets.QLabel(
                '({})'.format(version))

            plugin_name_info_layout = QtWidgets.QVBoxLayout()
            plugin_name_info_layout.setContentsMargins(2, 2, 2, 2)
            plugin_name_info_layout.setSpacing(5)
            plugin_name_layout = QtWidgets.QHBoxLayout()
            plugin_name_layout.setContentsMargins(2, 2, 2, 2)
            plugin_name_layout.setSpacing(2)
            plugin_info_layout = QtWidgets.QHBoxLayout()
            plugin_info_layout.setContentsMargins(2, 2, 2, 2)
            plugin_info_layout.setSpacing(5)
            plugin_name_layout.addWidget(self._plugin_name_label)
            plugin_name_layout.addWidget(self._plugin_version_label)
            plugin_name_layout.addStretch()
            plugin_name_info_layout.addLayout(plugin_name_layout)
            plugin_name_info_layout.addLayout(plugin_info_layout)
            plugin_name_info_layout.addStretch()
            self._plugin_date_label = QtWidgets.QLabel(upload_date)
            self._plugin_size_label = QtWidgets.QLabel(size)
            separator_widget = QtWidgets.QWidget()
            separator_layout = QtWidgets.QVBoxLayout()
            separator_layout.setAlignment(QtCore.Qt.AlignLeft)
            separator_layout.setContentsMargins(0, 0, 0, 0)
            separator_layout.setSpacing(0)
            separator_widget.setLayout(separator_layout)
            separator_frame = QtWidgets.QFrame()
            separator_frame.setMaximumHeight(15)
            separator_frame.setFrameShape(QtWidgets.QFrame.VLine)
            separator_frame.setFrameShadow(QtWidgets.QFrame.Sunken)
            separator_layout.addWidget(separator_frame)
            plugin_info_layout.addWidget(self._plugin_date_label)
            plugin_info_layout.addWidget(separator_widget)
            plugin_info_layout.addWidget(self._plugin_size_label)
            plugin_info_layout.addStretch()

            top_layout.addWidget(self._icon_label)
            top_layout.addLayout(plugin_name_info_layout)

            bottom_layout = QtWidgets.QHBoxLayout()
            bottom_layout.setContentsMargins(2, 2, 2, 2)
            bottom_layout.setSpacing(5)
            self._summary_text = QtWidgets.QPlainTextEdit(summary)
            self._summary_text.setReadOnly(True)
            self._summary_text.setMinimumHeight(60)
            self._summary_text.setFocusPolicy(QtCore.Qt.NoFocus)
            bottom_layout.addWidget(self._summary_text)

            download_layout = QtWidgets.QVBoxLayout()
            download_layout.setContentsMargins(2, 2, 2, 2)
            download_layout.setSpacing(2)
            self._progress = splash.ProgressCricle(width=80)
            self._progress_text = QtWidgets.QLabel('Wait please ...')
            self._ok_label = QtWidgets.QLabel()
            self._ok_label.setPixmap(resource.pixmap('success'))
            self._update_button = QtWidgets.QPushButton()
            self._progress.setVisible(False)
            self._progress_text.setVisible(False)
            self._ok_label.setVisible(False)
            progress_layout = QtWidgets.QHBoxLayout()
            progress_layout.addStretch()
            progress_layout.addWidget(self._progress)
            progress_layout.addStretch()
            progress_text_layout = QtWidgets.QHBoxLayout()
            progress_text_layout.addStretch()
            progress_text_layout.addWidget(self._progress_text)
            progress_text_layout.addStretch()
            ok_layout = QtWidgets.QHBoxLayout()
            ok_layout.addStretch()
            ok_layout.addWidget(self._ok_label)
            ok_layout.addStretch()
            download_layout.addStretch()
            download_layout.addLayout(progress_layout)
            download_layout.addLayout(progress_text_layout)
            download_layout.addLayout(ok_layout)
            download_layout.addWidget(self._update_button)
            download_layout.addStretch()

            main_info_layout.addLayout(top_layout)
            main_info_layout.addStretch()
            main_info_layout.addLayout(bottom_layout)
            main_info_layout.addStretch()

            main_info_layout.addStretch()
            main_layout.addLayout(main_info_layout)
            separator_widget = QtWidgets.QWidget()
            separator_layout = QtWidgets.QVBoxLayout()
            separator_layout.setAlignment(QtCore.Qt.AlignLeft)
            separator_layout.setContentsMargins(0, 0, 0, 0)
            separator_layout.setSpacing(0)
            separator_widget.setLayout(separator_layout)
            separator_frame = QtWidgets.QFrame()
            separator_frame.setFrameShape(QtWidgets.QFrame.VLine)
            separator_frame.setFrameShadow(QtWidgets.QFrame.Sunken)
            separator_layout.addWidget(separator_frame)
            main_layout.addWidget(separator_widget)
            main_layout.addLayout(download_layout)
            main_info_layout.addStretch()

            self._update_plugin_thread = QtCore.QThread(self)
            self._update_plugin_worker = utils.UpdatePluginWorker()
            self._update_plugin_worker.moveToThread(self._update_plugin_thread)
            self._update_plugin_worker.updateStart.connect(
                self._on_start_update)
            self._update_plugin_worker.updateFinish.connect(
                self._on_finish_update)
            self._update_plugin_thread.start()

            self._timer = QtCore.QTimer(self)

            self.updatePlugin.connect(self._update_plugin_worker.run)
            self._update_button.clicked.connect(self._on_update)
            self._timer.timeout.connect(self._on_advance_progress)

            self.refresh()
Пример #7
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()