-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGui.R
More file actions
56 lines (43 loc) · 1.58 KB
/
Gui.R
File metadata and controls
56 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
##################################################
# Name: Md. Kamruzzaman
# WSU: 11481693
# Project 2
# Math 567
##################################################
# Remove environmental variables
rm(list = ls())
RunGUI=function(){
source("main.R")
# Create a window with title
win=gwindow(title = "Set covering", width = 500, height = 500, name = "Project 2:Set cover")
group = ggroup(horizontal = FALSE, container=win)
objText = glabel(text="", container = group, width = 50)
objButton = gbutton(text = "Select file", handler = function(h,...){
svalue(objText) = gfile()
}, container = group)
objRadio = gradio(c("Preprocess","No preprocess"), container=group, selected = 2)
objCombo = gcombobox(c("Greedy","Modified greedy"), container = group)
objRun = gbutton(text = "Start", handler = function(h,...){
fileName = svalue(objText)
methodName = svalue(objCombo)
optionName = svalue(objRadio)
if(nchar(fileName)<3){
confirmDialog("Please select data file.")
}else{
obj = processAction(fileName, methodName, optionName)
if(!is.null(obj)){
t = obj$Time
u = "min"
if(t<1){
t = t*60
u = "sec"
}
text = paste("\nTime: ",t," ", u, "\nPoles: ",obj$Poles,"\n")
svalue(objResultText) = text
}else{
svalue(objResultText) = "Error in processing. Check your data file."
}
}
}, container = group)
objResultText = gtext("", container=group, font.attr=list(style="bold"), height = 80, width = 300, editable=F)
}