[Rqda-commits] r60 - pkg pkg/R pkg/man www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 12 14:25:15 CET 2009


Author: wincent
Date: 2009-03-12 14:25:15 +0100 (Thu, 12 Mar 2009)
New Revision: 60

Added:
   pkg/man/RQDATables.rd
Modified:
   pkg/ChangeLog
   pkg/R/CodesFun.R
   pkg/R/Coding_Buttons.R
   pkg/R/FileButton.R
   pkg/R/FilesFun.R
   www/documentation.html
Log:


Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2009-03-10 17:44:36 UTC (rev 59)
+++ pkg/ChangeLog	2009-03-12 13:25:15 UTC (rev 60)
@@ -1,5 +1,11 @@
+2009-03-12
+	* Fix minor bug of "Search File..." of popup menu in File Tab.
+
 2009-03-11
-      * New function of AddNewFileFun, add to popup menu of file Tab.
+	* New function of AddNewFileFun, Add new file from popup menu of file Tab.
+	* Fix minor bug of enc().
+	* Show files with/without memo only (from popup menu of file tab).
+	* Show codes with/without memo only (from popup menu of code tab).
 
 2009-01-14
 	* Add citation file.
@@ -8,7 +14,7 @@
 	* Add namespace
 	* RQDA-internal.rd is no loner needed (can be found in rev 57 or version 0.1-6)
 	
-2008-12-28
+2008-12-28 (as 0.1.6, submitted to CRAN)
 	* RQDA needs gWidgets (>= 0.0-31), gWidgetsRGtk2 (>= 0.0-36). Add it to DESCRIPTION file.
 	
 2008-12-24

Modified: pkg/R/CodesFun.R
===================================================================
--- pkg/R/CodesFun.R	2009-03-10 17:44:36 UTC (rev 59)
+++ pkg/R/CodesFun.R	2009-03-12 13:25:15 UTC (rev 60)
@@ -35,7 +35,24 @@
   } else gmessage("Cannot update Code List in the Widget. Project is closed already.\n",con=TRUE)
 }
 
+CodeNamesWidgetUpdate <- function(CodeNamesWidget=.rqda$.codes_rqda,sort=TRUE,decreasing = FALSE,CodeId=NULL,...)
+  ## CodeNamesWidgetUpdate is the alternative function of CodeNamesUpdate, should be used afterwards
+{
+  if (isIdCurrent(.rqda$qdacon)){
+    freecode <- dbGetQuery(.rqda$qdacon, "select name, id,date from freecode where status=1")
+    if (nrow(freecode)!=0) {
+      if (!is.null(CodeId)) {freecode <- freecode[freecode$id %in% CodeId,]}
+      codeName <- freecode$name
+      Encoding(codeName) <- "UTF-8"
+      if (sort){
+        codeName <- codeName[OrderByTime(freecode$date,decreasing=decreasing)]
+      }
+    }
+    tryCatch(CodeNamesWidget[] <- codeName, error=function(e){})
+  } else gmessage("Cannot update Code List in the Widget. Project is closed already.\n",con=TRUE)
+}
 
+
 mark <- function(widget,fore.col=.rqda$fore.col,back.col=NULL){
   ## modified so can change fore.col and back.col easily
   ## when col is NULL, it is skipped

Modified: pkg/R/Coding_Buttons.R
===================================================================
--- pkg/R/Coding_Buttons.R	2009-03-10 17:44:36 UTC (rev 59)
+++ pkg/R/Coding_Buttons.R	2009-03-12 13:25:15 UTC (rev 60)
@@ -337,11 +337,29 @@
     MemoWidget("code",.rqda$.codes_rqda,"freecode")
     }
   }
-CodesNamesWidgetMenu$"Sort by created time"$handler <- function(h, ...) {
+CodesNamesWidgetMenu$"Sort by created time (all codes)"$handler <- function(h, ...) {
     if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
      CodeNamesUpdate()
     }
   }
