Пример #1
0
 def __init__(self):
         super(MainFrame, self).__init__()
         self.currentFrame = None
         self.detailFrame = DetailFrame(self)
         self.detailFrame.hide()
         self.introFrame = IntroFrame(self)
         self.introFrame.hide()
         self.gameViewFrame = GameViewFrame(self)
         self.gameViewFrame.hide()
Пример #2
0
class MainFrame(QWidget):
        OFFSET_X = 212
        OFFSET_Y = 9
        WIDTH = 800 - OFFSET_X
        HEIGHT = 477

        ANIMATION_SHOW_FRAME_DURATION = 300

        def __init__(self):
                super(MainFrame, self).__init__()
                self.currentFrame = None
                self.detailFrame = DetailFrame(self)
                self.detailFrame.hide()
                self.introFrame = IntroFrame(self)
                self.introFrame.hide()
                self.gameViewFrame = GameViewFrame(self)
                self.gameViewFrame.hide()

        def _showFrame(self, frame, animation):
                if self.currentFrame is not None:
                        self.currentFrame.hide()
                self.currentFrame = frame
                self.currentFrame.move(QPoint(0, 0))
                self.currentFrame.resize(self.size())
                self.currentFrame.show()
                if animation:
                        QMetaObject.invokeMethod(self, '_showFrameAnimation', Qt.QueuedConnection)

        def showDetailFrame(self, animation = True):
                self._showFrame(self.detailFrame, animation)

        def showIntroFrame(self, animation = True):
                self._showFrame(self.introFrame, animation)

        def showGameViewFrame(self, animation = True):
                self._showFrame(self.gameViewFrame, animation)

        @Slot()
        def _showFrameAnimation(self):
                self.showFrameAnimation = QPropertyAnimation(self.currentFrame, 'pos')
                self.showFrameAnimation.setDuration(MainFrame.ANIMATION_SHOW_FRAME_DURATION)
                self.showFrameAnimation.setStartValue(QPoint(self.width(), 0))
                self.showFrameAnimation.setEndValue(QPoint(0, 0))
                self.showFrameAnimation.setEasingCurve(QEasingCurve.OutExpo)
                self.showFrameAnimation.start(QAbstractAnimation.DeleteWhenStopped)

        def paintEvent(self, event):
                image = QImage(QDir.currentPath() + '/gui/images/background.png')
                image = image.copy(MainFrame.OFFSET_X, MainFrame.OFFSET_Y, MainFrame.WIDTH, MainFrame.HEIGHT)
                image = image.scaled(self.width(), self.height(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
                QPainter(self).drawImage(0, 0, image)
Пример #3
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.mLayout = QVBoxLayout(self)
        self.mLayout.setContentsMargins(0, 0, 0, 0)
        self.mLayout.setSpacing(0)
        self.mHLayout = QHBoxLayout()
        self.mHLayout.setSpacing(20)

        self.mVLayout = QVBoxLayout()
        self.mVLayout.setContentsMargins(5, 5, 5, 5)

        self.mNavigation = NavigationBar(self)
        self.mNavigation.pushNavigation("Apps", 0)
        self.mNavigation.pushNavigation(
            "Neal Analytics SKU Assortment Optimization", 1)
        self.mNavigation.pushNavigation("Neal Analytics", 2)

        self.mSidePanel = SidePanel(self)
        self.mHeaderFrame = QFrame(self)
        self.mAppName = QLabel(self.mHeaderFrame)
        self.mAppName.setFont(QFont("SegeoUI", 20))
        self.mAppName.setText("Neal Analytics SKU Assortment Optimization")
        self.mAppNameBrief = QLabel(self.mHeaderFrame)
        self.mAppNameBrief.setFont(QFont("SegeoUI", 14))
        self.mAppNameBrief.setText("Neal Analytics")
        self.mHeaderLayout = QVBoxLayout(self.mHeaderFrame)
        self.mHeaderLayout.addWidget(self.mAppName, 0, Qt.AlignLeft)
        self.mHeaderLayout.addWidget(self.mAppNameBrief, 0, Qt.AlignLeft)

        self.mTab = TabWidget(self)
        self.mTab.addItemByText("Overview", 0)
        self.mTab.addItemByText("Reviews", 1)
        self.mTab.tabChanged.connect(self.onTabChanged)

        self.mOverviewFrame = QFrame(self)

        self.mIntroFrame = IntroFrame(self.mOverviewFrame)
        self.mIntroFrame.setIntroDescHtmlFile("./html/example.html")

        self.mImageView = ImageView(self.mOverviewFrame)
        self.mImageView.setPresenterSize(640, 480)
        self.mImageView.addThumbnail("./img/phantom.jpg")
        self.mImageView.addThumbnail("./img/spectre.jpg")
        self.mImageView.addThumbnail(
            "./img/deeplearning.png",
            "https://www.youtube.com/embed/b99UVkWzYTQ?rel=0&showinfo=0",
            1)
        self.mImageView.addThumbnail("./img/large.png")
        self.mImageView.addThumbnail("./img/microsoft_preferred.png")
        self.mImageView.addThumbnail("./img/phantom.jpg")
        self.mImageView.addThumbnail("./img/spectre.jpg")

        self.mOverviewLayout = QHBoxLayout(self.mOverviewFrame)
        self.mOverviewLayout.setSpacing(40)
        self.mOverviewLayout.setContentsMargins(0, 0, 0, 0)
        self.mOverviewLayout.addWidget(self.mIntroFrame)
        self.mOverviewLayout.addWidget(self.mImageView)

        self.mReviewFrame = ReviewContainer(self)

        self.mVLayout.addWidget(self.mHeaderFrame, 0)
        self.mVLayout.addWidget(self.mTab, 0)
        self.mVLayout.addWidget(self.mReviewFrame, 10)
        self.mVLayout.addWidget(self.mOverviewFrame, 10)

        self.mHLayout.addWidget(self.mSidePanel)
        self.mHLayout.addLayout(self.mVLayout)

        self.mLayout.addWidget(self.mNavigation, 0, Qt.AlignLeft)
        self.mLayout.addLayout(self.mHLayout)
        self.mSidePanel.adjustFixedWidth(200)

        self.mTab.setActiveItemByIndex(0)

        self.setObjectName("DetailPage")
        self.setStyleSheet("#DetailPage{background-color: white;}")
        self.setAutoFillBackground(True)
        self.onTabChanged(0)