If you to cut down the amount of code in your project only call the insert method from the button events and the call the connect method at the start of the insert method and the close method at the end of the insert method. It only saves a couple of lines but it makes the code tidier, more readable and efficient.
Also mark this solved if i've managed to solve it for you.