inst/examples/gui1.r

# firstHome <- getwd()
# 
# updateLoc <- function(x){
# 	if(!('.CDF' == substr(x$text, start = nchar(x$text) - 3, stop = nchar(x$text)))) {
# 		setwd(x$text)
# 	} else {
# 		print('loading indiv file not yet supported')
# 	}
# }
# 
# updateStep <- function(x){
# 	print(x$text)
# 	
# 	#print(class(x$text))
# 	out <<- getplotValues(steps = as.numeric(x$text))
# }
# 
# qsetClass('drawp1', Qt$QWidget, function(parent = NULL){
# 	super(parent)
# 
# 	
# 	# file directory for data
# 	loadLabel <- Qt$QLabel('File or Dir:')
# 	this$loadLine <- Qt$QLineEdit('../data/raw')
# 	this$loadButton <- Qt$QPushButton('&Load')
# 	loadButton$show()
# 
# 	# define the bottom nav buttons
# 	iconSize <- qsize(30L, 30L) # so that all icons are same size
# 	## show all 
# 	this$allButton <- Qt$QToolButton()
# 	allButton$setIcon(style()$standardIcon(Qt$QStyle$SP_DirOpenIcon))
# 	allButton$setIconSize(iconSize)
# 	allButton$setToolTip('Open all files in dir')
# 	allButton$enabled <- FALSE
# 
# 	## previous image
# 	this$prevButton <- Qt$QToolButton()
# 	prevButton$setIcon(style()$standardIcon(Qt$QStyle$SP_ArrowLeft))
# 	prevButton$setIconSize(iconSize)
# 	prevButton$setToolTip('View previous datafile (cyclic)')
# 
# 	## next image
# 	this$nextButton <- Qt$QToolButton()
# 	nextButton$setIcon(style()$standardIcon(Qt$QStyle$SP_ArrowRight))
# 	nextButton$setIconSize(iconSize)
# 	nextButton$setToolTip('View next datafile (cyclic)')
# 	
# 	# define the arg input buttons
# 	## bin method
# 	profile1 <- Qt$QRadioButton('&intlin')
# 	profile2 <- Qt$QRadioButton('&binlinbase')
# 	profile2$setChecked(TRUE)
# 	
# 	## step size
# 	stepArg <- Qt$QLineEdit('100')
# 	stepArg$setFixedWidth(150)
# 	
# 	## base level
# 	baselevelArg <- Qt$QLineEdit('min(intensity)')
# 	baselevelArg$setFixedWidth(150)
# 	
# 	## basespace
# 	basespaceArg <- Qt$QLineEdit('0')
# 	basespaceArg$setFixedWidth(150)
# 	
# 	# connect signals
# 	qconnect(loadButton, 'clicked', updateLoc, loadLine )
# 	qconnect(stepArg, 'returnPressed', updateStep, stepArg)
# 	# define Layouts
# 	## layout for nav buttons
# 	buttonLay <- Qt$QHBoxLayout()
# 	buttonLay$addStretch()
# 	buttonLay$addWidget(allButton)
# 	buttonLay$addWidget(prevButton)
# 	buttonLay$addWidget(nextButton)
# 	buttonLay$addStretch()
# 	## layout for file loading
# 	lay <- Qt$QHBoxLayout()
# 	lay$addWidget(loadLabel)
# 	lay$addWidget(loadLine)
# 	lay$addWidget(loadButton)
# 	lay$addStretch()
# 
# 	## layout for bin method		
# 	optLay1<- Qt$QVBoxLayout()
# 	optLay1$addWidget(profile1)
# 	optLay1$addWidget(profile2)
# 	
# 	## layout for  step size
# 	optLay2 <- Qt$QVBoxLayout()
# 	optLay2$addWidget(stepArg)
# 
# 	## layout for  base level
# 	optLay3 <- Qt$QVBoxLayout()
# 	optLay3$addWidget(baselevelArg)
#    
# 	## layout for basespace
# 	optLay4 <- Qt$QVBoxLayout()
# 	optLay4$addWidget(basespaceArg)
# 	
# 
# 	# Box layer between parent and child layouts
# 	## bin methods
# 	p1Frame <- Qt$QGroupBox('Bin Method')
# 	p1Frame$setLayout(optLay1)
# 	p1Frame$setFixedWidth(200)
# 	p1Frame$setAlignment(1)
# 	
# 	## step size
# 	p2Frame <- Qt$QGroupBox('Step Size')
# 	p2Frame$setLayout(optLay2)
# 	
# 	## base level
# 	p3Frame <- Qt$QGroupBox('baselevel')
# 	p3Frame$setLayout(optLay3)
# 	
# 	## base space
# 	p4Frame <- Qt$QGroupBox('basespace')
# 	p4Frame$setLayout(optLay4)
# 	
# 	# layout to manage all boxes for arg input
# 	optLayMaster <- Qt$QVBoxLayout()
# 	optLayMaster$addWidget(p1Frame)
# 	optLayMaster$addWidget(p2Frame)
# 	optLayMaster$addWidget(p3Frame)
# 	optLayMaster$addWidget(p4Frame)
# 	optLayMaster$addStretch()
# 	
# 	# overall layout for this page
# 	gridlay <- Qt$QGridLayout()
# 	gridlay$addLayout(lay, 0,0, 1,4)
# 	gridlay$addLayout(buttonLay,length(dir())+1,0,1,4)
# 	gridlay$addLayout(optLayMaster, 0,4, 4,1)
# 	## some dir handling to load the files
# 	updateLoc(loadLine)
# 	home <- getwd()
# 
# 	for(i in 1:length(dir())){
# 	dir_list <- Qt$QGroupBox(dir()[i])
# 	dir_list$setFlat(T)
# 	gridlay$addWidget(dir_list, i,0, 1,4)
# 	setwd(dir()[i])
# 
# 		for(j in 1:length(out[[i]])){
# 			if (j<=3){
# 			#	gridlay$addWidget(resizeView(drawPlace(), 200,100), i,j, 1,1, 132 )
# 			gridlay$addWidget(resizeView(out[[i]][[j]], 200,100), i,j, 1,1, 132 )			
# 			}
# 		}
# 		setwd(home)
# 	}
# 	
# 
# 	setLayout(gridlay)
# 
# 
# 	})
# 
# 	
# qsetClass('drawp2', Qt$QWidget, function(parent = NULL){
# 				super(parent)
# 
# gridlay2 <- Qt$QGridLayout()
# gridlay2$addWidget(resizeView(test$mainplot, 600,400), 0,0, 2,1, 132)
# gridlay2$addWidget(resizeView(test$raw, 400,267), 0,1,1,1, 132)
# gridlay2$addWidget(resizeView(test$corr, 400,267), 1,1,1,1 ,132)
# setLayout(gridlay2)				
# })
# 				
# qsetClass('chromgui', Qt$QWidget, function(parent = NULL){
# 
# 	super(parent)
# 	main <- Qt$QTabWidget()
# 	loadLabel <- Qt$QLabel('Load:')
# 	
# 	p1 <- drawp1() 
# 	p2 <- drawp2()
# 	p3 <- Qt$QWidget()
# 	p4 <- Qt$QWidget()
# 	p5 <- Qt$QWidget()
# 	p6 <- Qt$QWidget()
# 	p7 <- Qt$QWidget()
# 	p8 <- Qt$QWidget()
# 	
# 	main$addTab(p1, 'View Raw')
# 	main$addTab(p2, 'Baseline Subtraction')
# 	main$addTab(p3, 'Peak Detection') 
# 	main$addTab(p4, 'Component Detection')
# 	main$addTab(p5, 'Component Grouping')
# 	main$addTab(p6, 'Retention Time Correction')
# 	main$addTab(p7, 'Summarization')
# 	main$addTab(p8, 'Normalization')
# 	
# 	lay <- Qt$QVBoxLayout()
# 	lay$addWidget(main)
# 	
# 	setLayout(lay)
# 	
# 	setWindowTitle('Chromatoplots')
# })
# 
# qsetMethod('closeEvent', chromgui, function(x){
# 			setwd(firstHome)
# 		})
# 
# out <<- getplotValues()
# chr <- chromgui()
# chr$setMinimumHeight(625)
# chr$setMinimumWidth(1120)
# chr$show()
mariev/chromatoplotsgui documentation built on May 21, 2019, 11:46 a.m.