# Path: spyder_notebook/utils/localization.py

# 
# Path: spyder_notebook/utils/servermanager.py
# class ServerProcess():
#     """
#     Process executing a notebook server.
# 
#     This is a data class.
#     """
# 
#     def __init__(self, process, notebook_dir, interpreter, starttime=None,
#                  state=ServerState.STARTING, server_info=None, output=''):
#         """
#         Construct a ServerProcess.
# 
#         Parameters
#         ----------
#         process : QProcess
#             The process described by this instance.
#         notebook_dir : str
#             Directory from which the server can render notebooks.
#         interpreter : str
#             File name of Python interpreter used to render notebooks.
#         starttime : datetime or None, optional
#             Time at which the process was started. The default is None,
#             meaning that the current time should be used.
#         state : ServerState, optional
#             State of the server process. The default is ServerState.STARTING.
#         server_info : dict or None, optional
#             If set, this is a dict with information given by the server in
#             a JSON file in jupyter_runtime_dir(). It has keys like 'url' and
#             'token'. The default is None.
#         output : str
#             Output of the server process from stdout and stderr. The default
#             is ''.
#         """
#         self.process = process
#         self.notebook_dir = notebook_dir
#         self.interpreter = interpreter
#         self.starttime = starttime or datetime.datetime.now()
#         self.state = state
#         self.server_info = server_info
#         self.output = output
# 
# class ServerState(enum.Enum):
#     """State of a server process."""
# 
#     STARTING = 1
#     RUNNING = 2
#     FINISHED = 3
#     ERROR = 4
#     TIMED_OUT = 5


import sys
from qtpy.QtWidgets import (
    QApplication, QComboBox, QDialogButtonBox, QFormLayout, QLineEdit,
    QPushButton, QTextEdit, QVBoxLayout)
from spyder.plugins.variableexplorer.widgets.basedialog import BaseDialog
from spyder_notebook.utils.localization import _
from spyder_notebook.utils.servermanager import ServerProcess, ServerState

        self.refresh_data()

    def refresh_data(self):
        self.process_combo.clear()
        for server in self.servers:
            self.process_combo.addItem(str(server.process.processId()))
        self.select_process(0)

    def select_process(self, index):
        self.dir_lineedit.setText(self.servers[index].notebook_dir)
        self.interpreter_lineedit.setText(self.servers[index].interpreter)
        self.state_lineedit.setText(
            SERVER_STATE_DESCRIPTIONS[self.servers[index].state])
        self.log_textedit.setPlainText(self.servers[index].output)


def test():  # pragma: no cover
    """Display dialog for manual testing."""
    class FakeProcess:
        def __init__(self, pid):
            self.pid = pid

        def processId(self):
            return self.pid

    servers = [ServerProcess(FakeProcess(42), '/my/home/dir',
                             '/ham/interpreter',
                             state=ServerState.RUNNING,
                             output='Nicely humming along...\n'),

# Path: spyder_notebook/utils/localization.py

# 
# Path: spyder_notebook/utils/servermanager.py
# class ServerProcess():
#     """
#     Process executing a notebook server.
# 
#     This is a data class.
#     """
# 
#     def __init__(self, process, notebook_dir, interpreter, starttime=None,
#                  state=ServerState.STARTING, server_info=None, output=''):
#         """
#         Construct a ServerProcess.
# 
#         Parameters
#         ----------
#         process : QProcess
#             The process described by this instance.
#         notebook_dir : str
#             Directory from which the server can render notebooks.
#         interpreter : str
#             File name of Python interpreter used to render notebooks.
#         starttime : datetime or None, optional
#             Time at which the process was started. The default is None,
#             meaning that the current time should be used.
#         state : ServerState, optional
#             State of the server process. The default is ServerState.STARTING.
#         server_info : dict or None, optional
#             If set, this is a dict with information given by the server in
#             a JSON file in jupyter_runtime_dir(). It has keys like 'url' and
#             'token'. The default is None.
#         output : str
#             Output of the server process from stdout and stderr. The default
#             is ''.
#         """
#         self.process = process
#         self.notebook_dir = notebook_dir
#         self.interpreter = interpreter
#         self.starttime = starttime or datetime.datetime.now()
#         self.state = state
#         self.server_info = server_info
#         self.output = output
# 
# class ServerState(enum.Enum):
#     """State of a server process."""
# 
#     STARTING = 1
#     RUNNING = 2
#     FINISHED = 3
#     ERROR = 4
#     TIMED_OUT = 5


# Path: spyder_notebook/widgets/serverinfo.py
import sys
from qtpy.QtWidgets import (
    QApplication, QComboBox, QDialogButtonBox, QFormLayout, QLineEdit,
    QPushButton, QTextEdit, QVBoxLayout)
from spyder.plugins.variableexplorer.widgets.basedialog import BaseDialog
from spyder_notebook.utils.localization import _
from spyder_notebook.utils.servermanager import ServerProcess, ServerState


        self.refresh_data()

    def refresh_data(self):
        self.process_combo.clear()
        for server in self.servers:
            self.process_combo.addItem(str(server.process.processId()))
        self.select_process(0)

    def select_process(self, index):
        self.dir_lineedit.setText(self.servers[index].notebook_dir)
        self.interpreter_lineedit.setText(self.servers[index].interpreter)
        self.state_lineedit.setText(
            SERVER_STATE_DESCRIPTIONS[self.servers[index].state])
        self.log_textedit.setPlainText(self.servers[index].output)


def test():  # pragma: no cover
    """Display dialog for manual testing."""
    class FakeProcess:
        def __init__(self, pid):
            self.pid = pid

        def processId(self):
            return self.pid

    servers = [ServerProcess(FakeProcess(42), '/my/home/dir',
                             '/ham/interpreter',
                             state=ServerState.RUNNING,
                             output='Nicely humming along...\n'),

               ServerProcess(FakeProcess(404), '/some/other/dir',