def __init__(self): ## Creates and prepares a player. # Create the player. self.player = gst.element_factory_make("playbin2", "player") # Make the program emit signals. bus = self.player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() # Enable the visualisation if requested. self.setVisualisation(cfg.getBool("gui/enablevisualisation")) # Set the font for subtitles. self.setSubFont(cfg.get('video/subfont'))
def __init__(self, parent): # The subtitle manager window. window = gtk.Window() window.set_title(_("Subtitle Manager")) window.set_transient_for(parent) window.set_modal(True) window.set_position(gtk.WIN_POS_CENTER_ON_PARENT) window.set_destroy_with_parent(True) window.connect('delete-event', self.destroy) window.set_resizable(False) window.set_border_width(7) self.window = window vBox = gtk.VBox(spacing=7) window.add(vBox) # The automatic subtitles checkbox. chkAutoSubs = gtk.CheckButton(_("Automatic Subtitles")) chkAutoSubs.set_has_tooltip(True) chkAutoSubs.set_tooltip_text(_("Try to automatically find subtitles for each file.")) chkAutoSubs.connect('toggled', self.autoSubsToggled) self.chkAutoSubs = chkAutoSubs vBox.pack_start(chkAutoSubs) # The automatic subtitle extensions entry. hBoxExt = gtk.HBox(spacing=7) vBox.pack_start(hBoxExt) lblSubsExt = gtk.Label(_("Subtitle file extensions:")) hBoxExt.pack_start(lblSubsExt) txtSubsExt = gtk.Entry() txtSubsExt.set_has_tooltip(True) txtSubsExt.set_tooltip_text(_("Extensions to use when automatically detecting subtitles.\nSeparate with commas.")) txtSubsExt.connect('changed', self.subsExtsChanged) self.txtSubsExt = txtSubsExt hBoxExt.pack_start(txtSubsExt) # The add subtitles to current stream button. btnAddSub = gtk.Button(_("Add subtitles to current stream")) img = gtk.Image() img.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_BUTTON) btnAddSub.set_image(img) btnAddSub.connect('clicked', self.addSubs) vBox.pack_start(btnAddSub) # Font selection. btnFont = gtk.FontButton(cfg.get('video/subfont')) btnFont.connect('font-set', self.changeFont) vBox.pack_start(btnFont) # The subtitle encoding entry. hBoxEnc = gtk.HBox(spacing=7) vBox.pack_start(hBoxEnc) lblSubsEnc = gtk.Label(_("Subtitle encoding:")) hBoxEnc.pack_start(lblSubsEnc) txtSubsEnc = gtk.Entry() txtSubsEnc.set_has_tooltip(True) txtSubsEnc.set_tooltip_text(_("The subtitle encoding to use for subtitles. Leave empty to use the default system encoding.")) txtSubsEnc.connect('changed', self.subsEncChanged) self.txtSubsEnc = txtSubsEnc hBoxEnc.pack_start(txtSubsEnc) # A button box that contains the close button. btnBox = gtk.HButtonBox() btnBox.set_layout(gtk.BUTTONBOX_END) btnClose = gtk.Button('gtk-close') btnClose.set_use_stock(True) btnBox.pack_start(btnClose) btnClose.connect('clicked', self.destroy) vBox.pack_start(btnBox) # Do it all. self.getCfg() window.show_all()