[med-svn] [SCM] aghermann branch, master, updated. 4f7a3b774136ffffbaf9b05d90bd568347bc5461

Andrei Zavada johnhommer at gmail.com
Fri Nov 16 00:50:17 UTC 2012


The following commit has been merged in the master branch:
commit ddbfe7ea14c0ca3d965d292a9589c00a9b04c440
Author: Andrei Zavada <johnhommer at gmail.com>
Date:   Sun Oct 14 15:41:22 2012 +0300

    use secondary text in pop_ok_message

diff --git a/src/main.cc b/src/main.cc
index 6ded1ce..39d8f30 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -85,7 +85,7 @@ main( int argc, char **argv)
 
 		agh::global::init_rng();
 		if ( aghui::prepare_for_expdesign() ) {
-			aghui::pop_ok_message( NULL, "UI failed to initialize. Your install is broken.\n");
+			aghui::pop_ok_message( NULL, "UI failed to initialize", "Your install is broken.");
 			return 2;
 		}
 
diff --git a/src/ui/expdesign-admit-one.cc b/src/ui/expdesign-admit-one.cc
index 3b524a8..d31cb00 100644
--- a/src/ui/expdesign-admit-one.cc
+++ b/src/ui/expdesign-admit-one.cc
@@ -123,7 +123,9 @@ aghui::SExpDesignUI::dnd_maybe_admit_one( const char* fname)
 
 		int cmd_exit = system( cmd);
 		if ( cmd_exit )
-			pop_ok_message( (GtkWindow*)wMainWindow, "Command\n %s\nexited with code %d", cmd_exit);
+			pop_ok_message( wMainWindow,
+					"Failed to create recording path in experiment tree",
+					"Command\n %s\nexited with code %d", cmd_exit);
 
 		g_free( cmd);
 		g_free( dest);
