예제 #1
0
    def launch_ssh(self):
        ip = settings.getIP()
        user = settings.getParam("user")

        if platform.system() == 'Windows':
            subprocess.Popen([
                functions.resource_path(os.path.join('files', 'putty.exe')),
                user + '@' + ip
            ])
        else:
            cmd = ' ssh ' + user + '@' + ip + ' &'
            print(cmd)
            if shutil.which('konsole') != None:
                os.system('konsole -e ' + cmd)
            elif shutil.which('xfce4-terminal') != None:
                os.system('xfce4-terminal -x ' + cmd)
            elif shutil.which('gnome-terminal') != None:
                os.system('gnome-terminal ' + cmd)
            elif shutil.which('xterm') != None:
                os.system('xterm -e ' + cmd)
예제 #2
0
    def launch_ssh(self):
        ip = self.ip.text()
        user = settings.getParam('user')

        if platform.system() == 'Windows':
            subprocess.Popen([
                functions.resource_path(os.path.join('files', 'putty.exe')),
                user + '@' + ip
            ])
        else:
            cmd = ' ssh  -o "StrictHostKeyChecking no" ' + user + '@' + ip + ' &'
            if shutil.which('sshpass') != None:
                cmd = "sshpass -p '{}' ".format(
                    settings.getParam('ec2_passwd')) + cmd
            if shutil.which('konsole') != None:
                os.system('konsole -e ' + cmd)
            elif shutil.which('xfce4-terminal') != None:
                os.system('xfce4-terminal -x ' + cmd)
            elif shutil.which('gnome-terminal') != None:
                os.system('gnome-terminal ' + cmd)
            elif shutil.which('xterm') != None:
                os.system('xterm -e ' + cmd)
예제 #3
0
    def __init__(self, parent):
        super().__init__(parent)

        self.instance_types = pd.read_csv(
            functions.resource_path('files/instances.csv'))

        # Acciones
        self.hbox_manipulate = QHBoxLayout()
        self.hbox_manipulate.addWidget(QLabel("Actions:"))

        self.on = QPushButton("Turn On")
        self.off = QPushButton("Turn Off")
        self.reset = QPushButton("Reset")

        self.grid_manipulate = QGridLayout()
        self.grid_manipulate.addWidget(self.on, 0, 0)
        self.grid_manipulate.addWidget(self.off, 0, 1)
        self.grid_manipulate.addWidget(self.reset, 0, 2)

        self.on.clicked.connect(self.fn_prender)
        self.off.clicked.connect(self.fn_apagar)
        self.reset.clicked.connect(self.fn_reset)

        # Tamaño
        self.grid_manipulate.addWidget(QLabel('Instance Size:'), 1, 0)
        self.instance_type = QComboBox()

        self.grid_manipulate.addWidget(self.instance_type, 1, 1)
        self.set_type = QPushButton("Set Size")
        self.grid_manipulate.addWidget(self.set_type, 1, 2)
        self.set_type.clicked.connect(self.fn_set_type)

        # Atributos
        self.hbox_attr = QHBoxLayout()
        self.hbox_attr.addWidget(QLabel("Instance Information:"))

        self.grid_attr = QGridLayout()
        self.grid_attr.addWidget(QLabel('Name'), 0, 0)
        self.name = QLineEdit()
        self.name.setReadOnly(True)
        self.grid_attr.addWidget(self.name, 0, 1)

        self.grid_attr.addWidget(QLabel('Type'), 1, 0)
        self.type = QLineEdit()
        self.type.setReadOnly(True)
        self.grid_attr.addWidget(self.type, 1, 1)

        self.grid_attr.addWidget(QLabel('USD / hour'), 2, 0)
        self.price = QLineEdit()
        self.price.setReadOnly(True)
        self.grid_attr.addWidget(self.price, 2, 1)

        self.grid_attr.addWidget(QLabel('IP'), 3, 0)
        self.ip = QLineEdit()
        self.ip.setReadOnly(True)
        self.grid_attr.addWidget(self.ip, 3, 1)

        self.grid_attr.addWidget(QLabel('Status'), 4, 0)
        self.status = QLineEdit()
        self.status.setReadOnly(True)
        self.grid_attr.addWidget(self.status, 4, 1)

        # Servicios
        self.hbox_serv = QHBoxLayout()
        self.hbox_serv.addWidget(QLabel("Launch Services:"))

        self.nomachine = QPushButton("Remote Desktop")
        self.rstudio = QPushButton("RStudio")
        self.jupyter = QPushButton("Jupyter")
        self.ssh = QPushButton("SSH")
        self.sftp = QPushButton("File Transfer")

        self.nomachine.clicked.connect(self.launch_nx)
        self.rstudio.clicked.connect(self.launch_rstudio)
        self.jupyter.clicked.connect(self.launch_jupyter)
        self.ssh.clicked.connect(self.launch_ssh)
        self.sftp.clicked.connect(self.launch_sftp)

        self.hbox_url = QGridLayout()
        self.hbox_url.addWidget(self.nomachine, 0, 0)
        self.hbox_url.addWidget(self.rstudio, 0, 1)
        self.hbox_url.addWidget(self.jupyter, 1, 0)
        self.hbox_url.addWidget(self.ssh, 1, 1)
        self.hbox_url.addWidget(self.sftp, 2, 0)

        self.refresh = QPushButton("Refresh")
        self.refresh.clicked.connect(self.fn_status)

        self.vbox = QVBoxLayout()
        self.vbox.addLayout(self.hbox_manipulate)
        self.vbox.addLayout(self.grid_manipulate)
        self.vbox.addLayout(self.hbox_attr)
        self.vbox.addLayout(self.grid_attr)
        self.vbox.addWidget(self.refresh)
        self.vbox.addLayout(self.hbox_serv)
        self.vbox.addLayout(self.hbox_url)

        self.setLayout(self.vbox)
        self.fn_status()