コード例 #1
0
ファイル: AddFiles.py プロジェクト: DjMorgul/libreshot
    def __init__(self,
                 path="AddFiles.ui",
                 root="frmAddFiles",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self.frmAddFiles.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
        self.frmAddFiles.set_select_multiple(True)
        self.frmAddFiles.set_local_only(False)

        self.form = form
        self.project = project

        #open the last used folder
        default_folder = preferences.Settings.app_state["import_folder"]
        if default_folder != "None":
            self.frmAddFiles.set_current_folder(
                preferences.Settings.app_state["import_folder"])

        self.frmAddFiles.show_all()
コード例 #2
0
ファイル: AddToTimeline.py プロジェクト: DjMorgul/libreshot
    def __init__(self,
                 path="AddToTimeline.ui",
                 root="frmAddToTimeline",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 selected_files=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.form = form
        self.project = project
        self.selected_files = selected_files
        self.transitions = {}
        self.frmAddToTimeline.show_all()

        # init the LibreShot files tree
        self.OSTreeFiles = TreeFiles.LibreShotTree(self.treeFiles,
                                                   self.project)
        self.OSTreeFiles.set_project(self.project)
        self.model = self.treeFiles.get_model()

        # init the value of start_time with the play-head position
        self.txtStartTime.set_value(
            self.project.sequences[0].play_head_position)

        # refresh tree
        self.refresh()

        # Get default length of images
        imported_image_length = float(
            preferences.Settings.general["imported_image_length"])
        max_transition_length = (imported_image_length / 2.0) - 0.1

        # Set the upper limits of the transitions & fade length
        adjustment1 = gtk.Adjustment(value=2.0,
                                     lower=0.0,
                                     upper=max_transition_length,
                                     step_incr=0.5,
                                     page_incr=0.5,
                                     page_size=0.0)
        self.txtTransitionLength.configure(adjustment1, 0.5, 2)

        adjustment2 = gtk.Adjustment(value=2.0,
                                     lower=0.0,
                                     upper=max_transition_length,
                                     step_incr=0.5,
                                     page_incr=0.5,
                                     page_size=0.0)
        self.txtFadeLength.configure(adjustment2, 0.5, 2)

        # init all dropdowns
        self.init_fade()
        self.init_tracks()
        self.init_transitions()
コード例 #3
0
ファイル: fontselector.py プロジェクト: XXLRay/libreshot
    def __init__(self, instance, path="fontselector.ui", root="frmFontProperties", domain="OpenShot", project=None, **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self.calling_form = instance

        #get the list of available fonts
        fonts = gtk.ListStore(str)
        self.init_treeview(self.treeFontList)

        pc = self.frmFontProperties.get_pango_context()
        for family in pc.list_families():
            fonts.append([family.get_name()])


        self.treeFontList.set_model(fonts)

        #sort the fonts alphabetically
        fonts.set_sort_column_id(0, gtk.SORT_ASCENDING)

        #add the callbacks
        self.treeFontList.connect("cursor-changed", self.family_changed_cb)
        self.btnItalic.connect("toggled", self.style_changed_cb)
        self.btnBold.connect("toggled", self.weight_changed_cb)
        
        self.frmFontProperties.show_all()
コード例 #4
0
    def __init__(self,
                 instance,
                 path="fontselector.ui",
                 root="frmFontProperties",
                 domain="LibreShot",
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self.calling_form = instance

        #get the list of available fonts
        fonts = gtk.ListStore(str)
        self.init_treeview(self.treeFontList)

        pc = self.frmFontProperties.get_pango_context()
        for family in pc.list_families():
            fonts.append([family.get_name()])

        self.treeFontList.set_model(fonts)

        #sort the fonts alphabetically
        fonts.set_sort_column_id(0, gtk.SORT_ASCENDING)

        #add the callbacks
        self.treeFontList.connect("cursor-changed", self.family_changed_cb)
        self.btnItalic.connect("toggled", self.style_changed_cb)
        self.btnBold.connect("toggled", self.weight_changed_cb)

        self.frmFontProperties.show_all()
コード例 #5
0
ファイル: ImportImageSeq.py プロジェクト: DjMorgul/libreshot
    def __init__(self,
                 path="ImportImageSeq.ui",
                 root="frmImportImageSequence",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 pattern=None,
                 initial_folder=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.form = form
        self.project = project
        self.frmImportImageSequence.show_all()

        # init frames per image
        self.txtFramesPerImage.set_value(1)

        if pattern:
            # init the pattern, if passed in
            self.txtFileName.set_text(pattern)

        if initial_folder:
            self.folder_location.set_current_folder(initial_folder)
コード例 #6
0
ファイル: Profiles.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="profiles.ui", root="frmProfiles", domain="OpenShot", form=None, parent=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.project = project
		self.form = form
		self.parent = parent

		#find path where openshot is running
		self.path = self.project.BASE_DIR
		
		# init the list of possible project types / profiles
		self.profile_list = profiles.mlt_profiles(self.project).get_profile_list()
		
		# loop through each profile, and add it to the dropdown
		for file_name, p in self.profile_list:
			# append profile to list
			self.cmbProjectType.append_text(p.description())
			
		self.save_prompt = False
		
		self.frmProfiles.show_all()
		
		#set the default profile
		self.set_project_type_dropdown(self.form.settings.general["default_profile"])
		if not self.cmbProjectType.get_active_text():
			self.set_project_type_dropdown("DV/DVD NTSC")
コード例 #7
0
    def __init__(self,
                 path="ImportTransitions.ui",
                 root="frmImportTransitions",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.project = project
        self.form = form

        filter = gtk.FileFilter()
        filter.set_name("PNG files")
        filter.add_pattern("*.png")
        #filter.add_pattern("*.pgm")
        self.fileTransition.add_filter(filter)

        self.transition_file = ""
        self.icon_file = ""

        self.frmImportTransitions.show_all()
コード例 #8
0
ファイル: NewProject.py プロジェクト: XXLRay/libreshot
	def __init__(self, mode="", path="NewProject.ui", root="frmNewProject", domain="OpenShot", project=None, **kwargs):
		print "init"
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		self._ = Language_Init.Translator(project).lang.gettext
		_ = self._

		# project instance
		self.project = project
		self.form = project.form

		# check the mode of the form (i.e. new project or save as screen)
		self.mode = mode
		
		# init the project type properties
		self.init_properties()
		
		# init the list of possible project types / profiles
		self.profile_list = profiles.mlt_profiles(self.project).get_profile_list()
		
		# loop through each profile, and add it to the dropdown
		for file_name, p in self.profile_list:
			# append profile to list
			self.cmbProjectType.append_text(p.description())
			
			
		# SET THE SAVE FOLDER LOCATION
		if ".openshot" in self.project.folder:
			# This is the openshot default project (set the folder to 'DESKTOP')
			self.fileProjectFolder.set_current_folder(self.project.DESKTOP)
		
		elif len(self.project.folder) > 0:
			# set default folder (if there is a current folder)
			self.fileProjectFolder.set_current_folder(self.project.folder)
			
			
		# init the profile
		self.set_dropdown_values(self.form.settings.general["default_profile"], self.cmbProjectType)
			
		if (self.mode == "saveas"):
			# Save project as
			# Set window title
			self.frmNewProject.set_title(_("Save Project As..."))
			
			# init the project name
			self.txtProjectName.set_text(self.project.name)
			
			# init the profile
			self.set_dropdown_values(self.project.project_type, self.cmbProjectType)
			
		else:
			# New Project
			# Set window title
			self.frmNewProject.set_title(_("Create a Project"))
			
			# init the project name
			self.txtProjectName.set_text(_("Default Project"))
コード例 #9
0
ファイル: AddEffect.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="AddEffect.ui", root="frmAddEffect", domain="OpenShot", parent=None, form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext

		self.form = form
		self.project = project
		self.parent = parent
		EFFECTS_DIR = self.project.EFFECTS_DIR

		# Init Dropdown and model
		# create a ListStore
		self.store = gtk.ListStore(gtk.gdk.Pixbuf, str)
		self.sort_model = gtk.TreeModelSort(self.store)
		
		# Sort Effects ListStore
		self.sort_model.set_sort_column_id(1, gtk.SORT_ASCENDING)

		# Set the treeview's data model
		self.cboEffects.set_model(self.sort_model)
		
		# Init List of Effects
		effect_list = self.form.effect_list
		
		# Add effects to dropdown
		sorted_list = []
		for my_effect in effect_list:
			
			# is frei0r effect library installed?
			if self.form.has_frei0r_installed == False and my_effect.service.startswith("frei0r"):
				# frei0r not installed, and this is a frei0r effect
				# skip to next item in loop
				continue
			
			# does the frei0r installation include this effect?
			if my_effect.service.startswith("frei0r"):
				if my_effect.service not in self.form.filters:
					# don't add this effect, skip to the next one
					continue
			
			# get image for filter
			file_path = os.path.join(EFFECTS_DIR, "icons", "small", my_effect.icon)
			
			# get the pixbuf
			pbThumb = gtk.gdk.pixbuf_new_from_file(file_path)

			# add effect to tree
			item = self.store.append(None)
			self.store.set_value(item, 0, pbThumb)
			self.store.set_value(item, 1, _(my_effect.title))

		# show all controls
		self.frmAddEffect.show_all()
コード例 #10
0
    def __init__(self,
                 file,
                 path="FileProperties.ui",
                 root="frmFileProperties",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self.form = form
        self.project = project
        self.file = file

        #set the thumbnail - use the preview thumbnail
        #for video & image files
        pixbuf = file.get_thumbnail(112, 83)
        self.imgPreview.set_from_pixbuf(pixbuf)

        #set the file type
        self.lblMimeType.set_label(str(file.file_type).title())

        #if the file name is too long to fit the space, add ellipses and a tooltip.
        self.lblLocation1.set_text(file.name)
        #self.lblLocation1.set_tooltip_text(file.name)
        #self.lblLocation1.set_ellipsize(pango.ELLIPSIZE_END)
        #format the file length
        milliseconds = file.length * 1000
        time = timeline.timeline().get_friendly_time(milliseconds)

        hours = time[2]
        mins = time[3]
        secs = time[4]
        milli = time[5]

        time_str = "%02d:%02d:%02d:%03d" % (hours, mins, secs, milli)
        self.lblLengthValue.set_label(time_str)
        #project label
        self.txtLabel.set_text(file.label)

        if file.file_type in ["video", "image", "image sequence"]:
            self.lblSizeValue.set_label(
                str(file.width) + " x " + str(file.height))
        else:
            self.lblSize.set_sensitive(False)

        #show the form
        self.frmFileProperties.show_all()
コード例 #11
0
    def __init__(self,
                 path="BlenderGenerator.ui",
                 root="frm3dGenerator",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self._ = _
        self.form = form
        self.project = project
        self.unique_folder_name = str(uuid.uuid1())
        self.output_dir = os.path.join(self.project.USER_DIR, "blender")
        self.selected_template = ""
        self.is_rendering = False
        self.my_blender = None

        # init blender tree
        self.OSTreeBlender = TreeBlender.LibreShotTree(self.treeTemplates,
                                                       self.project)
        self.form.OSTreeBlender = self.OSTreeBlender

        # show all controls
        self.frm3dGenerator.show_all()

        # clear all editing controls
        self.clear_effect_controls()

        # clear any temp folders that are older than todays date
        self.clear_temp_files()

        # set black background
        self.imgPreviewEventBox.modify_bg(gtk.STATE_NORMAL,
                                          gtk.gdk.color_parse("black"))

        # Init dictionary which holds the values to the template parameters
        self.params = {}

        # Disable the Render button by default
        self.btnRender.set_sensitive(False)
        self.sliderPreview.set_sensitive(False)
        self.btnRefresh.set_sensitive(False)

        # Get a list of all TTF files (i.e. font files) on the users (as fast as possible)
        # computer, so that we can pass these into Blender to set the font.
        self.available_fonts = self.get_font_files()
コード例 #12
0
    def __init__(self,
                 path="UploadVideo.ui",
                 root="frmUploadVideo",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 filename=None,
                 service_name=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.form = form
        self.project = project
        self.filename = filename
        self.upload_manager = UploadManager(project, self.form.settings)

        # Init filename (if any passed in)
        if self.filename:
            self.fileFilename.set_filename(self.filename)

        # Init upload services dropdown
        upload_model = self.cboUploadService.get_model()
        upload_model.clear()

        self.upload_services = self.upload_manager.get_services()
        upload_types = self.upload_services.keys()
        upload_types.sort()
        # loop through export to options
        for option in upload_types:
            # append profile to list
            self.cboUploadService.append_text(option)

        # get default upload service
        if service_name:
            # service name passed into form
            default_upload_service = service_name
        else:
            # get default from settings
            default_upload_service = self.form.settings.app_state[
                "upload_service"]

        if default_upload_service in upload_types:
            self.set_dropdown_values(default_upload_service,
                                     self.cboUploadService)
        else:
            self.set_dropdown_values(upload_types[0], self.cboUploadService)
コード例 #13
0
ファイル: OpenProject.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="OpenProject.ui", root="frmOpenProject", domain="OpenShot", project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		self.project = project
		self.form = self.project.form

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext

		# set a file type filter (to limit the files to only valid files)
		OSPfilter = gtk.FileFilter()
		OSPfilter.add_pattern("*.osp")
		OSPfilter.set_name(_("OpenShot Project (*.osp)"))
		self.frmOpenProject.add_filter(OSPfilter)
コード例 #14
0
ファイル: ExportXML.py プロジェクト: DjMorgul/libreshot
	def __init__(self, path="ExportXML.ui", root="frmExportXML", domain="LibreShot", project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		self.project = project
		self.form = self.project.form

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext

		# set a file type filter (to limit the files to only valid files)
		OSPfilter = gtk.FileFilter()
		OSPfilter.add_pattern("*.mlt")
		OSPfilter.set_name(_("MLT XML (*.mlt)"))
		self.frmExportXML.add_filter(OSPfilter)
		self.frmExportXML.set_current_folder_uri("file://%s" % self.project.DESKTOP)
コード例 #15
0
ファイル: ExportXML.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="ExportXML.ui", root="frmExportXML", domain="OpenShot", project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		self.project = project
		self.form = self.project.form

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext

		# set a file type filter (to limit the files to only valid files)
		OSPfilter = gtk.FileFilter()
		OSPfilter.add_pattern("*.mlt")
		OSPfilter.set_name(_("MLT XML (*.mlt)"))
		self.frmExportXML.add_filter(OSPfilter)
		self.frmExportXML.set_current_folder_uri("file://%s" % self.project.DESKTOP)
コード例 #16
0
ファイル: AddFiles.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="AddFiles.ui", root="frmAddFiles", domain="OpenShot", form=None, project=None,clip=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)
		
		# Add language support
		_ = Language_Init.Translator(project).lang.gettext

		self.frmAddFiles.set_title("OpenShot")
		self.frmAddFiles.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
		self.frmAddFiles.set_select_multiple(False)
		
		self.form = form
		self.project = project
		self.clip = clip		
		
		self.frmAddFiles.show_all()
コード例 #17
0
    def __init__(
        self,
        path="TransitionProperties.ui",
        root="frmTransitionProperties",
        domain="OpenShot",
        form=None,
        project=None,
        current_transition=None,
        **kwargs
    ):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        # add items to direction combo
        options = [_("Transition"), _("Mask")]
        # loop through export to options
        for option in options:
            # append profile to list
            self.cboType.append_text(option)

            # add items to direction combo
        options = [_("Up"), _("Down")]
        # loop through export to options
        for option in options:
            # append profile to list
            self.cboDirection.append_text(option)

        self.form = form
        self.project = project
        self.current_transition = current_transition
        self.frmTransitionProperties.show_all()

        # init the project type properties
        self.lblName.set_text(self.current_transition.name)
        self.spinbtnStart.set_value(round(self.current_transition.position_on_track, 2))
        self.spinbtnLength.set_value(round(self.current_transition.length, 2))
        self.hsSoftness.set_value(self.current_transition.softness * 100.0)
        self.hsThreshold.set_value(self.current_transition.mask_value)

        # set the dropdown boxes
        self.set_type_dropdown()
        self.set_direction_dropdown()
コード例 #18
0
    def __init__(self,
                 path="TransitionProperties.ui",
                 root="frmTransitionProperties",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 current_transition=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        # add items to direction combo
        options = [_("Transition"), _("Mask")]
        # loop through export to options
        for option in options:
            # append profile to list
            self.cboType.append_text(option)

        # add items to direction combo
        options = [_("Up"), _("Down")]
        # loop through export to options
        for option in options:
            # append profile to list
            self.cboDirection.append_text(option)

        self.form = form
        self.project = project
        self.current_transition = current_transition
        self.frmTransitionProperties.show_all()

        # init the project type properties
        self.lblName.set_text(self.current_transition.name)
        self.spinbtnStart.set_value(
            round(self.current_transition.position_on_track, 2))
        self.spinbtnLength.set_value(round(self.current_transition.length, 2))
        self.hsSoftness.set_value(self.current_transition.softness * 100.0)
        self.hsThreshold.set_value(self.current_transition.mask_value)

        # set the dropdown boxes
        self.set_type_dropdown()
        self.set_direction_dropdown()
コード例 #19
0
ファイル: FileProperties.py プロジェクト: XXLRay/libreshot
	def __init__(self, file, path="FileProperties.ui", root="frmFileProperties", domain="OpenShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		
		self.form = form
		self.project = project
		self.file = file
		
		#set the thumbnail - use the preview thumbnail
		#for video & image files
		pixbuf = file.get_thumbnail(112, 83)
		self.imgPreview.set_from_pixbuf(pixbuf)
		
		#set the file type	
		self.lblMimeType.set_label(str(file.file_type).title())
		
		#if the file name is too long to fit the space, add ellipses and a tooltip.
		self.lblLocation1.set_text(file.name)
		#self.lblLocation1.set_tooltip_text(file.name)
		#self.lblLocation1.set_ellipsize(pango.ELLIPSIZE_END)
		#format the file length
		milliseconds = file.length * 1000
		time = timeline.timeline().get_friendly_time(milliseconds)
	
		hours = time[2]
		mins = time[3]
		secs = time[4]
		milli = time[5]
		
		time_str =  "%02d:%02d:%02d:%03d" % (hours, mins, secs, milli)
		self.lblLengthValue.set_label(time_str)
		#project label
		self.txtLabel.set_text(file.label)
		
		if file.file_type in ["video", "image", "image sequence"]:
			self.lblSizeValue.set_label(str(file.width) + " x " + str(file.height))
		else:
			self.lblSize.set_sensitive(False)
		
		#show the form
		self.frmFileProperties.show_all()
コード例 #20
0
ファイル: AddFiles.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="AddFiles.ui", root="frmAddFiles", domain="OpenShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext

		self.frmAddFiles.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
		self.frmAddFiles.set_select_multiple(True)
		self.frmAddFiles.set_local_only(False)
		
		self.form = form
		self.project = project
		
		#open the last used folder
		default_folder = preferences.Settings.app_state["import_folder"]
		if default_folder != "None":
			self.frmAddFiles.set_current_folder(preferences.Settings.app_state["import_folder"])
		
		self.frmAddFiles.show_all()
コード例 #21
0
ファイル: BlenderGenerator.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="BlenderGenerator.ui", root="frm3dGenerator", domain="OpenShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		
		self._ = _
		self.form = form
		self.project = project
		self.unique_folder_name = str(uuid.uuid1())
		self.output_dir = os.path.join(self.project.USER_DIR, "blender")
		self.selected_template = ""
		self.is_rendering = False
		self.my_blender = None
		
		# init blender tree
		self.OSTreeBlender = TreeBlender.OpenShotTree(self.treeTemplates, self.project)
		self.form.OSTreeBlender = self.OSTreeBlender
			
		# show all controls
		self.frm3dGenerator.show_all()
		
		# clear all editing controls
		self.clear_effect_controls()
		
		# clear any temp folders that are older than todays date
		self.clear_temp_files()
		
		# set black background
		self.imgPreviewEventBox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("black"))
		
		# Init dictionary which holds the values to the template parameters
		self.params = {}
		
		# Disable the Render button by default
		self.btnRender.set_sensitive(False)
		self.sliderPreview.set_sensitive(False)
		self.btnRefresh.set_sensitive(False)
		
		# Get a list of all TTF files (i.e. font files) on the users (as fast as possible)
		# computer, so that we can pass these into Blender to set the font.
		self.available_fonts = self.get_font_files()
コード例 #22
0
ファイル: About.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="About.ui", root="aboutdialog1", domain="OpenShot", version="0.0.0", project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self,  os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		
		# set version from constructor
		self.aboutdialog1.set_version(version)
		
		# init authors
		authors = []
		for person in info.CREDITS['code']:
			name = person['name']
			email = person['email']
			authors.append("%s <%s>" % (name, email))
		self.aboutdialog1.set_authors(authors)
		
		# init documenters
		authors = []
		for person in info.CREDITS['documentation']:
			name = person['name']
			email = person['email']
			authors.append("%s <%s>" % (name, email))
		self.aboutdialog1.set_documenters(authors)
		
		# init artists
		artists = []
		for person in info.CREDITS['artwork']:
			name = person['name']
			email = person['email']
			artists.append("%s <%s>" % (name, email))
		self.aboutdialog1.set_artists(artists)

		# string used to store the authors of translations:
		self.translation_authors = _("translator-credits")
		if self.translation_authors == "translator-credits":
			self.translation_authors = "Translation credits are located on LaunchPad:\nhttp://translations.launchpad.net/openshot"
		else:
			# replace all https links with http, so the AboutDialog will make them clickable.
			self.translation_authors = self.translation_authors.replace("https://", "http://")
		
		self.aboutdialog1.set_translator_credits(self.translation_authors)
コード例 #23
0
ファイル: ImportTransitions.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="ImportTransitions.ui", root="frmImportTransitions", domain="OpenShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _
		
		self.project = project
		self.form = form
		
		filter = gtk.FileFilter()
		filter.set_name("PNG files")
		filter.add_pattern("*.png")
		#filter.add_pattern("*.pgm")
		self.fileTransition.add_filter(filter)
		
		self.transition_file = ""
		self.icon_file = ""
		
		self.frmImportTransitions.show_all()
コード例 #24
0
ファイル: ImportImageSeq.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="ImportImageSeq.ui", root="frmImportImageSequence", domain="OpenShot", form=None, project=None, pattern=None, initial_folder=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.form = form
		self.project = project
		self.frmImportImageSequence.show_all()
		
		# init frames per image
		self.txtFramesPerImage.set_value(1)
		
		if pattern:
			# init the pattern, if passed in
			self.txtFileName.set_text(pattern)
			
		if initial_folder:
			self.folder_location.set_current_folder(initial_folder)
コード例 #25
0
ファイル: OpenProject.py プロジェクト: DjMorgul/libreshot
    def __init__(self,
                 path="OpenProject.ui",
                 root="frmOpenProject",
                 domain="LibreShot",
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        self.project = project
        self.form = self.project.form

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        # set a file type filter (to limit the files to only valid files)
        OSPfilter = gtk.FileFilter()
        OSPfilter.add_pattern("*.osp")
        OSPfilter.set_name(_("LibreShot Project (*.osp)"))
        self.frmOpenProject.add_filter(OSPfilter)
コード例 #26
0
ファイル: UploadVideo.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="UploadVideo.ui", root="frmUploadVideo", domain="OpenShot", form=None, project=None, filename=None, service_name=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.form = form
		self.project = project
		self.filename = filename
		self.upload_manager = UploadManager(project, self.form.settings)

		# Init filename (if any passed in)
		if self.filename:
			self.fileFilename.set_filename(self.filename)
		
		# Init upload services dropdown
		upload_model = self.cboUploadService.get_model()
		upload_model.clear()
		
		self.upload_services = self.upload_manager.get_services()
		upload_types = self.upload_services.keys()
		upload_types.sort()
		# loop through export to options
		for option in upload_types:
			# append profile to list
			self.cboUploadService.append_text(option)
			
		# get default upload service
		if service_name:
			# service name passed into form
			default_upload_service = service_name
		else:
			# get default from settings
			default_upload_service = self.form.settings.app_state["upload_service"]

		if default_upload_service in upload_types:
			self.set_dropdown_values(default_upload_service, self.cboUploadService)
		else:
			self.set_dropdown_values(upload_types[0], self.cboUploadService)
コード例 #27
0
    def __init__(self,
                 path="profiles.ui",
                 root="frmProfiles",
                 domain="LibreShot",
                 form=None,
                 parent=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.project = project
        self.form = form
        self.parent = parent

        #find path where libreshot is running
        self.path = self.project.BASE_DIR

        # init the list of possible project types / profiles
        self.profile_list = profiles.mlt_profiles(
            self.project).get_profile_list()

        # loop through each profile, and add it to the dropdown
        for file_name, p in self.profile_list:
            # append profile to list
            self.cmbProjectType.append_text(p.description())

        self.save_prompt = False

        self.frmProfiles.show_all()

        #set the default profile
        self.set_project_type_dropdown(
            self.form.settings.general["default_profile"])
        if not self.cmbProjectType.get_active_text():
            self.set_project_type_dropdown("DV/DVD NTSC")
コード例 #28
0
ファイル: AddToTimeline.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="AddToTimeline.ui", root="frmAddToTimeline", domain="OpenShot", form=None, project=None, selected_files=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.form = form
		self.project = project
		self.selected_files = selected_files
		self.transitions = {}
		self.frmAddToTimeline.show_all()
		
		# init the OpenShot files tree
		self.OSTreeFiles = TreeFiles.OpenShotTree(self.treeFiles, self.project)
		self.OSTreeFiles.set_project(self.project)
		self.model = self.treeFiles.get_model()
		
		# init the value of start_time with the play-head position
		self.txtStartTime.set_value(self.project.sequences[0].play_head_position)

		# refresh tree
		self.refresh()

		# Get default length of images
		imported_image_length = float(preferences.Settings.general["imported_image_length"])
		max_transition_length = (imported_image_length / 2.0) - 0.1
		
		# Set the upper limits of the transitions & fade length
		adjustment1 = gtk.Adjustment(value=2.0, lower=0.0, upper=max_transition_length, step_incr=0.5, page_incr=0.5, page_size=0.0)
		self.txtTransitionLength.configure(adjustment1, 0.5, 2)
		
		adjustment2 = gtk.Adjustment(value=2.0, lower=0.0, upper=max_transition_length, step_incr=0.5, page_incr=0.5, page_size=0.0)
		self.txtFadeLength.configure(adjustment2, 0.5, 2)
		
		# init all dropdowns
		self.init_fade()
		self.init_tracks()
		self.init_transitions()
コード例 #29
0
ファイル: AddFiles.py プロジェクト: DjMorgul/libreshot
    def __init__(self,
                 path="AddFiles.ui",
                 root="frmAddFiles",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 clip=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self.frmAddFiles.set_title("LibreShot")
        self.frmAddFiles.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
        self.frmAddFiles.set_select_multiple(False)

        self.form = form
        self.project = project
        self.clip = clip

        self.frmAddFiles.show_all()
コード例 #30
0
ファイル: Titles.py プロジェクト: XXLRay/libreshot
	def __init__(self, instance, path="titles_edit.ui", root="frmEditText", domain="OpenShot", number_of_text_boxes=0, tspans=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		
		self.frmTitles = instance
		self.tspans = tspans
		self.number_of_text_boxes = number_of_text_boxes
		self.accepted = False

		for i in range(0, self.number_of_text_boxes):
			# get text in SVG
			SVG_Text = ""
			if len(tspans[i].childNodes) > 0:
				SVG_Text = tspans[i].childNodes[0].data
				
			
			# create textbox & add to window
			tbox = gtk.Entry(max=0)
			tbox.set_text(SVG_Text)
			self.vbox3.pack_start(tbox, expand=True, fill=False)

		self.frmEditText.show_all()
コード例 #31
0
ファイル: Titles.py プロジェクト: DjMorgul/libreshot
	def __init__(self, instance, path="titles_edit.ui", root="frmEditText", domain="LibreShot", number_of_text_boxes=0, tspans=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		
		self.frmTitles = instance
		self.tspans = tspans
		self.number_of_text_boxes = number_of_text_boxes
		self.accepted = False

		for i in range(0, self.number_of_text_boxes):
			# get text in SVG
			SVG_Text = ""
			if len(tspans[i].childNodes) > 0:
				SVG_Text = tspans[i].childNodes[0].data
				
			
			# create textbox & add to window
			tbox = gtk.Entry(max=0)
			tbox.set_text(SVG_Text)
			self.vbox3.pack_start(tbox, expand=True, fill=False)

		self.frmEditText.show_all()
コード例 #32
0
	def __init__(self, path="ExportVideo.ui", root="frmExportVideo", domain="LibreShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		# set important vars
		self.form = form
		self.project = project
		self.original_project_type = self.project.project_type		# remember the original project type (i.e. mlt_profile)
		
		# Show all controls on this screen
		self.frmExportVideo.show_all()
		
		# set window as MODAL (so they can't mess up the export)
		self.frmExportVideo.set_modal(True)
		
		self.invalid_codecs = []
		
		# init the project type properties
		self.init_properties(self.cmbProjectType.get_active_text())
		
		# set the export file name
		self.txtFileName.set_text(self.project.name)

		# set the export folder as the project folder (if any)
		if ".libreshot" in self.project.folder:
			# This is the libreshot default project (set the folder to 'DESKTOP')
			self.fileExportFolder.set_current_folder(self.project.DESKTOP)
		else:
			# Set project folder
			self.fileExportFolder.set_current_folder(self.project.folder)
		
		# init the list of possible project types / profiles
		self.profile_list = profiles.mlt_profiles(self.project).get_profile_list()
		
		# loop through each profile, and add it to the dropdown
		for file_name, p in self.profile_list:
			# append profile to list
			self.cmbProjectType.append_text(p.description())
					
		export_options = [_("Video & Audio"), _("Image Sequence")]
		# loop through export to options
		for option in export_options:
			# append profile to list
			self.cboExportTo.append_text(option)


		export_types_model = self.cboExportType.get_model()
		export_types_model.clear()
		
		export_types = [_("Export to Folder"), _("Upload to Web")]
		# loop through export to options
		for option in export_types:
			# append profile to list
			self.cboExportType.append_text(option)
		self.set_dropdown_values(_("Export to Folder"), self.cboExportType)
		
		
		upload_model = self.cboUploadServices.get_model()
		upload_model.clear()
		
		self.upload_manager = UploadManager(project, self.form.settings)
		self.upload_services = self.upload_manager.get_services()
		upload_types = self.upload_services.keys()
		upload_types.sort()
		# loop through export to options
		for option in upload_types:
			# append profile to list
			self.cboUploadServices.append_text(option)
		self.set_dropdown_values(_("YouTube"), self.cboUploadServices)
		

		#populate the format/codec drop downs 
		#formats
		format_model = self.cboVIdeoFormat.get_model()
		format_model.clear()
		
		for format in self.form.vformats:
			self.cboVIdeoFormat.append_text(format)
			
		#video codecs
		vcodecs_model = self.cboVideoCodec.get_model()
		vcodecs_model.clear()
		
		for vcodec in self.form.vcodecs:
			self.cboVideoCodec.append_text(vcodec)
			
		#audio codecs
		acodecs_model = self.cboAudioCodec.get_model()
		acodecs_model.clear()
		
		# Add 'none' audio codec
		self.cboAudioCodec.append_text( "none" )
		for acodec in self.form.acodecs:
			# Add the rest of the audio codecs
			self.cboAudioCodec.append_text(acodec)
			
			
		# set the dropdown boxes
		self.set_project_type_dropdown()
		self.set_export_to_dropdown()
		
		#load the simple project type dropdown
		presets = []
		for file in os.listdir(self.project.EXPORT_PRESETS_DIR):
			xmldoc = xml.parse(os.path.join(self.project.EXPORT_PRESETS_DIR,file))
			type = xmldoc.getElementsByTagName("type")
			presets.append(_(type[0].childNodes[0].data))
		#exclude duplicates
		presets = list(set(presets))
		for item in sorted(presets):
			self.cboSimpleProjectType.append_text(item)
			
		#indicate that exporting cancelled
		self.cancelled = False
		
		# create the infobar displaying the missing codec message
		self.use_infobar = True
		self.last_error = None
		try:
			self.infobar = gtk.InfoBar()
			self.content = self.infobar.get_content_area()
			self.label = gtk.Label()
			
			self.image = gtk.Image()
			self.image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
			
			self.content.add(self.image)
			self.content.add(self.label)
			self.vbox1.pack_start(self.infobar)
			self.vbox1.reorder_child(self.infobar, 3)
			self.infobar.set_message_type(gtk.MESSAGE_WARNING)
		except:
			# older version of pygtk can not create an InfoBar
			self.use_infobar = False
コード例 #33
0
    def __init__(self,
                 path="Preferences.ui",
                 root="frmPreferences",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.project = project
        self.form = form

        if getIconPath("libreshot"):
            self.frmPreferences.set_icon_from_file(getIconPath("libreshot"))

        #populate the profiles dropdown
        self.populate_profiles()

        #populate the themes
        for dir in os.listdir(self.project.THEMES_DIR):
            self.cmbThemes.append_text(dir)

        #populate the languages
        self.cmbLanguage.append_text(_("default"))
        p = subprocess.Popen("locale -a", stdout=subprocess.PIPE, shell=True)
        langlist = p.communicate()
        for langitem in langlist:
            if bool(langitem):
                avlblang = langitem.split()
                for snglang in avlblang:
                    self.cmbLanguage.append_text(snglang)

        # populate output mode combo
        for output_mode in ["sdl", "sdl_preview"]:
            self.cmbOutputModes.append_text(output_mode)

        # populate scrolling options
        for use_stock in [_("Yes"), _("No")]:
            self.cmbSmoothScrolling.append_text(use_stock)

        # populate icon size options
        for icon_size in [_("Small"), _("Medium")]:
            self.cmbIconSize.append_text(icon_size)

        # disable scrolling options (based on MLT version)
        if self.form.MyVideo:
            if self.form.MyVideo.check_version(0, 6, 0):
                self.cmbSmoothScrolling.set_sensitive(True)
            else:
                self.cmbSmoothScrolling.set_sensitive(False)

        # populate stock icons combo
        for use_stock in [_("Yes"), _("No")]:
            self.cmbUseStockIcons.append_text(use_stock)

        #populate the codecs & formats
        self.VCodecList = gtk.ListStore(str)
        self.tvVCodecs.set_model(self.VCodecList)
        tree.treeviewAddGeneralTextColumn(self.tvVCodecs, _('Video Codecs'), 0)

        self.ACodecList = gtk.ListStore(str)
        self.tvACodecs.set_model(self.ACodecList)
        tree.treeviewAddGeneralTextColumn(self.tvACodecs, _('Audio Codecs'), 0)

        self.FormatsList = gtk.ListStore(str)
        self.tvFormats.set_model(self.FormatsList)
        tree.treeviewAddGeneralTextColumn(self.tvFormats, _('Formats'), 0)
        self.populate_codecs()

        #populate form objects
        self.valImageLength.set_value(
            float(self.form.settings.general["imported_image_length"].replace(
                ",", ".")))
        self.valHistoryStackSize.set_value(
            float(self.form.settings.general["max_history_size"]))
        self.txtMeltCommandName.set_text(
            self.form.settings.general["melt_command"])
        self.txtBlenderCommand.set_text(
            self.form.settings.general["blender_command"])
        theme_name = self.form.settings.general["default_theme"]
        self.set_dropdown_values(theme_name, self.cmbThemes)
        self.set_dropdown_values(self.form.settings.general["output_mode"],
                                 self.cmbOutputModes)

        # Init stock dropdown
        use_stock_icons = self.form.settings.general["use_stock_icons"]
        if use_stock_icons == "Yes":
            self.set_dropdown_values(_("Yes"), self.cmbUseStockIcons)
        else:
            self.set_dropdown_values(_("No"), self.cmbUseStockIcons)

        # Init smooth scrolling dropdown
        use_affine = self.form.settings.general["use_affine"]
        if use_affine == "Yes":
            self.set_dropdown_values(_("Yes"), self.cmbSmoothScrolling)
        else:
            self.set_dropdown_values(_("No"), self.cmbSmoothScrolling)

        # Init icon size dropdown
        icon_size = self.form.settings.general["icon_size"]
        if icon_size == "small":
            self.set_dropdown_values(_("Small"), self.cmbIconSize)
        else:
            self.set_dropdown_values(_("Medium"), self.cmbIconSize)

        #autosave objects
        if self.form.settings.general["autosave_enabled"] == "True":
            self.chkEnableAutosave.set_active(True)
        else:
            self.chkEnableAutosave.set_active(False)
        self.chkEnableAutosave.toggled()

        if self.form.settings.general["save_before_playback"] == "True":
            self.chkSaveBeforePlayback.set_active(True)
        else:
            self.chkSaveBeforePlayback.set_active(False)
        self.chkSaveBeforePlayback.toggled()

        self.valSaveInterval.set_value(
            int(self.form.settings.general["save_interval"]))

        #show the form
        self.frmPreferences.show_all()
コード例 #34
0
ファイル: preferences.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="Preferences.ui", root="frmPreferences", domain="OpenShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)
		
		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _
		
		self.project = project
		self.form = form

		if getIconPath("openshot"):
			self.frmPreferences.set_icon_from_file(getIconPath("openshot"))
		
		#populate the profiles dropdown
		self.populate_profiles()

		#populate the themes
		for dir in os.listdir(self.project.THEMES_DIR):
			self.cmbThemes.append_text(dir)
		
		# populate output mode combo
		for output_mode in ["sdl", "sdl_preview"]:
			self.cmbOutputModes.append_text(output_mode)
			
		# populate scrolling options
		for use_stock in [_("Yes"), _("No")]:
			self.cmbSmoothScrolling.append_text(use_stock)
			
		# populate icon size options
		for icon_size in [_("Small"), _("Medium")]:
			self.cmbIconSize.append_text(icon_size)
			
		# disable scrolling options (based on MLT version)
		if self.form.MyVideo:
			if self.form.MyVideo.check_version(0, 6, 0):
				self.cmbSmoothScrolling.set_sensitive(True)
			else:
				self.cmbSmoothScrolling.set_sensitive(False)

		# populate stock icons combo
		for use_stock in [_("Yes"), _("No")]:
			self.cmbUseStockIcons.append_text(use_stock)

			
		#populate the codecs & formats
		self.VCodecList = gtk.ListStore(str)
		self.tvVCodecs.set_model(self.VCodecList)
		tree.treeviewAddGeneralTextColumn(self.tvVCodecs,_('Video Codecs'),0)
		
		self.ACodecList = gtk.ListStore(str)
		self.tvACodecs.set_model(self.ACodecList)
		tree.treeviewAddGeneralTextColumn(self.tvACodecs,_('Audio Codecs'),0)
		
		self.FormatsList = gtk.ListStore(str)
		self.tvFormats.set_model(self.FormatsList)
		tree.treeviewAddGeneralTextColumn(self.tvFormats,_('Formats'),0)	
		self.populate_codecs()
		
			
		#populate form objects
		self.valImageLength.set_value(float(self.form.settings.general["imported_image_length"].replace(",",".")))
		self.valHistoryStackSize.set_value(float(self.form.settings.general["max_history_size"]))
		self.txtMeltCommandName.set_text(self.form.settings.general["melt_command"])
		self.txtBlenderCommand.set_text(self.form.settings.general["blender_command"])
		theme_name = self.form.settings.general["default_theme"]
		self.set_dropdown_values(theme_name, self.cmbThemes)
		self.set_dropdown_values(self.form.settings.general["output_mode"], self.cmbOutputModes)
		
		# Init stock dropdown
		use_stock_icons = self.form.settings.general["use_stock_icons"]
		if use_stock_icons == "Yes":
			self.set_dropdown_values(_("Yes"), self.cmbUseStockIcons)
		else:
			self.set_dropdown_values(_("No"), self.cmbUseStockIcons)
		
		# Init smooth scrolling dropdown
		use_affine = self.form.settings.general["use_affine"]
		if use_affine == "Yes":
			self.set_dropdown_values(_("Yes"), self.cmbSmoothScrolling)
		else:
			self.set_dropdown_values(_("No"), self.cmbSmoothScrolling)
		
		# Init icon size dropdown
		icon_size = self.form.settings.general["icon_size"]
		if icon_size == "small":
			self.set_dropdown_values(_("Small"), self.cmbIconSize)
		else:
			self.set_dropdown_values(_("Medium"), self.cmbIconSize)
		
		#autosave objects
		if self.form.settings.general["autosave_enabled"] == "True":
			self.chkEnableAutosave.set_active(True)
		else:
			self.chkEnableAutosave.set_active(False)
		self.chkEnableAutosave.toggled()
		
		if self.form.settings.general["save_before_playback"] == "True":
			self.chkSaveBeforePlayback.set_active(True)
		else:
			self.chkSaveBeforePlayback.set_active(False)
		self.chkSaveBeforePlayback.toggled()
		
		self.valSaveInterval.set_value(int(self.form.settings.general["save_interval"]))
		
		#show the form
		self.frmPreferences.show_all()
コード例 #35
0
ファイル: Titles.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="titles.ui", root="frmTitles", domain="OpenShot", form=None, project=None, file=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.project = project
		self.form = form
		self.file = file

		#find path where openshot is running
		self.path = self.project.BASE_DIR

		self.cmbTemplate.set_sensitive(True)

		self.xmldoc = ""

		self.bg_color_code = ""
		self.font_color_code = "#ffffff"

		self.bg_style_string = ""
		self.title_style_string = ""
		self.subtitle_style_string = ""

		self.font_weight = 'normal'
		self.font_style = 'normal'

		self.new_title_text = ""
		self.sub_title_text = ""
		self.subTitle = False
		
		self.display_name = ""
		self.font_family = "Bitstream Vera Sans"

		# get the aspect ratio of the current project
		p = profiles.mlt_profiles(self.project).get_profile(self.project.project_type)
		
		# determine which ratio folder to get titles from
		self.ratio_folder = ""
		if p.display_aspect_num() == 4 and p.display_aspect_den() == 3:
			self.ratio_folder = "4_3"
		else:
			self.ratio_folder = "16_9"

		#load the template files
		self.template_dir = os.path.join(self.path, "openshot", "titles", self.ratio_folder)
		for file in sorted(os.listdir(self.template_dir)):
			#pretty up the filename for display purposes
			if fnmatch.fnmatch(file, '*.svg'):
				(fileName, fileExtension)=os.path.splitext(file)
			self.cmbTemplate.append_text(fileName.replace("_"," "))

		#add the changed event once the combo has been populated
		self.cmbTemplate.connect("changed", self.on_cmbTemplate_changed)

		if not self.file:
			self.cmbTemplate.grab_focus()
			# init dropdown
			self.set_template_dropdown()
		else:
			self.filename = self.file
			self.load_svg_template(self.file)
			
			try:
				self.update_font_color_button()
				self.update_background_color_button()
			except:
				print "Warning: Failed to initialize the color pickers from the SVG."
			
			#set edit button states
			self.btnEditText.set_sensitive(True)
			self.btnFont.set_sensitive(True)
			self.btnFontColor.set_sensitive(True)
			self.btnBackgroundColor.set_sensitive(True)
			self.btnAdvanced.set_sensitive(True)
			self.writeToFile(self.xmldoc)
			#preview the file
			self.set_img_pixbuf(self.filename)
			
			#show the text editor
			if self.noTitles == False:
				self.on_btnEditText_clicked(None)
			
			#turn off the create button once we have created the new file
			self.btnCreate.set_sensitive(False)
			self.cmbTemplate.set_sensitive(False)
			
			if self.noTitles == True:
				self.btnEditText.set_sensitive(False)
				self.btnFont.set_sensitive(False)
				self.btnFontColor.set_sensitive(False)
コード例 #36
0
    def __init__(self,
                 path="AddEffect.ui",
                 root="frmAddEffect",
                 domain="LibreShot",
                 parent=None,
                 form=None,
                 project=None,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext

        self.form = form
        self.project = project
        self.parent = parent
        EFFECTS_DIR = self.project.EFFECTS_DIR

        # Init Dropdown and model
        # create a ListStore
        self.store = gtk.ListStore(gtk.gdk.Pixbuf, str)
        self.sort_model = gtk.TreeModelSort(self.store)

        # Sort Effects ListStore
        self.sort_model.set_sort_column_id(1, gtk.SORT_ASCENDING)

        # Set the treeview's data model
        self.cboEffects.set_model(self.sort_model)

        # Init List of Effects
        effect_list = self.form.effect_list

        # Add effects to dropdown
        sorted_list = []
        for my_effect in effect_list:

            # is frei0r effect library installed?
            if self.form.has_frei0r_installed == False and my_effect.service.startswith(
                    "frei0r"):
                # frei0r not installed, and this is a frei0r effect
                # skip to next item in loop
                continue

            # does the frei0r installation include this effect?
            if my_effect.service.startswith("frei0r"):
                if my_effect.service not in self.form.filters:
                    # don't add this effect, skip to the next one
                    continue

            # get image for filter
            file_path = os.path.join(EFFECTS_DIR, "icons", "small",
                                     my_effect.icon)

            # get the pixbuf
            pbThumb = gtk.gdk.pixbuf_new_from_file(file_path)

            # add effect to tree
            item = self.store.append(None)
            self.store.set_value(item, 0, pbThumb)
            self.store.set_value(item, 1, _(my_effect.title))

        # show all controls
        self.frmAddEffect.show_all()
コード例 #37
0
    def __init__(self,
                 mode="",
                 path="NewProject.ui",
                 root="frmNewProject",
                 domain="LibreShot",
                 project=None,
                 **kwargs):
        print "init"
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        self._ = Language_Init.Translator(project).lang.gettext
        _ = self._

        # project instance
        self.project = project
        self.form = project.form

        # check the mode of the form (i.e. new project or save as screen)
        self.mode = mode

        # init the project type properties
        self.init_properties()

        # init the list of possible project types / profiles
        self.profile_list = profiles.mlt_profiles(
            self.project).get_profile_list()

        # loop through each profile, and add it to the dropdown
        for file_name, p in self.profile_list:
            # append profile to list
            self.cmbProjectType.append_text(p.description())

        # SET THE SAVE FOLDER LOCATION
        if ".libreshot" in self.project.folder:
            # This is the libreshot default project (set the folder to 'DESKTOP')
            self.fileProjectFolder.set_current_folder(self.project.DESKTOP)

        elif len(self.project.folder) > 0:
            # set default folder (if there is a current folder)
            self.fileProjectFolder.set_current_folder(self.project.folder)

        # init the profile
        self.set_dropdown_values(self.form.settings.general["default_profile"],
                                 self.cmbProjectType)

        if (self.mode == "saveas"):
            # Save project as
            # Set window title
            self.frmNewProject.set_title(_("Save Project As..."))

            # init the project name
            self.txtProjectName.set_text(self.project.name)

            # init the profile
            self.set_dropdown_values(self.project.project_type,
                                     self.cmbProjectType)

        else:
            # New Project
            # Set window title
            self.frmNewProject.set_title(_("Create a Project"))

            # init the project name
            self.txtProjectName.set_text(_("Default Project"))
コード例 #38
0
ファイル: ExportVideo.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="ExportVideo.ui", root="frmExportVideo", domain="OpenShot", form=None, project=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		# set important vars
		self.form = form
		self.project = project
		self.original_project_type = self.project.project_type		# remember the original project type (i.e. mlt_profile)
		
		# Show all controls on this screen
		self.frmExportVideo.show_all()
		
		# set window as MODAL (so they can't mess up the export)
		self.frmExportVideo.set_modal(True)
		
		self.invalid_codecs = []
		
		# init the project type properties
		self.init_properties(self.cmbProjectType.get_active_text())
		
		# set the export file name
		self.txtFileName.set_text(self.project.name)

		# set the export folder as the project folder (if any)
		if ".openshot" in self.project.folder:
			# This is the openshot default project (set the folder to 'DESKTOP')
			self.fileExportFolder.set_current_folder(self.project.DESKTOP)
		else:
			# Set project folder
			self.fileExportFolder.set_current_folder(self.project.folder)
		
		# init the list of possible project types / profiles
		self.profile_list = profiles.mlt_profiles(self.project).get_profile_list()
		
		# loop through each profile, and add it to the dropdown
		for file_name, p in self.profile_list:
			# append profile to list
			self.cmbProjectType.append_text(p.description())
					
		export_options = [_("Video & Audio"), _("Image Sequence")]
		# loop through export to options
		for option in export_options:
			# append profile to list
			self.cboExportTo.append_text(option)


		export_types_model = self.cboExportType.get_model()
		export_types_model.clear()
		
		export_types = [_("Export to Folder"), _("Upload to Web")]
		# loop through export to options
		for option in export_types:
			# append profile to list
			self.cboExportType.append_text(option)
		self.set_dropdown_values(_("Export to Folder"), self.cboExportType)
		
		
		upload_model = self.cboUploadServices.get_model()
		upload_model.clear()
		
		self.upload_manager = UploadManager(project, self.form.settings)
		self.upload_services = self.upload_manager.get_services()
		upload_types = self.upload_services.keys()
		upload_types.sort()
		# loop through export to options
		for option in upload_types:
			# append profile to list
			self.cboUploadServices.append_text(option)
		self.set_dropdown_values(_("YouTube"), self.cboUploadServices)
		

		#populate the format/codec drop downs 
		#formats
		format_model = self.cboVIdeoFormat.get_model()
		format_model.clear()
		
		for format in self.form.vformats:
			self.cboVIdeoFormat.append_text(format)
			
		#video codecs
		vcodecs_model = self.cboVideoCodec.get_model()
		vcodecs_model.clear()
		
		for vcodec in self.form.vcodecs:
			self.cboVideoCodec.append_text(vcodec)
			
		#audio codecs
		acodecs_model = self.cboAudioCodec.get_model()
		acodecs_model.clear()
		
		# Add 'none' audio codec
		self.cboAudioCodec.append_text( "none" )
		for acodec in self.form.acodecs:
			# Add the rest of the audio codecs
			self.cboAudioCodec.append_text(acodec)
			
			
		# set the dropdown boxes
		self.set_project_type_dropdown()
		self.set_export_to_dropdown()
		
		#load the simple project type dropdown
		presets = []
		for file in os.listdir(self.project.EXPORT_PRESETS_DIR):
			xmldoc = xml.parse(os.path.join(self.project.EXPORT_PRESETS_DIR,file))
			type = xmldoc.getElementsByTagName("type")
			presets.append(_(type[0].childNodes[0].data))
		#exclude duplicates
		presets = list(set(presets))
		for item in sorted(presets):
			self.cboSimpleProjectType.append_text(item)
			
		#indicate that exporting cancelled
		self.cancelled = False
		
		# create the infobar displaying the missing codec message
		self.use_infobar = True
		self.last_error = None
		try:
			self.infobar = gtk.InfoBar()
			self.content = self.infobar.get_content_area()
			self.label = gtk.Label()
			
			self.image = gtk.Image()
			self.image.set_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
			
			self.content.add(self.image)
			self.content.add(self.label)
			self.vbox1.pack_start(self.infobar)
			self.vbox1.reorder_child(self.infobar, 3)
			self.infobar.set_message_type(gtk.MESSAGE_WARNING)
		except:
			# older version of pygtk can not create an InfoBar
			self.use_infobar = False
コード例 #39
0
ファイル: ClipProperties.py プロジェクト: DjMorgul/libreshot
    def __init__(self,
                 path="ClipProperties.ui",
                 root="frmClipProperties",
                 domain="LibreShot",
                 form=None,
                 project=None,
                 current_clip=None,
                 current_clip_item=None,
                 initial_tab=0,
                 **kwargs):
        SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path),
                                     root, domain, **kwargs)

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _

        self.form = form
        self.project = project
        self.current_clip = current_clip
        self.current_clip_item = current_clip_item
        self.restore_window_size()
        self.frmClipProperties.show_all()

        # Stop the video thread consumer
        self.form.MyVideo.pause()
        self.form.MyVideo.consumer_stop()
        # Force SDL to write on our drawing area
        os.putenv('SDL_WINDOWID', str(self.previewscreen.window.xid))
        gtk.gdk.flush()

        # make a copy of the current clip (for preview reasons)
        self.copy_of_clip = copy.copy(self.current_clip)
        self.copy_of_clip.keyframes = copy.deepcopy(
            self.current_clip.keyframes)
        self.copy_of_clip.effects = copy.deepcopy(self.current_clip.effects)
        self.copy_of_clip.position_on_track = 0

        # add items to direction combo
        options = [
            "16x", "15x", "14x", "13x", "12x", "11x", "10x", "9x", "8x", "7x",
            "6x", "5x", "4x", "3x", "2x",
            _("Normal Speed"), "1/2", "1/3", "1/4", "1/5", "1/6", "1/7", "1/8",
            "1/9", "1/10", "1/11", "1/12", "1/13", "1/14", "1/15", "1/16"
        ]
        # loop through export to options
        for option in options:
            # append profile to list
            self.cboSimpleSpeed.append_text(option)

        # add items to direction combo
        options = [_("Forward"), _("Reverse")]
        # loop through export to options
        for option in options:
            # append profile to list
            self.cboDirection.append_text(option)

        # get file name
        (dirName, fname) = os.path.split(self.current_clip.file_object.name)

        # get a local keyframe collection
        self.keyframes = copy.deepcopy(self.current_clip.keyframes)

        # init the default properties
        self.txtFileName.set_text(fname)
        self.spinbtnStart.set_value(self.current_clip.position_on_track)
        self.txtLength.set_text(
            _("{0} seconds").format(str(self.current_clip.length())))
        # Out time needs to me loaded before in time otherwise the properties window doesn't remember a cut start time when re-opened
        self.txtOut.set_value(round(self.current_clip.end_time, 2))
        self.txtIn.set_value(round(self.current_clip.start_time, 2))
        self.txtAudioFadeInAmount.set_value(
            round(self.current_clip.audio_fade_in_amount, 2))
        self.txtAudioFadeOutAmount.set_value(
            round(self.current_clip.audio_fade_out_amount, 2))
        self.txtVideoFadeInAmount.set_value(
            round(self.current_clip.video_fade_in_amount, 2))
        self.txtVideoFadeOutAmount.set_value(
            round(self.current_clip.video_fade_out_amount, 2))
        self.txtRotate.set_value(round(self.current_clip.rotation, 2))
        self.sliderVolume.set_value(self.current_clip.volume)
        self.chkFill.set_active(self.current_clip.fill)
        self.chkEffectsApplyAll.set_active(False)

        if self.current_clip.distort:
            self.chkMaintainAspect.set_active(False)
        else:
            self.chkMaintainAspect.set_active(True)

        self.chkVideoFadeIn.set_active(self.current_clip.video_fade_in)
        self.chkVideoFadeOut.set_active(self.current_clip.video_fade_out)
        self.chkAudioFadeIn.set_active(self.current_clip.audio_fade_in)
        self.chkAudioFadeOut.set_active(self.current_clip.audio_fade_out)

        self.spinAdvancedSpeed.set_value(self.current_clip.speed)
        self.set_horizontal_align_dropdown()
        self.set_vertical_align_dropdown()
        self.chkEnableVideo.set_active(self.current_clip.play_video)
        self.chkEnableAudio.set_active(self.current_clip.play_audio)
        self.set_direction_dropdown()
        self.set_speed_dropdown()
        self.set_StartEnd_values()

        # Hide the speed tab, if this is an image
        if self.current_clip.file_object.file_type == "video":
            # Speed only works for videos.  Image Sequences, audio, and images break with this setting.
            # So, we only show this setting for videos.
            self.vboxSpeed.set_property('visible', True)
        else:
            self.vboxSpeed.set_property('visible', False)

        # update effects tree
        self.OSTreeEffects = TreeEffects.LibreShotTree(self.treeEffects,
                                                       self.project)
        self.update_effects_tree()

        # Refresh XML
        self.RefreshPreview()

        # start and stop the video
        #self.form.MyVideo.play()
        #self.form.MyVideo.pause()

        # set the initial tab
        self.notebook1.set_current_page(initial_tab)

        # mark project as modified
        # so that the real project is refreshed... even if these
        # preview changes are not accepted
        self.project.set_project_modified(is_modified=True, refresh_xml=True)
コード例 #40
0
ファイル: Titles.py プロジェクト: DjMorgul/libreshot
	def __init__(self, path="titles.ui", root="frmTitles", domain="LibreShot", form=None, project=None, file=None, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.project = project
		self.form = form
		self.file = file

		#find path where libreshot is running
		self.path = self.project.BASE_DIR

		self.cmbTemplate.set_sensitive(True)

		self.xmldoc = ""

		self.bg_color_code = ""
		self.font_color_code = "#ffffff"

		self.bg_style_string = ""
		self.title_style_string = ""
		self.subtitle_style_string = ""

		self.font_weight = 'normal'
		self.font_style = 'normal'

		self.new_title_text = ""
		self.sub_title_text = ""
		self.subTitle = False
		
		self.display_name = ""
		self.font_family = "Bitstream Vera Sans"

		# get the aspect ratio of the current project
		p = profiles.mlt_profiles(self.project).get_profile(self.project.project_type)
		
		# determine which ratio folder to get titles from
		self.ratio_folder = ""
		if p.display_aspect_num() == 4 and p.display_aspect_den() == 3:
			self.ratio_folder = "4_3"
		else:
			self.ratio_folder = "16_9"

		#load the template files
		self.template_dir = os.path.join(self.path, "libreshot", "titles", self.ratio_folder)
		for file in sorted(os.listdir(self.template_dir)):
			#pretty up the filename for display purposes
			if fnmatch.fnmatch(file, '*.svg'):
				(fileName, fileExtension)=os.path.splitext(file)
			self.cmbTemplate.append_text(fileName.replace("_"," "))

		#add the changed event once the combo has been populated
		self.cmbTemplate.connect("changed", self.on_cmbTemplate_changed)

		if not self.file:
			self.cmbTemplate.grab_focus()
			# init dropdown
			self.set_template_dropdown()
		else:
			self.filename = self.file
			self.load_svg_template(self.file)
			
			try:
				self.update_font_color_button()
				self.update_background_color_button()
			except:
				print "Warning: Failed to initialize the color pickers from the SVG."
			
			#set edit button states
			self.btnEditText.set_sensitive(True)
			self.btnFont.set_sensitive(True)
			self.btnFontColor.set_sensitive(True)
			self.btnBackgroundColor.set_sensitive(True)
			self.btnAdvanced.set_sensitive(True)
			self.writeToFile(self.xmldoc)
			#preview the file
			self.set_img_pixbuf(self.filename)
			
			#show the text editor
			if self.noTitles == False:
				self.on_btnEditText_clicked(None)
			
			#turn off the create button once we have created the new file
			self.btnCreate.set_sensitive(False)
			self.cmbTemplate.set_sensitive(False)
			
			if self.noTitles == True:
				self.btnEditText.set_sensitive(False)
				self.btnFont.set_sensitive(False)
				self.btnFontColor.set_sensitive(False)
コード例 #41
0
ファイル: ClipProperties.py プロジェクト: XXLRay/libreshot
	def __init__(self, path="ClipProperties.ui", root="frmClipProperties", domain="OpenShot", form=None, project=None, current_clip=None, current_clip_item=None, initial_tab=0, **kwargs):
		SimpleGtkBuilderApp.__init__(self, os.path.join(project.UI_DIR, path), root, domain, **kwargs)

		# Add language support
		_ = Language_Init.Translator(project).lang.gettext
		self._ = _

		self.form = form
		self.project = project
		self.current_clip = current_clip
		self.current_clip_item = current_clip_item
		self.restore_window_size()
		self.frmClipProperties.show_all()

		# Stop the video thread consumer
		self.form.MyVideo.pause()
		self.form.MyVideo.consumer_stop()
		# Force SDL to write on our drawing area
		os.putenv('SDL_WINDOWID', str(self.previewscreen.window.xid))
		gtk.gdk.flush()
		
		# make a copy of the current clip (for preview reasons)
		self.copy_of_clip = copy.copy(self.current_clip)
		self.copy_of_clip.keyframes = copy.deepcopy(self.current_clip.keyframes)
		self.copy_of_clip.effects = copy.deepcopy(self.current_clip.effects)
		self.copy_of_clip.position_on_track = 0

		# add items to direction combo
		options = ["16x", "15x", "14x", "13x", "12x", "11x", "10x", "9x", "8x", "7x", "6x", "5x", "4x", "3x", "2x", _("Normal Speed"), "1/2", "1/3", "1/4", "1/5", "1/6", "1/7", "1/8", "1/9", "1/10", "1/11", "1/12", "1/13", "1/14", "1/15", "1/16" ]
		# loop through export to options
		for option in options:
			# append profile to list
			self.cboSimpleSpeed.append_text(option)
			
		# add items to direction combo
		options = [_("Forward"), _("Reverse")]
		# loop through export to options
		for option in options:
			# append profile to list
			self.cboDirection.append_text(option)
			
		# get file name
		(dirName, fname) = os.path.split(self.current_clip.file_object.name)
		
		# get a local keyframe collection
		self.keyframes = copy.deepcopy(self.current_clip.keyframes)
		
		# init the default properties
		self.txtFileName.set_text(fname)
		self.spinbtnStart.set_value(self.current_clip.position_on_track)
		self.txtLength.set_text(_("{0} seconds").format(str(self.current_clip.length())))
		# Out time needs to me loaded before in time otherwise the properties window doesn't remember a cut start time when re-opened
		self.txtOut.set_value(round(self.current_clip.end_time, 2))
                self.txtIn.set_value(round(self.current_clip.start_time, 2))
		self.txtAudioFadeInAmount.set_value(round(self.current_clip.audio_fade_in_amount, 2))
		self.txtAudioFadeOutAmount.set_value(round(self.current_clip.audio_fade_out_amount, 2))
		self.txtVideoFadeInAmount.set_value(round(self.current_clip.video_fade_in_amount, 2))
		self.txtVideoFadeOutAmount.set_value(round(self.current_clip.video_fade_out_amount, 2))
		self.txtRotate.set_value(round(self.current_clip.rotation, 2))
		self.sliderVolume.set_value(self.current_clip.volume)
		self.chkFill.set_active(self.current_clip.fill)
		self.chkEffectsApplyAll.set_active(False)
		
		if self.current_clip.distort:
			self.chkMaintainAspect.set_active(False)
		else:
			self.chkMaintainAspect.set_active(True)
			
		self.chkVideoFadeIn.set_active(self.current_clip.video_fade_in)
		self.chkVideoFadeOut.set_active(self.current_clip.video_fade_out)
		self.chkAudioFadeIn.set_active(self.current_clip.audio_fade_in)
		self.chkAudioFadeOut.set_active(self.current_clip.audio_fade_out)
		
		self.spinAdvancedSpeed.set_value(self.current_clip.speed)
		self.set_horizontal_align_dropdown()
		self.set_vertical_align_dropdown()
		self.chkEnableVideo.set_active(self.current_clip.play_video)
		self.chkEnableAudio.set_active(self.current_clip.play_audio)
		self.set_direction_dropdown()
		self.set_speed_dropdown()
		self.set_StartEnd_values()
		
		# Hide the speed tab, if this is an image
		if self.current_clip.file_object.file_type == "video":
			# Speed only works for videos.  Image Sequences, audio, and images break with this setting.
			# So, we only show this setting for videos.
			self.vboxSpeed.set_property('visible', True)
		else:
			self.vboxSpeed.set_property('visible', False)
		
		# update effects tree
		self.OSTreeEffects = TreeEffects.OpenShotTree(self.treeEffects, self.project)
		self.update_effects_tree()

		# Refresh XML
		self.RefreshPreview()

		# start and stop the video
		#self.form.MyVideo.play()
		#self.form.MyVideo.pause()
		
		# set the initial tab
		self.notebook1.set_current_page(initial_tab)
		
		# mark project as modified
		# so that the real project is refreshed... even if these
		# preview changes are not accepted
		self.project.set_project_modified(is_modified=True, refresh_xml=True)