(self)
Setup Ui
Setup Ui
Setup Ui
def setup_ui(self):
        """ Setup Ui
        """
        main_wrap = QVBoxLayout()
        main_wrap.setContentsMargins(0, 0, 0, 0)

        # updatebar on top
        self.update_bar = UpdateBar(self)
        self.update_bar.onUpdateNowClicked.connect(self._update_dwarf)
        self.update_bar.setVisible(False)
        main_wrap.addWidget(self.update_bar)

        # main content
        h_box = QHBoxLayout()
        h_box.setContentsMargins(15, 15, 15, 15)
        wrapper = QVBoxLayout()
        head = QHBoxLayout()
        head.setContentsMargins(50, 10, 0, 10)
        # dwarf icon
        icon = QLabel()
        icon.setPixmap(QPixmap(utils.resource_path('assets/dwarf.svg')))
        icon.setAlignment(Qt.AlignCenter)
        icon.setMinimumSize(QSize(125, 125))
        icon.setMaximumSize(QSize(125, 125))
        head.addWidget(icon)

        # main title
        v_box = QVBoxLayout()
        title = QLabel('Dwarf')
        title.setContentsMargins(0, 0, 0, 0)
        font = QFont('Anton', 100, QFont.Bold)
        font.setPixelSize(120)
        title.setFont(font)
        title.setMaximumHeight(125)
        title.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        title.setAlignment(Qt.AlignCenter)
        head.addWidget(title)

        sub_title_text = (
            self._pick_random_word(0) + ' ' + self._pick_random_word(1) + ' ' +
            self._pick_random_word(2) + ' ' + self._pick_random_word(3) + ' ' +
            self._pick_random_word(4))
        sub_title_text = sub_title_text[:1].upper() + sub_title_text[1:]
        self._sub_title = QLabel(sub_title_text)
        font = QFont('OpenSans', 16, QFont.Bold)
        font.setPixelSize(24)
        self._sub_title.setFont(font)
        font_metric = QFontMetrics(self._sub_title.font())
        self._char_width = font_metric.widthChar('#')
        self._sub_title.setAlignment(Qt.AlignCenter)
        self._sub_title.setContentsMargins(175, 0, 0, 20)
        self._sub_title.setSizePolicy(QSizePolicy.Expanding,
                                      QSizePolicy.Minimum)
        v_box.addLayout(head)
        v_box.addWidget(self._sub_title)

        wrapper.addLayout(v_box)

        recent = QLabel('Recent saved Sessions')
        font = recent.font()
        font.setPixelSize(14)
        font.setBold(True)
        # font.setPointSize(10)
        recent.setFont(font)
        wrapper.addWidget(recent)
        wrapper.addWidget(self._recent_list)
        h_box.addLayout(wrapper, stretch=False)
        buttonSpacer = QSpacerItem(15, 100, QSizePolicy.Fixed,
                                   QSizePolicy.Minimum)
        h_box.addItem(buttonSpacer)
        wrapper = QVBoxLayout()

        btn = QPushButton()
        ico = QIcon(QPixmap(utils.resource_path('assets/android.svg')))
        btn.setIconSize(QSize(75, 75))
        btn.setIcon(ico)
        btn.setToolTip('New Android Session')
        btn.clicked.connect(self._on_android_button)
        wrapper.addWidget(btn)

        btn = QPushButton()
        ico = QIcon(QPixmap(utils.resource_path('assets/apple.svg')))
        btn.setIconSize(QSize(75, 75))
        btn.setIcon(ico)
        btn.setToolTip('New iOS Session')
        btn.clicked.connect(self._on_ios_button)
        wrapper.addWidget(btn)

        btn = QPushButton()
        ico = QIcon(QPixmap(utils.resource_path('assets/local.svg')))
        btn.setIconSize(QSize(75, 75))
        btn.setIcon(ico)
        btn.setToolTip('New Local Session')
        btn.clicked.connect(self._on_local_button)
        wrapper.addWidget(btn)

        btn = QPushButton()
        ico = QIcon(QPixmap(utils.resource_path('assets/remote.svg')))
        btn.setIconSize(QSize(75, 75))
        btn.setIcon(ico)
        btn.setToolTip('New Remote Session')
        btn.clicked.connect(self._on_remote_button)
        wrapper.addWidget(btn)

        h_box.addLayout(wrapper, stretch=False)
        main_wrap.addLayout(h_box)
        self.setLayout(main_wrap)
