Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
    def __init__(self, seq_name, project):
        """Constructor"""

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

        # init variables for sequence
        self.name = seq_name
        self.length = 600.0  # length in seconds of sequence.  This controls how wide to render the tracks.
        self.project = project  # reference to current project
        self.scale = 8.0  # this represents how many seconds per tick mark
        self.tick_pixels = 100  # number of pixels between each tick mark
        self.play_head_position = 0.0  # position of the play head in seconds

        # init the tracks on the sequence
        self.tracks = []
        self.tracks.append(track.track(_("Track %s") % 2, self))
        self.tracks.append(track.track(_("Track %s") % 1, self))

        # init markers
        self.markers = []

        # reference to play_head goocanvas group
        self.play_head = None
        self.ruler_time = None
        self.play_head_line = None
        self.enable_animated_playhead = True
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
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()
Ejemplo n.º 6
0
	def __init__(self, project=None):
		self.project = project
		
		"""Constructor"""
		
		# Add language support
		translator = Language_Init.Translator(self.project)
		_ = translator.lang.gettext

		# init the variables for the File Object
		self.name = ""			# short / friendly name of the file
		self.length = 0.0		# length in seconds
		self.videorate = (30,0)	# audio rate or video framerate
		self.file_type = ""		# video, audio, image, image sequence
		self.max_frames = 0.0
		self.fps = 0.0
		self.height = 0
		self.width = 0
		self.label = ""			 # user description of the file
		self.thumb_location = "" # file uri of preview thumbnail
		self.ttl = 1			 # time-to-live - only used for image sequence.  Represents the # of frames per image.
		
		self.unique_id = str(uuid.uuid1())	
		self.parent = None
		self.project = project	  # reference to project
		
		self.video_codec = ""
		self.audio_codec = ""
		self.audio_frequency = ""
		self.audio_channels = ""
Ejemplo n.º 7
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()
Ejemplo n.º 8
0
    def __init__(self, project, settings):
        self.project = project
        self.filename = None
        self.settings = settings
        self.form = None

        # Add language support
        _ = Language_Init.Translator(project).lang.gettext
        self._ = _
Ejemplo n.º 9
0
    def __init__(self, project):
        """Constructor"""

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

        self.project = project
Ejemplo n.º 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()
Ejemplo n.º 11
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)
Ejemplo n.º 12
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()
Ejemplo n.º 13
0
    def __init__(self, treeview, project):

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

        # init vars
        self.treeview = treeview
        self.project = project

        # create a TreeStore
        self.store = gtk.TreeStore(gtk.gdk.Pixbuf, str, str, str)

        # Set the treeview's data model
        self.treeview.set_model(self.store)
        self.treeviewAddGeneralPixbufColumn(self.treeview,
                                            _("Thumb"),
                                            0,
                                            resizable=False,
                                            reorderable=False,
                                            project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          _("Name"),
                                          1,
                                          resizable=False,
                                          reorderable=True,
                                          editable=False,
                                          visible=True,
                                          elipses=False,
                                          autosize=True,
                                          project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          "blend_file",
                                          2,
                                          resizable=True,
                                          reorderable=True,
                                          editable=False,
                                          visible=False,
                                          project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          "unique_id",
                                          3,
                                          resizable=True,
                                          reorderable=True,
                                          editable=False,
                                          visible=False,
                                          project=self.project)

        # populate tree
        self.populate_tree()
Ejemplo n.º 14
0
	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)
Ejemplo n.º 15
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()
Ejemplo n.º 16
0
    def __init__(self, project, main_form, file_name, mode=None):
        self.project = project
        self.main_form = main_form
        self.file_name = file_name

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

        # set the FPS
        self.fps = self.project.fps()

        # update mode
        if mode:
            # set the mode
            self.mode = mode

        # call base class
        threading.Thread.__init__(self)
Ejemplo n.º 17
0
    def __init__(self, project, settings):
        self.project = project
        self.filename = None
        self.settings = settings
        self.token = None
        self.token_secret = None
        self.verifier = None
        self.form = None

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

        # get tokens (if already authorized)
        if self.settings.app_state["vimeo_token"]:
            self.token = self.settings.app_state["vimeo_token"]
        if self.settings.app_state["vimeo_token_secret"]:
            self.token_secret = self.settings.app_state["vimeo_token_secret"]
        if self.settings.app_state["vimeo_verifier"]:
            self.verifier = self.settings.app_state["vimeo_verifier"]
Ejemplo n.º 18
0
    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)