diff --git a/src/ui/expdesign-settings_cb.cc b/src/ui/expdesign-settings_cb.cc
index 85af44f..89a2a7d 100644
--- a/src/ui/expdesign-settings_cb.cc
+++ b/src/ui/expdesign-settings_cb.cc
@@ -44,14 +44,15 @@ tDesign_switch_page_cb( GtkNotebook     *notebook,
 
 		try { ED.ED->fft_params.check(); }
 		catch (invalid_argument ex) {
-			pop_ok_message( ED.wMainWindow, "Invalid FFT parameters; resetting to defaults.");
+			pop_ok_message( ED.wMainWindow,
+					"Invalid FFT parameters", "Resetting to defaults.");
 			ED.ED->fft_params.reset();
 		}
 
 		try {
 			ED.ED->mc_params.check( ED.ED->fft_params.pagesize);
 		} catch (invalid_argument ex) {
-			pop_ok_message( ED.wMainWindow, "Invalid MC parameters; resetting to defaults.");
+			pop_ok_message( ED.wMainWindow, "Invalid uC parameters", "Resetting to defaults.");
 			ED.ED->mc_params.reset();
 		}
 
diff --git a/src/ui/expdesign.cc b/src/ui/expdesign.cc
index 6796742..9f98d59 100644
--- a/src/ui/expdesign.cc
+++ b/src/ui/expdesign.cc
@@ -328,7 +328,9 @@ populate( bool do_load)
 	gtk_button_set_label( (GtkButton*)eMsmtProfileSmooth, __buf__);
 
 	if ( AghTT.empty() )
-		aghui::pop_ok_message( wMainWindow, "No usable EEG channels found in any recordings in the tree.");
+		aghui::pop_ok_message( wMainWindow,
+				       "No EEG channels",
+				       "There are no EEG channels found in any recordings in the tree.");
 	if ( AghTT.empty() or AghGG.empty() ) {
 		show_empty_experiment_blurb();
 		gtk_widget_set_visible( (GtkWidget*)lTaskSelector2, FALSE);
diff --git a/src/ui/libcommon.cc b/src/ui/libcommon.cc
index fca0786..5123052 100644
--- a/src/ui/libcommon.cc
+++ b/src/ui/libcommon.cc
@@ -11,6 +11,7 @@
  */
 
 
+#include <cassert>
 #include <gtk/gtk.h>
 #include "globals.hh"
 #include "misc.hh"
@@ -224,26 +225,28 @@ cairo_draw_signal( cairo_t *cr, const valarray<TFloat>& V,
 
 void
 aghui::
-pop_ok_message( GtkWindow *parent, const char *str, ...)
+pop_ok_message( GtkWindow *parent, const char* primary_text, const char *fmt, ...)
 {
-	va_list ap;
-	va_start (ap, str);
-
-	static GString *buf = NULL;
-	if ( buf == NULL )
-		buf = g_string_new("");
-
-	g_string_vprintf( buf, str, ap);
-	va_end (ap);
-
 	GtkWidget *msg =
 		gtk_message_dialog_new_with_markup(
 			parent,
 			(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
 			GTK_MESSAGE_INFO,
 			GTK_BUTTONS_OK,
-			buf->str, NULL);
+			primary_text, NULL);
+
+	DEF_UNIQUE_CHARP (_);
+	if ( fmt ) {
+		va_list ap;
+		va_start (ap, fmt);
+
+		assert (vasprintf( &_, fmt, ap) > 0);
+		va_end (ap);
+		gtk_message_dialog_format_secondary_markup( (GtkMessageDialog*)msg, "%s", _);
+	}
+
 	gtk_dialog_run( (GtkDialog*)msg);
+
 	gtk_widget_destroy( msg);
 }
 
diff --git a/src/ui/modelrun-facility_cb.cc b/src/ui/modelrun-facility_cb.cc
index 904904d..b06b7f5 100644
--- a/src/ui/modelrun-facility_cb.cc
+++ b/src/ui/modelrun-facility_cb.cc
@@ -155,9 +155,6 @@ bMFRun_clicked_cb( GtkButton*, gpointer userdata)
 	auto& MF = *(SModelrunFacility*)userdata;
 
 	if ( this_mf ) {
-		pop_ok_message( MF.wModelrunFacility,
-				"Another instance of Modelrun Facility is currently busy running simulations;"
-				" please wait until it completes.");
 		return;
 	}
 
diff --git a/src/ui/scoring-facility-ica.cc b/src/ui/scoring-facility-ica.cc
index 73e542f..7429079 100644
--- a/src/ui/scoring-facility-ica.cc
+++ b/src/ui/scoring-facility-ica.cc
@@ -57,7 +57,8 @@ setup_ica()
 		size_t this_sr = H.crecording.F().samplerate(H.h());
 		if ( checking_sr and this_sr != checking_sr ) {
 			pop_ok_message( wScoringFacility,
-					"Cannot perform ICA on channels with different sample rates.");
+					"Variable sample rates not supported",
+					"Sorry, ICA cannot be performed on channels with different sample rates.");
 			return 1;
 		} else
 			checking_sr = this_sr;
diff --git a/src/ui/scoring-facility-patterns.cc b/src/ui/scoring-facility-patterns.cc
index f1d40e5..b7db666 100644
--- a/src/ui/scoring-facility-patterns.cc
+++ b/src/ui/scoring-facility-patterns.cc
@@ -285,6 +285,10 @@ load_pattern( const char *label, bool do_globally)
 			}
 
 			if ( samplerate != field_channel->samplerate() ) {
+				pop_ok_message( (GtkWindow*)_p.wPattern,
+						"Sample rate mismatch",
+						"Loaded pattern has samplerate different from the current samplerate (%zu vs %zu); it will be resampled now.",
+						samplerate, field_channel->samplerate());
 				double fac = (double)field_channel->samplerate() / samplerate;
 				pattern =
 					sigproc::resample( pattern, 0, full_sample,
diff --git a/src/ui/scoring-facility-patterns_cb.cc b/src/ui/scoring-facility-patterns_cb.cc
index cefac58..3b09487 100644
--- a/src/ui/scoring-facility-patterns_cb.cc
+++ b/src/ui/scoring-facility-patterns_cb.cc
@@ -92,7 +92,7 @@ bPatternFind_clicked_cb( GtkButton *button, gpointer userdata)
 
 	FD.search( from);
 	if ( FD.last_find == (size_t)-1 )
-		pop_ok_message( (GtkWindow*)FD._p.wPattern, "Not found");
+		pop_ok_message( (GtkWindow*)FD._p.wPattern, "Not found", nullptr);
 	else { // reach up and out
 		auto& SF = FD.field_channel->_p;
 		SF.using_channel = FD.field_channel;
diff --git a/src/ui/session-chooser.cc b/src/ui/session-chooser.cc
index 7cedc1e..04efc07 100644
--- a/src/ui/session-chooser.cc
+++ b/src/ui/session-chooser.cc
@@ -78,7 +78,7 @@ SSessionChooser (const char* explicit_session)
 
 		string new_experiment_dir = string (getenv("HOME")) + "/NewExperiment";
 		if ( agh::fs::mkdir_with_parents( new_experiment_dir.c_str()) ) {
-			aghui::pop_ok_message( nullptr, "Failed to create a new directory in your $HOME."
+			aghui::pop_ok_message( nullptr, "Failed to create a new directory in your $HOME.",
 					       " There's nothing we can do about that.");
 		}
 		ed = new aghui::SExpDesignUI( this, new_experiment_dir);
diff --git a/src/ui/ui.hh b/src/ui/ui.hh
index 0f2cf28..029563e 100644
--- a/src/ui/ui.hh
+++ b/src/ui/ui.hh
@@ -153,7 +153,7 @@ cairo_put_banner( cairo_t *cr,
 
 
 
-void pop_ok_message( GtkWindow *parent, const gchar*, ...);
+void pop_ok_message( GtkWindow *parent, const char* primary, const gchar*, ...);
 gint pop_question( GtkWindow *parent, const gchar*, ...);
 void set_cursor_busy( bool busy, GtkWidget *wid);
 

-- 
Sleep experiment manager



More information about the debian-med-commit mailing list