コード例 #1
0
    def delete_connection(self):
        # Instance the Connection Model
        connection = Connection()
        connection.id = self.id_connection

        # Delete the tunnels
        connection.delete_tunnels()

        # Delete the connection
        if connection.delete() is False:
            MessageBox("Fail to delete the connection, please try again")
        else:
            # Call the callback
            self.refresh_callback()

            # Close the Window
            self.window.destroy()
コード例 #2
0
    def on_btn_edit_clicked(self, btn):
        # Get the ID of selected Connection
        tree = self.builder.get_object("connections_tree")

        # Get the selection
        (model, treeiter) = tree.get_selection().get_selected_rows()

        # Get the connection ID
        if model is not None and len(treeiter) > 0:
            # Get the ID
            connection_id = model[treeiter][1]

            # Load the Connection
            connection = Connection()
            connection.id = connection_id
            connection.load()
            connection.load_tunnels()

            # Open the Window with the connection
            ConnectionWindow(self.refresh_connections_list, connection)
コード例 #3
0
    def on_btn_connect_clicked(self, btn):
        # Get the selected ID
        tree = self.builder.get_object("connections_tree")

        # Get the selection
        (model, treeiter) = tree.get_selection().get_selected_rows()

        # Get the connection ID
        if model is not None and len(treeiter) > 0:
            # Get the ID
            connection_id = model[treeiter][1]

            # Load the Model
            connection = Connection()
            connection.id = connection_id
            connection.load()

            # Get the SSH Command
            command = connection.generate_ssh_command()

            # Open the Shell
            shell = Shell(command, connection.name)
            shell.run()
コード例 #4
0
    def load_connections(self):
        # Reset the List
        self.connections = []

        # Create the SQL
        sql = "select * from connections order by name"

        # Execute the sql
        results = self.dbconnection.select_query(sql)

        # Create a model for every connection
        for row in results:
            # Create new Connection
            connection = Connection()
            connection.id = row['id_connection']
            connection.name = row['name']
            connection.host = row['host']
            connection.user = row['user']
            connection.port = row['port']
            connection.use_key = True if row['use_key'] == 1 else False
            connection.key_path = row['key_path']

            # Add to the list
            self.connections.append(connection)