+CodesNamesWidgetMenu$"Show Codes With Memo"$handler <- function(h, ...) {
+  if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
+    cid <- dbGetQuery(.rqda$qdacon,"select id from freecode where memo is not null")
+    if (nrow(cid)!=0) {
+    cid <- cid[[1]]
+    CodeNamesWidgetUpdate(CodeNamesWidget=.rqda$.codes_rqda,CodeId=cid)
+  } else gmessage("No Code with memo.",con=TRUE)
+  }
+}
+CodesNamesWidgetMenu$"Show Codes Without Memo"$handler <- function(h, ...) {
+  if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
+    cid <- dbGetQuery(.rqda$qdacon,"select id from freecode where memo is null")
+    if (nrow(cid)!=0) {
+      cid <- cid[[1]]
+      CodeNamesWidgetUpdate(CodeNamesWidget=.rqda$.codes_rqda,CodeId=cid)
+    } else gmessage("No Code with memo.",con=TRUE)
+  }
+}
 
 
 CodingInfoButton <- function(label="C2Info")

Modified: pkg/R/FileButton.R
===================================================================
--- pkg/R/FileButton.R	2009-03-10 17:44:36 UTC (rev 59)
+++ pkg/R/FileButton.R	2009-03-12 13:25:15 UTC (rev 60)
@@ -164,7 +164,7 @@
       if (nrow(dbGetQuery(.rqda$qdacon,sprintf("select name from source where name=='%s'",Ftitle)))!=0) {
         Ftitle <- paste("New",Ftitle)
       }## Make sure it is unique
-      content <- svalue(textW)
+      content <- svalue(textW); Encoding(content) <- "UTF-8" ## should set encoding, otherwise, may error in enc()
       content <- enc(content) ## take care of double quote.
       maxid <- dbGetQuery(.rqda$qdacon,"select max(id) from source")[[1]] ## the current one
       nextid <- ifelse(is.na(maxid),0+1, maxid+1) ## the new one/ for the new file
@@ -215,7 +215,7 @@
 FileNamesWidgetMenu$"Search Files..."$handler <- function(h, ...) {
     if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
     pattern <- ginput("Please input a search pattern.",text="file like '%%'")
-    if (pattern!=""){
+    if (!is.na(pattern)){
     tryCatch(SearchFiles(pattern,Widget=.rqda$.fnames_rqda,is.UTF8=TRUE),error=function(e) gmessage("Error~~~."),con=TRUE)
     }
     }
@@ -232,11 +232,27 @@
     FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="coded"))
   }
 }
-FileNamesWidgetMenu$"Sort All By Imported Time"$handler <- function(h, ...) {
+FileNamesWidgetMenu$"Show All Sorted By Imported Time"$handler <- function(h, ...) {
     if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
      ##FileNamesUpdate(FileNamesWidget=.rqda$.fnames_rqda)
      FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=GetFileId(condition="unconditional",type="all"))
     }
   }
-
-
+FileNamesWidgetMenu$"Show Files With Memo"$handler <- function(h, ...) {
+    if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
+    fileid <- dbGetQuery(.rqda$qdacon,"select id from source where memo is not null")
+    if (nrow(fileid)!=0) {
+    fileid <- fileid[[1]]
+    FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=fileid)
+    } else gmessage("No file with memo.",con=TRUE)
+    }
+  }
+FileNamesWidgetMenu$"Show Files Without Memo"$handler <- function(h, ...) {
+    if (is_projOpen(env = .rqda, conName = "qdacon", message = FALSE)) {
+    fileid <- dbGetQuery(.rqda$qdacon,"select id from source where memo is null")
+    if (nrow(fileid)!=0) {
+    fileid <- fileid[[1]]
+    FileNameWidgetUpdate(FileNamesWidget=.rqda$.fnames_rqda,FileId=fileid)
+    } else gmessage("No file is found.",con=TRUE)
+    }
+  }

