def __init__(self, parent=None): super().__init__(parent) self.ui = UiMainWidget() # 那些widget对象都通过self.ui.*.*来访问,感觉也不是很好 self.ui.setup_ui(self) self.player = Player() self.desktop_mini = DesktopMiniLayer() self.current_playlist_widget = MusicTableWidget() self.lyric_widget = LyricWidget() self.network_manger = NetworkManager() self.search_shortcut = QShortcut(QKeySequence("Ctrl+F"), self) self._exit_shortcut = QShortcut(QKeySequence(Qt.Key_Escape), self) self.api = None self.network_queue = Queue() self.init() self.state = { "is_login": False, "current_mid": 0, "current_pid": 0, "platform": "" } APP_EVENT_LOOP = asyncio.get_event_loop() APP_EVENT_LOOP.call_later(1, self._init_plugins)
def __init__(self, parent=None): super().__init__(parent) # set app name before mediaObject was created to avoid phonon problem # QCoreApplication.setApplicationName("NetEaseMusic-ThirdParty") self.ui = UiMainWidget() # 那些widget对象都通过self.ui.*.*来访问,感觉也不是很好 self.ui.setup_ui(self) self.player = Player() self.current_playlist_widget = MusicTableWidget() self.lyric_widget = LyricWidget(self) self.left_central_widget = self.ui.left_widget.central_widget self.status = self.ui.status self.trayicon = TrayIcon(self) self.webview = self.ui.right_widget.webview # 常用的对象复制一下,方便使用 self.progress = self.ui.progress_info self.network_manger = NetworkManager() self.search_shortcut = QShortcut(QKeySequence("Ctrl+F"), self) self.play_or_pause_btn = self.ui.top_widget.play_pause_btn self.api = None self.network_queue = Queue() self.init() self.state = {'is_login': False, 'current_mid': 0, 'current_pid': 0} APP_EVENT_LOOP = asyncio.get_event_loop() APP_EVENT_LOOP.call_later(1, self._init_plugins)
def test_music_table_widget(qtbot): from widgets.music_table_widget import MusicTableWidget w = MusicTableWidget() w.show() qtbot.addWidget(w)