From cb03b58dbcde175fbf2fd02dc08af644f1180395 Mon Sep 17 00:00:00 2001 From: Jake Dube Date: Sun, 7 May 2017 21:00:20 +0200 Subject: [PATCH] Display compute method for the current project --- src/com/sheepit/client/Client.java | 1 + src/com/sheepit/client/Gui.java | 2 ++ src/com/sheepit/client/Job.java | 2 ++ src/com/sheepit/client/standalone/GuiSwing.java | 5 +++++ src/com/sheepit/client/standalone/GuiText.java | 5 +++++ .../sheepit/client/standalone/GuiTextOneLine.java | 9 ++++++++- .../client/standalone/swing/activity/Working.java | 12 +++++++++++- 7 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/com/sheepit/client/Client.java b/src/com/sheepit/client/Client.java index 15726ae..405a5ad 100644 --- a/src/com/sheepit/client/Client.java +++ b/src/com/sheepit/client/Client.java @@ -604,6 +604,7 @@ public class Client { gui.setRenderingProjectName(""); gui.setRemainingTime(""); gui.setRenderingTime(""); + gui.setComputeMethod(""); if (err != Error.Type.OK) { this.log.error("Client::work problem with runRenderer (ret " + err + ")"); return err; diff --git a/src/com/sheepit/client/Gui.java b/src/com/sheepit/client/Gui.java index aed6ee7..dabaa22 100644 --- a/src/com/sheepit/client/Gui.java +++ b/src/com/sheepit/client/Gui.java @@ -40,5 +40,7 @@ public interface Gui { public void setClient(Client cli); + public void setComputeMethod(String computeMethod_); + public Client getClient(); } diff --git a/src/com/sheepit/client/Job.java b/src/com/sheepit/client/Job.java index 0b99546..cbb3e7f 100644 --- a/src/com/sheepit/client/Job.java +++ b/src/com/sheepit/client/Job.java @@ -230,9 +230,11 @@ public class Job { String core_script = ""; if (getUseGPU() && config.getGPUDevice() != null && config.getComputeMethod() != ComputeType.CPU) { core_script = "sheepit_set_compute_device(\"CUDA\", \"GPU\", \"" + config.getGPUDevice().getCudaName() + "\")\n"; + gui.setComputeMethod("GPU"); } else { core_script = "sheepit_set_compute_device(\"NONE\", \"CPU\", \"CPU\")\n"; + gui.setComputeMethod("CPU"); } core_script += String.format("bpy.context.scene.render.tile_x = %1$d\nbpy.context.scene.render.tile_y = %1$d\n", getTileSize()); File script_file = null; diff --git a/src/com/sheepit/client/standalone/GuiSwing.java b/src/com/sheepit/client/standalone/GuiSwing.java index 0250af0..245f57c 100644 --- a/src/com/sheepit/client/standalone/GuiSwing.java +++ b/src/com/sheepit/client/standalone/GuiSwing.java @@ -212,6 +212,11 @@ public class GuiSwing extends JFrame implements Gui { client = cli; } + @Override + public void setComputeMethod(String computeMethod) { + this.activityWorking.setComputeMethod(computeMethod); + } + public Configuration getConfiguration() { return client.getConfiguration(); } diff --git a/src/com/sheepit/client/standalone/GuiText.java b/src/com/sheepit/client/standalone/GuiText.java index d4d3c25..ad116e1 100644 --- a/src/com/sheepit/client/standalone/GuiText.java +++ b/src/com/sheepit/client/standalone/GuiText.java @@ -135,6 +135,11 @@ public class GuiText implements Gui { client = cli; } + @Override + public void setComputeMethod(String computeMethod) { + System.out.println("Compute method: " + computeMethod); + } + @Override public Client getClient() { return client; diff --git a/src/com/sheepit/client/standalone/GuiTextOneLine.java b/src/com/sheepit/client/standalone/GuiTextOneLine.java index 31a160a..6640bbc 100644 --- a/src/com/sheepit/client/standalone/GuiTextOneLine.java +++ b/src/com/sheepit/client/standalone/GuiTextOneLine.java @@ -38,6 +38,7 @@ public class GuiTextOneLine implements Gui { private String creditsEarned; private int sigIntCount = 0; + private String computeMethod; private String status; private String line; @@ -51,6 +52,7 @@ public class GuiTextOneLine implements Gui { remaining = 0; creditsEarned = null; status = ""; + computeMethod = ""; line = ""; } @@ -146,6 +148,11 @@ public class GuiTextOneLine implements Gui { client = cli; } + @Override + public void setComputeMethod(String computeMethod_) { + computeMethod = computeMethod_; + } + @Override public Client getClient() { return client; @@ -155,7 +162,7 @@ public class GuiTextOneLine implements Gui { int charToRemove = line.length(); System.out.print("\r"); - line = String.format("Frames rendered: %d remaining: %d Credits earned: %s | %s %s", rendered, remaining, creditsEarned != null ? creditsEarned : "unknown", project, status + (exiting ? " (Exiting after this frame)" : "")); + line = String.format("Frames rendered: %d remaining: %d Credits earned: %s | %s using %s %s", rendered, remaining, creditsEarned != null ? creditsEarned : "unknown", project, computeMethod, status + (exiting ? " (Exiting after this frame)" : "")); System.out.print(line); for (int i = line.length(); i <= charToRemove; i++) { System.out.print(" "); diff --git a/src/com/sheepit/client/standalone/swing/activity/Working.java b/src/com/sheepit/client/standalone/swing/activity/Working.java index 8e4b827..15e0505 100644 --- a/src/com/sheepit/client/standalone/swing/activity/Working.java +++ b/src/com/sheepit/client/standalone/swing/activity/Working.java @@ -67,6 +67,7 @@ public class Working implements Activity { private JLabel current_project_name_value; private JLabel current_project_duration_value; private JLabel currrent_project_progression_value; + private JLabel current_project_compute_method_value; private JLabel user_info_points_total_value; private JLabel waiting_projects_value; private JLabel connected_machines_value; @@ -82,6 +83,7 @@ public class Working implements Activity { current_project_name_value = new JLabel(""); current_project_duration_value = new JLabel(""); currrent_project_progression_value = new JLabel(""); + current_project_compute_method_value = new JLabel(""); user_info_points_total_value = new JLabel(""); waiting_projects_value = new JLabel(""); connected_machines_value = new JLabel(""); @@ -100,6 +102,7 @@ public class Working implements Activity { JLabel current_project_name = new JLabel("Name: ", JLabel.TRAILING); JLabel current_project_duration = new JLabel("Rendering for: ", JLabel.TRAILING); JLabel current_project_progression = new JLabel("Remaining: ", JLabel.TRAILING); + JLabel current_project_compute_method_label = new JLabel("Compute method: ", JLabel.TRAILING); current_project_panel.add(current_project_status); current_project_panel.add(statusContent); @@ -113,6 +116,9 @@ public class Working implements Activity { current_project_panel.add(current_project_progression); current_project_panel.add(currrent_project_progression_value); + current_project_panel.add(current_project_compute_method_label); + current_project_panel.add(current_project_compute_method_value); + // user info JPanel session_info_panel = new JPanel(new SpringLayout()); session_info_panel.setBorder(BorderFactory.createTitledBorder("Session infos")); @@ -205,7 +211,7 @@ public class Working implements Activity { Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2); widthLeftColumn = Spring.max(widthLeftColumn, getBestWidth(global_stats_panel, 4, 2)); widthLeftColumn = Spring.max(widthLeftColumn, getBestWidth(session_info_panel, 3, 2)); - alignPanel(current_project_panel, 4, 2, widthLeftColumn); + alignPanel(current_project_panel, 5, 2, widthLeftColumn); alignPanel(global_stats_panel, 4, 2, widthLeftColumn); alignPanel(session_info_panel, 3, 2, widthLeftColumn); } @@ -226,6 +232,10 @@ public class Working implements Activity { current_project_duration_value.setText("" + time_ + ""); } + public void setComputeMethod(String computeMethod_) { + this.current_project_compute_method_value.setText(computeMethod_); + } + public void displayStats(Stats stats) { DecimalFormat df = new DecimalFormat("##,##,##,##,##,##,##0"); remainingFrameContent.setText(df.format(stats.getRemainingFrame()));