@@ -18980,80 +18980,6 @@ ps <- function(dispPane='co'){
18980
18980
# }
18981
18981
# displayGeneButton <- ttkbutton(genePlotTypeFrame, text='Display Single Gene', width=21, command=onDisplayGene)
18982
18982
18983
- # onDisplayGene <- function() {
18984
- # # Generate a temporary dialog window
18985
- # geneDialog <- tktoplevel()
18986
- # tkwm.title(geneDialog, "Gene Name Entry")
18987
-
18988
- # # Instruction label
18989
- # geneLabel <- ttklabel(geneDialog, text = 'Enter the name of the gene you wish to view in detail:')
18990
- # tkgrid(geneLabel, padx = 10, pady = 5)
18991
-
18992
- # # Create tclVars for both the entry and dropdown
18993
- # geneEntryVar <- tclVar("")
18994
- # geneDropdownVar <- tclVar("")
18995
-
18996
- # # Entry box for manual gene name input
18997
- # geneEntry <- tkentry(geneDialog, textvariable=geneEntryVar, width = 30)
18998
- # tkgrid(geneEntry, padx = 10, pady = 5)
18999
-
19000
- # # Dropdown (combobox) populated with available gene names from species$genes$name
19001
- # geneNamesList <- species$genes$name # Assuming this is a list of available gene names
19002
-
19003
- # if (length(geneNamesList) == 0) {
19004
- # tkmessageBox(message = "No gene names available.", icon = "error")
19005
- # tkdestroy(geneDialog)
19006
- # return()
19007
- # }
19008
-
19009
- # geneDropdown <- ttkcombobox(geneDialog, textvariable=geneDropdownVar, values = geneNamesList, width = 27)
19010
- # tkgrid(geneDropdown, padx = 10, pady = 5)
19011
-
19012
- # # Function to handle the 'OK' button click
19013
- # onOK <- function() {
19014
- # # Get the gene name from either the entry box or dropdown
19015
- # geneName <- tclvalue(geneEntryVar)
19016
- # if (nchar(geneName) == 0) {
19017
- # geneName <- tclvalue(geneDropdownVar) # Fall back to dropdown selection
19018
- # }
19019
-
19020
- # if (nchar(geneName) == 0) {
19021
- # # No gene entered or selected, analyze full proteome
19022
- # analyze_genes('')
19023
- # } else if (geneName %in% species$genes$name) {
19024
- # # Valid gene name, analyze the selected gene
19025
- # analyze_genes(geneName)
19026
- # } else {
19027
- # # Invalid gene name, display error message
19028
- # log_message(paste0(geneName, ' is not a valid gene of ', species$name))
19029
- # }
19030
-
19031
- # tkdestroy(geneDialog) # Close the dialog box
19032
- # }
19033
-
19034
- # # OK button
19035
- # okButton <- ttkbutton(geneDialog, text = 'OK', command = onOK)
19036
- # tkgrid(okButton, padx = 10, pady = 10)
19037
-
19038
- # # Cancel button
19039
- # onCancel <- function() {
19040
- # tkdestroy(geneDialog) # Close the dialog box without action
19041
- # }
19042
- # cancelButton <- ttkbutton(geneDialog, text = 'Cancel', command = onCancel)
19043
- # tkgrid(cancelButton, padx = 10, pady = 10)
19044
-
19045
- # # Keep focus on the dialog
19046
- # tkfocus(geneDialog)
19047
- # tcl("update") # Ensure focus and window visibility is updated
19048
- # }
19049
- # displayGeneButton <- ttkbutton(genePlotTypeFrame, text='Display Single Gene', width=21, command=onDisplayGene)
19050
-
19051
- onDisplayProteome <- function()
19052
- {
19053
- analyze_genes('')
19054
- }
19055
- displayGenomeButton <- ttkbutton(genePlotTypeFrame, text='Display Full Proteome', width=21, command=onDisplayProteome)
19056
-
19057
18983
onDisplayGene <- function() {
19058
18984
# Generate a temporary dialog window
19059
18985
geneDialog <- tktoplevel()
@@ -19063,17 +18989,24 @@ onDisplayGene <- function() {
19063
18989
geneLabel <- ttklabel(geneDialog, text = 'Enter the name of the gene you wish to view in detail:')
19064
18990
tkgrid(geneLabel, padx = 10, pady = 5)
19065
18991
19066
- # Create Tcl variables to hold the gene name values
18992
+ # Create tclVars for both the entry and dropdown
19067
18993
geneEntryVar <- tclVar("")
19068
18994
geneDropdownVar <- tclVar("")
19069
18995
19070
18996
# Entry box for manual gene name input
19071
- geneEntry <- tkentry(geneDialog, width = 30, textvariable = geneEntryVar )
18997
+ geneEntry <- tkentry(geneDialog, textvariable=geneEntryVar, width = 30 )
19072
18998
tkgrid(geneEntry, padx = 10, pady = 5)
19073
18999
19074
19000
# Dropdown (combobox) populated with available gene names from species$genes$name
19075
19001
geneNamesList <- species$genes$name # Assuming this is a list of available gene names
19076
- geneDropdown <- ttkcombobox(geneDialog, values = geneNamesList, width = 27, textvariable = geneDropdownVar)
19002
+
19003
+ if (length(geneNamesList) == 0) {
19004
+ tkmessageBox(message = "No gene names available.", icon = "error")
19005
+ tkdestroy(geneDialog)
19006
+ return()
19007
+ }
19008
+
19009
+ geneDropdown <- ttkcombobox(geneDialog, textvariable=geneDropdownVar, values = geneNamesList, width = 27)
19077
19010
tkgrid(geneDropdown, padx = 10, pady = 5)
19078
19011
19079
19012
# Function to handle the 'OK' button click
@@ -19111,9 +19044,76 @@ onDisplayGene <- function() {
19111
19044
19112
19045
# Keep focus on the dialog
19113
19046
tkfocus(geneDialog)
19047
+ tcl("update") # Ensure focus and window visibility is updated
19114
19048
}
19115
19049
displayGeneButton <- ttkbutton(genePlotTypeFrame, text='Display Single Gene', width=21, command=onDisplayGene)
19116
19050
19051
+ onDisplayProteome <- function()
19052
+ {
19053
+ analyze_genes('')
19054
+ }
19055
+ displayGenomeButton <- ttkbutton(genePlotTypeFrame, text='Display Full Proteome', width=21, command=onDisplayProteome)
19056
+
19057
+ # onDisplayGene <- function() {
19058
+ # # Generate a temporary dialog window
19059
+ # geneDialog <- tktoplevel()
19060
+ # tkwm.title(geneDialog, "Gene Name Entry")
19061
+
19062
+ # # Instruction label
19063
+ # geneLabel <- ttklabel(geneDialog, text = 'Enter the name of the gene you wish to view in detail:')
19064
+ # tkgrid(geneLabel, padx = 10, pady = 5)
19065
+
19066
+ # # Create Tcl variables to hold the gene name values
19067
+ # geneEntryVar <- tclVar("")
19068
+ # geneDropdownVar <- tclVar("")
19069
+
19070
+ # # Entry box for manual gene name input
19071
+ # geneEntry <- tkentry(geneDialog, width = 30, textvariable = geneEntryVar)
19072
+ # tkgrid(geneEntry, padx = 10, pady = 5)
19073
+
19074
+ # # Dropdown (combobox) populated with available gene names from species$genes$name
19075
+ # geneNamesList <- species$genes$name # Assuming this is a list of available gene names
19076
+ # geneDropdown <- ttkcombobox(geneDialog, values = geneNamesList, width = 27, textvariable = geneDropdownVar)
19077
+ # tkgrid(geneDropdown, padx = 10, pady = 5)
19078
+
19079
+ # # Function to handle the 'OK' button click
19080
+ # onOK <- function() {
19081
+ # # Get the gene name from either the entry box or dropdown
19082
+ # geneName <- tclvalue(geneEntryVar)
19083
+ # if (nchar(geneName) == 0) {
19084
+ # geneName <- tclvalue(geneDropdownVar) # Fall back to dropdown selection
19085
+ # }
19086
+
19087
+ # if (nchar(geneName) == 0) {
19088
+ # # No gene entered or selected, analyze full proteome
19089
+ # analyze_genes('')
19090
+ # } else if (geneName %in% species$genes$name) {
19091
+ # # Valid gene name, analyze the selected gene
19092
+ # analyze_genes(geneName)
19093
+ # } else {
19094
+ # # Invalid gene name, display error message
19095
+ # log_message(paste0(geneName, ' is not a valid gene of ', species$name))
19096
+ # }
19097
+
19098
+ # tkdestroy(geneDialog) # Close the dialog box
19099
+ # }
19100
+
19101
+ # # OK button
19102
+ # okButton <- ttkbutton(geneDialog, text = 'OK', command = onOK)
19103
+ # tkgrid(okButton, padx = 10, pady = 10)
19104
+
19105
+ # # Cancel button
19106
+ # onCancel <- function() {
19107
+ # tkdestroy(geneDialog) # Close the dialog box without action
19108
+ # }
19109
+ # cancelButton <- ttkbutton(geneDialog, text = 'Cancel', command = onCancel)
19110
+ # tkgrid(cancelButton, padx = 10, pady = 10)
19111
+
19112
+ # # Keep focus on the dialog
19113
+ # tkfocus(geneDialog)
19114
+ # }
19115
+ # displayGeneButton <- ttkbutton(genePlotTypeFrame, text='Display Single Gene', width=21, command=onDisplayGene)
19116
+
19117
19117
##add widgets to fileFrame
19118
19118
tkgrid(onedFileFrame, column=1, row=1, sticky='nswe', pady=c(6, 4), padx=8)
19119
19119
tkgrid(onedFileBox, column=1, row=1, sticky='nswe')
@@ -19239,7 +19239,7 @@ displayGeneButton <- ttkbutton(genePlotTypeFrame, text='Display Single Gene', wi
19239
19239
## Now that the window is set up, deiconify it to show the window properly
19240
19240
tkwm.deiconify(dlg)
19241
19241
tcl("update") # Ensure the window is fully drawn and updated
19242
- refresh(... )
19242
+ refresh()
19243
19243
19244
19244
invisible()
19245
19245
}
0 commit comments