[Zooimage-commits] r127 - pkg/zooimage/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 7 09:29:19 CEST 2009


Author: romain
Date: 2009-05-07 09:29:19 +0200 (Thu, 07 May 2009)
New Revision: 127

Modified:
   pkg/zooimage/R/gui.r
   pkg/zooimage/R/zim.r
   pkg/zooimage/R/zis.r
Log:
careful about winDialogString out of windows

Modified: pkg/zooimage/R/gui.r
===================================================================
--- pkg/zooimage/R/gui.r	2009-05-06 15:19:35 UTC (rev 126)
+++ pkg/zooimage/R/gui.r	2009-05-07 07:29:19 UTC (rev 127)
@@ -525,7 +525,7 @@
     dir <- paste(tkchooseDirectory(), collapse = " ")
 	if (length(dir) == 0) return(invisible())
 	# Ask for a subdir for this training set
-	subdir <- winDialogString("Subdirectory where to create the training set:",
+	subdir <- dialogString("Subdirectory where to create the training set:",
 		default = "_train")
 	if (is.null(subdir) || length(subdir) == 0 || subdir == "") {
 		cat("Operation cancelled!\n")
@@ -553,7 +553,7 @@
 		return(invisible())
 	# Ask for a name for this ZITrain object
 	if (isWin()) {
-	    name <- winDialogString("Name for the ZITrain object:",
+	    name <- dialogString("Name for the ZITrain object:",
 			default = "ZItrain")
 	} else {
 		name <- guiDlgInput("Name for the ZITrain object:",
@@ -633,7 +633,7 @@
 	if (length(ZIT) == 0 || (length(ZIT) == 1 && ZIT == "")) return(invisible())
 	# Ask for a name for this ZIClass object
 	if (isWin()) {
-	    name <- winDialogString("Name for the ZIClass object to create:",
+	    name <- dialogString("Name for the ZIClass object to create:",
 			default = "ZIclass")
 	} else {
 		name <- guiDlgInput("Name for the ZIClass object:",
@@ -692,7 +692,7 @@
 	if (length(ZIT) == 0 || (length(ZIT) == 1 && ZIT == "")) return(invisible())
 	# Ask for a name for this ZIClass object
 	if (isWin()) {
-	    name <- winDialogString("Name for the ZIClass object to create:",
+	    name <- dialogString("Name for the ZIClass object to create:",
 			default = "ZIclass")
 	} else {
 		name <- guiDlgInput("Name for the ZIClass object:",
@@ -856,7 +856,7 @@
 
 	# Get class breaks for size spectra
 	if (isWin()) {
-	    brks <- winDialogString("Breaks for size spectrum classes (empty for no spectrum):",
+	    brks <- dialogString("Breaks for size spectrum classes (empty for no spectrum):",
 			default = "seq(0.25, 2, by = 0.1)")
 	} else {
 		brks <- guiDlgInput("Breaks for size spectrum classes (empty for no spectrum):",
@@ -867,7 +867,7 @@
 
 	# Get a name for the variable containing results
 	if (isWin()) {
-	    name <- winDialogString("Name for the ZIRes object to create:",
+	    name <- dialogString("Name for the ZIRes object to create:",
 			default = "ZIres")
 	} else {
 		name <- guiDlgInput("Name for the ZIRes object:",
@@ -1077,6 +1077,17 @@
 }
 # }}}
 
+#{{{ dialogString
+dialogString <- function( message, title, default ){
+	if (isWin()) {
+	    winDialogString(message, default = default )
+	} else {	
+		guiDlgInput(message, title, default )
+	}
+}
+# }}}
+
+
 # {{{ ijplugin
 ijplugin <- function( zimfile, 
 	ij.plugin = c("Scanner_Gray16", "MacroPhoto_Gray16", "Scanner_Color", "Microscope_Color" ) ){

Modified: pkg/zooimage/R/zim.r
===================================================================
--- pkg/zooimage/R/zim.r	2009-05-06 15:19:35 UTC (rev 126)
+++ pkg/zooimage/R/zim.r	2009-05-07 07:29:19 UTC (rev 127)
@@ -463,13 +463,8 @@
 	
 	# Create a .zim file from a template and edit it
 	if (is.null(zimfile) || zimfile == "") {
-		if (isWin()) {
-	        zimfile <- winDialogString("Give a name for the new .zim file:",
-				default = "myfile.zim")
-		} else {	
-			zimfile <- guiDlgInput("Give a name for the new .zim file:",
+		zimfile <- dialogString("Give a name for the new .zim file:",
 				"ZIM file creation", default = "myfile.zim")
-		}
 		if (is.null(zimfile) || length(zimfile) == 0 || zimfile == "")
 			return(invisible())
 		if ( !hasExtension( zimfile, "zim")){

Modified: pkg/zooimage/R/zis.r
===================================================================
--- pkg/zooimage/R/zis.r	2009-05-06 15:19:35 UTC (rev 126)
+++ pkg/zooimage/R/zis.r	2009-05-07 07:29:19 UTC (rev 127)
@@ -83,13 +83,8 @@
 	
 	# {{{ use a ui to get the file name
 	if (is.null(zisfile) || zisfile == "") {
-		if (isWin()) {
-	        zisfile <- winDialogString("Give a name for the new .zis file:",
-				default = "Description.zis")
-		} else {	
-			zisfile <- guiDlgInput("Give a name for the new .zis file:",
+		zisfile <- dialogString("Give a name for the new .zis file:",
 				"ZIS file creation", default = "Description.zis")
-		}
 		if (is.null(zisfile) || length(zisfile) == 0 || zisfile == ""){
 			return(invisible())
 		}



More information about the Zooimage-commits mailing list