Ejemplo n.º 19
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")
Ejemplo n.º 20
0
    def __init__(self, track_name, parent_sequence):
        """Constructor"""

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

        # init variables for sequence
        self.name = track_name
        self.x = 10  # left x coordinate to start the track
        self.y_top = 0  # top y coordinate of this track
        self.y_bottom = 0  # bottom y coordinate of this track
        self.parent = parent_sequence  # reference to parent sequence object
        self.play_video = True
        self.play_audio = True
        self.unique_id = str(uuid.uuid1())

        # init the tracks on the sequence
        self.clips = []

        # init transitions
        self.transitions = []
Ejemplo n.º 21
0
    def __init__(self, treeview, project):

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

        # init vars
        self.treeview = treeview
        self.project = project

        # create a TreeStore
        self.store = gtk.TreeStore(str, str)

        # Set the treeview's data model
        self.treeview.set_model(self.store)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          _("Current"),
                                          0,
                                          resizable=False,
                                          reorderable=False,
                                          editable=False,
                                          visible=True,
                                          elipses=False,
                                          autosize=True,
                                          project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          _("Action"),
                                          1,
                                          resizable=False,
                                          reorderable=False,
                                          editable=False,
                                          visible=True,
                                          elipses=False,
                                          autosize=True,
                                          project=self.project)

        # populate tree
        self.populate_tree(0)
Ejemplo n.º 22
0
    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()
Ejemplo n.º 23
0
    def __init__(self, view, project):

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

        # init vars
        self.view = view
        self.project = project
        self.view.set_item_width(130)
        self.filter_category = "Show All"

        # create a TreeStore
        self.store = gtk.ListStore(gtk.gdk.Pixbuf, str, str)

        # Set the treeview's data model
        self.view.set_model(self.store)

        # Populate transitions
        self.populate()

        # connect signals
        self.view.connect_after('drag_begin',
                                self.on_icvTransitions_drag_begin)
Ejemplo n.º 24
0
	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()
Ejemplo n.º 25
0
	def __init__(self, init_threads=True):
		"""Constructor"""
		
		# debug message/function control
		self.DEBUG = True
		
		# define common directories containing resources
		# get the base directory of the libreshot installation for all future relative references
		# Note: don't rely on __file__ to be an absolute path. E.g., in the debugger (pdb) it will be
		# a relative path, so use os.path.abspath()
		self.BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
		self.UI_DIR = os.path.join(self.BASE_DIR, "libreshot", "windows", "ui")
		self.IMAGE_DIR = os.path.join(self.BASE_DIR, "libreshot", "images")
		self.LOCALE_DIR = os.path.join(self.BASE_DIR, "libreshot", "locale")
		self.PROFILES_DIR = os.path.join(self.BASE_DIR, "libreshot", "profiles")
		self.TRANSITIONS_DIR = os.path.join(self.BASE_DIR, "libreshot", "transitions")
		self.BLENDER_DIR = os.path.join(self.BASE_DIR, "libreshot", "blender")
		self.EXPORT_PRESETS_DIR = os.path.join(self.BASE_DIR, "libreshot", "export_presets")
		self.EFFECTS_DIR = os.path.join(self.BASE_DIR, "libreshot", "effects")
		# location for per-session, per-user, files to be written/read to
		self.DESKTOP = os.path.join(os.path.expanduser("~"), "Desktop")
		self.USER_DIR = os.path.join(os.path.expanduser("~"), ".libreshot")
		self.THEMES_DIR = os.path.join(self.BASE_DIR, "libreshot", "themes")
		self.USER_PROFILES_DIR = os.path.join(self.USER_DIR, "user_profiles")
		self.USER_TRANSITIONS_DIR = os.path.join(self.USER_DIR, "user_transitions")
		

		# only run the following code if we are really using 
		# this project file... 
		if init_threads:

			# Add language support
			translator = Language_Init.Translator(self)
			_ = translator.lang.gettext
			
			# init the variables for the project
			from windows import preferences
			self.name = _("Default Project")
			self.folder = self.USER_DIR
			self.project_type = preferences.Settings.general["default_profile"]
			self.canvas = None
			self.is_modified = False
			self.refresh_xml = True
			self.mlt_profile = None
			
			# set theme
			self.set_theme(preferences.Settings.general["default_theme"])
			
			# reference to the main GTK form
			self.form = None
			
			# init the file / folder list (used to populate the tree)
			self.project_folder = files.LibreShotFolder(self)
	
			# ini the sequences collection
			self.sequences = [sequences.sequence(_("Default Sequence 1"), self)]		
	
			# init the tab collection
			self.tabs = [self.sequences[0]]	  # holds a refernce to the sequences, and the order of the tabs
	
			# clear temp folder
			self.clear_temp_folder()
			
			# create thumbnailer object
			self.thumbnailer = thumbnail.thumbnailer()
			self.thumbnailer.set_project(self)
			self.thumbnailer.start()
