def test_read_config_file(self): GlobalSettings.addConfigSection("section-1") GlobalSettings.addConfigOption("section1OptionA", section="section-1", key="option-a", default=50) GlobalSettings.addConfigOption("section1OptionB", section="section-1", key="option-b", default=False) GlobalSettings.addConfigOption("section1OptionC", section="section-1", key="option-c", default="") self.assertEqual(GlobalSettings.section1OptionA, 50) self.assertEqual(GlobalSettings.section1OptionB, False) self.assertEqual(GlobalSettings.section1OptionC, "") conf_file_content = ("[section-1]\n" "option-a = 10\n" "option-b = True\n" "option-c = Pigs fly\n") with mock.patch("pitivi.settings.xdg_config_home") as xdg_config_home,\ tempfile.TemporaryDirectory() as temp_dir: with open(os.path.join(temp_dir, "pitivi.conf"), "w") as tmp_file: tmp_file.write(conf_file_content) xdg_config_home.return_value = temp_dir settings = GlobalSettings() self.assertEqual(settings.section1OptionA, 10) self.assertEqual(settings.section1OptionB, True) self.assertEqual(settings.section1OptionC, "Pigs fly")
def _createDefaultConfig(self, child_name): """ If they do not exist already, create default settings to save the state of a detachable widget. """ GlobalSettings.addConfigSection(child_name) GlobalSettings.addConfigOption(child_name + "docked", section=child_name, key="docked", default=True) GlobalSettings.addConfigOption(child_name + "width", section=child_name, key="width", default=320) GlobalSettings.addConfigOption(child_name + "height", section=child_name, key="height", default=400) GlobalSettings.addConfigOption(child_name + "x", section=child_name, key="x", default=0) GlobalSettings.addConfigOption(child_name + "y", section=child_name, key="y", default=0) GlobalSettings.readSettingSectionFromFile(self.settings, child_name)
def _create_default_config(self, child_name): """Creates default settings to save the state of a detachable widget.""" try: GlobalSettings.addConfigSection(child_name) except ConfigError: self.info("Section %s already exists", child_name) return GlobalSettings.addConfigOption(child_name + "docked", section=child_name, key="docked", default=True) GlobalSettings.addConfigOption(child_name + "width", section=child_name, key="width", default=320) GlobalSettings.addConfigOption(child_name + "height", section=child_name, key="height", default=400) GlobalSettings.addConfigOption(child_name + "x", section=child_name, key="x", default=0) GlobalSettings.addConfigOption(child_name + "y", section=child_name, key="y", default=0) GlobalSettings.readSettingSectionFromFile(self.settings, child_name)
def test_read_config_file(self): GlobalSettings.addConfigSection("section-1") GlobalSettings.addConfigOption("section1OptionA", section="section-1", key="option-a", default=50) GlobalSettings.addConfigOption("section1OptionB", section="section-1", key="option-b", default=False) GlobalSettings.addConfigOption("section1OptionC", section="section-1", key="option-c", default="") GlobalSettings.addConfigOption("section1OptionD", section="section-1", key="option-d", default=[]) GlobalSettings.addConfigOption("section1OptionE", section="section-1", key="option-e", default=["foo"]) GlobalSettings.addConfigOption("section1OptionF", section="section-1", key="option-f", default=Gdk.RGBA()) self.assertEqual(GlobalSettings.section1OptionA, 50) self.assertEqual(GlobalSettings.section1OptionB, False) self.assertEqual(GlobalSettings.section1OptionC, "") self.assertEqual(GlobalSettings.section1OptionD, []) self.assertEqual(GlobalSettings.section1OptionE, ["foo"]) self.assertEqual(GlobalSettings.section1OptionF, Gdk.RGBA()) self.assertIs(GlobalSettings.options["section-1"]["section1OptionA"][0], int) self.assertIs(GlobalSettings.options["section-1"]["section1OptionB"][0], bool) self.assertIs(GlobalSettings.options["section-1"]["section1OptionC"][0], str) self.assertIs(GlobalSettings.options["section-1"]["section1OptionD"][0], list) self.assertIs(GlobalSettings.options["section-1"]["section1OptionE"][0], list) self.assertIs(GlobalSettings.options["section-1"]["section1OptionF"][0], Gdk.RGBA) conf_file_content = ("[section-1]\n" "option-a = 10\n" "option-b = True\n" "option-c = Pigs fly\n" "option-d=\n" "option-e=\n" " elmo\n" " knows\n" " where you live\n" "option-f=rgba(51,102,255,0.4)") with mock.patch("pitivi.settings.xdg_config_home") as xdg_config_home,\ tempfile.TemporaryDirectory() as temp_dir: with open(os.path.join(temp_dir, "pitivi.conf"), "w") as tmp_file: tmp_file.write(conf_file_content) xdg_config_home.return_value = temp_dir settings = GlobalSettings() self.assertEqual(settings.section1OptionA, 10) self.assertEqual(settings.section1OptionB, True) self.assertEqual(settings.section1OptionC, "Pigs fly") self.assertEqual(settings.section1OptionD, []) expected_e_value = [ "elmo", "knows", "where you live" ] self.assertEqual(settings.section1OptionE, expected_e_value) self.assertEqual(settings.section1OptionF, Gdk.RGBA(0.2, 0.4, 1.0, 0.4))
def test_add_config_option(self): def add_option(): GlobalSettings.addConfigOption("optionA1", section="section-a", key="option-a-1", default=False) # "section-a" does not exist. with self.assertRaises(ConfigError): add_option() GlobalSettings.addConfigSection("section-a") add_option() self.assertFalse(GlobalSettings.optionA1) with self.assertRaises(ConfigError): add_option()
def test_write_config_file(self): GlobalSettings.addConfigSection("section-new") GlobalSettings.addConfigOption("sectionNewOptionA", section="section-new", key="option-a", default="elmo") with mock.patch("pitivi.settings.xdg_config_home") as xdg_config_home,\ tempfile.TemporaryDirectory() as temp_dir: xdg_config_home.return_value = temp_dir settings1 = GlobalSettings() settings1.sectionNewOptionA = "kermit" settings1.storeSettings() settings2 = GlobalSettings() self.assertEqual(settings2.sectionNewOptionA, "kermit")
SAMPLE_DURATION = Gst.SECOND / 100 THUMB_MARGIN_PX = 3 # For the waveforms, ensures we always have a little extra surface when # scrolling while playing. MARGIN = 500 PREVIEW_GENERATOR_SIGNALS = { "done": (GObject.SIGNAL_RUN_LAST, None, ()), "error": (GObject.SIGNAL_RUN_LAST, None, ()), } THUMB_HEIGHT = EXPANDED_SIZE - 2 * THUMB_MARGIN_PX GlobalSettings.addConfigSection("previewers") GlobalSettings.addConfigOption("previewers_max_cpu", section="previewers", key="max-cpu-usage", default=90) class PreviewerBin(Gst.Bin, Loggable): """Baseclass for elements gathering datas to create previews.""" def __init__(self, bin_desc): Gst.Bin.__init__(self) Loggable.__init__(self) self.internal_bin = Gst.parse_bin_from_description(bin_desc, True) self.add(self.internal_bin)
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301, USA. """User preferences.""" import os from gettext import gettext as _ from gi.repository import Gtk from pitivi.configure import get_ui_dir from pitivi.settings import GlobalSettings from pitivi.utils import widgets from pitivi.utils.loggable import Loggable from pitivi.utils.ui import SPACING GlobalSettings.addConfigSection("user-interface") GlobalSettings.addConfigOption('prefsDialogWidth', section="user-interface", key="prefs-dialog-width", default=600) GlobalSettings.addConfigOption('prefsDialogHeight', section="user-interface", key="prefs-dialog-height", default=400) class PreferencesDialog(Loggable): """Preferences for how the app works."""
def test_add_section(self): GlobalSettings.addConfigSection("section-a") with self.assertRaises(ConfigError): GlobalSettings.addConfigSection("section-a")
SAMPLE_DURATION = Gst.SECOND / 100 THUMB_MARGIN_PX = 3 THUMB_HEIGHT = EXPANDED_SIZE - 2 * THUMB_MARGIN_PX THUMB_PERIOD = int(Gst.SECOND / 2) assert Gst.SECOND % THUMB_PERIOD == 0 # For the waveforms, ensures we always have a little extra surface when # scrolling while playing. MARGIN = 500 PREVIEW_GENERATOR_SIGNALS = { "done": (GObject.SIGNAL_RUN_LAST, None, ()), "error": (GObject.SIGNAL_RUN_LAST, None, ()), } GlobalSettings.addConfigSection("previewers") GlobalSettings.addConfigOption("previewers_max_cpu", section="previewers", key="max-cpu-usage", default=90) class PreviewerBin(Gst.Bin, Loggable): """Baseclass for elements gathering datas to create previews.""" def __init__(self, bin_desc): Gst.Bin.__init__(self) Loggable.__init__(self) self.internal_bin = Gst.parse_bin_from_description(bin_desc, True) self.add(self.internal_bin)
import pitivi.utils as utils from pitivi.configure import get_pixmap_dir from pitivi.elements.singledecodebin import SingleDecodeBin from pitivi.elements.thumbnailsink import CairoSurfaceThumbnailSink from pitivi.elements.arraysink import ArraySink from pitivi.signalinterface import Signallable import pitivi.stream as stream from pitivi.settings import GlobalSettings from pitivi.ui.zoominterface import Zoomable from pitivi.log.loggable import Loggable from pitivi.factories.file import PictureFileSourceFactory from pitivi.thumbnailcache import ThumbnailCache from pitivi.ui.prefs import PreferencesDialog from pitivi.receiver import receiver, handler GlobalSettings.addConfigSection("thumbnailing") GlobalSettings.addConfigOption("thumbnailSpacingHint", section="thumbnailing", key="spacing-hint", default=2, notify=True) PreferencesDialog.addNumericPreference( "thumbnailSpacingHint", section=_("Appearance"), label=_("Thumbnail Gap (pixels)"), lower=0, description=_("The gap between thumbnails")) # this default works out to a maximum of ~ 1.78 MiB per factory, assuming: # 4:3 aspect ratio
from pitivi.ui.clipproperties import ClipProperties from pitivi.ui.common import beautify_factory from pitivi.utils import beautify_length from pitivi.ui.zoominterface import Zoomable if HAVE_GCONF: D_G_INTERFACE = "/desktop/gnome/interface" for gconf_dir in (D_G_INTERFACE, ): gconf.client_get_default ().add_dir (gconf_dir, gconf.CLIENT_PRELOAD_NONE) GlobalSettings.addConfigOption("fileSupportEnabled", environment="PITIVI_FILE_SUPPORT", default=False) GlobalSettings.addConfigSection("main-window") GlobalSettings.addConfigOption('mainWindowFullScreen', section="main-window", key="full-screen", default=False) GlobalSettings.addConfigOption('mainWindowHPanePosition', section="main-window", key="hpane-position", type_=int) GlobalSettings.addConfigOption('mainWindowMainHPanePosition', section="main-window", key="main-hpane-position", type_=int) GlobalSettings.addConfigOption('mainWindowVPanePosition', section="main-window", key="vpane-position",
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301, USA. import os from enum import IntEnum from gettext import gettext as _ from gi.repository import GObject from gi.repository import Peas from pitivi.configure import get_plugins_dir from pitivi.configure import get_user_plugins_dir from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable GlobalSettings.addConfigSection("plugins") GlobalSettings.addConfigOption("ActivePlugins", section="plugins", key="active-plugins", default=[]) class API(GObject.GObject): """Interface that gives access to all the objects inside Pitivi.""" def __init__(self, app): GObject.GObject.__init__(self) self.app = app class PluginType(IntEnum): SYSTEM = 1
from pitivi.ui.common import beautify_factory from pitivi.utils import beautify_length from pitivi.ui.zoominterface import Zoomable from pitivi.ui.startupwizard import StartUpWizard if HAVE_GCONF: D_G_INTERFACE = "/desktop/gnome/interface" for gconf_dir in (D_G_INTERFACE, ): gconf.client_get_default ().add_dir (gconf_dir, gconf.CLIENT_PRELOAD_NONE) GlobalSettings.addConfigOption("fileSupportEnabled", environment="PITIVI_FILE_SUPPORT", default=False) GlobalSettings.addConfigSection("main-window") GlobalSettings.addConfigOption('mainWindowFullScreen', section="main-window", key="full-screen", default=False) GlobalSettings.addConfigOption('mainWindowHPanePosition', section="main-window", key="hpane-position", type_=int) GlobalSettings.addConfigOption('mainWindowMainHPanePosition', section="main-window", key="main-hpane-position", type_=int) GlobalSettings.addConfigOption('mainWindowVPanePosition', section="main-window", key="vpane-position",
from pitivi.check import missing_soft_deps from pitivi.configure import get_ui_dir, get_pixmap_dir from pitivi.dialogs.clipmediaprops import ClipMediaPropsDialog from pitivi.dialogs.filelisterrordialog import FileListErrorDialog from pitivi.mediafilespreviewer import PreviewWidget from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable from pitivi.utils.misc import PathWalker, quote_uri, path_from_uri from pitivi.utils.ui import beautify_info, beautify_length, info_name, \ URI_TARGET_ENTRY, FILE_TARGET_ENTRY, SPACING # Values used in the settings file. SHOW_TREEVIEW = 1 SHOW_ICONVIEW = 2 GlobalSettings.addConfigSection('clip-library') GlobalSettings.addConfigOption('lastImportFolder', section='clip-library', key='last-folder', environment='PITIVI_IMPORT_FOLDER', default=os.path.expanduser("~")) GlobalSettings.addConfigOption('closeImportDialog', section='clip-library', key='close-import-dialog-after-import', default=True) GlobalSettings.addConfigOption('lastClipView', section='clip-library', key='last-clip-view', type_=int, default=SHOW_ICONVIEW)
from pitivi.configure import get_gstpresets_dir from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable # Make sure gst knowns about our own GstPresets Gst.preset_set_app_dir(get_gstpresets_dir()) class ProxyingStrategy: AUTOMATIC = "automatic" ALL = "all" NOTHING = "nothing" GlobalSettings.addConfigSection("proxy") GlobalSettings.addConfigOption('proxyingStrategy', section='proxy', key='proxying-strategy', default=ProxyingStrategy.AUTOMATIC) GlobalSettings.addConfigOption('numTranscodingJobs', section='proxy', key='num-proxying-jobs', default=4) ENCODING_FORMAT_PRORES = "prores-opus-in-matroska.gep" ENCODING_FORMAT_JPEG = "jpeg-opus-in-matroska.gep" def createEncodingProfileSimple(container_caps, audio_caps, video_caps):
"videorate", "frei0r-filter-delay0r", "frei0r-filter-baltan", "frei0r-filter-nervous", )), ) BLACKLISTED_EFFECTS = ["colorconvert", "coglogoinsert", "festival", "alphacolor", "cogcolorspace", "videodetect", "navigationtest", "videoanalyse", "volume"] BLACKLISTED_PLUGINS = [] HIDDEN_EFFECTS = [ # Overlaying an image onto a video stream can already be done. "gdkpixbufoverlay"] GlobalSettings.addConfigSection('effect-library') (COL_NAME_TEXT, COL_DESC_TEXT, COL_EFFECT_TYPE, COL_EFFECT_CATEGORIES, COL_ELEMENT_NAME, COL_ICON) = list(range(6)) ICON_WIDTH = 48 + 2 * 6 # 48 pixels, plus a margin on each side class EffectInfo(object): """Info for displaying and using an effect. Attributes:
def test_add_section(self): GlobalSettings.addConfigSection("section-a") GlobalSettings.addConfigSection("section-a")
def test_read_config_file(self): GlobalSettings.addConfigSection("section-1") GlobalSettings.addConfigOption("section1OptionA", section="section-1", key="option-a", default=50) GlobalSettings.addConfigOption("section1OptionB", section="section-1", key="option-b", default=False) GlobalSettings.addConfigOption("section1OptionC", section="section-1", key="option-c", default="") GlobalSettings.addConfigOption("section1OptionD", section="section-1", key="option-d", default=[]) GlobalSettings.addConfigOption("section1OptionE", section="section-1", key="option-e", default=["foo"]) GlobalSettings.addConfigOption("section1OptionF", section="section-1", key="option-f", default=Gdk.RGBA()) self.assertEqual(GlobalSettings.section1OptionA, 50) self.assertEqual(GlobalSettings.section1OptionB, False) self.assertEqual(GlobalSettings.section1OptionC, "") self.assertEqual(GlobalSettings.section1OptionD, []) self.assertEqual(GlobalSettings.section1OptionE, ["foo"]) self.assertEqual(GlobalSettings.section1OptionF, Gdk.RGBA()) self.assertIs( GlobalSettings.options["section-1"]["section1OptionA"][0], int) self.assertIs( GlobalSettings.options["section-1"]["section1OptionB"][0], bool) self.assertIs( GlobalSettings.options["section-1"]["section1OptionC"][0], str) self.assertIs( GlobalSettings.options["section-1"]["section1OptionD"][0], list) self.assertIs( GlobalSettings.options["section-1"]["section1OptionE"][0], list) self.assertIs( GlobalSettings.options["section-1"]["section1OptionF"][0], Gdk.RGBA) conf_file_content = ("[section-1]\n" "option-a = 10\n" "option-b = True\n" "option-c = Pigs fly\n" "option-d=\n" "option-e=\n" " elmo\n" " knows\n" " where you live\n" "option-f=rgba(51,102,255,0.4)") with mock.patch("pitivi.settings.xdg_config_home") as xdg_config_home,\ tempfile.TemporaryDirectory() as temp_dir: with open(os.path.join(temp_dir, "pitivi.conf"), "w") as tmp_file: tmp_file.write(conf_file_content) xdg_config_home.return_value = temp_dir settings = GlobalSettings() self.assertEqual(settings.section1OptionA, 10) self.assertEqual(settings.section1OptionB, True) self.assertEqual(settings.section1OptionC, "Pigs fly") self.assertEqual(settings.section1OptionD, []) expected_e_value = ["elmo", "knows", "where you live"] self.assertEqual(settings.section1OptionE, expected_e_value) self.assertEqual(settings.section1OptionF, Gdk.RGBA(0.2, 0.4, 1.0, 0.4))
from gi.repository import Gtk from gi.repository import Pango from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable from pitivi.utils.misc import uri_is_valid from pitivi.utils.pipeline import AssetPipeline from pitivi.utils.ui import beautify_length from pitivi.utils.ui import beautify_stream from pitivi.utils.ui import SPACING from pitivi.viewer.viewer import ViewerWidget PREVIEW_WIDTH = 250 PREVIEW_HEIGHT = 100 GlobalSettings.addConfigSection('filechooser-preview') GlobalSettings.addConfigOption('FCEnablePreview', section='filechooser-preview', key='do-preview-on-clip-import', default=True) GlobalSettings.addConfigOption('FCpreviewWidth', section='filechooser-preview', key='video-preview-width', default=PREVIEW_WIDTH) GlobalSettings.addConfigOption('FCpreviewHeight', section='filechooser-preview', key='video-preview-height', default=PREVIEW_HEIGHT) ACCEPTABLE_TAGS = [ Gst.TAG_ALBUM_ARTIST, Gst.TAG_ARTIST, Gst.TAG_TITLE, Gst.TAG_ALBUM,
import pitivi.ui.dnd as dnd from pitivi.ui.pathwalker import PathWalker, quote_uri from pitivi.ui.filelisterrordialog import FileListErrorDialog from pitivi.configure import get_pixmap_dir from pitivi.signalgroup import SignalGroup from pitivi.stream import VideoStream, AudioStream, TextStream, MultimediaStream from pitivi.settings import GlobalSettings from pitivi.utils import beautify_length from pitivi.ui.common import beautify_factory, factory_name, beautify_stream, PADDING from pitivi.log.loggable import Loggable from pitivi.sourcelist import SourceListError SHOW_TREEVIEW = 1 SHOW_ICONVIEW = 2 GlobalSettings.addConfigSection("clip-library") GlobalSettings.addConfigOption( "lastImportFolder", section="clip-library", key="last-folder", environment="PITIVI_IMPORT_FOLDER", default=os.path.expanduser("~"), ) GlobalSettings.addConfigOption( "closeImportDialog", section="clip-library", key="close-import-dialog-after-import", default=True ) GlobalSettings.addConfigOption( "lastClipView", section="clip-library", key="last-clip-view", type_=int, default=SHOW_ICONVIEW ) (COL_ICON, COL_ICON_LARGE, COL_INFOTEXT, COL_FACTORY, COL_URI, COL_LENGTH, COL_SEARCH_TEXT, COL_SHORT_TEXT) = range(8)
GlobalSettings.addConfigOption('mainWindowX', section="main-window", key="X", default=0, type_=int) GlobalSettings.addConfigOption('mainWindowY', section="main-window", key="Y", default=0, type_=int) GlobalSettings.addConfigOption('mainWindowWidth', section="main-window", key="width", default=-1, type_=int) GlobalSettings.addConfigOption('mainWindowHeight', section="main-window", key="height", default=-1, type_=int) GlobalSettings.addConfigSection('export') GlobalSettings.addConfigOption('lastExportFolder', section='export', key="last-export-folder", environment="PITIVI_EXPORT_FOLDER", default=os.path.expanduser("~")) GlobalSettings.addConfigSection("version") GlobalSettings.addConfigOption('displayCounter', section='version', key='info-displayed-counter', default=0) GlobalSettings.addConfigOption('lastCurrentVersion', section='version', key='last-current-version', default='')
from math import pi import cairo from gettext import gettext as _ from pitivi.action import ViewAction from pitivi.stream import VideoStream from pitivi.utils import time_to_string, Seeker from pitivi.log.loggable import Loggable from pitivi.pipeline import PipelineError from pitivi.ui.common import SPACING, hex_to_rgb from pitivi.settings import GlobalSettings from pitivi.ui.dynamic import TimeWidget GlobalSettings.addConfigSection("viewer") GlobalSettings.addConfigOption("viewerDocked", section="viewer", key="docked", default=True) GlobalSettings.addConfigOption("viewerWidth", section="viewer", key="width", default=320) GlobalSettings.addConfigOption("viewerHeight", section="viewer", key="height", default=240) GlobalSettings.addConfigOption("viewerX", section="viewer", key="x-pos",
from gi.repository import GLib from gi.repository import GObject from gi.repository import Gtk from gi.repository import Peas from pitivi.configure import get_ui_dir from pitivi.pluginmanager import PluginManager from pitivi.settings import GlobalSettings from pitivi.utils import widgets from pitivi.utils.loggable import Loggable from pitivi.utils.ui import alter_style_class from pitivi.utils.ui import fix_infobar from pitivi.utils.ui import PADDING from pitivi.utils.ui import SPACING GlobalSettings.addConfigSection("user-interface") GlobalSettings.addConfigOption('prefsDialogWidth', section="user-interface", key="prefs-dialog-width", default=600) GlobalSettings.addConfigOption('prefsDialogHeight', section="user-interface", key="prefs-dialog-height", default=400) class PreferencesDialog(Loggable): """Preferences for how the app works.""" _instance = None
from pitivi.ui.sourcelist import SourceList from pitivi.ui.common import beautify_factory from pitivi.utils import beautify_length from pitivi.ui.zoominterface import Zoomable if HAVE_GCONF: D_G_INTERFACE = "/desktop/gnome/interface" for gconf_dir in (D_G_INTERFACE, ): gconf.client_get_default ().add_dir (gconf_dir, gconf.CLIENT_PRELOAD_NONE) GlobalSettings.addConfigOption("fileSupportEnabled", environment="PITIVI_FILE_SUPPORT", default=False) GlobalSettings.addConfigSection("main-window") GlobalSettings.addConfigOption('mainWindowFullScreen', section="main-window", key="full-screen", default=False) GlobalSettings.addConfigOption('mainWindowHPanePosition', section="main-window", key="hpane-position", type_=int) GlobalSettings.addConfigOption('mainWindowVPanePosition', section="main-window", key="vpane-position", default=200) GlobalSettings.addConfigOption('mainWindowWidth', section="main-window", key="width",
from pitivi.ui.common import beautify_factory from pitivi.utils import beautify_length from pitivi.ui.zoominterface import Zoomable if HAVE_GCONF: D_G_INTERFACE = "/desktop/gnome/interface" for gconf_dir in (D_G_INTERFACE, ): gconf.client_get_default().add_dir(gconf_dir, gconf.CLIENT_PRELOAD_NONE) GlobalSettings.addConfigOption("fileSupportEnabled", environment="PITIVI_FILE_SUPPORT", default=False) GlobalSettings.addConfigSection("main-window") GlobalSettings.addConfigOption('mainWindowFullScreen', section="main-window", key="full-screen", default=False) GlobalSettings.addConfigOption('mainWindowHPanePosition', section="main-window", key="hpane-position", type_=int) GlobalSettings.addConfigOption('mainWindowVPanePosition', section="main-window", key="vpane-position", default=200) GlobalSettings.addConfigOption('mainWindowWidth', section="main-window", key="width",
try: # We can afford to scale the images here, the impact is negligible icon = GdkPixbuf.Pixbuf.new_from_file_at_size( os.path.join(self._pixdir, effect_name + ".png"), ICON_WIDTH, ICON_WIDTH) # An empty except clause is bad, but "gi._glib.GError" is not helpful. except: icon = GdkPixbuf.Pixbuf.new_from_file( os.path.join(self._pixdir, "defaultthumbnail.svg")) return icon # ----------------------- UI classes to manage effects -------------------------# HIDDEN_EFFECTS = ["frei0r-filter-scale0tilt"] GlobalSettings.addConfigSection('effect-library') (COL_NAME_TEXT, COL_DESC_TEXT, COL_EFFECT_TYPE, COL_EFFECT_CATEGORIES, COL_FACTORY, COL_ELEMENT_NAME, COL_ICON) = list(range(7)) class EffectListWidget(Gtk.VBox, Loggable): """ Widget for listing effects """ def __init__(self, instance, unused_uiman):
import pitivi.ui.dnd as dnd from pitivi.ui.pathwalker import PathWalker from pitivi.ui.filelisterrordialog import FileListErrorDialog from pitivi.configure import get_pixmap_dir from pitivi.signalgroup import SignalGroup from pitivi.stream import VideoStream, AudioStream, TextStream, \ MultimediaStream from pitivi.settings import GlobalSettings from pitivi.utils import beautify_length from pitivi.ui.common import beautify_factory, factory_name, \ beautify_stream from pitivi.log.loggable import Loggable from pitivi.sourcelist import SourceListError GlobalSettings.addConfigSection('clip-library') GlobalSettings.addConfigOption('lastImportFolder', section='clip-library', key='last-folder', environment='PITIVI_IMPORT_FOLDER', default=os.path.expanduser("~")) GlobalSettings.addConfigOption('closeImportDialog', section='clip-library', key='close-import-dialog-after-import', default=True) (COL_ICON, COL_INFOTEXT, COL_FACTORY, COL_URI, COL_LENGTH, COL_SEARCH_TEXT) = range(6) ui = ''' <ui>
from pitivi.configure import get_pixmap_dir from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable from pitivi.utils.misc import uri_is_valid from pitivi.utils.ui import beautify_length, beautify_stream,\ SPACING from pitivi.viewer import ViewerWidget DEFAULT_AUDIO_IMAGE = os.path.join(get_pixmap_dir(), "pitivi-sound.png") PREVIEW_WIDTH = 250 PREVIEW_HEIGHT = 100 GlobalSettings.addConfigSection('filechooser-preview') GlobalSettings.addConfigOption('FCEnablePreview', section='filechooser-preview', key='do-preview-on-clip-import', default=True) GlobalSettings.addConfigOption('FCpreviewWidth', section='filechooser-preview', key='video-preview-width', default=PREVIEW_WIDTH) GlobalSettings.addConfigOption('FCpreviewHeight', section='filechooser-preview', key='video-preview-height', default=PREVIEW_HEIGHT) class PreviewWidget(gtk.VBox, Loggable):
from gi.repository import Gdk from gi.repository import GES from gi.repository import GObject from gi.repository import Gst from gi.repository import Gtk from pitivi.settings import GlobalSettings from pitivi.utils.loggable import Loggable from pitivi.utils.misc import format_ns from pitivi.utils.pipeline import AssetPipeline from pitivi.utils.ui import SPACING from pitivi.utils.widgets import TimeWidget from pitivi.viewer.overlay_stack import OverlayStack GlobalSettings.addConfigSection("viewer") GlobalSettings.addConfigOption("viewerDocked", section="viewer", key="docked", default=True) GlobalSettings.addConfigOption("viewerWidth", section="viewer", key="width", default=320) GlobalSettings.addConfigOption("viewerHeight", section="viewer", key="height", default=240) GlobalSettings.addConfigOption("viewerX", section="viewer", key="x-pos",
import pitivi.settings as settings from pitivi.settings import GlobalSettings from pitivi.configure import get_pixmap_dir import pitivi.utils as utils from pitivi.utils.misc import big_to_cairo_alpha_mask, big_to_cairo_red_mask, big_to_cairo_green_mask, big_to_cairo_blue_mask from pitivi.utils.receiver import receiver, handler from pitivi.utils.timeline import Zoomable from pitivi.utils.signal import Signallable from pitivi.utils.loggable import Loggable from pitivi.dialogs.prefs import PreferencesDialog 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"),
icon = GdkPixbuf.Pixbuf.new_from_file(os.path.join(self._pixdir, effect_name)) # empty except clause is bad but load_icon raises Gio.Error. ## Right, *gio*. except: try: icon = GdkPixbuf.Pixbuf.new_from_file(os.path.join(self._pixdir, "defaultthumbnail.svg")) except: return None return icon # ----------------------- UI classes to manage effects -------------------------# HIDDEN_EFFECTS = ["frei0r-filter-scale0tilt"] GlobalSettings.addConfigSection("effect-library") (COL_NAME_TEXT, COL_DESC_TEXT, COL_EFFECT_TYPE, COL_EFFECT_CATEGORIES, COL_FACTORY, COL_ELEMENT_NAME, COL_ICON) = range( 7 ) class EffectListWidget(Gtk.VBox, Loggable): """ Widget for listing effects """ def __init__(self, instance, uiman): Gtk.VBox.__init__(self) Loggable.__init__(self) self.app = instance