Allows to set the properties of a title

Allows to add several files, and add the all in the current title, or each one in a new title
This commit is contained in:
Sergio Costas 2014-07-12 23:46:12 +02:00
parent 6cb04b131e
commit a60221b57d
8 changed files with 614 additions and 13 deletions

View file

@ -16,17 +16,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
from gi.repository import Gtk,GObject
import os
class title(GObject.GObject):
counter = 0
def __init__(self,file_treeview,original_liststore):
def __init__(self,paths,file_treeview,original_liststore,title_name = None):
GObject.GObject.__init__(self)
self.paths = paths
self.file_treeview = file_treeview
title.counter += 1
self.title_name = _("Title %(X)d") % {"X":title.counter}
if (title_name == None):
title.counter += 1
self.title_name = _("Title %(X)d") % {"X":title.counter}
else:
self.title_name = title_name
self.post_action = "stop"
columns = []
for iterator in range(0, original_liststore.get_n_columns()):
columns.append(original_liststore.get_column_type(iterator))
@ -37,6 +43,46 @@ class title(GObject.GObject):
self.disc_type = disc_type
def properties(self):
builder = Gtk.Builder()
builder.set_translation_domain("devede_ng")
builder.add_from_file(os.path.join(self.paths.glade,"wtitle_properties.ui"))
builder.connect_signals(self)
# Interface widgets
wtitle_properties = builder.get_object("title_properties")
wtitle = builder.get_object("entry_title")
wplay_first = builder.get_object("play_first")
wplay_prev = builder.get_object("play_previous")
wplay_again = builder.get_object("play_again")
wplay_next = builder.get_object("play_next")
wplay_last = builder.get_object("play_last")
wtitle.set_text(self.title_name)
builder.get_object(self.post_action).set_active(True)
wtitle_properties.show_all()
retval = wtitle_properties.run()
if (retval == 2):
self.title_name = wtitle.get_text()
if (wplay_first.get_active()):
self.post_action = "play_first"
elif (wplay_prev.get_active()):
self.post_action = "play_previous"
elif (wplay_again.get_active()):
self.post_action = "play_again"
elif (wplay_next.get_active()):
self.post_action = "play_next"
elif (wplay_last.get_active()):
self.post_action = "play_last"
else:
self.post_action = "stop"
wtitle_properties.destroy()
def delete_title(self):
print("Deleted title "+self.title_name)