[Rqda-commits] r19 - pkg pkg/R www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 24 07:26:10 CET 2008


Author: wincent
Date: 2008-11-24 07:26:10 +0100 (Mon, 24 Nov 2008)
New Revision: 19

Modified:
   pkg/ChangeLog
   pkg/DESCRIPTION
   pkg/R/CodesFun.R
   pkg/R/Coding_Buttons.R
   pkg/R/root_gui.R
   pkg/R/zzz.R
   pkg/TODO
   www/index.html
Log:


Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/ChangeLog	2008-11-24 06:26:10 UTC (rev 19)
@@ -1,3 +1,7 @@
+2008-11-24
+	* Can back to the original file from Retrieval text chunck (Improve the retreival button).
+	  has a bug: can not scroll to the right position.
+	
 2008-11-23 (as version 0.1.5)
 	* Add AddTo/DropFrom Buttons for Code-Category.
 	* Improve the display of retrieved coding.
@@ -19,7 +23,7 @@
 	* Handle Encoding better (use UTF-8 for storage in date base)
 	* Add cases category
 	
-2008-11-01
+2008-11-01(as version 0.1.3)
 	* Add functionality of file/code/coding memo.
 	
 2008-10-31

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/DESCRIPTION	2008-11-24 06:26:10 UTC (rev 19)
@@ -9,3 +9,4 @@
 Description: Qualitative Data Analysis based on R language. Current version only supports plain text.
 License: FreeBSD
 LazyLoad: yes
+URL: http://rqda.r-forge.r-project.org/

Modified: pkg/R/CodesFun.R
===================================================================
--- pkg/R/CodesFun.R	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/R/CodesFun.R	2008-11-24 06:26:10 UTC (rev 19)
@@ -128,4 +128,80 @@
   }
 }
 
+retrieval2 <- function(){
+  currentCode <- svalue(.rqda$.codes_rqda)
+  if (length(currentCode)!=0){
+    Encoding(currentCode) <- "UTF-8"
+    currentCid <- dbGetQuery(.rqda$qdacon,sprintf("select id from freecode where name== '%s' ",currentCode))[1,1]
+    ## reliable is more important                       
+    retrieval <- dbGetQuery(.rqda$qdacon,sprintf("select cid,fid, selfirst, selend,seltext from coding where status==1 and cid=%i order by fid",currentCid))
+    if (nrow(retrieval)==0) gmessage("No Coding associated with the selected code.",con=T) else {
+      ## retrieval <-  retrieval[order( retrieval$fid),]
+      ## use sql to order the fid
+      fid <- unique(retrieval$fid)
+      retrieval$fname <-""
+      .gw <- gwindow(title=sprintf("Retrieved text: %s",currentCode),parent=c(370,10),width=600,height=600)
+      .retreivalgui <- gtext(con=.gw)
+      for (i in fid){
+        FileName <- dbGetQuery(.rqda$qdacon,sprintf("select name from source where status==1 and id==%i",i))[['name']]
+        tryCatch(Encoding(FileName) <- "UTF-8",error=function(e){})
+        ##fname <- paste("Source: ", FileNames, sep="")
+        retrieval$fname[retrieval$fid==i] <- FileName
+      }
+      Encoding(retrieval$seltext) <-  Encoding(retrieval$fname) <- "UTF-8"
 
+      ## modification begins
+        ComputeCallbackFun <- function(BeginPosition,EndPosition,FileName){
+          CallBackFUN <- function(button){  
+            tryCatch(dispose(.rqda$.rootBackToFile),error=function(e) {})
+            root <- gwindow(title=FileName, parent=c(370,10),width=600,height=600)
+            assign(".rootBackToFile",root,env=.rqda)
+            displayFile <- gtext(container=root,font.attr=c(sizes="large"))
+            assign(".displayFile",displayFile,env=.rqda)
+            content <- dbGetQuery(.rqda$qdacon, sprintf("select file from source where name='%s'",FileName))[1,1]
+            Encoding(content) <- "UTF-8" ## so it display correct in the gtext widget
+            add(.rqda$.displayFile,content,font.attr=c(sizes="large"))
+            HL(.rqda$.displayFile,data.frame(begin=BeginPosition,end=EndPosition))
+            .rqda$.displayFile at widget@widget$SetEditable(FALSE)
+            gtkTextViewScrollToIter(.rqda$.displayFile at widget@widget,
+                                      .rqda$.displayFile at widget@widget$GetBuffer()$GetIterAtOffset(BeginPosition)$iter,
+                                      0.001,xal=0,yal=0,use.align=T)## doesn't seem to work.
+            }    
+         CallBackFUN
+        }
+
+      buffer <- .retreivalgui at widget@widget$GetBuffer()
+      iter <- buffer$getIterAtOffset(0)$iter
+create.tags <- function(buffer)
+{
+buffer$createTag("big",size = 20 * PANGO_SCALE)
+buffer$createTag("x-large",scale = PANGO_SCALE_X_LARGE)
+buffer$createTag("large",scale = PANGO_SCALE_LARGE)
+buffer$createTag("red.foreground",foreground = "red")
+}
+create.tags(buffer)
+
+      apply(retrieval,1, function(x){
+        metaData <- sprintf("%s [%s:%s]",x[['fname']],x[['selfirst']],x[['selend']])
+        buffer$InsertWithTagsByName(iter, metaData,"x-large","red.foreground")
+        anchorcreated <- buffer$createChildAnchor(iter)
+        iter$BackwardChar()
+        anchor <- iter$getChildAnchor()  
+        widget <- gtkButtonNewWithLabel("Back")
+        gSignalConnect(widget, "clicked", ComputeCallbackFun(x[['selfirst']],x[['selend']],x[['fname']]))
+        .retreivalgui at widget@widget$addChildAtAnchor(widget, anchor)
+        widget$showAll()
+        iter$ForwardChar()
+        buffer$insert(iter, "\n")
+        buffer$InsertWithTagsByName(iter, x[['seltext']],"large")
+        buffer$insert(iter, "\n\n")
+      }
+            )
+    }
+  }
+}
+
+
+
+
+

