def onModuleLoad(self): self.singleton = self topPanel = TopPanel() rightPanel = VerticalPanel() self.mailDetail = MailDetail() self.shortcuts = Shortcuts() topPanel.setWidth("100%") # MailList uses Mail.get() in its constructor, so initialize it after # 'singleton'. mailList = MailList(self.singleton) mailList.setWidth("100%") # Create the right panel, containing the email list & details. rightPanel.add(mailList) rightPanel.add(self.mailDetail) mailList.setWidth("100%") self.mailDetail.setWidth("100%") # Create a dock panel that will contain the menu bar at the top, # the shortcuts to the left, and the mail list & details taking the rest. outer = DockPanel() outer.add(topPanel, DockPanel.NORTH) outer.add(self.shortcuts, DockPanel.WEST) outer.add(rightPanel, DockPanel.CENTER) outer.setWidth("100%") outer.setSpacing(4) outer.setCellWidth(rightPanel, "100%") # Hook the window resize event, so that we can adjust the UI. #FIXME need implementation # Window.addWindowResizeListener(this) #Window.addWindowResizeListener(self) # Get rid of scrollbars, and clear out the window's built-in margin, # because we want to take advantage of the entire client area. Window.enableScrolling(False) Window.setMargin("0px") # Finally, add the outer panel to the RootPanel, so that it will be # displayed. #RootPanel.get().add(outer) # FIXME get# RootPanel().add(outer) RootPanel().add(Logger()) # Call the window resized handler to get the initial sizes setup. Doing # this in a deferred command causes it to occur after all widgets' sizes # have been computed by the browser. # FIXME - need implementation# # DeferredCommand.add(onWindowResized(Window.getClientWidth(), Window.getClientHeight())) self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
def __init_ui(self): self.setGeometry(200, 200, 1024, 700) self.setWindowTitle(u'QQ音乐民间(Linux)版') central_layout = QVBoxLayout() central_layout.setSpacing(0) central_layout.setContentsMargins(0, 0, 0, 0) central_widget = QWidget() central_widget.setLayout(central_layout) self.setCentralWidget(central_widget) self.top_panel = TopPanel() self.top_panel.edt_search.connect(SIGNAL('returnPressed()'), self.action_search) self.top_panel.btn_search.connect(SIGNAL('clicked()'), self.action_search) central_layout.addWidget(self.top_panel) wrap_layout = QHBoxLayout() wrap_layout.setSpacing(0) wrap_layout.setContentsMargins(0, 0, 0, 0) central_layout.addLayout(wrap_layout) self.left_panel = LeftPanel() self.left_panel.btn_search.connect(SIGNAL('clicked()'), self.action_show_search_panel) self.left_panel.btn_playlist.connect(SIGNAL('clicked()'), self.action_show_playlist_panel) self.left_panel.btn_cache.connect(SIGNAL('clicked()'), self.action_show_cache_panel) self.left_panel.btn_download.connect(SIGNAL('clicked()'), self.action_show_download_panel) wrap_layout.addWidget(self.left_panel) self.stacked = QStackedWidget() wrap_layout.addWidget(self.stacked) self.search_panel = SearchPanel() self.search_panel.connect(SIGNAL('before_search()'), self.open_waiting) self.search_panel.connect(SIGNAL('after_fill()'), self.close_waiting) self.search_panel.song_table.connect(SIGNAL('cell_double_clicked()'), self.play_search_table) self.search_panel.btn_add_playlist.connect(SIGNAL('clicked()'), self.action_add_playlist) self.search_panel.tencent.connect(SIGNAL('after_download(PyObject)'), self.after_download) self.stacked.addWidget(self.search_panel) self.playlist_panel = PlaylistPanel() self.playlist_panel.song_table.connect(SIGNAL('cell_double_clicked()'), self.play_list_table) self.stacked.addWidget(self.playlist_panel) self.cache_panel = CachePanel() self.cache_panel.song_table.connect(SIGNAL('cell_double_clicked()'), self.play_cache_table) self.stacked.addWidget(self.cache_panel) self.download_panel = DownloadPanel() self.download_panel.song_table.connect(SIGNAL('cell_double_clicked()'), self.play_download_table) self.stacked.addWidget(self.download_panel) self.bottom_panel = BottomPanel() self.bottom_panel.connect(SIGNAL('before_load()'), self.open_waiting) self.bottom_panel.connect(SIGNAL('load_error()'), self.close_waiting) self.bottom_panel.loader.connect(SIGNAL('after_cache()'), self.after_cache) self.bottom_panel.player.connect(SIGNAL('before_play()'), self.close_waiting) self.bottom_panel.btn_stop.connect(SIGNAL('clicked()'), self.close_waiting) central_layout.addWidget(self.bottom_panel)