def setup_ui ( self ) : main_wrap = QVBoxLayout ( ) main_wrap . setContentsMargins ( 0 , 0 , 0 , 0 ) # updatebar on top self . update_bar = UpdateBar ( self ) self . update_bar . onUpdateNowClicked . connect ( self . _update_dwarf ) self . update_bar . setVisible ( False ) main_wrap . addWidget ( self . update_bar ) # main content h_box = QHBoxLayout ( ) h_box . setContentsMargins ( 15 , 15 , 15 , 15 ) wrapper = QVBoxLayout ( ) head = QHBoxLayout ( ) head . setContentsMargins ( 50 , 10 , 0 , 10 ) # dwarf icon icon = QLabel ( ) icon . setPixmap ( QPixmap ( utils . resource_path ( 'assets/dwarf.svg' ) ) ) icon . setAlignment ( Qt . AlignCenter ) icon . setMinimumSize ( QSize ( 125 , 125 ) ) icon . setMaximumSize ( QSize ( 125 , 125 ) ) head . addWidget ( icon ) # main title v_box = QVBoxLayout ( ) title = QLabel ( 'Dwarf' ) title . setContentsMargins ( 0 , 0 , 0 , 0 ) font = QFont ( 'Anton' , 100 , QFont . Bold ) font . setPixelSize ( 120 ) title . setFont ( font ) title . setMaximumHeight ( 125 ) title . setSizePolicy ( QSizePolicy . Expanding , QSizePolicy . Minimum ) title . setAlignment ( Qt . AlignCenter ) head . addWidget ( title ) sub_title_text = ( self . _pick_random_word ( 0 ) + ' ' + self . _pick_random_word ( 1 ) + ' ' + self . _pick_random_word ( 2 ) + ' ' + self . _pick_random_word ( 3 ) + ' ' + self . _pick_random_word ( 4 ) ) sub_title_text = sub_title_text [ : 1 ] . upper ( ) + sub_title_text [ 1 : ] self . _sub_title = QLabel ( sub_title_text ) font = QFont ( 'OpenSans' , 16 , QFont . Bold ) font . setPixelSize ( 24 ) self . _sub_title . setFont ( font ) font_metric = QFontMetrics ( self . _sub_title . font ( ) ) self . _char_width = font_metric . widthChar ( '#' ) self . _sub_title . setAlignment ( Qt . AlignCenter ) self . _sub_title . setContentsMargins ( 175 , 0 , 0 , 20 ) self . _sub_title . setSizePolicy ( QSizePolicy . Expanding , QSizePolicy . Minimum ) v_box . addLayout ( head ) v_box . addWidget ( self . _sub_title ) wrapper . addLayout ( v_box ) recent = QLabel ( 'Recent saved Sessions' ) font = recent . font ( ) font . setPixelSize ( 14 ) font . setBold ( True ) # font.setPointSize(10) recent . setFont ( font ) wrapper . addWidget ( recent ) wrapper . addWidget ( self . _recent_list ) h_box . addLayout ( wrapper , stretch = False ) buttonSpacer = QSpacerItem ( 15 , 100 , QSizePolicy . Fixed , QSizePolicy . Minimum ) h_box . addItem ( buttonSpacer ) wrapper = QVBoxLayout ( ) btn = QPushButton ( ) ico = QIcon ( QPixmap ( utils . resource_path ( 'assets/android.svg' ) ) ) btn . setIconSize ( QSize ( 75 , 75 ) ) btn . setIcon ( ico ) btn . setToolTip ( 'New Android Session' ) btn . clicked . connect ( self . _on_android_button ) wrapper . addWidget ( btn ) btn = QPushButton ( ) ico = QIcon ( QPixmap ( utils . resource_path ( 'assets/apple.svg' ) ) ) btn . setIconSize ( QSize ( 75 , 75 ) ) btn . setIcon ( ico ) btn . setToolTip ( 'New iOS Session' ) btn . clicked . connect ( self . _on_ios_button ) wrapper . addWidget ( btn ) btn = QPushButton ( ) ico = QIcon ( QPixmap ( utils . resource_path ( 'assets/local.svg' ) ) ) btn . setIconSize ( QSize ( 75 , 75 ) ) btn . setIcon ( ico ) btn . setToolTip ( 'New Local Session' ) btn . clicked . connect ( self . _on_local_button ) wrapper . addWidget ( btn ) btn = QPushButton ( ) ico = QIcon ( QPixmap ( utils . resource_path ( 'assets/remote.svg' ) ) ) btn . setIconSize ( QSize ( 75 , 75 ) ) btn . setIcon ( ico ) btn . setToolTip ( 'New Remote Session' ) btn . clicked . connect ( self . _on_remote_button ) wrapper . addWidget ( btn ) h_box . addLayout ( wrapper , stretch = False ) main_wrap . addLayout ( h_box ) self . setLayout ( main_wrap )