Ejemplo n.º 26
0
    def __init__(self, treeview, project):

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

        # init vars
        self.treeview = treeview
        self.project = project
        self.filter_category = "Show All"

        self.store = None

        # Setup columns for treeview or iconview
        if type(treeview) == gtk.TreeView:
            # tree view
            # create a TreeStore
            self.store = gtk.TreeStore(gtk.gdk.Pixbuf, str, str, str, str)

            self.treeviewAddGeneralPixbufColumn(self.treeview,
                                                _("Thumb"),
                                                0,
                                                resizable=False,
                                                reorderable=False,
                                                project=self.project)
            self.treeviewAddGeneralTextColumn(self.treeview,
                                              _("Name"),
                                              1,
                                              resizable=False,
                                              reorderable=True,
                                              editable=False,
                                              visible=True,
                                              elipses=False,
                                              autosize=True,
                                              project=self.project)
            self.treeviewAddGeneralTextColumn(self.treeview,
                                              "service",
                                              2,
                                              resizable=True,
                                              reorderable=True,
                                              editable=False,
                                              visible=False,
                                              project=self.project)
            self.treeviewAddGeneralTextColumn(self.treeview,
                                              "unique_id",
                                              3,
                                              resizable=True,
                                              reorderable=True,
                                              editable=False,
                                              visible=False,
                                              project=self.project)
            self.treeviewAddGeneralTextColumn(self.treeview,
                                              "description",
                                              4,
                                              resizable=True,
                                              reorderable=True,
                                              editable=False,
                                              visible=False,
                                              project=self.project)
        else:
            # icon view
            # create a ListStore
            self.store = gtk.ListStore(gtk.gdk.Pixbuf, str, str, str, str)

            self.treeview.set_pixbuf_column(0)
            self.treeview.set_text_column(2)
            self.treeview.set_text_column(1)

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

        # populate tree
        self.populate_tree()

        # connect signals
        self.treeview.connect_after('drag_begin',
                                    self.on_treeEffects_drag_begin)

        # set tooltip column
        self.treeview.set_tooltip_column(4)
Ejemplo n.º 27
0
	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)
Ejemplo n.º 28
0
    def __init__(self, treeview, project):

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

        # init vars
        self.treeview = treeview
        self.project = project

        # create a TreeStore
        self.store = gtk.TreeStore(gtk.gdk.Pixbuf, str, str, str, str)

        #set multiple selection mode on the tree
        selection = treeview.get_selection()
        selection.set_mode(gtk.SELECTION_MULTIPLE)

        # Set the treeview's data model
        self.treeview.set_model(self.store)
        self.treeviewAddGeneralPixbufColumn(self.treeview,
                                            _("Thumb"),
                                            0,
                                            resizable=False,
                                            reorderable=False,
                                            project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          _("File"),
                                          1,
                                          resizable=True,
                                          reorderable=True,
                                          editable=False,
                                          visible=True,
                                          elipses=False,
                                          autosize=True,
                                          project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          _("Length"),
                                          2,
                                          resizable=True,
                                          reorderable=True,
                                          editable=False,
                                          visible=True,
                                          project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          _("Label"),
                                          3,
                                          resizable=True,
                                          reorderable=True,
                                          editable=True,
                                          visible=True,
                                          elipses=False,
                                          autosize=True,
                                          project=self.project)
        self.treeviewAddGeneralTextColumn(self.treeview,
                                          "unique_id",
                                          4,
                                          resizable=True,
                                          reorderable=True,
                                          editable=True,
                                          visible=False,
                                          elipses=True,
                                          project=self.project)

        #self.row = {}
        #self.row["0"] = [None, "Choose a Video or Audio File to Begin", "", "", ""]
        #self.store.append(None, [self.row["0"]])
        #item = self.store.append(None, [[gtk.STOCK_OPEN, _("Choose a Video or Audio File to Begin"), "", "", ""]])
        item = self.store.append(None)
        self.store.set_value(item, 0, None)
        self.store.set_value(item, 1,
                             _("Choose a Video or Audio File to Begin"))
        self.store.set_value(item, 2, "")
        self.store.set_value(item, 3, "")
        self.store.set_value(item, 4, "")

        # connect signals
        self.treeview.connect_after('drag_begin', self.on_treeFiles_drag_begin)
Ejemplo n.º 29
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()
Ejemplo n.º 30
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"))