def __create_new(self):
     """Create default preferences file."""
     msg = _(u"Please take a moment to set your preferences.\n\n")
     title = _(u"Preferences")
     utils.make_warn_msg(msg, title)
     # show preferences
     prefDiag = Dialog(None, self, initial=True)
     prefDiag.ShowModal()
     prefDiag.Destroy()
Exemple #2
0
 def __create_new(self):
     """
     Create default preferences file.
     """
     msg = _(u"Please take a moment to set your preferences.\n\n")
     title = _(u"Preferences")
     utils.make_warn_msg(msg, title)
     # show preferences
     prefDiag = Dialog(None, self, initial=True)
     prefDiag.ShowModal()
     prefDiag.Destroy()
Exemple #3
0
    def __load_file(self, configFilePath):
        """Read file and apply settings."""
        app.debug_print("loading config file : %s" % configFilePath)
        # attempt to open config file
        try:
            xmldoc = codecs.open(configFilePath, 'r', 'utf-8')
            xmldoc = minidom.parseString(xmldoc.read().encode("utf-8"))
        except:
            utils.make_err_msg(
                               _(u"Invalid XML in config file : %s") % configFilePath,
                               _(u"Invalid Configuration")
                               )
        else:
            config = xmldoc.firstChild

            # set autopreview to false while loading config
            # avoids loading paths more than once
            v = main.bottomWindow.autoPreview.GetValue()
            main.bottomWindow.autoPreview.SetValue(False)

            # get original path
            oldPath = main.picker.view.path.GetValue()

            self.__load_config_xml(config)
            
            if self.loadError:
                utils.make_warn_msg(_(u"Not all settings could be loaded."))

            # Do not replace a set path if one is not set in the config
            newPath = main.picker.view.path.GetValue()            
            if oldPath and not newPath:
                main.picker.view.path.SetValue(oldPath)

            # preview
            main.bottomWindow.autoPreview.SetValue(v)
            if app.autoModeLevel != 0 or\
                (app.prefs.get('previewOnConfig') and app.autoModeLevel is False):
                    main.picker.view.reset_dirpicker_on_config_load()
Exemple #4
0
    def __load_file(self, configFilePath):
        """Read file and apply settings."""
        app.debug_print("loading config file : %s" % configFilePath)
        # attempt to open config file
        try:
            xmldoc = codecs.open(configFilePath, 'r', 'utf-8')
            xmldoc = minidom.parseString(xmldoc.read().encode("utf-8"))
        except:
            utils.make_err_msg(
                _(u"Invalid XML in config file : %s") % configFilePath,
                _(u"Invalid Configuration"))
        else:
            config = xmldoc.firstChild

            # set autopreview to false while loading config
            # avoids loading paths more than once
            v = main.bottomWindow.autoPreview.GetValue()
            main.bottomWindow.autoPreview.SetValue(False)

            # get original path
            oldPath = main.picker.view.path.GetValue()

            self.__load_config_xml(config)

            if self.loadError:
                utils.make_warn_msg(_(u"Not all settings could be loaded."))

            # Do not replace a set path if one is not set in the config
            newPath = main.picker.view.path.GetValue()
            if oldPath and not newPath:
                main.picker.view.path.SetValue(oldPath)

            # preview
            main.bottomWindow.autoPreview.SetValue(v)
            if app.autoModeLevel != 0 or\
                (app.prefs.get('previewOnConfig') and app.autoModeLevel is False):
                main.picker.view.reset_dirpicker_on_config_load()