def edit_options(self, *p): cache=dict(self.options) ew=EditWidget(cache.__setitem__, cache.get) ew.set_name(_("Tag bag options")) ew.add_checkbox(_("Update with new tags"), "display-new-tags", _("Automatically display new defined tags")) res=ew.popup() if res: self.options.update(cache) return True
def edit_options(self, button): user_defined = object() cache = dict(self.options) for c in ('representation', 'separator'): cache[c] = cache[c].replace('\n', '\\n').replace('\t', '\\t') old_representation = cache['representation'] cache['user-separator'] = cache['separator'] if cache['separator'] not in (' ', '\\n', '\\t', ' - '): cache['separator'] = user_defined ew = EditWidget(cache.__setitem__, cache.get) ew.set_name(_("Transcription options")) ew.add_checkbox(_("Default representation"), "default-representation", _("Use the default representation for annotations")) ew.add_entry( _("Representation"), "representation", _("If default representation is unchecked,\nthis TALES expression that will be used to format the annotations." )) ew.add_option( _("Separator"), "separator", _("This separator will be inserted between the annotations."), { _('Whitespace'): ' ', _('Newline'): "\\n", _('Tabulation'): "\\t", _('Dash'): " - ", _('User defined'): user_defined, }) ew.add_entry( _("User-defined separator"), "user-separator", _("Separator used if user-defined is selected.Use \\n for a newline and \\t for a tabulation." )) ew.add_checkbox(_("Display timestamps"), "display-time", _("Insert timestsamp values")) ew.add_checkbox(_("Display annotation bounds"), 'display-bounds', _("Display annotation bounds")) res = ew.popup() if res: if old_representation != cache['representation']: # The user-defined representation was changed. In most # cases, this means that the user wants to use it # instead of the default representation, so force # default-representation to False cache['default-representation'] = False if cache['separator'] == user_defined: # User-defined has been selected. Use the user-separator value cache['separator'] = cache['user-separator'] self.options.update(cache) # Process special characters for c in ('representation', 'separator'): self.options[c] = self.options[c].replace('\\n', '\n').replace( '\\t', '\t') self.generate_buffer_content() return True
def edit_options(self, *p): cache = dict(self.options) ew = EditWidget(cache.__setitem__, cache.get) ew.set_name(_("Tag bag options")) ew.add_checkbox(_("Update with new tags"), "display-new-tags", _("Automatically display new defined tags")) res = ew.popup() if res: self.options.update(cache) return True
def edit_options(self, button): user_defined=object() cache=dict(self.options) for c in ('representation', 'separator'): cache[c] = cache[c].replace('\n', '\\n').replace('\t', '\\t') old_representation=cache['representation'] cache['user-separator']=cache['separator'] if cache['separator'] not in (' ', '\\n', '\\t', ' - '): cache['separator']=user_defined ew=EditWidget(cache.__setitem__, cache.get) ew.set_name(_("Transcription options")) ew.add_checkbox(_("Default representation"), "default-representation", _("Use the default representation for annotations")) ew.add_entry(_("Representation"), "representation", _("If default representation is unchecked,\nthis TALES expression that will be used to format the annotations.")) ew.add_option(_("Separator"), "separator", _("This separator will be inserted between the annotations."), { _('Whitespace'): ' ', _('Newline'): "\\n", _('Tabulation'): "\\t", _('Dash'): " - ", _('User defined'): user_defined, }) ew.add_entry(_("User-defined separator"), "user-separator", _("Separator used if user-defined is selected.Use \\n for a newline and \\t for a tabulation.")) ew.add_checkbox(_("Display timestamps"), "display-time", _("Insert timestsamp values")) ew.add_checkbox(_("Display annotation bounds"), 'display-bounds', _("Display annotation bounds")) res=ew.popup() if res: if old_representation != cache['representation']: # The user-defined representation was changed. In most # cases, this means that the user wants to use it # instead of the default representation, so force # default-representation to False cache['default-representation']=False if cache['separator'] == user_defined: # User-defined has been selected. Use the user-separator value cache['separator']=cache['user-separator'] self.options.update(cache) # Process special characters for c in ('representation', 'separator'): self.options[c]=self.options[c].replace('\\n', '\n').replace('\\t', '\t') self.generate_buffer_content() return True
def edit_preferences(self, *p): cache=dict(self.options) ew=EditWidget(cache.__setitem__, cache.get) ew.set_name(_("Preferences")) ew.add_checkbox(_("Timestamp"), "timestamp", _("Click inserts timestamp marks")) ew.add_checkbox(_("Insert on single-click"), 'insert-on-single-click', _("A single click will insert the mark (else a double click is needed)")) ew.add_checkbox(_("Play on scroll"), "play-on-scroll", _("Play the new position upon timestamp modification")) ew.add_checkbox(_("Generate empty annotations"), "empty-annotations", _("If checked, generate annotations for empty text")) ew.add_spin(_("Reaction time"), "delay", _("Reaction time (substracted from current player time, except when paused.)"), -5000, 5000) ew.add_checkbox(_("Auto-insert"), "autoinsert", _("Automatic timestamp mark insertion")) ew.add_spin(_("Automatic insertion delay"), 'automatic-mark-insertion-delay', _("If autoinsert is active, timestamp marks will be automatically inserted when text is entered after no interaction since this delay (in ms).\n1000 is typically a good value."), 0, 100000) ew.add_spin(_("Font size"), "font-size", _("Font size for text (0 for standard size)"), 0, 48) res=ew.popup() if res: if cache['font-size'] != self.options['font-size']: # Font-size was changed. Update the textview. self.update_font_size(cache['font-size']) self.options.update(cache) return True
def edit_preferences(self, *p): cache=dict(self.options) ew=EditWidget(cache.__setitem__, cache.get) ew.set_name(_("Preferences")) ew.add_checkbox(_("Timestamp"), "timestamp", _("Click inserts timestamp marks")) ew.add_checkbox(_("Insert on double-click"), 'insert-on-double-click', _("A double click inserts the mark")) ew.add_checkbox(_("Insert on single-click"), 'insert-on-single-click', _("A single click inserts the mark")) ew.add_entry(_("Mark prefix"), 'mark-prefix', _("Text to insert before a mark (use \\n for newline)")) ew.add_entry(_("Mark suffix"), 'mark-suffix', _("Text to insert after a mark (use \\n for newline)")) ew.add_checkbox(_("Play on scroll"), "play-on-scroll", _("Play the new position upon timestamp modification")) ew.add_checkbox(_("Generate empty annotations"), "empty-annotations", _("If checked, generate annotations for empty text")) ew.add_spin(_("Reaction time"), "delay", _("Reaction time (substracted from current player time, except when paused.)"), -5000, 5000) ew.add_checkbox(_("Auto-insert"), "autoinsert", _("Automatic timestamp mark insertion")) ew.add_spin(_("Automatic insertion delay"), 'automatic-mark-insertion-delay', _("If autoinsert is active, timestamp marks will be automatically inserted when text is entered after no interaction since this delay (in ms).\n1000 is typically a good value."), 0, 100000) ew.add_spin(_("Font size"), "font-size", _("Font size for text (0 for standard size)"), 0, 48) res=ew.popup() if res: if cache['font-size'] != self.options['font-size']: # Font-size was changed. Update the textview. self.update_font_size(cache['font-size']) self.options.update(cache) return True