Exemplo n.º 1
0
    def build_widgets(self):
        '''
 		Builds the dialog for interaction with the user.
 		'''
        self.cont = tk.Frame(self.toplevel, background=MAC_GREY)
        self.cont.pack(expand=True, fill=tk.BOTH)
        self.cont_widgets = tk.Frame(self.cont, background=MAC_GREY)
        self.cont_widgets.pack(fill=tk.X, anchor=tk.W)
        self.cont_widgets.grid_columnconfigure(1, weight=1)
        self.create_preview_container()

        self.doneIcon, self.refreshIcon = images.get_done_refresh_icons()
        labelTitle = tk.Label(self.cont_widgets,
                              text='Define groups to highlight them ' +
                              'in the projection plot\nNote that you can' +
                              ' also enter your own color.',
                              **titleLabelProperties)

        labelMethod = tk.Label(self.cont_widgets,
                               text='Components :{}'.format(self.method),
                               **titleLabelProperties)
        labelColorMap = tk.Label(self.cont_widgets,
                                 text='Color Map:',
                                 bg=MAC_GREY)
        comboboxColorMap = ttk.Combobox(self.cont_widgets,
                                        textvariable=self.colorMap,
                                        values=self.colorSchmes,
                                        width=10)
        comboboxColorMap.bind('<<ComboboxSelected>>', self.refresh)
        ## creating buttons for applying
        inferButton = ttk.Button(self.cont_widgets,
                                 text='Infer groups',
                                 command=self.infer_groups)

        CreateToolTip(
            inferButton,
            title_='Infer Grouping',
            text='Calculates Levenshtein distance and uses affinity' +
            ' propagation to group them')

        applyButton = create_button(self.cont_widgets,
                                    image=self.doneIcon,
                                    command=self.apply_coloring)

        refreshButton = create_button(
            self.cont_widgets,
            image=self.refreshIcon,
            command=lambda: self.apply_coloring(close=False))

        ## grid widgets
        labelTitle.grid(row=0,
                        column=0,
                        padx=4,
                        pady=15,
                        columnspan=3,
                        sticky=tk.W)
        labelTitle.grid(row=1,
                        column=0,
                        padx=4,
                        pady=15,
                        columnspan=3,
                        sticky=tk.W)

        labelColorMap.grid(row=2, column=0, padx=4, pady=4, sticky=tk.E)
        comboboxColorMap.grid(row=2, column=1, padx=4, pady=4, sticky=tk.W)
        inferButton.grid(row=2, column=1, padx=(15, 40), pady=4, sticky=tk.E)

        applyButton.grid(row=2, column=2, sticky=tk.E, padx=4)
        refreshButton.grid(row=2, column=2, sticky=tk.E, padx=45)
