def _createContent(self): """ Create the Data View for the Project. It has two panes: Left: containing the Protocol classes tree Right: containing the Data list """ p = tk.PanedWindow(self, orient=tk.HORIZONTAL, bg='white') # Left pane, contains Data tree leftFrame = tk.Frame(p, bg='white') bgColor = '#eaebec' self._createDataTree(leftFrame, bgColor) gui.configureWeigths(leftFrame) # Right pane rightFrame = tk.Frame(p, bg='white') rightFrame.columnconfigure(0, weight=1) rightFrame.rowconfigure(1, weight=1) #rightFrame.rowconfigure(0, minsize=label.winfo_reqheight()) self._fillRightPane(rightFrame) # Add sub-windows to PanedWindows p.add(leftFrame, padx=5, pady=5) p.add(rightFrame, padx=5, pady=5) p.paneconfig(leftFrame, minsize=300) p.paneconfig(rightFrame, minsize=400) return p
def _addBoundTree(self, parent, ProviderClass, height, **kwargs): bt = BoundTree(parent, ProviderClass(self.experiment, **kwargs), height=height) bt.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(parent) return bt
def body(self, bodyFrame): bodyFrame.config(bg='white') configureWeigths(bodyFrame, 1, 1) # Label label_text = tk.Label(bodyFrame, text="Name", bg='white', bd=0) label_text.grid(row=0, column=0, sticky='nw', padx=(15, 10), pady=15) # Label box var = tk.StringVar() var.set(self.label.getName()) self.textVar = var self.textLabel = tk.Entry(bodyFrame, width=20, textvariable=var) self.textLabel.grid(row=0, column=1, sticky='news', padx=5, pady=5) # Comment colorLabel = tk.Label(bodyFrame, text='Color \n(Click to change)', bg='white', bd=0) colorLabel.grid(row=1, column=0, sticky='nw', padx=(15, 10), pady=15) self.colorVar = tk.StringVar() self.colorVar.set(self.label.getColor()) self.colorBox = tk.Frame(bodyFrame, bg=self.colorVar.get()) self.colorBox.grid(row=1, column=1, sticky='news', padx=5, pady=5) colorLabel.bind('<Button-1>', self._changeColor) self.colorBox.bind('<Button-1>', self._changeColor)
def _createSamplesFrame(self, content): frame = tk.Frame(content) #frame = tk.LabelFrame(content, text='General') lfSamples = tk.LabelFrame(frame, text='Samples') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) self.samplesTree = self._addBoundTree(lfSamples, SamplesTreeProvider, 10, fitting=self.fitting) self.samplesTree.itemDoubleClick = self._onSampleDoubleClick self.samplesTree.itemClick = self._onSampleClick plotFrame = tk.Frame(lfSamples) plotFrame.grid(row=1, column=0, sticky='ws', padx=5, pady=5) # Add a combobox with the variable for time timeVars = [v.varName for v in self.experiment.variables.values() if v.role == v.ROLE_TIME] timeVars += [v.varName for v in self.experiment.variables.values() if v.role == v.ROLE_MEASUREMENT] measureVars = [v.varName for v in self.experiment.variables.values() if v.role == v.ROLE_MEASUREMENT] def addVar(text, col, choices): varFrame = tk.Frame(plotFrame) varFrame.grid(row=0, column=col, sticky='new') label = tk.Label(varFrame, text=text, font=self.fontBold) label.grid(row=0, column=0, padx=5, pady=2, sticky='nw') combo = ComboBox(varFrame, choices, width=10) combo.grid(row=0, column=1, sticky='nw', padx=5, pady=5) radioVar = tk.IntVar() radio = tk.Checkbutton(varFrame, text='Log10', variable=radioVar) radio.grid(row=0, column=2, sticky='nw', padx=5, pady=5) return combo, radio, radioVar self.timeWidget = addVar('Time variable', 0, timeVars) self.measureWidget = addVar('Measure variable', 1, measureVars) self.measureWidget[2].set(True) self.plotButton = Button(plotFrame, ' Plot ', font=self.fontBold, command=self._onPlotClick, tooltip='Select one or more samples to plot ' 'their measures of the selected ' 'variables (optionally in log).') self.plotButton.grid(row=0, column=2, sticky='ne', padx=5) self.plotSummaryButton = Button(plotFrame, ' Summary Plot ', font=self.fontBold, command=self._onPlotSummaryClick, tooltip='Select several samples to plot' ' their statistics' ' (min, max, avg and std).') self.plotSummaryButton.grid(row=1, column=2, sticky='ne', padx=5, pady=5) #frame.grid(row=1, column=0, sticky='news', padx=5, pady=5) content.add(frame, sticky='news', padx=5, pady=5)
def _createBottomFrame(self, content): frame = tk.Frame(content) t = TaggedText(frame, height=10) t.grid(row=0, column=0, sticky='news', padx=5, pady=5) t.addLine("*Correlation Matrix*") t.addText(np.array2string(self.R)) frame.grid(row=2, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame)
def _createMeasurementFrame(self, content): frame = tk.Frame(content) #frame = tk.LabelFrame(content, text='General') lfSamples = tk.LabelFrame(frame, text=self.title) gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) self.measurementTree = self._addBoundTree(lfSamples, self.provider, 10) frame.grid(row=0, column=0, sticky='news', padx=5, pady=5)
def _createButtonsFrame(self, content): frame = tk.Frame(content) gui.configureWeigths(frame) buttonsFrame = tk.Frame(frame) buttonsFrame.grid(row=0, column=0, sticky='ne') closeButton = Button(buttonsFrame, 'Close', command=self.close, imagePath='fa-times.png') frame.grid(row=2, column=0, sticky='news', padx=5, pady=5)
def _createButtonsFrame(self, content): frame = tk.Frame(content) self.plotButton = HotButton(frame, ' Plot ', font=self.fontBold, command=self._onPlotClick, tooltip='Select one or two variables to plot ') self.plotButton.grid(row=0, column=0, sticky='se', padx=5) frame.grid(row=1, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame)
def _createSamplesFrame(self, content): frame = tk.Frame(content, bg='white') #frame = tk.LabelFrame(content, text='General') lfSamples = tk.LabelFrame(frame, text="Samples", bg='white') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) self.samplesTree = self._addBoundTree(lfSamples, self.provider, 10) self.samplesTree.itemClick = self._onSampleChanged frame.grid(row=0, column=0, sticky='news', padx=5, pady=5)
def _createButtonsFrame(self, content): frame = tk.Frame(content) self.plotButton = HotButton( frame, ' Plot ', font=self.fontBold, command=self._onPlotClick, tooltip='Select one or two variables to plot ') self.plotButton.grid(row=0, column=0, sticky='se', padx=5) frame.grid(row=1, column=0, sticky='sew', padx=5, pady=5) gui.configureWeigths(frame)
def _createTopFrame(self, content): frame = tk.Frame(content) lfSamples = tk.LabelFrame(frame, text='Plot') gui.configureWeigths(frame) lfSamples.grid(row=0, column=0, sticky='news', padx=5, pady=5) # Create tree for Population Variables tp = PopulationVariablesTreeProvider(self._variables.values()) self.tree = BoundTree(frame, tp, height=10) self.tree.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(frame) frame.grid(row=0, column=0, sticky='news', padx=5, pady=(10, 5))
def __init__(self, **kwargs): gui.Window.__init__(self, minsize=(620, 200), **kwargs) self.population = kwargs.get('population') self.callback = kwargs.get('callback', None) self.plotter = None self._variables = OrderedDict() self._variablesDict = {} self._loadVariables(self.population) content = tk.Frame(self.root) self._createContent(content) content.grid(row=0, column=0, sticky='news') gui.configureWeigths(content)
def _createButtonsFrame(self, content): frame = tk.Frame(content) gui.configureWeigths(frame) buttonsFrame = tk.Frame(frame) buttonsFrame.grid(row=0, column=0, sticky='ne') closeButton = Button(buttonsFrame, 'Close', command=self.close, imagePath='fa-times.png') closeButton.grid(row=0, column=0, sticky='ne', padx=5) self.newButton = HotButton(buttonsFrame, ' New Experiment ', command=self._onCreateClick, tooltip='Create a new experiment with the ' 'selected samples. You can also edit' 'title and comment.') self.newButton.grid(row=0, column=1, sticky='ne', padx=5) frame.grid(row=1, column=0, sticky='news', padx=5, pady=5)
def _createSlidersFrame(self, content): frame = tk.Frame(content, bg='white') lfBounds = tk.LabelFrame(frame, text="Parameter Bounds", bg='white') gui.configureWeigths(frame) i = 0 self.sliders = {} paramUnits = self.targetProtocol.parameterUnits for paramName, bounds in self.targetProtocol.getParameterBounds().iteritems(): bounds = bounds or (0, 1) slider = MinMaxSlider(lfBounds, "%s [%s]"%(paramName,strUnit(paramUnits[i])), bounds[0], bounds[1], callback=self._onVarChanged) slider.grid(row=i, column=0, padx=5, pady=5) self.sliders[paramName] = slider i += 1 lfBounds.grid(row=0, column=0, sticky='news', padx=5, pady=5) frame.grid(row=0, column=1, sticky='news', padx=5, pady=5)
def _createSlidersFrame(self, content): frame = tk.Frame(content, bg='white') lfBounds = tk.LabelFrame(frame, text="Parameter Bounds", bg='white') gui.configureWeigths(frame) i = 0 self.sliders = {} paramUnits = self.targetProtocol.parameterUnits for paramName, bounds in self.targetProtocol.getParameterBounds().items(): bounds = bounds or (0, 1) slider = MinMaxSlider(lfBounds, "%s [%s]"%(paramName,strUnit(paramUnits[i])), bounds[0], bounds[1], callback=self._onVarChanged) slider.grid(row=i, column=0, padx=5, pady=5) self.sliders[paramName] = slider i += 1 lfBounds.grid(row=0, column=0, sticky='news', padx=5, pady=5) frame.grid(row=0, column=1, sticky='news', padx=5, pady=5)
def __init__(self, parent, windows, **args): tk.Frame.__init__(self, parent, **args) # Load global configuration self.windows = windows self.project = windows.project self.root = windows.root self.getImage = windows.getImage self.protCfg = windows.protCfg self.icon = windows.icon self.settings = windows.getSettings() self.showGraph = self.settings.getRunsView() self.style = ttk.Style() self._dataGraph = windows.project.getSourceGraph() c = self._createContent() gui.configureWeigths(self) c.grid(row=0, column=0, sticky='news')
def __init__(self, parent, windows, **args): tk.Frame.__init__(self, parent, **args) # Load global configuration self.windows = windows self.project = windows.project self.root = windows.root self.getImage = windows.getImage self.settings = windows.getSettings() self.showGraph = self.settings.getRunsView() self.style = ttk.Style() self.root.bind("<F5>", self.refreshData) self.__autoRefresh = None self.__autoRefreshCounter = 3 # start by 3 secs self._dataGraph = windows.project.getSourceGraph(True) c = self._createContent() gui.configureWeigths(self) c.grid(row=0, column=0, sticky='news')
def __init__(self, parent, windows, **args): tk.Frame.__init__(self, parent, **args) # Load global configuration self.windows = windows self.project = windows.project self.root = windows.root self.getImage = windows.getImage self.protCfg = windows.protCfg self.icon = windows.icon self.settings = windows.getSettings() self.showGraph = self.settings.getRunsView() self.style = ttk.Style() self.root.bind("<F5>", self.refreshData) self.__autoRefresh = None self.__autoRefreshCounter = 3 # start by 3 secs self._dataGraph = windows.project.getSourceGraph(True) c = self._createContent() gui.configureWeigths(self) c.grid(row=0, column=0, sticky='news')
def _fillRightPane(self, parent): """ # Create the right Pane that will be composed by: # a Action Buttons TOOLBAR in the top # and another vertical Pane with: # Runs History (at Top) # Sectected run info (at Bottom) """ # Create the Action Buttons TOOLBAR toolbar = tk.Frame(parent, bg='white') toolbar.grid(row=0, column=0, sticky='news') gui.configureWeigths(toolbar) #toolbar.columnconfigure(0, weight=1) toolbar.columnconfigure(1, weight=1) self.runsToolbar = tk.Frame(toolbar, bg='white') self.runsToolbar.grid(row=0, column=0, sticky='sw') # On the left of the toolbar will be other # actions that can be applied to all runs (refresh, graph view...) self.allToolbar = tk.Frame(toolbar, bg='white') self.allToolbar.grid(row=0, column=10, sticky='se') #self.createActionToolbar() # Create the Run History tree v = ttk.PanedWindow(parent, orient=tk.VERTICAL) #runsFrame = ttk.Labelframe(v, text=' History ', width=500, height=500) runsFrame = tk.Frame(v, bg='white') self._createDataGraph(runsFrame) gui.configureWeigths(runsFrame) # Create the Selected Run Info infoFrame = tk.Frame(v) gui.configureWeigths(infoFrame) self._infoText = TaggedText( infoFrame, bg='white', handlers={'sci-open': self._openProtocolFormFromId}) self._infoText.grid(row=0, column=0, sticky='news') v.add(runsFrame, weight=3) v.add(infoFrame, weight=1) v.grid(row=1, column=0, sticky='news')
def _fillRightPane(self, parent): """ # Create the right Pane that will be composed by: # a Action Buttons TOOLBAR in the top # and another vertical Pane with: # Runs History (at Top) # Sectected run info (at Bottom) """ # Create the Action Buttons TOOLBAR toolbar = tk.Frame(parent, bg='white') toolbar.grid(row=0, column=0, sticky='news') gui.configureWeigths(toolbar) #toolbar.columnconfigure(0, weight=1) toolbar.columnconfigure(1, weight=1) self.runsToolbar = tk.Frame(toolbar, bg='white') self.runsToolbar.grid(row=0, column=0, sticky='sw') # On the left of the toolbar will be other # actions that can be applied to all runs (refresh, graph view...) self.allToolbar = tk.Frame(toolbar, bg='white') self.allToolbar.grid(row=0, column=10, sticky='se') #self.createActionToolbar() # Create the Run History tree v = ttk.PanedWindow(parent, orient=tk.VERTICAL) #runsFrame = ttk.Labelframe(v, text=' History ', width=500, height=500) runsFrame = tk.Frame(v, bg='white') self._createDataGraph(runsFrame) gui.configureWeigths(runsFrame) # Create the Selected Run Info infoFrame = tk.Frame(v) gui.configureWeigths(infoFrame) self._infoText = TaggedText(infoFrame, bg='white', handlers={'sci-open': self._openProtocolFormFromId}) self._infoText.grid(row=0, column=0, sticky='news') v.add(runsFrame, weight=3) v.add(infoFrame, weight=1) v.grid(row=1, column=0, sticky='news')
def _addBoundTree(self, parent, provider, height): bt = BoundTree(parent, provider, height=height) bt.grid(row=0, column=0, sticky='news', padx=5, pady=5) gui.configureWeigths(parent) return bt
def body(self, bodyFrame): bodyFrame.config(bg='white') gui.configureWeigths(bodyFrame) self._createSamplesFrame(bodyFrame) self._createSlidersFrame(bodyFrame) self._createLogsFrame(bodyFrame)