Issue #45. Graph generation is now disabled by default.

This commit is contained in:
WrinklyNinja
2013-08-15 12:54:01 +01:00
parent 2b567f9d37
commit cc49f51672
5 changed files with 50 additions and 34 deletions
+7 -6
View File
@@ -1,15 +1,16 @@
# BOSS Settings File
# Example Default BOSS Settings File
# This file is written in YAML <http://www.yaml.org/>.
Language: eng # An ISO 639-3 language string.
Language: eng # One of 'eng', 'spa', 'rus' or ''.
Game: auto # auto, or one of the 'folder' values below.
Last Game: auto # auto, or one of the 'folder' values below.
Debug Verbosity: 0 # 0, 1, 2, 3. Logging takes place if > 0.
Update Masterlist: true
View Report Externally: false
Generate Graph Image: false
# Games. The four archetypes are 'Oblivion', 'Skyrim', 'Fallout3' and 'FalloutNV'. They correspond to each base game's libespm and libloadorder settings.
# Games. The four types are 'Oblivion', 'Skyrim', 'Fallout3' and 'FalloutNV'. They correspond to each base game's libespm and libloadorder settings.
Games:
- folder: Oblivion
name: "TES IV: Oblivion"
@@ -18,7 +19,7 @@ Games:
url: http://better-oblivion-sorting-software.googlecode.com/svn/data/boss-oblivion/masterlist.yaml
path: ~
registry: Software\Bethesda Softworks\Oblivion\Installed Path
- folder: Skyrim
name: "TES V: Skyrim"
type: Skyrim
@@ -26,7 +27,7 @@ Games:
url: http://better-oblivion-sorting-software.googlecode.com/svn/data/boss-skyrim/masterlist.yaml
path: ~
registry: Software\Bethesda Softworks\Skyrim\Installed Path
- folder: Fallout3
name: Fallout 3
type: Fallout3
@@ -42,7 +43,7 @@ Games:
url: http://better-oblivion-sorting-software.googlecode.com/svn/data/boss-fallout-nv/masterlist.yaml
path: ~
registry: Software\Bethesda Softworks\FalloutNV\Installed Path
- folder: Nehrim
name: Nehrim - At Fate's Edge
type: Oblivion
+26 -21
View File
@@ -168,7 +168,7 @@ namespace boss {
node.text().set(" ");
}
inline void AppendNav(pugi::xml_node& body) {
inline void AppendNav(pugi::xml_node& body, bool createGraphTab) {
pugi::xml_node nav, div;
nav = body.append_child();
@@ -187,11 +187,13 @@ namespace boss {
div.append_attribute("data-section").set_value("plugins");
div.text().set("Details");
div = nav.append_child();
div.set_name("div");
div.append_attribute("class").set_value("button");
div.append_attribute("data-section").set_value("graph");
div.text().set("Graph");
if (createGraphTab) {
div = nav.append_child();
div.set_name("div");
div.append_attribute("class").set_value("button");
div.append_attribute("data-section").set_value("graph");
div.text().set("Graph");
}
div = nav.append_child();
div.set_name("div");
@@ -407,23 +409,25 @@ namespace boss {
AppendSummary(main, hasChanged, masterlistVersion, masterlistUpdateEnabled, messageNo, warnNo, errorNo, messages);
//Append graph tag.
pugi::xml_node graph = main.append_child();
graph.set_name("div");
graph.append_attribute("id").set_value("graph");
graph.append_attribute("class").set_value("hidden");
if (boost::filesystem::exists(graphPath)) {
//Append graph tag.
pugi::xml_node graph = main.append_child();
graph.set_name("div");
graph.append_attribute("id").set_value("graph");
graph.append_attribute("class").set_value("hidden");
pugi::xml_node img = graph.append_child();
img.set_name("object");
img.append_attribute("data").set_value(ToFileURL(graphPath).c_str());
img.append_attribute("type").set_value("image/svg+xml");
pugi::xml_node img = graph.append_child();
img.set_name("object");
img.append_attribute("data").set_value(ToFileURL(graphPath).c_str());
img.append_attribute("type").set_value("image/svg+xml");
//Also need to set image dimensions, get them from the graph file.
std::string width, height;
GetGraphWidthHeight(graphPath, width, height);
//Also need to set image dimensions, get them from the graph file.
std::string width, height;
GetGraphWidthHeight(graphPath, width, height);
img.append_attribute("width").set_value(width.c_str());
img.append_attribute("height").set_value(height.c_str());
img.append_attribute("width").set_value(width.c_str());
img.append_attribute("height").set_value(height.c_str());
}
}
inline void AppendFilters(pugi::xml_node& body, int messageNo, int pluginNo) {
@@ -538,7 +542,7 @@ namespace boss {
pugi::xml_node body = doc.append_child();
body.set_name("body");
AppendNav(body);
AppendNav(body, boost::filesystem::exists(graphPath));
int messageNo=0;
AppendMain(body, oldDetails, masterlistVersion, graphPath, masterlistUpdateEnabled, messages, plugins, messageNo);
@@ -565,6 +569,7 @@ namespace boss {
root["Debug Verbosity"] = 0;
root["Update Masterlist"] = true;
root["View Report Externally"] = false;
root["Generate Graph Image"] = false;
games.push_back(Game(g_game_tes4));
games.push_back(Game(g_game_tes5));
+3 -4
View File
@@ -631,10 +631,9 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
AddNonOverlapEdges(graph, priorityMap);
AddOverlapEdges(graph, overlapMap);
//Just for fun - output the graph as a ".dot" file for external rendering. If I can get this pretty, I might add it to a tab in the BOSS Report - here's a few Javascript libraries for displaying .dot files, but in my test case the graph is too complex and both libraries I found ran out of memory.
//The .dot file can be converted to an SVG using Graphviz: the command is `dot -Tsvg output.dot -o output.svg`.
if (fs::exists(g_path_graphvis)) {
//First delete any existing graph file.
fs::remove(_game.GraphPath());
if (_settings["Generate Graph Image"].as<bool>() && fs::exists(g_path_graphvis)) {
BOOST_LOG_TRIVIAL(trace) << "Outputting the graph.";
fs::path temp = fs::path(_game.GraphPath().string() + ".temp");
boss::SaveGraph(graph, temp);
+11 -1
View File
@@ -57,6 +57,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
UpdateMasterlistBox = new wxCheckBox(this, wxID_ANY, translate("Update masterlist before sorting."));
reportViewBox = new wxCheckBox(this, wxID_ANY, translate("View reports externally in default browser."));
displayGraphImageBox = new wxCheckBox(this, wxID_ANY, translate("Generate and display plugin graph images."));
//Set up list columns.
gamesList->AppendColumn(translate("Name"));
@@ -112,6 +113,8 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
bigBox->Add(reportViewBox, wholeItem);
bigBox->Add(displayGraphImageBox, wholeItem);
bigBox->AddSpacer(10);
bigBox->AddStretchSpacer(1);
@@ -128,7 +131,7 @@ SettingsFrame::SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node
SetDefaultValues();
//Tooltips.
DebugVerbosityChoice->SetToolTip(translate("The output is logged to the BOSSDebugLog.txt file"));
DebugVerbosityChoice->SetToolTip(translate("The output is logged to the BOSSDebugLog.txt file."));
//Now set the layout and sizes.
SetBackgroundColour(wxColour(255,255,255));
@@ -171,6 +174,11 @@ void SettingsFrame::SetDefaultValues() {
reportViewBox->SetValue(view);
}
if (_settings["Generate Graph Image"]) {
bool graph = _settings["Generate Graph Image"].as<bool>();
displayGraphImageBox->SetValue(graph);
}
for (size_t i=0, max=_games.size(); i < max; ++i) {
gamesList->InsertItem(i, FromUTF8(_games[i].Name()));
gamesList->SetItem(i, 1, FromUTF8(boss::Game(_games[i].Id()).FolderName()));
@@ -204,6 +212,8 @@ void SettingsFrame::OnQuit(wxCommandEvent& event) {
_settings["View Report Externally"] = reportViewBox->IsChecked();
_settings["Generate Graph Image"] = displayGraphImageBox->IsChecked();
for (size_t i=0,max=gamesList->GetItemCount(); i < max; ++i) {
string name, folder, master, url, path, registry;
unsigned int id;
+3 -2
View File
@@ -33,13 +33,13 @@
class SettingsFrame : public wxDialog {
public:
SettingsFrame(wxWindow *parent, const wxString& title, YAML::Node& settings, std::vector<boss::Game>& games);
void OnQuit(wxCommandEvent& event);
void OnGameSelect(wxListEvent& event);
void OnAddGame(wxCommandEvent& event);
void OnEditGame(wxCommandEvent& event);
void OnRemoveGame(wxCommandEvent& event);
void SetDefaultValues();
private:
wxChoice *DebugVerbosityChoice;
@@ -47,6 +47,7 @@ private:
wxChoice *LanguageChoice;
wxCheckBox *UpdateMasterlistBox;
wxCheckBox *reportViewBox;
wxCheckBox *displayGraphImageBox;
wxListView *gamesList;
wxButton * addBtn;