Modified: pkg/R/Coding_Buttons.R
===================================================================
--- pkg/R/Coding_Buttons.R	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/R/Coding_Buttons.R	2008-11-24 06:26:10 UTC (rev 19)
@@ -42,7 +42,17 @@
           )
 }
 
+ExtendButton <- function(label){
+  gbutton(label,
+          handler=function(h,...) {
+            if (is_projOpen(env=.rqda,conName="qdacon")) {
+              retrieval2()
+            }
+          }
+          )
+}
 
+
 HL_ALLButton <- function(){
   gbutton("HL ALL",
           handler=function(h,...) {

Modified: pkg/R/root_gui.R
===================================================================
--- pkg/R/root_gui.R	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/R/root_gui.R	2008-11-24 06:26:10 UTC (rev 19)
@@ -71,10 +71,10 @@
   .codes_button[1,4] <- CodeMemoButton(label="C-Memo")
   .codes_button[1,5]<- CodingMemoButton(label="C2Memo")
   .codes_button[2,1]<- HL_ALLButton()
-  .codes_button[2,2]<- RetrievalButton("Retrieval")
-  .codes_button[2,3]<- gbutton("Extend",handler=function(h,...)NI())
-  .codes_button[2,4]<- Unmark_Button()
-  .codes_button[2,5]<- Mark_Button()
+ # .codes_button[2,2]<- RetrievalButton("Retrieval")
+  .codes_button[2,2]<- ExtendButton("Retrieval")
+  .codes_button[2,3]<- Unmark_Button()
+  .codes_button[2,4]<- Mark_Button()
 
 ######################### GUI  for cases
 #########################

Modified: pkg/R/zzz.R
===================================================================
--- pkg/R/zzz.R	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/R/zzz.R	2008-11-24 06:26:10 UTC (rev 19)
@@ -4,5 +4,5 @@
   .rqda$BOM <- FALSE
   .rqda$encoding <- "unknown"
   cat("\nUse 'RQDA()' to start the programe.\n",fill=TRUE)
-  RQDA()
+  if (interactive()) RQDA()
 }

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2008-11-22 15:06:23 UTC (rev 18)
+++ pkg/TODO	2008-11-24 06:26:10 UTC (rev 19)
@@ -1,13 +1,7 @@
-tree-like structure of files/ codes.
+tree-like structure of files.
 
-get back to orginal files from coding(extend button)
-
 summary functions for review of coding.
 
-better display coding chuck.
-
-Extended coding chuck, then release it as verion 0.1.5
-
 functions cleaning treecode/codecat table.
 
 ### less important

Modified: www/index.html
===================================================================
--- www/index.html	2008-11-22 15:06:23 UTC (rev 18)
+++ www/index.html	2008-11-24 06:26:10 UTC (rev 19)
@@ -52,10 +52,10 @@
 <li>Support non-English documents, Simplified Chinese Character is well-tested under Windows
 <li>Character-level coding using codes
 <li>Memos of documents, codes, coding, project, files and more
-<li>Retrieval of coding
+<li>Retrieval of coding, and easily back to the original file (ease the problem of segmentation)
 <li>Single-file (*.rqda) format, which is basically SQLite database. Data are stored in UTF-8, so it should be portable
 <li>Facilitator helps to categorize codes,which is key to theory building. I deliberately avoid using tree-like categorization
-<li>There is a case category, which is crucial feature to bridge qualitative and quantative research
+<li>There is a case category, which is crucial feature to bridge qualitative and quantitative research
 <li>Search information about selected case from the Internet vis popup menu
 <li>Temporary delete files and codes
 <li> Rename the files,code, code category, case and others



More information about the Rqda-commits mailing list