Esempio n. 1
0
	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()
Esempio n. 2
0
    def __init__(
        self, path="Preferences.glade", root="frmPreferences", domain="OpenShot", form=None, project=None, **kwargs
    ):
        SimpleGladeApp.__init__(self, os.path.join(project.GLADE_DIR, path), root, domain, **kwargs)

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

        self.project = project
        self.form = form
        self.settings = Settings(self.project)

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

        view = self.icvCategories
        self.model = gtk.ListStore(str, gtk.gdk.Pixbuf)

        # Populate the form with the preference category icons
        # General section
        pixbuf = view.render_icon(gtk.STOCK_PREFERENCES, size=gtk.ICON_SIZE_BUTTON, detail=None)
        self.model.append([_("General"), pixbuf])

        # Formats section
        pixbuf = view.render_icon(gtk.STOCK_INFO, size=gtk.ICON_SIZE_BUTTON, detail=None)
        self.model.append([_("AV Formats"), pixbuf])

        # Formats section
        pixbuf = view.render_icon(gtk.STOCK_INFO, size=gtk.ICON_SIZE_BUTTON, detail=None)
        self.model.append([_("Profiles"), pixbuf])

        # Connect the iconview with the model
        view.set_model(self.model)
        # Map model text and pixbuf columns to iconview
        view.set_text_column(0)
        view.set_pixbuf_column(1)

        # populate the combo boxes
        # 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.cmbProfiles.append_text(str(file_name))

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

            # populate project file type combo
        for file_type in ["binary", "ascii"]:
            self.cmbFileType.append_text(file_type)

            # 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.txtImageLength.set_text(self.settings.general["imported_image_length"])
        self.txtHistoryStackSize.set_text(self.settings.general["max_history_size"])
        self.txtMeltCommandName.set_text(self.settings.general["melt_command"])
        theme_name = self.settings.general["default_theme"]
        file_type = self.settings.general["project_file_type"]
        self.set_dropdown_values(theme_name, self.cmbThemes)
        self.set_dropdown_values(self.settings.general["default_profile"], self.cmbProfiles)
        self.set_dropdown_values(file_type, self.cmbFileType)
        # set the example theme icon
        self.load_theme_image(theme_name)

        # show the form
        self.frmPreferences.show_all()
Esempio n. 3
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()