A jilted ex-partner has been convicted of attempted murder after forgetting to take the safety off his gun.