Modified: pkg/R/FilesFun.R
===================================================================
--- pkg/R/FilesFun.R	2009-03-10 17:44:36 UTC (rev 59)
+++ pkg/R/FilesFun.R	2009-03-12 13:25:15 UTC (rev 60)
@@ -83,7 +83,11 @@
 ##   .rqda$encoding <- encoding
 ## }
 
-enc <- function(x) gsub("'", "''", x)
+enc <- function(x,encoding="UTF-8") {
+## encoding is the encoding of x (character vector).
+Encoding(x) <- encoding
+gsub("'", "''", x)
+}
 ## replace " with two '. to make insert smoothly.
 
 ViewFileFun <- function(FileNameWidget){

Added: pkg/man/RQDATables.rd
===================================================================
--- pkg/man/RQDATables.rd	                        (rev 0)
+++ pkg/man/RQDATables.rd	2009-03-12 13:25:15 UTC (rev 60)
@@ -0,0 +1,23 @@
+\name{RQDATables}
+\alias{RQDATables}
+\title{Data Tables in rqda file}
+\description{
+The internal data table structures in rqda file, which is a SQLite data base.
+}
+\details{
+  The source table contains the content of files.
+  \item{name}{name of the file.}
+  \item{id}{id of the file.}
+  \item{file}{content of a file.}
+  \item{memo}{memo of the file.}
+  \item{owner}{creator the the file.}
+  \item{date}{the date of the file-import.}
+  \item{dataM}{not used now.}
+  \item{status}{status of the file, 1 for standard status and 0 for
+    temporarily deleted file.}
+
+  The filecat table contains information on the file categorization.
+  \item{name}{name of the file category.}
+  \item{fid}{file id.}
+}
+\author{ HUANG Ronggui }

Modified: www/documentation.html
===================================================================
--- www/documentation.html	2009-03-10 17:44:36 UTC (rev 59)
+++ www/documentation.html	2009-03-12 13:25:15 UTC (rev 60)
@@ -47,7 +47,7 @@
 <p><b>2. Files</b>
 <p> After open a project, you can import files by click import button in the Files Tab. By default, the file should be a plain text with encoding of ASCII, otherwise, you should set the File encoding in Settings Tab before you import files.
 
-<p> If you want to import a lots of files, you can use R function write.FileList() to import them. For more information about its usage, please consult to ?write.FileList. 
+<p> If you want to import a lots of files, you can use R function write.FileList() to import them. For more information about its usage, please consult to ?write.FileList. In addition, from the pop-up menu in file Tabm you can add new file directly by typing or pasting content: right-click - Add new file... - type new content or paste content - click "save to project" - input the file title and click ok. After that, you can close the "add new file" widget.
 
 <p> You can delete files. First select one file you want to delete, then click delete button in Files Tab. Similarly, you can rename the selected file name (one file per time). You can select a file, and click open button to open the file, so you can read the content of it. You can open a file by double click as well.
 
@@ -102,6 +102,7 @@
 <br>1. Under Linux/FreeBSD, you should set the locale of R to UTF-8 to get a better support of non-English documents. In my FreeBSD box, I set the locale of R by this R command: <i>Sys.setlocale(locale = "zh_CN.UTF-8")</i>.
 <br>2. When RDQA is launched, it is better to minimize the main window of R (e.g. Rgui, Rterm, terminal from which R is launched).
 <br>3. Besides the C-Cat and F-Cat, you can use a trick to help organize files, codes list,and cases by using specific name rules. For example, if you name a group of codes with 1 as prefix and another group of codes with 2 as prefix, then you can click the triangle symbol in ther right-upper corners of the Codes List table, then the codes are sorted according to their prefix. Similar trick applies to others.
+<br>4. If a file is large, and you want to quit RQDA without finish coding, you can write a file memo, say "unfinished". Afterwards, you can use "Search File..." of the file pop-up menu to locate the file by "memo like '%unfinished%'".
 
 <h1><a id="faq">FAQ<a></h1>
 <br><B>Q:</B>How can I get help?



More information about the Rqda-commits mailing list