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>
|
<description>Microsoft doesn't follow any file hierarchy standarts.</description>
|
||||||
</key>
|
</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">
|
<key name="greeting" type="s">
|
||||||
<default l10n="messages">"Hello, earthlings"</default>
|
<default l10n="messages">"Hello, earthlings"</default>
|
||||||
<summary>A greeting</summary>
|
<summary>A greeting</summary>
|
||||||
|
|
|
@ -13,9 +13,6 @@ namespace LAview.Core {
|
||||||
|
|
||||||
AppSettings settings;
|
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 {
|
public string lyx_path {
|
||||||
get { return settings.lyx_path; }
|
get { return settings.lyx_path; }
|
||||||
set { settings.lyx_path = value; }
|
set { settings.lyx_path = value; }
|
||||||
|
@ -31,6 +28,19 @@ namespace LAview.Core {
|
||||||
set { settings.perl_path = value; }
|
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.
|
* Load Data Modules.
|
||||||
*/
|
*/
|
||||||
|
@ -75,9 +85,17 @@ namespace LAview.Core {
|
||||||
|
|
||||||
/* Initialization */
|
/* Initialization */
|
||||||
AppDirs.init ();
|
AppDirs.init ();
|
||||||
|
settings = new AppSettings();
|
||||||
|
|
||||||
load_data_modules (AppDirs.data_plugins_dir);
|
load_data_modules (AppDirs.data_plugins_dir);
|
||||||
load_object_modules (AppDirs.object_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 ();
|
load_templates_list ();
|
||||||
clear_cache ();
|
clear_cache ();
|
||||||
}
|
}
|
||||||
|
@ -129,7 +147,7 @@ namespace LAview.Core {
|
||||||
objects_list = { };
|
objects_list = { };
|
||||||
composed_objects = { };
|
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 t_path = Path.build_path (Path.DIR_SEPARATOR_S, AppDirs.cache_dir, "template.tex");
|
||||||
var lyx_file_path = templates[template_index].get_path();
|
var lyx_file_path = templates[template_index].get_path();
|
||||||
try {
|
try {
|
||||||
|
@ -188,7 +206,7 @@ namespace LAview.Core {
|
||||||
if (c == false)
|
if (c == false)
|
||||||
throw new IOError.FAILED (_("Prepare document first."));
|
throw new IOError.FAILED (_("Prepare document first."));
|
||||||
generate_document_tex ();
|
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());
|
return converter.tex2pdf (doc_tex_path(), doc_pdf_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,7 +751,7 @@ namespace LAview.Core {
|
||||||
}
|
}
|
||||||
string generate_document_lyx () throws Error {
|
string generate_document_lyx () throws Error {
|
||||||
generate_document_tex ();
|
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());
|
var sp = converter.tex2lyx (doc_tex_path(), doc_lyx_path());
|
||||||
if (sp.wait_check() == false) throw new IOError.FAILED(_("Error running tex2lyx subprocess."));
|
if (sp.wait_check() == false) throw new IOError.FAILED(_("Error running tex2lyx subprocess."));
|
||||||
if (!File.new_for_path(doc_lyx_path()).query_exists())
|
if (!File.new_for_path(doc_lyx_path()).query_exists())
|
||||||
|
|
|
@ -7,6 +7,8 @@ namespace LAview.Core {
|
||||||
string _latexmk_pl_path;
|
string _latexmk_pl_path;
|
||||||
string _perl_path;
|
string _perl_path;
|
||||||
string[] _templates_strv;
|
string[] _templates_strv;
|
||||||
|
string _data_path;
|
||||||
|
string _object_path;
|
||||||
|
|
||||||
public string lyx_path {
|
public string lyx_path {
|
||||||
get { return _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 {
|
public AppSettings () throws Error {
|
||||||
string schema_file = AppDirs.settings_dir+"/gschemas.compiled";
|
string schema_file = AppDirs.settings_dir+"/gschemas.compiled";
|
||||||
if (!File.new_for_path (schema_file).query_exists ())
|
if (!File.new_for_path (schema_file).query_exists ())
|
||||||
|
@ -67,7 +87,18 @@ namespace LAview.Core {
|
||||||
settings.changed["perl-path"].connect (() => {
|
settings.changed["perl-path"].connect (() => {
|
||||||
_perl_path = settings.get_string("perl-path");
|
_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