-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindowInformationLevel.py
More file actions
142 lines (114 loc) · 4.39 KB
/
Copy pathWindowInformationLevel.py
File metadata and controls
142 lines (114 loc) · 4.39 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#import config module for environmental variability
import config
#import my utility class and function
import MyUtility
#import my multi threading function to upload and download file
from MyMultiThreading import *
#tkinter import
import tkinter as tk
from tkinter import *
from tkinter import ttk
from tkinter.messagebox import showinfo
#Import all windows class
import WindowStandardOrganicCompounds as wSOC
import WindowDynamicOrganicCompounds as wDOC
class InformationLevelWindow(tk.Toplevel): #tk.Tk):
def __init__(self, wn_root, wn_previous):
super().__init__()
#change icon
img = PhotoImage(file=resource_path(config.icon))
self.iconphoto(False, img)
#take the root window
self.wn_root = wn_root
#take the previous window
self.wn_previous = wn_previous
# configure the root window
self.title('Meta4P') #Meta Protein Annotation Aggregation
self.geometry('355x270')
#title label
self.lbl_title = tk.Label(self, text='Data level',width=30, font=config.font_title)
self.lbl_title.grid(row=0, column=0, padx=6, pady=6)
#Proteins button
self.btn_proteins = tk.Button(self, text='Proteins', width=26, font=config.font_button, command=self.do_proteins)
self.btn_proteins.grid(row=1, column=0, padx=5, pady=5)
#Peptide button
self.btn_peptide = tk.Button(self, text='Peptides', width=26, font=config.font_button, command=self.do_peptide)
self.btn_peptide.grid(row=2, column=0, padx=5, pady=5)
#PSMs button
if(MyUtility.workDict["input_type"] != 'fragpipe'):
self.btn_psms = tk.Button(self, text='PSMs', width=26, font=config.font_button, command=self.do_psms)
self.btn_psms.grid(row=3, column=0, padx=5, pady=5)
#empty label
self.lbl_empty = tk.Label(self, text='',width=30, font=config.font_subtitle)
self.lbl_empty.grid(row=4, column=0, padx=6, pady=6)
#Previous Step
self.btn_previous_step = tk.Button(self, text='← Previous step', font=config.font_button, width=20, command=self.previous_window)
self.btn_previous_step.grid(row=5, column=0, padx=5, pady=5)
#put this window up
self.lift()
#when i close window
self.protocol("WM_DELETE_WINDOW", self.on_closing)
def on_closing(self):
if tk.messagebox.askokcancel("Quit", "Do you want to quit?"):
self.wn_root.destroy()
def do_proteins(self):
#change mode type value
MyUtility.workDict["mode"] = 'Proteins'
self.create_OrganicCompounds()
def do_peptide(self):
#change mode type value
MyUtility.workDict["mode"] = 'Peptides'
self.create_OrganicCompounds()
def do_psms(self):
#change mode type value
MyUtility.workDict["mode"] = 'PSMs'
self.create_OrganicCompounds()
def create_OrganicCompounds(self):
#hide menu window
self.withdraw()
#create new window according to user input_type choose
if(MyUtility.workDict["input_type"] != 'other'):
self.windowSOC = wSOC.StandardOrganicCompoundsWindow(self.wn_root, self)
else:
self.windowDOC = wDOC.DynamicOrganicCompoundsWindow(self.wn_root, self)
def previous_window(self):
#hide this window
#self.withdraw()
#Destroy this window
self.destroy()
#show last window
self.wn_previous.deiconify()
self.wn_previous.lift()
'''
#create new window or show it if alredy exists
if( hasattr(self, 'windowPr') ):
self.windowPr.deiconify()
#put this window up
self.windowPr.lift()
else:
self.windowPr = wPr.ProteinsWindow(self)
'''
"""
window.configure(bg='lightgray')
# move window center
winWidth = window.winfo_reqwidth()
winwHeight = window.winfo_reqheight()
posRight = int(window.winfo_screenwidth() / 2 - winWidth / 2)
posDown = int(window.winfo_screenheight() / 2 - winwHeight / 2)
window.geometry("+{}+{}".format(posRight, posDown))
window.mainloop()
"""
'''
#import os
import os
#get the current path
dir_path = os.path.dirname(os.path.realpath(__file__))
#add folder dir
dir_path = dir_path + '/temp'
# Check whether the specified path exists or not
isExist = os.path.exists(dir_path)
if not isExist:
# Create a new directory because it does not exist
os.makedirs(dir_path)
print("The new directory is created!")
'''