def create_main_panel_listen(self): """Creating the listening version of the interface""" self.listener = Network.Listener(self.l_input.text()) self.accepting = True # Create two displays for the local and remote file systems m_local_fs_display = QTextEdit() m_local_fs_display.setReadOnly(True) m_remote_fs_listen = QTextEdit() m_remote_fs_listen.setReadOnly(True) files = os.listdir("/root/sptp_server") listen_files = [] for file in files: m_local_fs_display.append(file) listen_files.append(file) # Combine the displays into a container widget mh_panel = make_container_widget( [m_local_fs_display, m_remote_fs_listen], vertical=False) mh_history = QTextEdit() mh_history.setReadOnly(True) mh_history.setFixedHeight(100) # Prototyping the command line interface msr_button = QPushButton() msr_input = QLineEdit() # Transfer command line mh_input = make_container_widget([msr_button, msr_input], vertical=False) wait_label = QLabel("Waiting for a connection...") load = QLabel() movie = QMovie("loading.gif") load.setMovie(movie) movie.start() wait_panel = make_container_widget([wait_label, load]) # Create entire panel that will be the window layout m_panel = make_container_widget([mh_panel, mh_history, mh_input]) all_panel = make_container_widget([wait_panel, m_panel]) m_panel.hide() self.window.setCentralWidget(all_panel) self.window.setWindowTitle("Server: Simple Python Transfer Protocol") self.m_remote_fs_listen = m_remote_fs_listen self.listen_files = listen_files self.wait_panel = wait_panel self.m_panel = m_panel
def btn_listen_clicked(self): # Currently when listen button is clicked, show the chat pane self.window.setCentralWidget(self.chat_pane) self.txt_history.append('Waiting for connection...') self.listener = Network.Listener(5000) self.accepting = True