def fill_metadata(self, table, mp): """ Fill the table with available data, empty otherwise """ for child in table.get_children(): table.remove(child) # FIXME maybe change the glade to avoid removing any widget table.resize(1, 2) row = 1 for meta in DCTERMS: t = gtk.Label(metadata[meta]) t.set_justify(gtk.JUSTIFY_LEFT) t.set_alignment(0, 0) modification = str(int(self.hprop * 16)) + "px" t.modify_font(pango.FontDescription(modification)) t.set_width_chars(15) d = gtk.Entry() d.set_name(meta) try: if meta == "creator": if len(mp.creators): d.set_text(", ".join(mp.creators)) else: d.set_text("") elif meta == "ispartof": d = ComboBoxEntryExt(self.par, listseries.get_series(), NO_SERIES) d.set_name(meta) if mp.series_title not in [None, ""]: d.child.set_text(mp.series_title) else: d.child.set_text(NO_SERIES) elif meta in ["contributor", "subject"]: # FIXME do it like creator if len(mp.metadata_episode[meta]) > 0: d.set_text(", ".join(mp.metadata_episode[meta])) else: d.set_text("") else: d.set_text(mp.metadata_episode[meta]) except (TypeError, KeyError): if meta == "ispartof": d = ComboBoxEntryExt(self.par, listseries.get_series(), NO_SERIES) if mp.series_title not in [None, ""]: d.child.set_text(mp.series_title) else: d.child.set_text(NO_SERIES) if meta == "created": d.connect("button-press-event", self.edit_date) if meta == "title": d.set_tooltip_text(d.get_text()) d.modify_font(pango.FontDescription(modification)) table.attach(t, 0, 1, row - 1, row, False, False, 0, 0) table.attach(d, 1, 2, row - 1, row, gtk.EXPAND | gtk.FILL, False, 0, 0) t.show() d.show() row = row + 1
def on_edit_meta(self,button): """GUI callback Pops up the Metadata editor of the active Mediapackage""" self.dispatcher.emit("disable-no-audio") if self.recorder.current_mediapackage and self.recorder.current_mediapackage.manual: Metadata(self.recorder.current_mediapackage, series.get_series(), parent=self) self.dispatcher.emit("enable-no-audio") return True
def on_edit_meta(self,button): """Pops up the Metadata editor of the active Mediapackage""" self.dispatcher.emit("disable-no-audio") #self.change_state(GC_BLOCKED) if not self.scheduled_recording: Metadata(self.mediapackage, series.get_series(), parent=self) mp = self.mediapackage self.dispatcher.emit("enable-no-audio") #self.change_state(self.previous) return True
def on_edit_meta(self,button): """Pops up the Metadata editor of the active Mediapackage""" self.dispatcher.emit("disable-no-audio") #self.change_state(GC_BLOCKED) if not self.scheduled_recording: Metadata(self.mediapackage, series.get_series(), parent=self) mp = self.mediapackage self.statusbar.SetVideo(None,mp.getTitle()) if self.mediapackage.getCreator() != None: self.statusbar.SetPresenter(None,mp.getCreator() if mp.getCreator() != None else '') self.dispatcher.emit("enable-no-audio") #self.change_state(self.previous) return True
def fill_metadata(self, table, mp): """ Fill the table with available data, empty otherwise """ for child in table.get_children(): table.remove( child ) #FIXME maybe change the glade to avoid removing any widget table.resize(1, 2) row = 1 for meta in DCTERMS: t = gtk.Label(metadata[meta]) t.set_justify(gtk.JUSTIFY_LEFT) t.set_alignment(0, 0) modification = str(int(self.hprop * 16)) + "px" t.modify_font(pango.FontDescription(modification)) t.set_width_chars(15) d = gtk.Entry() d.set_name(meta) try: if meta in ["ispartof", "isPartOf"]: d = ComboBoxEntryExt(self.par, listseries.get_series(), NO_SERIES) d.set_name(meta) if mp.getSeriesIdentifier() != None: d.child.set_text(mp.getSeriesTitle()) else: d.child.set_text(NO_SERIES) elif mp.metadata_episode.has_key(meta): d.set_text(mp.metadata_episode[meta] or '') else: d.set_text('') except (TypeError, KeyError) as error: context.get_logger().error("Exception Filling Metadata " + meta) if meta == "created": # currently Unused d.connect("button-press-event", self.edit_date) if meta == "title": d.set_tooltip_text(d.get_text()) d.modify_font(pango.FontDescription(modification)) table.attach(t, 0, 1, row - 1, row, False, False, 0, 0) table.attach(d, 1, 2, row - 1, row, gtk.EXPAND | gtk.FILL, False, 0, 0) row = row + 1
def on_edit_meta(self, button): """Pops up the Metadata editor of the active Mediapackage""" self.dispatcher.emit("disable-no-audio") #self.change_state(GC_BLOCKED) if not self.scheduled_recording: Metadata(self.mediapackage, series.get_series(), parent=self) mp = self.mediapackage self.statusbar.SetVideo(None, mp.getTitle()) if self.mediapackage.getCreator() != None: self.statusbar.SetPresenter( None, mp.getCreator() if mp.getCreator() != None else '') self.dispatcher.emit("enable-no-audio") #self.change_state(self.previous) return True
def fill_metadata(self,table,mp): """ Fill the table with available data, empty otherwise """ for child in table.get_children(): table.remove(child) #FIXME maybe change the glade to avoid removing any widget table.resize(1,2) row = 1 for meta in DCTERMS: t=gtk.Label(metadata[meta]) t.set_justify(gtk.JUSTIFY_LEFT) t.set_alignment(0,0) modification = str(int(self.hprop*16))+"px" t.modify_font(pango.FontDescription(modification)) t.set_width_chars(15) d=gtk.Entry() d.set_name(meta) try: if meta in ["ispartof", "isPartOf"]: d = ComboBoxEntryExt(self.par,listseries.get_series(), NO_SERIES) d.set_name(meta) if mp.getSeriesIdentifier() != None: d.child.set_text(mp.getSeriesTitle()) else: d.child.set_text(NO_SERIES) elif mp.metadata_episode.has_key(meta): d.set_text(mp.metadata_episode[meta] or '') else: d.set_text('') except (TypeError, KeyError) as error: context.get_logger().error("Exception Filling Metadata "+meta) if meta == "created": # currently Unused d.connect("button-press-event",self.edit_date) if meta == "title": d.set_tooltip_text(d.get_text()) d.modify_font(pango.FontDescription(modification)) table.attach(t,0,1,row-1,row,False,False,0,0) table.attach(d,1,2,row-1,row,gtk.EXPAND|gtk.FILL,False,0,0) row=row+1
def on_rec(button): dispatcher = context.get_dispatcher() dispatcher.emit("disable-no-audio") global recorder_ui global metadata mp = recorder_ui.mediapackage # Add default metadata to the MP mp.metadata_episode.update(metadata) # Check the series try: del (mp.metadata_episode['isPartOf']) mp.metadata_series = list_series.getSeriesbyId( metadata['isPartOf'])['list'] except (TypeError, KeyError): # There was no series specified, so no change was needed pass series_list = list_series.get_series() arguments = { 'package': mp, 'series_list': series_list, 'title': _("New Recording"), 'subtitle': _("New Recording"), 'ok_label': _("Start"), } if len(series_list) <= 1: arguments['empty_series_label'] = None popup = MetadataClass(**arguments) if popup.return_value == -8: recorder_ui.on_rec() dispatcher.emit("enable-no-audio")
def on_rec(button): dispatcher = context.get_dispatcher() dispatcher.emit("disable-no-audio") global recorder_ui global metadata mp = recorder_ui.mediapackage # Add default metadata to the MP mp.metadata_episode.update(metadata) # Check the series try: del(mp.metadata_episode['isPartOf']) mp.metadata_series = list_series.getSeriesbyId(metadata['isPartOf'])['list'] except (TypeError, KeyError): # There was no series specified, so no change was needed pass series_list = list_series.get_series() arguments = { 'package': mp, 'series_list': series_list, 'title': _("New Recording"), 'subtitle': _("New Recording"), 'ok_label': _("Start"), } if len(series_list) <= 1: arguments['empty_series_label'] = None popup = MetadataClass(**arguments) if popup.return_value == -8: recorder_ui.on_rec() dispatcher.emit("enable-no-audio")
def edit(self,key): """Pop ups the Metadata Editor""" logger.info("Edit: {0}".format(str(key))) selected_mp = self.repository.get(key) Metadata(selected_mp, series.get_series()) self.repository.update(selected_mp)
def fill_metadata(self,table,mp): """ Fill the table with available data, empty otherwise """ for child in table.get_children(): table.remove(child) #FIXME maybe change the glade to avoid removing any widget table.resize(1,2) row = 1 for meta in DCTERMS: t=gtk.Label(metadata[meta]) t.set_justify(gtk.JUSTIFY_LEFT) t.set_alignment(0,0) modification = str(int(self.hprop*16))+"px" t.modify_font(pango.FontDescription(modification)) t.set_width_chars(15) d=gtk.Entry() d.set_name(meta) try: if meta == "creator": if len(mp.creators): d.set_text(", ".join(mp.creators)) else: d.set_text("") elif meta in ["ispartof", "isPartOf"]: d = ComboBoxEntryExt(self.par,listseries.get_series(), NO_SERIES) d.set_name(meta) if mp.series_title not in [None, ""]: d.child.set_text(mp.series_title) else: d.child.set_text(NO_SERIES) elif meta in ["contributor", "subject"]: # FIXME do it like creator if len(mp.metadata_episode[meta])>0: d.set_text(", ".join(mp.metadata_episode[meta])) else: d.set_text("") else: d.set_text(mp.metadata_episode[meta]) except (TypeError, KeyError): if meta in ["ispartof", "isPartOf"]: d = ComboBoxEntryExt(self.par,listseries.get_series(), NO_SERIES) if mp.series_title not in [None, ""]: d.child.set_text(mp.series_title) else: d.child.set_text(NO_SERIES) if meta == "created": d.connect("button-press-event",self.edit_date) if meta == "title": d.set_tooltip_text(d.get_text()) d.modify_font(pango.FontDescription(modification)) table.attach(t,0,1,row-1,row,False,False,0,0) table.attach(d,1,2,row-1,row,gtk.EXPAND|gtk.FILL,False,0,0) t.show() d.show() row=row+1
def edit(self, key): """Pop ups the Metadata Editor""" logger.info("Edit: {0}".format(str(key))) selected_mp = self.repository.get(key) Metadata(selected_mp, series.get_series()) self.repository.update(selected_mp)