Exemplo n.º 2
0
	def build_widgets(self):
 		'''
 		Builds the dialog for interaction with the user.
 		'''	 
 		self.cont= tk.Frame(self.toplevel, background = MAC_GREY) 
 		self.cont.pack(expand =True, fill = tk.BOTH)
 		self.cont_widgets = tk.Frame(self.cont,background=MAC_GREY) 
 		self.cont_widgets.pack(fill=tk.X, anchor = tk.W) 
 		self.cont_widgets.grid_columnconfigure(1,weight=1)
 		self.create_preview_container() 
 		
 		self.doneIcon, self.refreshIcon = images.get_done_refresh_icons()
 		
 		labelTitle = tk.Label(self.cont_widgets, text= operationTitle[self.operationType], 
                                     **titleLabelProperties)
 		labelSearch = tk.Label(self.cont_widgets, text = 'String :', bg = MAC_GREY) 
 		entrySearch = ttk.Entry(self.cont_widgets, textvariable = self.searchString)
 		entrySearch.unbind('<Command-v>')
 		
 		if self.operationType == 'Search string & annotate':
 			entrySearch.bind('<Control-v>', self.copy_from_clipboard)
 			if platform == 'MAC':
 				entrySearch.bind('<Command-v>', self.copy_from_clipboard)
 		if platform == 'MAC':
 			entrySearch.bind('<Command-z>', self.undo) 	
 			
 		entrySearch.bind('<Control-z>', self.undo) 			
 		entrySearch.bind('<Return>',lambda event: \
 		self.update_data_upon_search(event, forceUpdate = True))
 		self.searchString.trace(mode="w", callback=self.update_data_upon_search)
 		
 		if self.operationType in ['Find category & annotate','Subset data on unique category']:
 		
 			## for these types we want to provide the possibility to change the separator to get unique values
 			labelSeparator = tk.Label(self.cont_widgets, text = 'Sep. :', bg = MAC_GREY)
 			sepComboBox = ttk.Combobox(self.cont_widgets, textvariable = self.separatorString,
 									   exportselection = 0, 
 									   values = [';',',',':','-','_','/'])
 			self.separatorString.set(';')
 			
 			refreshButton = tk.Button(self.cont_widgets, image=self.refreshIcon, 
 														 command = self.refresh_separator)
 			
 			labelSeparator.grid(row=1,padx=5, pady=5, sticky=tk.W)  
 			sepComboBox.grid(row=1, column=1, sticky=tk.EW, padx=2)
 			refreshButton.grid(row=1, column=2, sticky=tk.E, padx=2)
 			
 		elif self.operationType == 'Search string & annotate':
 		
 			labelInfo = tk.Label(self.cont_widgets,text= 'For multiple search strings type: "String1","String2" ..', 
 								 bg=MAC_GREY, justify=tk.LEFT)
 		
 			annotateStringCb = ttk.Checkbutton(self.cont_widgets, 
 				variable = self.annotateSearchString, text = 'Annotate matches by search string(s)')
 			onlyFirstFind = ttk.Checkbutton(self.cont_widgets, 
 				variable = self.onlyFirstFind , text = 'Annotate combinations (String1,String2)',
 				command = self.check_cbs)
 			caseSensitive = ttk.Checkbutton(self.cont_widgets, 
 					variable = self.caseSensitive, text = 'Case sensitive',
 					command = lambda: self.update_data_upon_search(forceUpdate = True))
 				
 			useRegRexpress = ttk.Checkbutton(self.cont_widgets, 
 										variable = self.userRedExpression, 
 										text = 'Input is a regular expression')
 										
 			labelInfo.grid(row=1,column=0,columnspan=3,padx=3,sticky = tk.W,pady=4)
 			annotateStringCb.grid(row=2,column=0,columnspan=2,padx=3,sticky=tk.W) 
 			onlyFirstFind.grid(row=3,column=0,columnspan=2,padx=3,sticky=tk.W) 
 			useRegRexpress.grid(row=3,column=1,columnspan=2,padx=3,sticky=tk.E)
 			caseSensitive.grid(row=2,column=1,columnspan=2,padx=3,sticky=tk.E)
 		
 		elif self.operationType in ['Annotate scatter points',
 				'Find entry in hierarch. cluster','Find entry in line plot']:
 			
 			labelColumn = tk.Label(self.cont_widgets,text= 'Column:', bg=MAC_GREY)
 								 
 			optionMenuColumn = ttk.OptionMenu(self.cont_widgets, self.annotationColumn, 
 											  self.dfClass.df_columns[0], *self.dfClass.df_columns,
 											  command = self.update_data) 
 			caseSensitive = ttk.Checkbutton(self.cont_widgets,
 										variable = self.caseSensitive, 
 										text = 'Case sensitive',
 										command = lambda : self.update_data_upon_search(forceUpdate = True))
 			
 			caseSensitive.grid(row=2,column=1,columnspan=2,padx=3,sticky=tk.E)
 			optionMenuColumn.grid(row=3,column=1,columnspan=1,sticky=tk.EW)
 			labelColumn.grid(row=3,column=0,sticky=tk.W,padx=3)
 		
 		## creating buttons for applying 
 		
 		applyButton = tk.Button(self.cont_widgets, image=self.doneIcon, command = self.commandDict[self.operationType])

 		labelTitle.grid(row=0,column=0,padx=4, pady = 15, columnspan = 3, sticky=tk.W)
 		labelSearch.grid(row=5,padx = 5, pady = 5, sticky=tk.W)
 		entrySearch.grid(column = 1, row = 5, sticky=tk.EW, padx=2)
 		applyButton.grid(row=5,column=2,sticky=tk.E,padx=2)
Exemplo n.º 3
0
    def build_widgets(self):
        '''
 		Builds the dialog for interaction with the user.
 		'''
        self.cont = tk.Frame(self.toplevel, background=MAC_GREY)
        self.cont.pack(expand=True, fill=tk.BOTH)
        self.cont_widgets = tk.Frame(self.cont, background=MAC_GREY)
        self.cont_widgets.pack(fill=tk.X, anchor=tk.W)
        self.cont_widgets.grid_columnconfigure(1, weight=1)
        self.create_preview_container()

        self.doneIcon, self.refreshIcon = images.get_done_refresh_icons()

        labelTitle = tk.Label(self.cont_widgets,
                              text=operationTitle[self.operationType],
                              **titleLabelProperties)

        if self.dataType == 'object':

            exactMatchCB = ttk.Checkbutton(self.cont_widgets,
                                           variable=self.exactMatch,
                                           text='Match entire cell content')
            exactMatchCB.grid(row=3,
                              column=0,
                              columnspan=2,
                              padx=3,
                              sticky=tk.W)

        labelInfo = tk.Label(self.cont_widgets,
                             text=infoText[self.dataType],
                             bg=MAC_GREY,
                             justify=tk.LEFT)

        labelSearch = tk.Label(self.cont_widgets,
                               text='Replace: ',
                               bg=MAC_GREY)
        labelReplace = tk.Label(self.cont_widgets, text='with: ', bg=MAC_GREY)

        entrySearch = ttk.Entry(self.cont_widgets,
                                textvariable=self.searchString)
        entryReplace = ttk.Entry(self.cont_widgets,
                                 textvariable=self.replaceString)

        entrySearch.bind('<Return>', \
        lambda event :self.update_data_upon_search(forceUpdate = True))

        self.searchString.trace(mode="w",
                                callback=self.update_data_upon_search)

        applyButton = create_button(
            self.cont_widgets,
            image=self.doneIcon,
            command=self.commandDict[self.operationType])

        labelTitle.grid(row=0,
                        column=0,
                        padx=4,
                        pady=15,
                        columnspan=3,
                        sticky=tk.W)
        labelInfo.grid(row=1,
                       column=0,
                       padx=4,
                       pady=3,
                       columnspan=3,
                       sticky=tk.W)

        labelSearch.grid(row=4, padx=5, pady=5, sticky=tk.W)
        labelReplace.grid(row=5, padx=5, pady=5, sticky=tk.W)
        entrySearch.grid(column=1, row=4, sticky=tk.EW, padx=2)
        entryReplace.grid(column=1, row=5, sticky=tk.EW, padx=2)
        applyButton.grid(row=4, column=2, sticky=tk.E, padx=2, rowspan=2)