Ejemplo n.º 1
0
 def save_configuration_object(self, plugin_name, filename, item):
     dirname = plugin_configuration_dir(plugin_name)
     if not os.path.isdir(dirname):
         os.makedirs(dirname)
     path = os.path.join(dirname, filename)
     with open(path, 'wb') as file:
         pickle.dump(item, file)
Ejemplo n.º 2
0
Archivo: api.py Proyecto: abseabse/gtg
 def save_configuration_object(self, plugin_name, filename, item):
     dirname = plugin_configuration_dir(plugin_name)
     if not os.path.isdir(dirname):
         os.makedirs(dirname)
     path = os.path.join(dirname, filename)
     with open(path, 'wb') as file:
         pickle.dump(item, file)
Ejemplo n.º 3
0
Archivo: api.py Proyecto: jdiez17/gtg
    def load_configuration_object(self, plugin_name, filename, default_values=None):
        if default_values is not None:
            config = dict(default_values)
        else:
            config = dict()

        dirname = plugin_configuration_dir(plugin_name)
        path = os.path.join(dirname, filename)
        try:
            with open(path, "rb") as file:
                item = pickle.load(file)
                config.update(item)
        except:
            pass
        return config
Ejemplo n.º 4
0
    def load_configuration_object(self, plugin_name, filename,
                                  default_values=None):
        if default_values is not None:
            config = dict(default_values)
        else:
            config = dict()

        dirname = plugin_configuration_dir(plugin_name)
        path = os.path.join(dirname, filename)
        try:
            with open(path, 'rb') as file:
                item = pickle.load(file)
                config.update(item)
        except:
            pass
        return config
Ejemplo n.º 5
0
""" Module for discovering templates and work with templates """

from glob import glob
import os.path
import subprocess
import sys
import tempfile
import threading

from GTG.core.dirs import plugin_configuration_dir

from Cheetah.Template import Template as CheetahTemplate
from gi.repository import GObject

TEMPLATE_PATHS = [
    os.path.join(plugin_configuration_dir('export'), "export_templates"),
    os.path.join(os.path.dirname(os.path.abspath(__file__)),
                 "export_templates"),
]


def get_templates_paths():
    """ Returns a list containing the full path for all the
    available templates. """
    template_list = []
    for a_dir in TEMPLATE_PATHS:
        template_list += glob(os.path.join(a_dir, "template_*"))
    return template_list


class Template():
Ejemplo n.º 6
0
""" Module for discovering templates and work with templates """

from glob import glob
import os.path
import subprocess
import sys
import tempfile
import threading

from GTG.core.dirs import plugin_configuration_dir

from Cheetah.Template import Template as CheetahTemplate
from gi.repository import GObject

TEMPLATE_PATHS = [
    os.path.join(plugin_configuration_dir('export'), "export_templates"),
    os.path.join(
        os.path.dirname(os.path.abspath(__file__)), "export_templates"),
]


def get_templates_paths():
    """ Returns a list containing the full path for all the
    available templates. """
    template_list = []
    for a_dir in TEMPLATE_PATHS:
        template_list += glob(os.path.join(a_dir, "template_*"))
    return template_list


class Template: