[chronojump] If R is missing on open encoder modes, now open website button is shown
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] If R is missing on open encoder modes, now open website button is shown
- Date: Thu, 4 Jan 2018 12:10:38 +0000 (UTC)
commit 9505fab00ddc610e37076e742402a3c377b1d653
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jan 4 13:09:57 2018 +0100
If R is missing on open encoder modes, now open website button is shown
glade/dialog_message.glade | 57 ++++++++++++++++++++++++++++++++++++++++++-
src/constants.cs | 1 +
src/gui/chronojump.cs | 9 ++++++-
src/gui/dialogMessage.cs | 21 +++++++++++++++-
4 files changed, 84 insertions(+), 4 deletions(-)
---
diff --git a/glade/dialog_message.glade b/glade/dialog_message.glade
index 73deecd..74288cc 100644
--- a/glade/dialog_message.glade
+++ b/glade/dialog_message.glade
@@ -263,6 +263,61 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton" id="button_go">
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <signal name="clicked" handler="on_button_go_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Go</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-jump-to</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -281,7 +336,6 @@
<widget class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
<child>
<widget class="GtkButton" id="close_button">
<property name="label">gtk-close</property>
@@ -304,7 +358,6 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
diff --git a/src/constants.cs b/src/constants.cs
index 8f8dcc4..9cb929f 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -618,6 +618,7 @@ public class Constants
};
public static string DatabaseNotFound = Catalog.GetString("Error. Cannot find database.");
+ public static string WebsiteNotFound = Catalog.GetString("Sorry, cannot open website.");
public static string DirectoryCannotOpen = Catalog.GetString("Error. Cannot open directory.");
public static string FileNotFound = Catalog.GetString("Error. File not found.");
public static string FileCopyProblem = Catalog.GetString("Error. Cannot copy file.");
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 1510fe3..dbba7e2 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2926,6 +2926,11 @@ public partial class ChronoJumpWindow
private void on_menuitem_mode_main_menu_activate (object o, EventArgs args)
{
+ show_start_page();
+ }
+
+ private void show_start_page()
+ {
notebook_start_selector.CurrentPage = 0;
notebook_start.CurrentPage = 0;
@@ -3054,7 +3059,9 @@ public partial class ChronoJumpWindow
new DialogMessage(Constants.MessageTypes.WARNING,
Catalog.GetString("Sorry, R software is not installed.") +
"\n" + Catalog.GetString("Please, install it from here:") +
- "\n\nhttp://cran.cnr.berkeley.edu/bin/macosx/R-latest.pkg");
+ "\n\nhttp://cran.cnr.berkeley.edu/bin/macosx/R-latest.pkg",
+ "button_go_r_mac");
+ show_start_page();
return;
}
diff --git a/src/gui/dialogMessage.cs b/src/gui/dialogMessage.cs
index 7813152..17e4ac7 100644
--- a/src/gui/dialogMessage.cs
+++ b/src/gui/dialogMessage.cs
@@ -32,7 +32,9 @@ public class DialogMessage
[Widget] Gtk.Image image_help;
[Widget] Gtk.Box hbox_stiffness_formula;
+ [Widget] Gtk.Button button_go;
public bool Visible;
+ private string button_go_link = "";
public DialogMessage (string title, Constants.MessageTypes type, string message)
{
@@ -48,9 +50,13 @@ public class DialogMessage
initialize("", type, message);
if(objectToShow == "hbox_stiffness_formula")
hbox_stiffness_formula.Show();
+ else if(objectToShow == "button_go_r_mac")
+ {
+ button_go_link = "http://cran.cnr.berkeley.edu/bin/macosx/R-latest.pkg";
+ button_go.Show();
+ }
}
-
private void initialize(string title, Constants.MessageTypes type, string message)
{
LogB.Information("Dialog message: " + message);
@@ -59,6 +65,9 @@ public class DialogMessage
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "dialog_message.glade",
"dialog_message", "chronojump");
gladeXML.Autoconnect(this);
+ button_go.Visible = false;
+ button_go_link = "";
+
Visible = true;
//put an icon to window
@@ -96,6 +105,16 @@ public class DialogMessage
dialog_message.Show();
}
+ public void on_button_go_clicked (object obj, EventArgs args)
+ {
+ LogB.Information("Opening browser (r mac install) to: " + button_go_link);
+ try {
+ System.Diagnostics.Process.Start(button_go_link);
+ } catch {
+ label_message.Text = Constants.WebsiteNotFound;
+ }
+ }
+
public void on_close_button_clicked (object obj, EventArgs args)
{
Visible = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]