[Arvore-commits] r4 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 24 19:25:36 CEST 2009


Author: isix
Date: 2009-08-24 19:25:33 +0200 (Mon, 24 Aug 2009)
New Revision: 4

Modified:
   pkg/R/arvore.R
   pkg/R/icer.sim.window.R
   pkg/R/onGraph.summary.simwindow.R
   pkg/R/rollback.R
Log:
Now arvoRe is ActiveState Tcltk independent :)

Modified: pkg/R/arvore.R
===================================================================
--- pkg/R/arvore.R	2008-08-08 04:37:57 UTC (rev 3)
+++ pkg/R/arvore.R	2009-08-24 17:25:33 UTC (rev 4)
@@ -1,17 +1,18 @@
-`arvore` <-
+arvore <-
 function(...) {
 	# Se .ArvoReRunning existe, então o ÁrvoRe já está em execução...
 	if (!exists(".ArvoReRunning", envir = globalenv() )) {
 		# ArvoRe Settings
 		library(tcltk)
+		library(tcltk2)
 		###############################################################################
 		# THE GAME!!
 		###############################################################################
 		# Configuration variables
 		.EnvironmentArvoRe <- globalenv()
 		.EnvironmentArvore.Secure <- new.env(parent = globalenv())
-		.arvore.version <- "Alfa-0.1.4"								# The ArvoRe version
-		.arvore.release.date <- "June 18, 2008 06:43:29 PM "		# The ArvoRe version date
+		.arvore.version <- "Alfa-0.1.7"								# The ArvoRe version
+		.arvore.release.date <- "March 27, 2009 06:43:29 PM "		# The ArvoRe version date
 		.modeltypeArvore <- "CE" 									# Default calculation method "Simple" # "CEA"
 		.workstatus <- "saved"										# File status
 		.opennedfile <- "newfile"									# File name
@@ -49,12 +50,23 @@
 		###############################################################################
 		# The Tk things
 		###############################################################################
-		carregaTclpath()	# Carrega extensões da Tcltk
-		tclRequire("Img")
+#  		carregaTclpath()	# Carrega extensões da Tcltk
+		for (i in 1:length(.libPaths())) {
+			icon.but <- file.path(paste(.libPaths()[i],"/arvoRe/icons/New.png",sep=""))
+			if (file.exists(icon.but)) {
+				caminho <- file.path(paste(.libPaths()[i],"/arvoRe/tklibs/BWidget_1.8.0",sep=""))
+				addTclPath(caminho)
+				caminho <- file.path(paste(.libPaths()[i],"/arvoRe/tklibs/Tktable2.9",sep=""))
+				addTclPath(caminho)
+				caminho <- file.path(paste(.libPaths()[i],"/arvoRe/tklibs/Img1.3",sep=""))
+				addTclPath(caminho)				
+				i <- length(.libPaths()) + 1	# Termina com tudo se já encontrou
+			}
+		}		
+		tclRequire("Tk") # Used in TckTk 8.5
+ 		tclRequire("Img")
 		tclRequire("BWidget")
 		#---------------------------------------------------------------------- 
-		# tclRequire("Tk") # Used in TckTk 8.5
-		
 		# Create a new decision tree
 		new.tree()
 		
@@ -81,7 +93,7 @@
 		
 		# Set max and min size to main ArvoRe window
 		tkwm.minsize(tt,640,480)
-		tkwm.maxsize(tt,1024,768)
+# 		tkwm.maxsize(tt,1024,768)
 		
 		# The Frames
 		frameOverall <- tkframe(tt)
@@ -122,30 +134,30 @@
 		tkadd(topMenu,"cascade",label="Arquivo",menu=fileMenu)
 		
 		editMenu <- tkmenu(topMenu,tearoff=FALSE)
-			tkadd(editMenu,"command",label="Desfazer",command=function() changedofunction(TheTree, .modeltypeArvore, .EnvironmentArvore.Secure))
-			tkadd(editMenu,"command",label="Refazer",command=function() changedofunction(TheTree, .modeltypeArvore, .EnvironmentArvore.Secure))
+			tkadd(editMenu,"command",label="Desfazer", command=function() changedofunction(TheTree, .modeltypeArvore, .EnvironmentArvore.Secure))
+			tkadd(editMenu,"command",label="Refazer", command=function() changedofunction(TheTree, .modeltypeArvore, .EnvironmentArvore.Secure))
 			tkadd(editMenu,"separator")
-			tkadd(editMenu,"command",label="Recortar",command=function() naoimplementado())
-			tkadd(editMenu,"command",label="Copiar",command=function() naoimplementado())
-			tkadd(editMenu,"command",label="Colar",command=function() naoimplementado())
+			tkadd(editMenu,"command",label="Recortar", command=function() naoimplementado())
+			tkadd(editMenu,"command",label="Copiar", command=function() naoimplementado())
+			tkadd(editMenu,"command",label="Colar", command=function() naoimplementado())
 			tkadd(editMenu,"separator")
-			tkadd(editMenu,"command",label="Excluir",command=function() naoimplementado())
+			tkadd(editMenu,"command",label="Excluir", command=function() removenodewindows())
 			tkadd(editMenu,"separator")
-			tkadd(editMenu,"command",label="Recortar sub-árvore",command=function() naoimplementado())
-			tkadd(editMenu,"command",label="Copiar sub-árvore",command=function() naoimplementado())
-			tkadd(editMenu,"command",label="Colar sub-árvore",command=function() naoimplementado())
+			tkadd(editMenu,"command", state="disabled",label="Recortar sub-árvore",command=function() naoimplementado())
+			tkadd(editMenu,"command", state="disabled",label="Copiar sub-árvore",command=function() naoimplementado())
+			tkadd(editMenu,"command", state="disabled",label="Colar sub-árvore",command=function() naoimplementado())
 			tkadd(editMenu,"separator")
-			tkadd(editMenu,"command",label="Excluir sub-árvore",command=function() naoimplementado())
+			tkadd(editMenu,"command",label="Excluir sub-árvore", command=function() removenodewindows())
 			tkadd(editMenu,"separator")
-			tkadd(editMenu,"command",label="Variáveis...",command=function() dialog.variable.window())
+			tkadd(editMenu,"command",label="Variáveis...", command=function() dialog.variable.window())
 			tkadd(editMenu,"separator")
-			tkadd(editMenu,"command",label="Configurações",command=function() properties.tree())
+			tkadd(editMenu,"command",label="Configurações", command=function() properties.tree())
 		tkadd(topMenu,"cascade",label="Editar",menu=editMenu)
 		
 		modelMenu <- tkmenu(topMenu,tearoff=FALSE)
-			tkadd(modelMenu,"command",label="Árvore de decisão simples",command=function() set.model.type("SD") )
+			tkadd(modelMenu,"command",label="Árvore de decisão simples", command=function() set.model.type("SD") )
 			tkadd(modelMenu,"separator")
-			tkadd(modelMenu,"command",label="Árvore de decisão Custo-Efetividade",command=function() set.model.type("CE") )
+			tkadd(modelMenu,"command",label="Árvore de decisão Custo-Efetividade", command=function() set.model.type("CE") )
 		
 		tkadd(topMenu,"cascade",label="Modelo",menu=modelMenu)
 		
@@ -319,7 +331,7 @@
 			icon.but <- file.path(paste(.libPaths()[i],"/arvoRe/icons/Graph.png",sep=""))
 			if (file.exists(icon.but)) {
 				icn <- tkimage.create("photo", file=icon.but)
-				sa.but <- tkbutton(frameBottons, image=icn, width=.Width.img.but, height=.Height.img.but, command=function() sa.1way.window())
+				sa.but <- tkbutton(frameBottons, state="disabled", image=icn, width=.Width.img.but, height=.Height.img.but, command=function() sa.1way.window())
 				tcl("DynamicHelp::add", sa.but, "-type", "balloon", "-text", "Análise de Sensibilidade 1-way")
 			} else {
 				sa.but <- tkbutton(frameBottons, text="Análise de Sensibilidade 1-way", width=.Width.img.but, height=.Height.img.but, command=function() sa.1way.window())
@@ -332,7 +344,7 @@
 			icon.but <- file.path(paste(.libPaths()[i],"/arvoRe/icons/Graph2.png",sep=""))
 			if (file.exists(icon.but)) {
 				icn <- tkimage.create("photo", file=icon.but)
-				sa2.but <- tkbutton(frameBottons, image=icn, width=.Width.img.but, height=.Height.img.but, command=function() sa.2way.window())
+				sa2.but <- tkbutton(frameBottons, state="disabled", image=icn, width=.Width.img.but, height=.Height.img.but, command=function() sa.2way.window())
 				tcl("DynamicHelp::add", sa2.but, "-type", "balloon", "-text", "Análise de Sensibilidade 2-way")
 			} else {
 				sa2.but <- tkbutton(frameBottons, text="Análise de Sensibilidade 2-way", width=.Width.img.but, height=.Height.img.but, command=function() sa.2way.window())
@@ -418,9 +430,11 @@
 		
 		# Send treeWidget addres to .EnvironmentArvoRe
 		assign("treeWidget", treeWidget, .EnvironmentArvoRe)
-
+		
 		theTreeTkArvore(TheTree)
 		
+# 		print(" cheguei aqui ")
+
 		# The Tree Bottons
 		.Height.but <- 2
 		.Width.but <- 16

Modified: pkg/R/icer.sim.window.R
===================================================================
--- pkg/R/icer.sim.window.R	2008-08-08 04:37:57 UTC (rev 3)
+++ pkg/R/icer.sim.window.R	2009-08-24 17:25:33 UTC (rev 4)
@@ -132,7 +132,8 @@
 							2 * ( Data.alternative.Cost$CovDcDe[i] ) / 
 										( Data.alternative.Effectiveness$Mean[i] / Data.alternative.Cost$Mean[i] )
 							)
-				print(var.icer)
+# 				print(var.icer)
+				var.icer <- sqrt(var.icer^2)
 				
 				var.icer <- as.numeric(as.character(var.icer))
 				

Modified: pkg/R/onGraph.summary.simwindow.R
===================================================================
--- pkg/R/onGraph.summary.simwindow.R	2008-08-08 04:37:57 UTC (rev 3)
+++ pkg/R/onGraph.summary.simwindow.R	2009-08-24 17:25:33 UTC (rev 4)
@@ -466,7 +466,7 @@
 			width=.Width.but, height=.Height.but, command = OnDistrib.effectiveness)
 		Distrib.CER.but <- tkbutton(frameDistribution,text = label.but3, 
 			width =.Width.but, height=.Height.but, command = OnDistrib.CER)
-		Distrib.incrementals.but <- tkbutton(frameDistribution, text = label.but4, 
+		Distrib.incrementals.but <- tkbutton(frameDistribution, state = "disabled", text = label.but4, 
 			width=.Width.but, height=.Height.but, command = OnDistrib.incrementals)
 		CE.but <- tkbutton(frameOtherGraphs, text = label.but5, 
 			width=.Width.but, height=.Height.but, command = function() OnCE.Graph.summary.simwindow(Alltreatmentstable))

Modified: pkg/R/rollback.R
===================================================================
--- pkg/R/rollback.R	2008-08-08 04:37:57 UTC (rev 3)
+++ pkg/R/rollback.R	2009-08-24 17:25:33 UTC (rev 4)
@@ -47,7 +47,7 @@
 			ans.effectiveness[position, i] <- val.expected.effectiveness
 		}	
 	}
-	ans <- list("CE" = ans.ce, "Cost" = ans.cost, "Effectiveness" = ans.effectiveness)
+	ans <- list("CE" = ans.cost/ans.effectiveness , "Cost" = ans.cost, "Effectiveness" = ans.effectiveness)
 	return(ans)
 }
 



More information about the Arvore-commits mailing list