implement removing transmissions
This commit is contained in:
14
db.py
14
db.py
@ -53,6 +53,16 @@ def add_transmission(uid):
|
|||||||
log.error("Couldn't create a transmission with uid: %s"%(uid))
|
log.error("Couldn't create a transmission with uid: %s"%(uid))
|
||||||
log.error(error)
|
log.error(error)
|
||||||
|
|
||||||
|
def delete_transmission(uid):
|
||||||
|
command="DELETE FROM transmissions WHERE uid=?"
|
||||||
|
try:
|
||||||
|
cursor.execute(command, (uid,))
|
||||||
|
sqliteConnection.commit()
|
||||||
|
log.debug("Deleted a transmission with uid %s"%(uid))
|
||||||
|
except sqlite3.Error as error:
|
||||||
|
log.error("Couldn't delete a transmission with uid: %s"%(uid))
|
||||||
|
log.error(error)
|
||||||
|
|
||||||
def edit_transmission(uid, date, author, title, transmission_text, timeslots, transmission_order, play):
|
def edit_transmission(uid, date, author, title, transmission_text, timeslots, transmission_order, play):
|
||||||
command="UPDATE transmissions set date=?, author=?, title=?, transmission_text=?, timeslots=?, transmission_order=?, play=? WHERE uid=?"
|
command="UPDATE transmissions set date=?, author=?, title=?, transmission_text=?, timeslots=?, transmission_order=?, play=? WHERE uid=?"
|
||||||
try:
|
try:
|
||||||
@ -63,7 +73,3 @@ def edit_transmission(uid, date, author, title, transmission_text, timeslots, tr
|
|||||||
log.error("Couldn't create a transmission with uid %s (date %s, author %s)"%uid, (date, author))
|
log.error("Couldn't create a transmission with uid %s (date %s, author %s)"%uid, (date, author))
|
||||||
log.error(error)
|
log.error(error)
|
||||||
|
|
||||||
|
|
||||||
def delete_transmission():
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
10
main.py
10
main.py
@ -200,12 +200,16 @@ class MainWindow(Gtk.Window):
|
|||||||
db.add_transmission(uid)
|
db.add_transmission(uid)
|
||||||
self.update_transmission_list()
|
self.update_transmission_list()
|
||||||
|
|
||||||
|
def on_delete_transmission(self, user_data):
|
||||||
|
uid = self.transmissions[self.transmission_list.get_selected_row().get_index()][0]
|
||||||
|
log.debug("attempting to delete transmission %s" % uid)
|
||||||
|
db.delete_transmission(uid)
|
||||||
|
self.update_transmission_list()
|
||||||
|
|
||||||
|
|
||||||
def on_picked_transmission(self, row, user_data):
|
def on_picked_transmission(self, row, user_data):
|
||||||
log.debug("row %i activated" % user_data.get_index())
|
log.debug("row %i activated" % user_data.get_index())
|
||||||
|
|
||||||
def on_delete_transmission(self, user_data):
|
|
||||||
log.debug("transmission %s deleted" % self.transmission_list.get_selected_row().get_index())
|
|
||||||
|
|
||||||
def on_transmission_saved(self, user_data):
|
def on_transmission_saved(self, user_data):
|
||||||
messageBuffer = self.message.get_buffer()
|
messageBuffer = self.message.get_buffer()
|
||||||
startIter, endIter = messageBuffer.get_bounds()
|
startIter, endIter = messageBuffer.get_bounds()
|
||||||
|
Reference in New Issue
Block a user