示例#1
0
文件: ui.py 项目: zhangzhii/FeelUOwn
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        self._layout = QHBoxLayout(self)

        self.back_btn = QPushButton('⇦', self)
        self.forward_btn = QPushButton('⇨', self)
        self.magicbox = MagicBox(self._app)
        self.status_line = StatusLine(self._app)
        self.back_btn.setObjectName('back_btn')
        self.forward_btn.setObjectName('forward_btn')
        self.setObjectName('bottom_panel')

        self.plugin_status_line_item = StatusLineItem('plugin',
                                                      PluginStatus(self._app))
        self.status_line.add_item(self.plugin_status_line_item)

        self._layout.addWidget(self.back_btn)
        self._layout.addWidget(self.forward_btn)
        self._layout.addWidget(self.magicbox)
        self._layout.addWidget(self.status_line)

        height = self.magicbox.height()
        self.setFixedHeight(height)
        self.back_btn.setFixedWidth(height)
        self.forward_btn.setFixedWidth(height)

        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
示例#2
0
文件: ui.py 项目: samirashoi/FeelUOwn
    def __init__(self, app):
        self._app = app
        self._layout = QVBoxLayout(app)
        self._bottom_layout = QHBoxLayout()
        self._top_separator = Separator(parent=app)
        self._splitter = QSplitter(app)
        if use_mac_theme():
            self._splitter.setHandleWidth(0)

        # NOTE: 以位置命名的部件应该只用来组织界面布局,不要
        # 给其添加任何功能性的函数
        self.top_panel = TopPanel(app, app)
        self._left_panel_container = QScrollArea(self._app)
        self._left_panel_container.setWidgetResizable(True)
        self.left_panel = LeftPanel(self._app, self._splitter)
        self._left_panel_container.setWidget(self.left_panel)
        self.right_panel = RightPanel(self._app, self._splitter)

        # alias
        self.pc_panel = self.top_panel.pc_panel
        self.table_container = self.right_panel.table_container
        self.magicbox = MagicBox(self._app)

        # 对部件进行一些 UI 层面的初始化
        self._splitter.addWidget(self._left_panel_container)
        self._splitter.addWidget(self.right_panel)

        self.right_panel.setMinimumWidth(780)
        self._left_panel_container.setSizePolicy(QSizePolicy.Minimum,
                                                 QSizePolicy.Expanding)
        self.right_panel.setSizePolicy(QSizePolicy.Expanding,
                                       QSizePolicy.Expanding)

        if use_mac_theme():
            self._layout.addWidget(self.magicbox)
            self._layout.addWidget(self._splitter)
            self._layout.addWidget(self._top_separator)
            self._layout.addWidget(self.top_panel)
        else:
            self._layout.addWidget(self.top_panel)
            self._layout.addWidget(self._top_separator)
            self._layout.addWidget(self._splitter)
            self._layout.addWidget(self.magicbox)

        # self._layout.addLayout(self._bottom_layout)
        # self._bottom_layout.addWidget(self.magicbox)
        self._layout.setSpacing(0)
        self._layout.setContentsMargins(0, 0, 0, 0)
        self.top_panel.layout().setSpacing(0)
        self.top_panel.layout().setContentsMargins(0, 0, 0, 0)

        self.pc_panel.playlist_btn.clicked.connect(self.show_player_playlist)

        self._app.hotkey_manager.registe(
            [QKeySequence('Ctrl+F'),
             QKeySequence(':'),
             QKeySequence('Alt+x')], self.magicbox.setFocus)