[Rqda-commits] r18 - pkg pkg/R pkg/man www
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 22 16:06:23 CET 2008
Author: wincent
Date: 2008-11-22 16:06:23 +0100 (Sat, 22 Nov 2008)
New Revision: 18
Removed:
www/RQDA_0.1.3.zip
Modified:
pkg/ChangeLog
pkg/DESCRIPTION
pkg/R/CaseButton.R
pkg/R/CodeCatButton.R
pkg/R/CodesFun.R
pkg/R/FileButton.R
pkg/R/GUIHandler.R
pkg/R/ProjectButton.R
pkg/R/ProjectFun.R
pkg/R/root_gui.R
pkg/R/zzz.R
pkg/TODO
pkg/man/RQDA-package.Rd
www/Main.png
www/index.html
Log:
This version is regarded as release candidate version (RC1). should be Ok to use in the real world research.
Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/ChangeLog 2008-11-22 15:06:23 UTC (rev 18)
@@ -1,3 +1,7 @@
+2008-11-23 (as version 0.1.5)
+ * Add AddTo/DropFrom Buttons for Code-Category.
+ * Improve the display of retrieved coding.
+
2008-11-22
* change "Add Code Category" Button to popup menu
* Open selected file by double click.
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/DESCRIPTION 2008-11-22 15:06:23 UTC (rev 18)
@@ -1,7 +1,7 @@
Package: RQDA
Type: Package
Title: Qualitative data analysis
-Version: 0.1.4
+Version: 0.1.5
Date: 2008-11-01
Author: Huang Ronggui
Maintainer: Huang <ronggui.huang at gmail.com>
Modified: pkg/R/CaseButton.R
===================================================================
--- pkg/R/CaseButton.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/CaseButton.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -5,8 +5,10 @@
if (nrow(CaseName)!=0) {
Encoding(CaseName[['name']]) <- "UTF-8"
tryCatch(CaseNamesWidget[] <- CaseName[['name']], error=function(e){})
- }}
+ } else tryCatch(CaseNamesWidget[] <- NULL, error=function(e){})
+## when nrow(CaseName)==0, update it to NULL
}
+}
#################
@@ -174,20 +176,26 @@
CaseNamesWidgetMenu <- list()
CaseNamesWidgetMenu$WebSearch$Baidu$handler <- function(h,...){
KeyWord <- svalue(.rqda$.CasesNamesWidget)
+ if (length(KeyWord)!=0){
KeyWord <- iconv(KeyWord, from="UTF-8")
browseURL(sprintf("http://www.baidu.com/s?wd=%s",paste("%",paste(charToRaw(KeyWord),sep="",collapse="%"),sep="",collapse="")))
}
+}
CaseNamesWidgetMenu$WebSearch$Google$handler <- function(h,...){
KeyWord <- svalue(.rqda$.CasesNamesWidget)
+ if (length(KeyWord)!=0){
KeyWord <- iconv(KeyWord, from="UTF-8")
browseURL(sprintf("http://www.google.com/search?q=%s",KeyWord))
}
+}
CaseNamesWidgetMenu$WebSearch$Yahoo$handler <- function(h,...){
KeyWord <- svalue(.rqda$.CasesNamesWidget)
+ if (length(KeyWord)!=0){
KeyWord <- iconv(KeyWord, from="UTF-8")
browseURL(sprintf("http://search.yahoo.com/search;_ylt=A0oGkmFV.CZJNssAOK.l87UF?p=%s&ei=UTF-8&iscqry=&fr=sfp&fr2=sfp"
,KeyWord))
}
+}
Modified: pkg/R/CodeCatButton.R
===================================================================
--- pkg/R/CodeCatButton.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/CodeCatButton.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -58,14 +58,16 @@
Encoding(Selected) <- "UTF-8"
catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from codecat where status==1 and name=='%s'",Selected))[,1]
if (length(catid) ==1){
- dbGetQuery(.rqda$qdacon,sprintf("update codecat set status=0 where name=='%s'",Selected))
- ## set status in table freecode to 0
- UpdateTableWidget(Widget=.rqda$.CodeCatWidget,FromdbTable="codecat")
- tryCatch(dbGetQuery(.rqda$qdacon,sprintf("update treecode set status=0 where cid=='%s'",catid)),error=function(e){})
+ dbGetQuery(.rqda$qdacon,sprintf("update codecat set status=0 where name=='%s'",Selected))
+ ## set status in table freecode to 0
+ UpdateTableWidget(Widget=.rqda$.CodeCatWidget,FromdbTable="codecat")
+ tryCatch(dbGetQuery(.rqda$qdacon,sprintf("update treecode set status=0 where catid=='%s'",catid)),error=function(e){})
+ ## should delete all the related codelists
+ UpdateCodeofCatWidget() ## update the code of cat widget
} else gmessage("The Category Name is not unique.",con=T)
-
+
}
- }
+ }
}
)
}
@@ -93,11 +95,76 @@
)
}
+UpdateCodeofCatWidget <- function(con=.rqda$qdacon,Widget=.rqda$.CodeofCat){
+ SelectedCodeCat <- svalue(.rqda$.CodeCatWidget)
+ if (length(SelectedCodeCat)!=0){
+ ## if code cat is selected, then continue
+ Encoding(SelectedCodeCat) <- "UTF-8"
+ catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from codecat where status=1 and name='%s'",SelectedCodeCat))[,1]
+ Total_cid <- dbGetQuery(con,sprintf("select cid from treecode where status==1 and catid==%i",catid))
+ if (nrow(Total_cid)!=0){
+ items <- dbGetQuery(con,"select name,id from freecode where status==1")
+ if (nrow(items)!=0) {
+ items <- items[items$id %in% Total_cid$cid,"name"]
+ Encoding(items) <- "UTF-8"
+ } else items <- NULL
+ } else items <- NULL
+ } else items <- NULL
+ tryCatch(Widget[] <- items,error=function(e){})
+}
+
CodeCatAddToButton <- function(label="AddTo",Widget=.rqda$.CodeCatWidget,...)
{
gbutton(label,handler=function(h,...) {
- Selected <- select.list()
+ ## SelectedCodeCat and its id (table codecat): svalue()-> Name; sql->catid
+ SelectedCodeCat <- svalue(.rqda$.CodeCatWidget)
+ catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from codecat where status=1 and name='%s'",SelectedCodeCat))[,1]
+ ## CodeList and the id (table freecode): sql -> name and id where status==1
+ freecode <- dbGetQuery(.rqda$qdacon,"select name, id from freecode where status=1")
+ Encoding(SelectedCodeCat) <- Encoding(freecode[['name']]) <- "UTF-8"
+ ## Get CodeList already in the category (table treecode): sql -> cid where catid==catid
+ codeofcat <- dbGetQuery(.rqda$qdacon,sprintf("select cid from treecode where status=1 and catid=%i",catid))
+ if (nrow(codeofcat)!=0){
+ ## compute those not in the category, then push them to select.list()
+ codeoutofcat <- subset(freecode,!(id %in% codeofcat$cid))
+ } else codeoutofcat <- freecode
+ Selected <- select.list(codeoutofcat[['name']],multiple=TRUE)
+ if (length(Selected)!=0){
+ Selected <- iconv(Selected,to="UTF-8")
+ cid <- codeoutofcat[codeoutofcat$name %in% Selected,"id"]
+ Dat <- data.frame(cid=cid,catid=catid,date=date(),dateM=date(),memo="",status=1)
+ ## Push selected codeList to table treecode
+ dbWriteTable(.rqda$qdacon,"treecode",Dat,row.names=FALSE,append=TRUE)
+ ## update .CodeofCat Widget
+ UpdateCodeofCatWidget()
+ }
}
-)
+ )
}
+## update .rqda$.CodeofCat[] by click handler on .rqda$.CodeCatWidget
+CodeCatDropFromButton <- function(label="DropFrom",Widget=.rqda$.CodeofCat,...)
+{
+ gbutton(label,handler=function(h,...) {
+ ## Get CodeList already in the category (table treecode): svalue()
+ CodeOfCat <- svalue(Widget)
+ if ((NumofSelected <- length(CodeOfCat)) ==0) {
+ gmessage("Please select the Codes you want to delete.",con=T)} else
+ {
+ ## Give a confirm msg
+ del <- gconfirm(sprintf("Delete %i code(s) from this category. Are you sure?",NumofSelected),con=T,icon="question")
+ if (isTRUE(del)){
+ ## set status==0 for those selected CodeList (table treecode)
+ SelectedCodeCat <- svalue(.rqda$.CodeCatWidget)
+ Encoding(SelectedCodeCat) <- Encoding(CodeOfCat)<- "UTF-8"
+ catid <- dbGetQuery(.rqda$qdacon,sprintf("select catid from codecat where status=1 and name='%s'",SelectedCodeCat))[,1]
+ for (i in CodeOfCat){
+ cid <- dbGetQuery(.rqda$qdacon,sprintf("select id from freecode where status=1 and name='%s'",i))[,1]
+ dbGetQuery(.rqda$qdacon,sprintf("update treecode set status==0 where catid==%i and cid==%i",catid,cid))
+ }
+ ## update .CodeofCat Widget
+ UpdateCodeofCatWidget()
+}}
+ }
+ )
+}
Modified: pkg/R/CodesFun.R
===================================================================
--- pkg/R/CodesFun.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/CodesFun.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -27,7 +27,7 @@
if (nrow(codesName)!=0) {
Encoding(codesName[['name']]) <- "UTF-8"
tryCatch(CodeNamesWidget[] <- codesName[['name']], error=function(e){})
- } else cat("Project is closed already.\n")
+ } else gmessage("Cannot update Code List in the Widget. Project is closed already.\n",con=T)
}
}
@@ -98,27 +98,34 @@
retrieval <- 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",currentCid))
+ if (nrow(retrieval)==0) gmessage("No Coding associated with the selected code.",con=T) else {
+ retrieval <- retrieval[order( retrieval$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){
- FileNames <- dbGetQuery(.rqda$qdacon,sprintf("select name from source where status==1 and id==%i",i))[['name']]
- tryCatch(Encoding(FileNames) <- "UTF-8",error=function(e){})
- fname <- paste("Source: ", FileNames, sep="")
- seltext <- retrieval$seltext[retrieval$fid==i]
- seltext <- paste(seltext,collapse="\n\n")
- CodingIndex <- retrieval[retrieval$fid==i,c("selfirst","selend")]
- CodingIndex <- apply(CodingIndex,1,FUN=function(x) paste(x,sep="",collapse=":"))
- Encoding(seltext) <- "UTF-8"
- add(.retreivalgui,fname,font.attr=c(style="italic",size="x-large"))
- add(.retreivalgui,CodingIndex,font.attr=c(style="italic",size="x-large"))
- add(.retreivalgui,"\n",font.attr=c(style="italic"))
- add(.retreivalgui,seltext,font.attr=c(style="normal",size="large"))
- add(.retreivalgui,"\n",font.attr=c(style="italic"))
+ 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"
+
+ apply(retrieval,1, function(x){
+ metaData <- sprintf("%s [%s:%s]\n",x[['fname']],x[['selfirst']],x[['selend']])
+ add(.retreivalgui,metaData,font.attr=c(foreground="red",size="x-large"),do.newline=FALSE)
+ add(.retreivalgui,x[['seltext']],font.attr=c(style="normal",size="large"),do.newline=FALSE)
+ add(.retreivalgui,"\n\n",font.attr=c(style="normal",size="large"),do.newline=FALSE)
+ }
+ )
}
+ }
+}
+
Modified: pkg/R/FileButton.R
===================================================================
--- pkg/R/FileButton.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/FileButton.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -2,7 +2,8 @@
{
gbutton(label, contain=container, handler=function(h,...){
if (is_projOpen(env=.rqda,conName="qdacon")) {
- path <- gfile(type="open",filter=list("text files" = list(mime.types = c("text/plain"))))
+ path <- gfile(type="open",filter=list("text files" = list(mime.types = c("text/plain")),
+ "All files" = list(patterns = c("*"))))
if (path!=""){
Encoding(path) <- "UTF-8" ## have to convert, otherwise, can not find the file.
ImportFile(path,con=.rqda$qdacon)
Modified: pkg/R/GUIHandler.R
===================================================================
--- pkg/R/GUIHandler.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/GUIHandler.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -70,6 +70,7 @@
addHandlerClicked(.rqda$.codes_rqda,handler <- function(h,...){
+ if (is_projOpen(env=.rqda,conName="qdacon")){
CodeNamesUpdate(CodeNamesWidget=.rqda$.codes_rqda)
con <- .rqda$qdacon
SelectedCode <- currentCode <- svalue(.rqda$.codes_rqda)
@@ -94,7 +95,7 @@
},error=function(e){}) # end of mark text chuck
}
}
- },action=list(marktxtwidget=".openfile_gui")
+ }},action=list(marktxtwidget=".openfile_gui")
)
@@ -135,6 +136,9 @@
},action=list(marktxtwidget=".openfile_gui")
)
+ addHandlerClicked(.rqda$.CodeCatWidget,handler <- function(h,...){
+ UpdateCodeofCatWidget(con=.rqda$qdacon,Widget=.rqda$.CodeofCat)
+})
add3rdmousepopupmenu(.rqda$.CasesNamesWidget, CaseNamesWidgetMenu)
## popup menu by right-click on CaseNamesWidget
Modified: pkg/R/ProjectButton.R
===================================================================
--- pkg/R/ProjectButton.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/ProjectButton.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -11,7 +11,8 @@
OpenProjectButton <- function(container=.proj_gui){
gbutton("Open Project",container=container,handler=function(h,...){
- path <- gfile(type="open",filter=list("rqda"=list(patterns = c("*.rqda","*.*"))))
+ path <- gfile(type="open",filter=list("rqda"=list(patterns = c("*.rqda")),
+ "All files" = list(patterns = c("*"))))
if (path!=""){
Encoding(path) <- "UTF-8"
open_proj(path,assignenv=.rqda)
@@ -19,6 +20,7 @@
tryCatch(FileNamesUpdate(),error=function(e){})
tryCatch(CaseNamesUpdate(),error=function(e){})
tryCatch(UpdateTableWidget(Widget=.rqda$.CodeCatWidget,FromdbTable="codecat"),error=function(e){})
+ tryCatch(UpdateCodeofCatWidget(),error=function(e){})
}
}
@@ -33,6 +35,7 @@
tryCatch(.rqda$.fnames_rqda[]<-NULL,error=function(e){})
tryCatch(.rqda$.CasesNamesWidget[]<-NULL,error=function(e){})
tryCatch(UpdateTableWidget(Widget=.rqda$.CodeCatWidget,FromdbTable="codecat"),error=function(e){})
+ tryCatch(UpdateCodeofCatWidget(),error=function(e){})
}
)
Modified: pkg/R/ProjectFun.R
===================================================================
--- pkg/R/ProjectFun.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/ProjectFun.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -50,7 +50,9 @@
owner text, date text, memo text)")
if (dbExistsTable(con,"project")) dbRemoveTable(con, "project")
## coding: information about the project
- dbGetQuery(con,"create table project (encoding text, date text, memo text)")
+ dbGetQuery(con,"create table project (encoding text, detabaseversion text, date text,dateM text,
+ memo text,BOM integer)")
+ dbGetQuery(con,sprintf("insert into project (detabaseversion,date) values ('0.1.5','%s')",date()))
if (dbExistsTable(con,"cases")) dbRemoveTable(con, "cases")
dbGetQuery(con,"create table cases (name text, memo text,
owner text,date text,dateM text,
Modified: pkg/R/root_gui.R
===================================================================
--- pkg/R/root_gui.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/root_gui.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -36,7 +36,9 @@
2. Import files.\n
3. Add codes.\n
4. Open a file and begin coding.\n
-Author: <ronggui.huang at gmail.com>\n",
+Author: <ronggui.huang at gmail.com>\n
+License: FreeBSD\n
+Version: 0.1.5\n",
container=.proj_gui)
@@ -70,7 +72,7 @@
.codes_button[1,5]<- CodingMemoButton(label="C2Memo")
.codes_button[2,1]<- HL_ALLButton()
.codes_button[2,2]<- RetrievalButton("Retrieval")
- .codes_button[2,3]<- RetrievalButton(label="Extend")
+ .codes_button[2,3]<- gbutton("Extend",handler=function(h,...)NI())
.codes_button[2,4]<- Unmark_Button()
.codes_button[2,5]<- Mark_Button()
@@ -95,21 +97,21 @@
".Ccat_PW" <- ggroup(cont=.codecat_pan,horizontal = FALSE)## parent Widget of C-cat
".CodeCatWidget" <- gtable("Please click Update",container=.Ccat_PW,expand=TRUE)
.CodeCatWidget[] <- NULL; names(.CodeCatWidget)<-"Code Category"
- ".CodeofCat" <- gtable("Please click Update",container=.Ccat_PW,expand=TRUE)
+ ".CodeofCat" <- gtable("Please click Update",container=.Ccat_PW,expand=TRUE,multiple=TRUE)
.CodeofCat[] <- NULL;names(.CodeofCat)<-"Codes of This Category"
.codecat_buttons[1,1] <- AddCodeCatButton("Add")
.codecat_buttons[1,2] <- CodeCat_RenameButton("Rename")
.codecat_buttons[1,3] <- DeleteCodeCatButton("Delete") ## should take care of treecode table
- .codecat_buttons[1,4] <- gbutton("AddTo")
- .codecat_buttons[1,5] <- gbutton("DropFrom")
+ .codecat_buttons[1,4] <- CodeCatAddToButton("AddTo")
+ .codecat_buttons[1,5] <- CodeCatDropFromButton("DropFrom")
######################### GUI for F-cat
#########################
- ".fcat_gui" <- ggroup(container=.nb_rqdagui,horizontal=FALSE,label="F-Cat")
+## ".fcat_gui" <- ggroup(container=.nb_rqdagui,horizontal=FALSE,label="F-Cat")
######################### GUI for settings
#########################
- ".settings_gui" <- ggroup(container=.nb_rqdagui,horizontal=FALSE,label="Settings")
+## ".settings_gui" <- ggroup(container=.nb_rqdagui,horizontal=FALSE,label="Settings")
######################### Put them together
@@ -125,6 +127,7 @@
assign(".fnames_rqda",.fnames_rqda,env=.rqda)
assign(".CasesNamesWidget",.CasesNamesWidget,env=.rqda)
assign(".CodeCatWidget",.CodeCatWidget,env=.rqda)
+assign(".CodeofCat",.CodeofCat,env=.rqda)
##########################
### set the positions
Modified: pkg/R/zzz.R
===================================================================
--- pkg/R/zzz.R 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/R/zzz.R 2008-11-22 15:06:23 UTC (rev 18)
@@ -3,6 +3,6 @@
.rqda$owner <- "default"
.rqda$BOM <- FALSE
.rqda$encoding <- "unknown"
- cat("\nUse RQDA() to start the programe.\n",fill=TRUE)
- ## RQDA()
+ cat("\nUse 'RQDA()' to start the programe.\n",fill=TRUE)
+ RQDA()
}
Modified: pkg/TODO
===================================================================
--- pkg/TODO 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/TODO 2008-11-22 15:06:23 UTC (rev 18)
@@ -6,7 +6,9 @@
better display coding chuck.
-Extended coding chuck.
+Extended coding chuck, then release it as verion 0.1.5
+functions cleaning treecode/codecat table.
+
### less important
should add document on the table structure.
Modified: pkg/man/RQDA-package.Rd
===================================================================
--- pkg/man/RQDA-package.Rd 2008-11-22 05:13:45 UTC (rev 17)
+++ pkg/man/RQDA-package.Rd 2008-11-22 15:06:23 UTC (rev 18)
@@ -12,8 +12,8 @@
\tabular{ll}{
Package: \tab RQDA\cr
Type: \tab Package\cr
-Version: \tab 0.1\cr
-Date: \tab 2008-05-11\cr
+Version: \tab 0.1.5\cr
+Date: \tab 2008-11-22\cr
Depends: \tab DBI, RSQLite, RGtk2, gWidgets, gWidgetsRGtk2\cr
License: \tab FreeBSD\cr
LazyLoad: \tab yes\cr
Modified: www/Main.png
===================================================================
(Binary files differ)
Deleted: www/RQDA_0.1.3.zip
===================================================================
(Binary files differ)
Modified: www/index.html
===================================================================
--- www/index.html 2008-11-22 05:13:45 UTC (rev 17)
+++ www/index.html 2008-11-22 15:06:23 UTC (rev 18)
@@ -51,12 +51,14 @@
<li>Import documents from plain text
<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>Memos of documents, codes, coding, project, files and more
<li>Retrieval of coding
-<li>Single-file (*.rqda) format, which is basically SQLite database
-<li>Temporary deletion of files and codes
-<li>There is a case category, which is crucial feature to bridge qualitative and quantative research.
-<li>Facilitator helps to categorize codes,which is key to theory building. I deliberately avoid using tree-like categorization.
+<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>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
<BR><BR>By R functions, it can:
<li>Show the temporary deletion files and codes
More information about the Rqda-commits
mailing list