Old TimeLapse
Tuesday, December 15, 2009
Have item play when it is double clicked
@glade_callback
def doubleclicked(self, data, third):
if os.path.isfile(os.path.abspath(self.soundfile)):
self.player.set_property("uri", "file://" +
os.path.abspath(self.soundfile))
self.player.set_state(gst.STATE_PLAYING)
else:
pass
Fix bug where data can not be selected if it does not have a picture
def itemSelected(self,data):
self.timestamp = data.get_cells()[0].get_property("text")
def datum_by_tag(tag):
return xmlhelper.get_datum_by_timestamp(self.timestamp, tag)
self.filepath = datum_by_tag("filepath")
try:
image = datum_by_tag("image")
except:
image = "noImage.jpg"
myPixbuf = gtk.gdk.pixbuf_new_from_file_at_size(image, 400, 400)
self.MainImage.set_from_pixbuf(myPixbuf)
self.soundfile = datum_by_tag("sound")
if self.soundfile is not None:
self.interface.get_widget("play_button").set_sensitive(True)
else:
self.interface.get_widget("play_button").set_sensitive(False)
Confirmation Window for Delete All button
@glade_callback
def deleteAllClicked(self, data):
self.interface.get_widget("delete_confirmation").show()
@glade_callback
def deleteAllConfirmed(self, data):
print "all deleted"
self.update_pixbuf()
shutil.rmtree("data/")
os.mkdir("data")
xmlhelper.remove_all_data()
self.update_pixbuf()
self.interface.get_widget("delete_confirmation").hide()
@glade_callback
def deleteAllCanceled(self, data):
self.interface.get_widget("delete_confirmation").hide()
@glade_callback
def doubleclicked(self, data, third):
if os.path.isfile(os.path.abspath(self.soundfile)):
self.player.set_property("uri", "file://" +
os.path.abspath(self.soundfile))
self.player.set_state(gst.STATE_PLAYING)
else:
pass
Fix bug where data can not be selected if it does not have a picture
def itemSelected(self,data):
self.timestamp = data.get_cells()[0].get_property("text")
def datum_by_tag(tag):
return xmlhelper.get_datum_by_timestamp(self.timestamp, tag)
self.filepath = datum_by_tag("filepath")
try:
image = datum_by_tag("image")
except:
image = "noImage.jpg"
myPixbuf = gtk.gdk.pixbuf_new_from_file_at_size(image, 400, 400)
self.MainImage.set_from_pixbuf(myPixbuf)
self.soundfile = datum_by_tag("sound")
if self.soundfile is not None:
self.interface.get_widget("play_button").set_sensitive(True)
else:
self.interface.get_widget("play_button").set_sensitive(False)
Confirmation Window for Delete All button
@glade_callback
def deleteAllClicked(self, data):
self.interface.get_widget("delete_confirmation").show()
@glade_callback
def deleteAllConfirmed(self, data):
print "all deleted"
self.update_pixbuf()
shutil.rmtree("data/")
os.mkdir("data")
xmlhelper.remove_all_data()
self.update_pixbuf()
self.interface.get_widget("delete_confirmation").hide()
@glade_callback
def deleteAllCanceled(self, data):
self.interface.get_widget("delete_confirmation").hide()
No comments:
Post a Comment