def fill_upload_pdb_Frame(self): """Fill Frame with neccessary widgets""" # -Create Widgets- if platform.system() == 'Darwin': self.upload_pdb_upload_Button = tk.Button( self.upload_pdb_Frame, text='Select Structure File', command=self.open_pdb_filedialog, highlightbackground='#FFF') else: self.upload_pdb_upload_Button = ctk.Button( self.upload_pdb_Frame, text='Select Structure File', command=self.open_pdb_filedialog, style='Path.TButton', ) self.upload_pdb_path_Label = ctk.Label( self.upload_pdb_Frame, textvariable=self.pdbFilePath_var, style='Path.TLabel', font=9) # Bind geometry change of this widget to updating the wraplength self.upload_pdb_path_Label.bind('<Configure>', self.update_wraplengths) # -Place Widgets- self.upload_pdb_upload_Button.place(**self.UPLOAD_BUTTON) self.upload_pdb_path_Label.place(**self.UPLOAD_LABEL)
def fill_upload_Frame(self): """Fill Frame with neccessary widgets""" # -Create Widgets- # Title self.upload_title_Label = ctk.Label(self.upload_Frame, text='Upload Files', font=20, style='Title.TLabel') # Frames self.upload_pdb_Frame = tk.Frame(self.upload_Frame) self.fill_upload_pdb_Frame() self.upload_csv_Frame = tk.Frame(self.upload_Frame) self.fill_upload_csv_Frame() self.upload_chr_Frame = tk.Frame(self.upload_Frame) self.fill_upload_chr_Frame() # -Place Widgets- # Title self.upload_title_Label.place(x=0, y=0, width=0, height=0, relx=0, rely=0, relwidth=1, relheight=0.25) # Frames self.upload_pdb_Frame.place(x=0, y=0, width=0, height=0, relx=0 / 3, rely=0.25, relwidth=1 / 3, relheight=0.75) self.upload_csv_Frame.place(x=0, y=0, width=0, height=0, relx=1 / 3, rely=0.25, relwidth=1 / 3, relheight=0.75) self.upload_chr_Frame.place(x=0, y=0, width=0, height=0, relx=2 / 3, rely=0.25, relwidth=1 / 3, relheight=0.75)
def fill_upload_chr_Frame(self): """Fill Frame with neccessary widgets""" # -Create Widgets- if platform.system() == 'Darwin': self.upload_chr_upload_Button = tk.Button( self.upload_chr_Frame, text='Select Chrome Driver', command=self.open_chr_filedialog, highlightbackground='#FFF') else: self.upload_chr_upload_Button = ctk.Button( self.upload_chr_Frame, text='Select Chrome Driver', command=self.open_chr_filedialog, style='Path.TButton', ) self.upload_chr_path_Label = ctk.Label( self.upload_chr_Frame, textvariable=self.chrFilePath_var, style='Path.TLabel', font=9) # -Place Widgets- self.upload_chr_upload_Button.place(**self.UPLOAD_BUTTON) self.upload_chr_path_Label.place(**self.UPLOAD_LABEL)
def fill_protein_Frame(self): """Fill Frame with neccessary widgets""" # -Create Widgets- # Title self.protein_title_Label = ctk.Label(self.protein_Frame, text='Structure Info', font=20, style='Title.TLabel') # Protein Name self.protein_name_Label = ctk.Label(self.protein_Frame, text='Output File Name', font=10, style='Protein.TLabel') self.protein_name_Entry = ctk.Entry(self.protein_Frame, textvariable=self.proteinName_var, font=13, justify=tk.CENTER) # Protein ID self.protein_id_Label = ctk.Label(self.protein_Frame, text='Chain ID of Residues', font=10, style='Protein.TLabel') self.protein_id_Entry = ctk.Entry( self.protein_Frame, textvariable=self.wantedProteinId_var, font=13, justify=tk.CENTER) # -Place Widgets- # Title self.protein_title_Label.place(x=0, y=0, width=0, height=0, relx=0, rely=0, relwidth=1, relheight=0.25) # Protein Name self.protein_name_Label.place(x=20, y=-5, width=-40, height=0, relx=0, rely=0.35, relwidth=1, relheight=0.1) self.protein_name_Entry.place(x=20, y=-5, width=-40, height=0, relx=0, rely=0.45, relwidth=1, relheight=0.15) # Protein ID self.protein_id_Label.place(x=20, y=-5, width=-40, height=0, relx=0, rely=0.65, relwidth=1, relheight=0.1) self.protein_id_Entry.place(x=20, y=-5, width=-40, height=0, relx=0, rely=0.75, relwidth=1, relheight=0.15)
def fill_options_Frame(self): """Fill Frame with neccessary widgets""" # -Create Widgets- # Title self.options_title_Label = ctk.Label(self.options_Frame, text='Options', font=20, style='Title.TLabel') # Interaction self.options_interaction_Label = ctk.Label( self.options_Frame, text='Select Network Type', font=12, ) self.options_main_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Chains Only', font=11, variable=self.interaction_var, value='main', style='Interaction.TRadiobutton') self.options_detailed_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Chains & Residues', font=11, variable=self.interaction_var, value='detail', style='Interaction.TRadiobutton') # Edge List self.options_edgeList_Label = ctk.Label( self.options_Frame, text='Select Edgelist Output', font=12, ) self.options_letter_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Chain ID', font=11, variable=self.edgeList_var, value='letter', style='EdgeList.TRadiobutton') self.options_name_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Chain Name', font=11, variable=self.edgeList_var, value='name', style='EdgeList.TRadiobutton') self.options_number_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Network ID', font=11, variable=self.edgeList_var, value='number', style='EdgeList.TRadiobutton') # plot network self.options_n_plot_Label = ctk.Label( self.options_Frame, text='Select Network Layout', font=12, ) self.options_letter_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Chain ID', font=11, variable=self.edgeList_var, value='letter', style='EdgeList.TRadiobutton') self.options_name_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Chain Name', font=11, variable=self.edgeList_var, value='name', style='EdgeList.TRadiobutton') self.options_number_Radiobutton = ctk.Radiobutton( self.options_Frame, text='Node ID', font=11, variable=self.edgeList_var, value='number', style='EdgeList.TRadiobutton') # -Place Widgets- # Title self.options_title_Label.place(x=0, y=0, width=0, height=0, relx=0, rely=0, relwidth=0.25, relheight=1) # Interaction self.options_interaction_Label.place(x=0, y=0, width=0, height=0, relx=0.25, rely=0, relwidth=0.3, relheight=0.5) self.options_main_Radiobutton.place(x=0, y=0, width=0, height=0, relx=0.6, rely=0, relwidth=0.2, relheight=0.5) self.options_detailed_Radiobutton.place(x=0, y=0, width=0, height=0, relx=0.8, rely=0, relwidth=0.2, relheight=0.5) # Edge List self.options_edgeList_Label.place(x=0, y=0, width=0, height=0, relx=0.25, rely=0.5, relwidth=0.3, relheight=0.5) self.options_letter_Radiobutton.place(x=0, y=0, width=0, height=0, relx=0.55, rely=0.5, relwidth=0.45 / 3, relheight=0.5) self.options_name_Radiobutton.place(x=0, y=0, width=0, height=0, relx=0.55 + 0.45 / 3, rely=0.5, relwidth=0.45 / 3, relheight=0.5) self.options_number_Radiobutton.place(x=0, y=0, width=0, height=0, relx=1 - 0.45 / 3, rely=0.5, relwidth=0.45 / 3, relheight=0.5)
def create_widgets(self): """Create window widgets""" # -Frames- self.options_Frame = tk.Frame(self) self.fill_options_Frame() self.upload_Frame = tk.Frame(self) self.fill_upload_Frame() self.protein_Frame = tk.Frame(self) self.fill_protein_Frame() # -Logo- self.logo_Label = tk.Label(self, compound='center', background=self.PRI_BG_COLOR, image=self.logo_img, anchor=tk.CENTER) self.logo_Label.image = self.logo_img # -Buttons- if platform.system() == 'Darwin': self.run_Button = tk.Button(self, text='Select Directory & Run', font=17, highlightbackground=self.PRI_BG_COLOR, command=self.run) self.analysis_Button = tk.Button( self, text='Network Analysis', font=13, highlightbackground=self.PRI_BG_COLOR, command=self.network_analysis) self.plot_Button = tk.Button(self, text='Plot Network', font=13, highlightbackground=self.PRI_BG_COLOR, command=self.plot_network) else: self.run_Button = ctk.Button(self, text='Select Directory & Run', font=17, command=self.run) self.analysis_Button = ctk.Button(self, text='Network Analysis', font=13, command=self.network_analysis) self.plot_Button = ctk.Button(self, text='Plot Network', font=13, command=self.plot_network) OptionList = [ '', 'circular', 'kamada_kawai', 'random', 'spectral', 'spring', 'shell' ] if platform.system() == 'Darwin': self.plot_options = tk.OptionMenu(self, self.layout_type, *OptionList) self.plot_options.configure( background=self.PRI_BG_COLOR, highlightbackground=self.PRI_BG_COLOR, highlightcolor=self.PRI_BG_COLOR, ) self.update_idletasks() self.update() else: self.plot_options = ttk.OptionMenu(self, self.layout_type, *OptionList)