def do_deactivate(self): PreferencesDialog.remove_section("console") self.window.destroy() self.remove_menu_item() self.window = None self.terminal = None self.app = None
def testOther(self): PreferencesDialog.addPathPreference('aPathPreference', label="Test Path", section="timeline", description="Test the path widget") PreferencesDialog.addChoicePreference( 'aChoicePreference', label="Swallow Velocity", section="timeline", description= "What is the airspeed velocity of a coconut-laden swallow?", choices=(("42 Knots", 32), ("9 furlongs per fortnight", 42), ("I don't know that!", None))) PreferencesDialog.addChoicePreference( 'aLongChoicePreference', label="Favorite Color", section="timeline", description="What is the color of the parrot's plumage?", choices=(("Mauve", "Mauve"), ("Chartreuse", "Chartreuse"), ("Magenta", "Magenta"), ("Pink", "Pink"), ("Norwegian Blue", "Norwegian Blue"), ("Yellow Ochre", "Yellow Ochre"))) PreferencesDialog.addTogglePreference( 'aTogglePreference', label="Test Toggle", section="timeline", description="Test the toggle widget") PreferencesDialog.addFontPreference('aFontPreference', label="Foo Font", section="timeline", description="Test the font widget")
def testText(self): PreferencesDialog.addTextPreference('textPreference1', label="Unfiltered", section="Test", description="Anything can go in this box") PreferencesDialog.addTextPreference('textPreference2', label="Numbers only", section="Test", description="This input validates its input with a regex", matches=r"^-?\d+(\.\d+)?$")
def testText(self): PreferencesDialog.addTextPreference('textPreference1', label="Unfiltered", section="timeline", description="Anything can go in this box") PreferencesDialog.addTextPreference('textPreference2', label="Numbers only", section="timeline", description="This input validates its input with a regex", matches=r"^-?\d+(\.\d+)?$")
def testText(self): section = list(PreferencesDialog.section_names.keys())[0] PreferencesDialog.addTextPreference('textPreference1', label="Unfiltered", section=section, description="Anything can go in this box") PreferencesDialog.addTextPreference('textPreference2', label="Numbers only", section=section, description="This input validates its input with a regex", matches=r"^-?\d+(\.\d+)?$")
def testNumeric(self): PreferencesDialog.addNumericPreference('numericPreference1', label="Open Range", section="Test", description="This option has no upper bound", lower=-10) self.assertTrue('numericPreference1' in PreferencesDialog.prefs['Test']) PreferencesDialog.addNumericPreference('numericPreference2', label="Closed Range", section="Test", description="This option has both upper and lower bounds", lower=-10, upper=10000)
def testNumeric(self): PreferencesDialog.addNumericPreference('numericPreference1', label="Open Range", section="timeline", description="This option has no upper bound", lower=-10) self.assertTrue( 'numericPreference1' in PreferencesDialog.prefs["timeline"]) PreferencesDialog.addNumericPreference('numericPreference2', label="Closed Range", section="timeline", description="This option has both upper and lower bounds", lower=-10, upper=10000)
def testNumeric(self): section = list(PreferencesDialog.section_names.keys())[0] PreferencesDialog.addNumericPreference('numericPreference1', label="Open Range", section=section, description="This option has no upper bound", lower=-10) self.assertTrue( 'numericPreference1' in PreferencesDialog.prefs[section]) PreferencesDialog.addNumericPreference('numericPreference2', label="Closed Range", section=section, description="This option has both upper and lower bounds", lower=-10, upper=10000)
def testOther(self): section = list(PreferencesDialog.section_names.keys())[0] PreferencesDialog.addPathPreference('aPathPreference', label="Test Path", section=section, description="Test the path widget") PreferencesDialog.addChoicePreference('aChoicePreference', label="Swallow Velocity", section=section, description="What is the airspeed velocity of a coconut-laden swallow?", choices=( ("42 Knots", 32), ("9 furlongs per fortnight", 42), ("I don't know that!", None))) PreferencesDialog.addChoicePreference('aLongChoicePreference', label="Favorite Color", section=section, description="What is the color of the parrot's plumage?", choices=( ("Mauve", "Mauve"), ("Chartreuse", "Chartreuse"), ("Magenta", "Magenta"), ("Pink", "Pink"), ("Norwegian Blue", "Norwegian Blue"), ("Yellow Ochre", "Yellow Ochre"))) PreferencesDialog.addTogglePreference('aTogglePreference', label="Test Toggle", section=section, description="Test the toggle widget") PreferencesDialog.addFontPreference('aFontPreference', label="Foo Font", section=section, description="Test the font widget")
def do_activate(self): api = self.object self.app = api.app try: self.app.settings.addConfigSection("console") except ConfigError: pass try: self.app.settings.addConfigOption(attrname="consoleColor", section="console", key="console-color", notify=True, default=Console.DEFAULT_COLOR) except ConfigError: pass try: self.app.settings.addConfigOption( attrname="consoleErrorColor", section="console", key="console-error-color", notify=True, default=Console.DEFAULT_STDERR_COLOR) except ConfigError: pass try: self.app.settings.addConfigOption( attrname="consoleOutputColor", section="console", key="console-output-color", notify=True, default=Console.DEFAULT_STDOUT_COLOR) except ConfigError: pass try: self.app.settings.addConfigOption( attrname="consoleFont", section="console", key="console-font", notify=True, default=Console.DEFAULT_FONT.to_string()) except ConfigError: pass self.app.settings.reload_attribute_from_file("console", "consoleColor") self.app.settings.reload_attribute_from_file("console", "consoleErrorColor") self.app.settings.reload_attribute_from_file("console", "consoleOutputColor") self.app.settings.reload_attribute_from_file("console", "consoleFont") PreferencesDialog.add_section("console", _("Console")) PreferencesDialog.addColorPreference(attrname="consoleColor", label=_("Color"), description=None, section="console") PreferencesDialog.addColorPreference( attrname="consoleErrorColor", # Translators: The color of the content from stderr. label=_("Standard error color"), description=None, section="console") PreferencesDialog.addColorPreference( attrname="consoleOutputColor", # Translators: The color of the content from stdout. label=_("Standard output color"), description=None, section="console") PreferencesDialog.addFontPreference(attrname="consoleFont", label=_("Font"), description=None, section="console") self._setup_dialog() self.add_menu_item() self.menu_item.show()
from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable from pitivi.utils.timeline import SELECT from pitivi.utils.ui import argb_to_gdk_rgba from pitivi.utils.ui import fix_infobar from pitivi.utils.ui import gdk_rgba_to_argb GlobalSettings.addConfigOption('titleClipLength', section="user-interface", key="title-clip-length", default=5000, notify=True) PreferencesDialog.addNumericPreference('titleClipLength', section="timeline", label=_("Title clip duration"), description=_( "Default clip length (in milliseconds) of titles when inserting on the timeline."), lower=1) FOREGROUND_DEFAULT_COLOR = 0xFFFFFFFF # White BACKGROUND_DEFAULT_COLOR = 0x00000000 # Transparent DEFAULT_FONT_DESCRIPTION = "Sans 36" DEFAULT_VALIGNMENT = GES.TextVAlign.ABSOLUTE DEFAULT_HALIGNMENT = GES.TextHAlign.ABSOLUTE class TitleEditor(Loggable): """Widget for configuring a title. Attributes: app (Pitivi): The app.
os.path.join(configure.get_pixmap_dir(), "trimbar-normal.png")) TRIMBAR_PIXBUF_FOCUS = GdkPixbuf.Pixbuf.new_from_file( os.path.join(configure.get_pixmap_dir(), "trimbar-focused.png")) NAME_HOFFSET = 10 NAME_VOFFSET = 5 NAME_PADDING = 2 NAME_PADDING2X = 2 * NAME_PADDING GlobalSettings.addConfigOption('videoClipBg', section='user-interface', key='videoclip-background', default=993737707, notify=True) PreferencesDialog.addColorPreference('videoClipBg', section=_("Appearance"), label=_("Color for video clips"), description=_("The background color for clips in video tracks.")) GlobalSettings.addConfigOption('audioClipBg', section='user-interface', key='audioclip-background', default=996806336, notify=True) PreferencesDialog.addColorPreference('audioClipBg', section=_("Appearance"), label=_("Color for audio clips"), description=_("The background color for clips in audio tracks.")) GlobalSettings.addConfigOption('titleClipBg', section='user-interface',
GlobalSettings.add_config_section("proxy") GlobalSettings.add_config_option('proxying_strategy', section='proxy', key='proxying-strategy', default=ProxyingStrategy.AUTOMATIC) GlobalSettings.add_config_option('num_transcoding_jobs', section='proxy', key='num-proxying-jobs', default=4, notify=True) PreferencesDialog.add_numeric_preference( 'num_transcoding_jobs', description="", section="_proxies", label=_("Max number of parallel transcoding jobs"), lower=1) GlobalSettings.add_config_option("max_cpu_usage", section="proxy", key="max-cpu-usage", default=10, notify=True) PreferencesDialog.add_numeric_preference( 'max_cpu_usage', description="", section="_proxies", label=_("Max CPU usage dedicated to transcoding"), lower=1, upper=100)
def do_activate(self): api = self.object self.app = api.app self.app.settings.addConfigSection("console") self.app.settings.addConfigOption(attrname="consoleColor", section="console", key="console-color", notify=True, default=Console.DEFAULT_COLOR) self.app.settings.addConfigOption(attrname="consoleErrorColor", section="console", key="console-error-color", notify=True, default=Console.DEFAULT_STDERR_COLOR) self.app.settings.addConfigOption(attrname="consoleOutputColor", section="console", key="console-output-color", notify=True, default=Console.DEFAULT_STDOUT_COLOR) self.app.settings.addConfigOption( attrname="consoleFont", section="console", key="console-font", notify=True, default=Console.DEFAULT_FONT.to_string()) self.app.settings.reload_attribute_from_file("console", "consoleColor") self.app.settings.reload_attribute_from_file("console", "consoleErrorColor") self.app.settings.reload_attribute_from_file("console", "consoleOutputColor") self.app.settings.reload_attribute_from_file("console", "consoleFont") PreferencesDialog.add_section("console", _("Console")) PreferencesDialog.addColorPreference(attrname="consoleColor", label=_("Color"), description=None, section="console") PreferencesDialog.addColorPreference( attrname="consoleErrorColor", # Translators: The color of the content from stderr. label=_("Standard error color"), description=None, section="console") PreferencesDialog.addColorPreference( attrname="consoleOutputColor", # Translators: The color of the content from stdout. label=_("Standard output color"), description=None, section="console") PreferencesDialog.addFontPreference(attrname="consoleFont", label=_("Font"), description=None, section="console") open_action = Gio.SimpleAction.new("open_console", None) open_action.connect("activate", self.__menu_item_activate_cb) self.app.add_action(open_action) self.app.shortcuts.add("app.open_console", ["<Primary>d"], _("Developer Console")) self._setup_dialog() self.add_menu_item() self.menu_item.show()
from ruler import ScaleRuler from gettext import gettext as _ from pitivi.utils.pipeline import Pipeline, PipelineError from elements import URISourceElement, TransitionElement, Ghostclip from controls import ControlContainer GlobalSettings.addConfigOption('edgeSnapDeadband', section="user-interface", key="edge-snap-deadband", default=5, notify=True) PreferencesDialog.addNumericPreference('edgeSnapDeadband', section=_("Behavior"), label=_("Snap distance"), description=_("Threshold (in pixels) at which two clips will snap together " "when dragging or trimming."), lower=0) GlobalSettings.addConfigOption('imageClipLength', section="user-interface", key="image-clip-length", default=1000, notify=True) PreferencesDialog.addNumericPreference('imageClipLength', section=_("Behavior"), label=_("Image clip duration"), description=_("Default clip length (in miliseconds) of images when inserting on the timeline."), lower=1)
key='info-displayed-counter', default=0) GlobalSettings.add_config_option('lastCurrentVersion', section='version', key='last-current-version', default='') GlobalSettings.add_config_option("useDarkTheme", section="user-interface", key="use-dark-theme", default=True, notify=True) PreferencesDialog.add_toggle_preference( "useDarkTheme", section="other", label=_("Dark Theme"), description=_("Whether or not to use a dark theme.")) class MainWindow(Gtk.ApplicationWindow, Loggable): """Pitivi's main window. It manages the UI and handles the switch between different perspectives, such as the default GreeterPerspective, and the EditorPerspective. Attributes: app (Pitivi): The app. """ def __init__(self, app): # Pulseaudio "role"
def __preferences_cb(self, unused_action, unused_param): PreferencesDialog(self.app).run()
def do_activate(self): api = self.object self.app = api.app try: self.app.settings.addConfigSection("console") except ConfigError: pass try: self.app.settings.addConfigOption(attrname="consoleColor", section="console", key="console-color", notify=True, default=Console.DEFAULT_COLOR) except ConfigError: pass try: self.app.settings.addConfigOption(attrname="consoleErrorColor", section="console", key="console-error-color", notify=True, default=Console.DEFAULT_STDERR_COLOR) except ConfigError: pass try: self.app.settings.addConfigOption(attrname="consoleOutputColor", section="console", key="console-output-color", notify=True, default=Console.DEFAULT_STDOUT_COLOR) except ConfigError: pass try: self.app.settings.addConfigOption(attrname="consoleFont", section="console", key="console-font", notify=True, default=Console.DEFAULT_FONT.to_string()) except ConfigError: pass self.app.settings.reload_attribute_from_file("console", "consoleColor") self.app.settings.reload_attribute_from_file("console", "consoleErrorColor") self.app.settings.reload_attribute_from_file("console", "consoleOutputColor") self.app.settings.reload_attribute_from_file("console", "consoleFont") PreferencesDialog.add_section("console", _("Console")) PreferencesDialog.addColorPreference(attrname="consoleColor", label=_("Color"), description=None, section="console") PreferencesDialog.addColorPreference(attrname="consoleErrorColor", # Translators: The color of the content from stderr. label=_("Standard error color"), description=None, section="console") PreferencesDialog.addColorPreference(attrname="consoleOutputColor", # Translators: The color of the content from stdout. label=_("Standard output color"), description=None, section="console") PreferencesDialog.addFontPreference(attrname="consoleFont", label=_("Font"), description=None, section="console") open_action = Gio.SimpleAction.new("open_console", None) open_action.connect("activate", self.__menu_item_activate_cb) self.app.add_action(open_action) self.app.shortcuts.add("app.open_console", ["<Primary>d"], _("Developer Console")) self._setup_dialog() self.add_menu_item() self.menu_item.show()
GlobalSettings.addConfigSection("thumbnailing") GlobalSettings.addConfigOption("thumbnailSpacingHint", section="thumbnailing", key="spacing-hint", default=5, notify=True) GlobalSettings.addConfigOption("thumbnailPeriod", section="thumbnailing", key="thumbnail-period", default=gst.SECOND, notify=True) PreferencesDialog.addNumericPreference("thumbnailSpacingHint", section=_("Appearance"), label=_("Thumbnail gap"), lower=0, description=_("The spacing between thumbnails, in pixels")) PreferencesDialog.addChoicePreference("thumbnailPeriod", section=_("Performance"), label=_("Thumbnail every"), choices=( # Note that we cannot use "%s second" or ngettext, because fractions # are not supported by ngettext and their plurality is ambiguous # in many languages. # See http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html (_("1/100 second"), gst.SECOND / 100), (_("1/10 second"), gst.SECOND / 10), (_("1/4 second"), gst.SECOND / 4), (_("1/2 second"), gst.SECOND / 2),
def _prefsCb(self, unused_action): PreferencesDialog(self.app).run()