Closes #2: Custom plugins directories (for module debugging).
This commit is contained in:
parent
84f16713dc
commit
01f7cc1796
|
@ -25,6 +25,18 @@
|
|||
<description>Microsoft doesn't follow any file hierarchy standarts.</description>
|
||||
</key>
|
||||
|
||||
<key name="data-path" type="s">
|
||||
<default>""</default>
|
||||
<summary>Path to user's data plugins.</summary>
|
||||
<description>Need for plugins developing/debugging.</description>
|
||||
</key>
|
||||
|
||||
<key name="object-path" type="s">
|
||||
<default>""</default>
|
||||
<summary>Path to user's object plugins.</summary>
|
||||
<description>Need for plugins developing/debugging.</description>
|
||||
</key>
|
||||
|
||||
<key name="greeting" type="s">
|
||||
<default l10n="messages">"Hello, earthlings"</default>
|
||||
<summary>A greeting</summary>
|
||||
|
|
|
@ -13,9 +13,6 @@ namespace LAview.Core {
|
|||
|
||||
AppSettings settings;
|
||||
|
||||
public Gee.HashMap<Type, PluginData> data_plugins = new Gee.HashMap<Type, PluginData>();
|
||||
public Gee.HashMap<Type, PluginObject> object_plugins = new Gee.HashMap<Type, PluginObject>();
|
||||
|
||||
public string lyx_path {
|
||||
get { return settings.lyx_path; }
|
||||
set { settings.lyx_path = value; }
|
||||
|
@ -31,6 +28,19 @@ namespace LAview.Core {
|
|||
set { settings.perl_path = value; }
|
||||
}
|
||||
|
||||
public string data_path {
|
||||
get { return settings.data_path; }
|
||||
set { settings.data_path = value; }
|
||||
}
|
||||
|
||||
public string object_path {
|
||||
get { return settings.object_path; }
|
||||
set { settings.object_path = value; }
|
||||
}
|
||||
|
||||
public Gee.HashMap<Type, PluginData> data_plugins = new Gee.HashMap<Type, PluginData>();
|
||||
public Gee.HashMap<Type, PluginObject> object_plugins = new Gee.HashMap<Type, PluginObject>();
|
||||
|
||||
/**
|
||||
* Load Data Modules.
|
||||
*/
|
||||
|
@ -75,9 +85,17 @@ namespace LAview.Core {
|
|||
|
||||
/* Initialization */
|
||||
AppDirs.init ();
|
||||
settings = new AppSettings();
|
||||
|
||||
load_data_modules (AppDirs.data_plugins_dir);
|
||||
load_object_modules (AppDirs.object_plugins_dir);
|
||||
settings = new AppSettings();
|
||||
|
||||
if (File.new_for_path (data_path).query_exists())
|
||||
load_data_modules (data_path);
|
||||
|
||||
if (File.new_for_path (object_path).query_exists())
|
||||
load_object_modules (object_path);
|
||||
|
||||
load_templates_list ();
|
||||
clear_cache ();
|
||||
}
|
||||
|
@ -129,7 +147,7 @@ namespace LAview.Core {
|
|||
objects_list = { };
|
||||
composed_objects = { };
|
||||
|
||||
var converter = new Conv.Converter.new_with_paths (settings.lyx_path, settings.latexmk_pl_path, settings.perl_path);
|
||||
var converter = new Conv.Converter.new_with_paths (lyx_path, latexmk_pl_path, perl_path);
|
||||
var t_path = Path.build_path (Path.DIR_SEPARATOR_S, AppDirs.cache_dir, "template.tex");
|
||||
var lyx_file_path = templates[template_index].get_path();
|
||||
try {
|
||||
|
@ -188,7 +206,7 @@ namespace LAview.Core {
|
|||
if (c == false)
|
||||
throw new IOError.FAILED (_("Prepare document first."));
|
||||
generate_document_tex ();
|
||||
var converter = new Conv.Converter.new_with_paths (settings.lyx_path, settings.latexmk_pl_path, settings.perl_path);
|
||||
var converter = new Conv.Converter.new_with_paths (lyx_path, latexmk_pl_path, perl_path);
|
||||
return converter.tex2pdf (doc_tex_path(), doc_pdf_path());
|
||||
}
|
||||
|
||||
|
@ -733,7 +751,7 @@ namespace LAview.Core {
|
|||
}
|
||||
string generate_document_lyx () throws Error {
|
||||
generate_document_tex ();
|
||||
var converter = new Conv.Converter.new_with_paths (settings.lyx_path, settings.latexmk_pl_path, settings.perl_path);
|
||||
var converter = new Conv.Converter.new_with_paths (lyx_path, latexmk_pl_path, perl_path);
|
||||
var sp = converter.tex2lyx (doc_tex_path(), doc_lyx_path());
|
||||
if (sp.wait_check() == false) throw new IOError.FAILED(_("Error running tex2lyx subprocess."));
|
||||
if (!File.new_for_path(doc_lyx_path()).query_exists())
|
||||
|
|
|
@ -7,6 +7,8 @@ namespace LAview.Core {
|
|||
string _latexmk_pl_path;
|
||||
string _perl_path;
|
||||
string[] _templates_strv;
|
||||
string _data_path;
|
||||
string _object_path;
|
||||
|
||||
public string lyx_path {
|
||||
get { return _lyx_path; }
|
||||
|
@ -43,6 +45,24 @@ namespace LAview.Core {
|
|||
}
|
||||
}
|
||||
|
||||
public string data_path {
|
||||
get { return _data_path; }
|
||||
set {
|
||||
if (settings != null) settings.set_string ("data-path", value);
|
||||
_data_path = value;
|
||||
}
|
||||
default = "data";
|
||||
}
|
||||
|
||||
public string object_path {
|
||||
get { return _object_path; }
|
||||
set {
|
||||
if (settings != null) settings.set_string ("object-path", value);
|
||||
_object_path = value;
|
||||
}
|
||||
default = "object";
|
||||
}
|
||||
|
||||
public AppSettings () throws Error {
|
||||
string schema_file = AppDirs.settings_dir+"/gschemas.compiled";
|
||||
if (!File.new_for_path (schema_file).query_exists ())
|
||||
|
@ -67,7 +87,18 @@ namespace LAview.Core {
|
|||
settings.changed["perl-path"].connect (() => {
|
||||
_perl_path = settings.get_string("perl-path");
|
||||
});
|
||||
|
||||
_templates_strv = settings.get_strv("templates");
|
||||
settings.changed["templates"].connect (() => {
|
||||
_templates_strv = settings.get_strv("templates");
|
||||
});
|
||||
_data_path = settings.get_string("data-path");
|
||||
settings.changed["data-path"].connect (() => {
|
||||
_data_path = settings.get_string("data-path");
|
||||
});
|
||||
_object_path = settings.get_string("object-path");
|
||||
settings.changed["object-path"].connect (() => {
|
||||
_object_path = settings.get_string("object-path");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue