Example #1
0
    def addDrawer(self, type, name, path):
        if (self.userName == None):
            self.slot_show_message(MMessage.warning, u"请先登录账号")
            return
        self.parmerPanel = Parmers.ParmerPanel(self.userName)
        self.parmerPanel.setParam(type, name, path)
        self.parmerPanel.send_message_signal.connect(self.setMessageBox)
        self.custom_widget = QWidget()
        custom_lay = QFormLayout()
        self.custom_widget.setLayout(custom_lay)
        custom_lay.setContentsMargins(0, 0, 0, 0)
        custom_lay.addWidget(self.parmerPanel)

        self.drawer = MDrawer(u'参数面板', parent=self.view.centerWindow)
        self.drawer.layout().setContentsMargins(0, 0, 0, 0)
        self.drawer.setFixedWidth(Data.getWindowWidth() / 3)
        self.drawer.set_widget(self.custom_widget)
        # self.drawer.layout().addWidget(self.custom_widget)

        dayu_theme.apply(self.drawer)

        self.drawer.show()

        # self.parmerPanel.model_widget.setMinimumSize(Data.getWindowHeight()/3,Data.getWindowHeight()/3)
        # self.view.centerWindow.layout().addWidget(self.parmerPanel.model_widget)
        self.parmerPanel.model_widget.embed()
        self.parmerPanel.setModelWidget(path)  #设置3d视图
Example #2
0
    def __init__(self,
                 cover=None,
                 avatar=None,
                 title=None,
                 description=None,
                 extra=False,
                 parent=None):
        super(MMeta, self).__init__(parent)
        self.setAttribute(Qt.WA_StyledBackground)
        self._cover_label = QLabel()
        self._avatar = MAvatar()
        self._title_label = MLabel().h4()
        self._description_label = MLabel().secondary()
        self._description_label.setWordWrap(True)
        self._description_label.set_elide_mode(Qt.ElideRight)
        self._title_layout = QHBoxLayout()
        self._title_layout.addWidget(self._title_label)
        self._title_layout.addStretch()
        self._extra_button = MToolButton(
            parent=self).icon_only().svg('more.svg')
        self._title_layout.addWidget(self._extra_button)
        self._extra_button.setVisible(extra)

        content_lay = QFormLayout()
        content_lay.setContentsMargins(5, 5, 5, 5)
        content_lay.addRow(self._avatar, self._title_layout)
        content_lay.addRow(self._description_label)

        self._button_layout = QHBoxLayout()

        main_lay = QVBoxLayout()
        main_lay.setSpacing(0)
        main_lay.setContentsMargins(1, 1, 1, 1)
        main_lay.addWidget(self._cover_label)
        main_lay.addLayout(content_lay)
        main_lay.addLayout(self._button_layout)
        main_lay.addStretch()
        self.setLayout(main_lay)
        self._cover_label.setFixedSize(QSize(200, 200))