def __init__(self, parent, windows, **kwargs):
        tk.Frame.__init__(self, parent, bg='white', **kwargs)
        self.windows = windows
        self.root = windows.root
        self.vars = {}
        self.checkvars = []

        bigSize = pwgui.cfgFontSize + 2
        smallSize = pwgui.cfgFontSize - 2
        fontName = pwgui.cfgFontName

        self.bigFont = tkFont.Font(size=bigSize, family=fontName)
        self.bigFontBold = tkFont.Font(size=bigSize,
                                       family=fontName,
                                       weight='bold')

        self.projDateFont = tkFont.Font(size=smallSize, family=fontName)
        self.projDelFont = tkFont.Font(size=smallSize,
                                       family=fontName,
                                       weight='bold')
        # Header section
        headerFrame = tk.Frame(self, bg='white')
        headerFrame.grid(row=0, column=0, sticky='new')
        headerText = "Enter your desired values"

        label = tk.Label(headerFrame,
                         text=headerText,
                         font=self.bigFontBold,
                         borderwidth=0,
                         anchor='nw',
                         bg='white',
                         fg=pwgui.Color.DARK_GREY_COLOR)
        label.grid(row=0, column=0, sticky='nw', padx=(20, 5), pady=10)

        # Body section
        bodyFrame = tk.Frame(self, bg='white')
        bodyFrame.grid(row=1, column=0, sticky='news')
        self._fillContent(bodyFrame)

        # Add the create project button
        btnFrame = tk.Frame(self, bg='white')
        btn = HotButton(btnFrame,
                        text="Start demo",
                        font=self.bigFontBold,
                        command=self._onAction)
        btn.grid(row=0, column=1, sticky='ne', padx=10, pady=10)

        # Add the Import project button
        btn = Button(btnFrame,
                     Message.LABEL_BUTTON_CANCEL,
                     Icon.ACTION_CLOSE,
                     font=self.bigFontBold,
                     command=self.windows.close)
        btn.grid(row=0, column=0, sticky='ne', padx=10, pady=10)

        btnFrame.grid(row=2, column=0, sticky='sew')
        btnFrame.columnconfigure(0, weight=1)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
Example #2
0
    def __init__(self, parent, windows, **args):
        tk.Frame.__init__(self, parent, bg='white', **args)
        self.windows = windows
        self.manager = windows.manager
        self.root = windows.root

        #tkFont.Font(size=12, family='verdana', weight='bold')
        bigSize = pwgui.cfgFontSize + 2
        smallSize = pwgui.cfgFontSize - 2
        fontName = pwgui.cfgFontName

        self.projNameFont = tkFont.Font(size=bigSize,
                                        family=fontName,
                                        weight='bold')
        self.projDateFont = tkFont.Font(size=smallSize, family=fontName)
        self.projDelFont = tkFont.Font(size=smallSize,
                                       family=fontName,
                                       weight='bold')
        self.manager = Manager()
        btn = HotButton(self,
                        text=Message.LABEL_CREATE_PROJECT,
                        font=self.projNameFont,
                        command=self._onCreateProject)
        btn.grid(row=0, column=0, sticky='nw', padx=10, pady=10)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
        text = TaggedText(self, width=40, height=15, bd=0, bg='white')
        text.grid(row=1, column=0, sticky='news')

        self.createProjectList(text)
        text.setReadOnly(True)
        self.text = text
    def _fillButtonsFrame(self, frame):
        subframe = tk.Frame(frame)
        subframe.grid(row=0, column=0, sticky='nw')
        frame.columnconfigure(1, weight=1)

        ctfBtn = Button(subframe, "CTF Monitor", command=self._monitorCTF)
        ctfBtn.grid(row=0, column=0, sticky='nw', padx=(0, 5))
        if self.protocol.createCtfMonitor() is None:
            ctfBtn['state'] = 'disabled'

        movieGainBtn = Button(subframe,
                              "Movie Gain Monitor",
                              command=self._monitorMovieGain)
        movieGainBtn.grid(row=0, column=1, sticky='nw', padx=(0, 5))
        if self.protocol.createMovieGainMonitor() is None:
            movieGainBtn['state'] = 'disabled'

        sysBtn = Button(subframe,
                        "System Monitor",
                        command=self._monitorSystem)
        sysBtn.grid(row=0, column=2, sticky='nw', padx=(0, 5))
        if self.protocol.createSystemMonitor() is None:
            sysBtn['state'] = 'disabled'

        htmlBtn = HotButton(subframe,
                            'Open HTML Report',
                            command=self._openHTML)
        htmlBtn.grid(row=0, column=3, sticky='nw', padx=(0, 5))

        closeBtn = self.createCloseButton(frame)
        closeBtn.grid(row=0, column=1, sticky='ne')
    def _fillButtonsFrame(self, frame):
        subframe = tk.Frame(frame)
        subframe.grid(row=0, column=0, sticky='nw')
        frame.columnconfigure(1, weight=1)

        imgPlainBtn = Button(subframe,
                             "View plain images",
                             command=self._viewPlainImages)
        imgPlainBtn.grid(row=0, column=0, sticky='nw', padx=(0, 5))
        if self._getModel() is None:
            imgPlainBtn['state'] = 'disabled'

        imgOverlaidBtn = Button(subframe,
                                "View images with spots",
                                command=self._viewOverlaidImages)
        imgOverlaidBtn.grid(row=0, column=1, sticky='nw', padx=(0, 5))
        if None in {self._getModel(), self._getRefls()}:
            imgOverlaidBtn['state'] = 'disabled'

        reciprocalBtn = Button(subframe,
                               "View reciprocal lattice",
                               command=self._viewReciprocal)
        reciprocalBtn.grid(row=0, column=2, sticky='nw', padx=(0, 5))
        if None in {self._getModel(), self._getRefls()}:
            reciprocalBtn['state'] = 'disabled'

        htmlBtn = HotButton(subframe,
                            'Open HTML Report',
                            command=self._openHTML)
        htmlBtn.grid(row=0, column=3, sticky='nw', padx=(0, 5))
        if self._getHtml() is None:
            htmlBtn['state'] = 'disabled'

        closeBtn = self.createCloseButton(frame)
        closeBtn.grid(row=0, column=1, sticky='ne')
    def _createClusteringBox(self, content):
        frame = tk.LabelFrame(content, text='Cluster')
        frame.columnconfigure(0, minsize=50)
        frame.columnconfigure(1, weight=1)  #, minsize=30)

        # Cluster line
        self._addLabel(frame, 'Cluster name', 0, 0)
        self.clusterVar = tk.StringVar()
        clusterEntry = tk.Entry(frame,
                                textvariable=self.clusterVar,
                                width=30,
                                bg='white')
        clusterEntry.grid(row=0, column=1, sticky='nw', pady=5)

        buttonsFrame = tk.Frame(frame, bg='green')
        buttonsFrame.grid(row=1, column=1, sticky='se', padx=5, pady=5)
        buttonsFrame.columnconfigure(0, weight=1)

        self.createBtn = HotButton(
            buttonsFrame,
            text='Create Cluster',
            tooltip="Select some points to create the cluster",
            imagePath='fa-plus-circle.png',
            command=self._onCreateClick)
        self.createBtn.grid(row=0, column=1)

        frame.grid(row=1, column=0, sticky='new', padx=5, pady=(5, 10))
Example #6
0
    def _createTrajectoriesBox(self, content):
        frame = tk.LabelFrame(content, text='Trajectories')
        frame.columnconfigure(0, minsize=50)
        frame.columnconfigure(1, weight=1)#, minsize=30)

        # Animation name
        self._addLabel(frame, 'Name', 0, 0)
        self.animationVar = tk.StringVar()
        clusterEntry = tk.Entry(frame, textvariable=self.animationVar, 
                                   width=30, bg='white')
        clusterEntry.grid(row=0, column=1, sticky='nw', pady=5)
        
        buttonsFrame = tk.Frame(frame)
        buttonsFrame.grid(row=1, column=1, 
                          sticky='se', padx=5, pady=5)
        buttonsFrame.columnconfigure(0, weight=1)

        self.generateBtn = HotButton(buttonsFrame, text='Generate Animation', state=tk.DISABLED,
                              tooltip='Select trajectory points to generate the animations',
                              imagePath='fa-plus-circle.png', command=self._onCreateClick)
        self.generateBtn.grid(row=0, column=1, padx=5)  
        
        self.loadBtn = Button(buttonsFrame, text='Load', imagePath='fa-folder-open.png',
                              tooltip='Load a generated animation.',command=self._onLoadClick)
        self.loadBtn.grid(row=0, column=2, padx=5)   
                  
        self.closeBtn = Button(buttonsFrame, text='Close', imagePath=Icon.ACTION_CLOSE,
                              tooltip='Close window', command=self.close)
        self.closeBtn.grid(row=0, column=3, padx=(5, 10)) 
               
        frame.grid(row=1, column=0, sticky='new', padx=5, pady=(5, 10))
    def addActionsFrame(self):
        """ Add the "toolbar" for actions like create project, import
         project or filter"""
        # Add the create project button
        bg = "white"
        btnFrame = tk.Frame(self, bg=bg)
        btn = HotButton(btnFrame,
                        text=Message.LABEL_CREATE_PROJECT,
                        font=self.projNameFont,
                        command=self._onCreateProject)
        btn.grid(row=0, column=0, sticky='nw', padx=10, pady=10)
        # Add the Import project button
        btn = Button(btnFrame,
                     text=Message.LABEL_IMPORT_PROJECT,
                     font=self.projNameFont,
                     command=self._onImportProject)
        btn.grid(row=0, column=1, sticky='nw', padx=10, pady=10)
        btnFrame.grid(row=0, column=0, sticky='nw')

        # Add a filter box
        # Add the Import project button
        btn = tk.Label(btnFrame, bg=bg, text="Filter:", font=self.projNameFont)
        btn.grid(row=0, column=2, sticky='nse', padx=10, pady=10)
        self.filterBox = tk.Entry(btnFrame,
                                  font=self.projNameFont,
                                  textvariable=self.filter)
        self.filterBox.grid(row=0, column=3, sticky='ne', padx=10, pady=12)
        self.filterBox.bind('<Return>', self._onFilter)
        self.filterBox.bind('<KP_Enter>', self._onFilter)
Example #8
0
    def visualizeClasses(self, e=None):
        classTemplate = "class_%03d"
        averages = '%03d@' + self.protocol._getFileName('averages')

        def getInfo2(level, classNo):
            return classTemplate % classNo, averages % classNo

        node = self.protocol.buildDendrogram(writeAverages=False)

        g = Graph(root=node)
        self.graph = g

        self.win = Window("Select classes",
                          self.formWindow,
                          minsize=(1000, 600))
        root = self.win.root
        canvas = Canvas(root)
        canvas.grid(row=0, column=0, sticky='nsew')
        root.grid_columnconfigure(0, weight=1)
        root.grid_rowconfigure(0, weight=1)

        self.buttonframe = tk.Frame(root)
        self.buttonframe.grid(row=2, column=0, columnspan=2)
        self.win.createCloseButton(self.buttonframe).grid(row=0,
                                                          column=0,
                                                          sticky='n',
                                                          padx=5,
                                                          pady=5)
        saveparticlesbtn = HotButton(self.buttonframe,
                                     "Particles",
                                     Icon.PLUS_CIRCLE,
                                     command=self._askCreateParticles)
        saveparticlesbtn.grid(row=0, column=1, sticky='n', padx=5, pady=5)
        btn = HotButton(self.buttonframe,
                        "Classes",
                        Icon.PLUS_CIRCLE,
                        command=self._askCreateClasses)
        btn.grid(row=0, column=2, sticky='n', padx=5, pady=5)

        lt = LevelTree(g)
        lt.DY = 135  # TODO: change in percent of the image size
        lt.setCanvas(canvas)
        lt.paint(self._createNode, maxLevel=self.maxLevel.get() - 1)
        canvas.updateScrollRegion()

        return [self.win]
Example #9
0
    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 _createFigureBox(self, content):
     from pyworkflow.gui.matplotlib_image import FigureFrame
     figFrame = FigureFrame(content, figsize=(6, 6))
     figFrame.grid(row=0, column=0, padx=5, columnspan=2)
     self.figure = figFrame.figure
     
     applyBtn = HotButton(content, text='Apply B-factor',
                        command=self._onApplyBfactorClick)
     applyBtn.grid(row=1, column=0, sticky='ne', padx=5, pady=5)
     
     closeBtn = Button(content, text='Close', imagePath=Icon.ACTION_CLOSE,
                        command=self.close)
     closeBtn.grid(row=1, column=1, sticky='ne', padx=5, pady=5)
Example #11
0
    def _createControls(self, frame):
        self._vars = {}
        inputFrame = tk.Frame(frame)
        inputFrame.grid(row=0, column=0)

        for i, varName in enumerate(CUSTOMMASK_VARS):
            self._createVarWidgets(inputFrame, varName,
                                   CUSTOMMASK_VARS[varName], i % 2, i // 2)

        previewBtn = HotButton(frame,
                               text='Preview',
                               command=self._computeRightPreview)
        previewBtn.grid(row=1, column=1, padx=5, pady=5)
Example #12
0
    def __init__(self, title, parent=None, weight=True, minsize=(400, 110),
                 icon="scipion_bn.xbm", **args):
        """
         We assume the parent should be of ProjectsView
        """
        Window.__init__(self, title, parent.windows, weight=weight,
                        icon=icon, minsize=minsize, enableQueue=True)
        self.root['background'] = 'white'

        self.parent = parent
        self.projectsPath = self.parent.manager.PROJECTS
        self.projName = tk.StringVar()
        self.projName.set('')
        self.projLocation = tk.StringVar()
        self.projLocation.set(self.projectsPath)

        content = tk.Frame(self.root)
        content.columnconfigure(0, weight=1)
        content.columnconfigure(1, weight=3)
        content.config(bg='white')
        content.grid(row=0, column=0, sticky='news', padx=5, pady=5)

        #  Project name line
        labelName = tk.Label(content, text=Message.LABEL_PROJECT + ' name', bg='white', bd=0)
        labelName.grid(row=0, sticky=tk.W, padx=5, pady=5)
        entryName = tk.Entry(content, bg=cfgEntryBgColor, width=20, textvariable=self.projName)
        entryName.grid(row=0, column=1, columnspan=2, sticky=tk.W, padx=5, pady=5)

        # Project location line
        labelLocation = tk.Label(content, text=Message.LABEL_PROJECT + ' location', bg='white', bd=0)
        labelLocation.grid(row=1, column=0, sticky='nw', padx=5, pady=5)

        self.entryBrowse = tk.Entry(content, bg=cfgEntryBgColor, width=40, textvariable=self.projLocation)
        self.entryBrowse.grid(row=1, column=1, sticky='nw', padx=5, pady=5)
        self.btnBrowse = IconButton(content, 'Browse', Icon.ACTION_BROWSE, highlightthickness=0, command=self._browsePath)
        self.btnBrowse.grid(row=1, column=2, sticky='e', padx=5, pady=5)

        self.initial_focus = entryName

        btnFrame = tk.Frame(content)
        btnFrame.columnconfigure(0, weight=1)
        btnFrame.grid(row=2, column=0, sticky='sew', padx=5, pady=(0, 5), columnspan=2)
        btnFrame.config(bg='white')

        # Create buttons
        btnSelect = HotButton(btnFrame, 'Create', Icon.BUTTON_SELECT, command=self._select)
        btnSelect.grid(row=0, column=0, sticky='e', padx=5, pady=5)
        btnCancel = Button(btnFrame, 'Cancel', Icon.BUTTON_CANCEL, command=self.close)
        btnCancel.grid(row=0, column=1, sticky='e', padx=5, pady=5)
Example #13
0
    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 _fillButtonsFrame(self, frame):
        subframe = tk.Frame(frame)
        subframe.grid(row=0, column=0, sticky='nw')
        frame.columnconfigure(1, weight=1)

        ctfBtn = Button(subframe, "CTF Monitor", command=self._monitorCTF)
        ctfBtn.grid(row=0, column=0, sticky='nw', padx=(0, 5))

        sysBtn = Button(subframe,
                        "System Monitor",
                        command=self._monitorSystem)
        sysBtn.grid(row=0, column=1, sticky='nw', padx=(0, 5))

        htmlBtn = HotButton(subframe,
                            'Generate HTML Report',
                            command=self._generateHTML)
        htmlBtn.grid(row=0, column=2, sticky='nw', padx=(0, 5))

        closeBtn = self.createCloseButton(frame)
        closeBtn.grid(row=0, column=1, sticky='ne')
Example #15
0
    def body(self, bodyFrame):
        figFrame = FigureFrame(bodyFrame, figsize=(18, 9))
        figFrame.grid(row=0, column=0, columnspan=5)

        #self._runBeforePreWhitening(self.prot)
        dialog.FlashMessage(self.form.root,
                            "Running Pre-Whitening tool...",
                            func=self._runBeforePreWhitening)
        results = self.results

        self.figure = figFrame.getFigure()  #plt.figure(figsize=(18, 9))
        self._runPreWhitening(results['newElbowAngstrom'],
                              results['newRampWeight'])

        #bodyFrame.config()
        bodyFrame.columnconfigure(0, weight=1)
        bodyFrame.rowconfigure(0, weight=1)

        controlsFrame = tk.Frame(bodyFrame)
        controlsFrame.grid(row=1, column=0)

        self.elbowSlider = LabelSlider(controlsFrame,
                                       "Angstroms",
                                       from_=2.1 * results['vxSize'],
                                       to=100,
                                       value=results['newElbowAngstrom'])
        self.elbowSlider.grid(row=1, column=0, padx=5, pady=5)

        self.rampSlider = LabelSlider(controlsFrame,
                                      "Ramp weight",
                                      from_=0.0,
                                      to=1.,
                                      value=results['newRampWeight'])
        self.rampSlider.grid(row=1, column=1, padx=5, pady=5)

        self.updateBtn = HotButton(
            controlsFrame,
            "   Update   ",
            command=self._onUpdate,
            tooltip="Update plots with new pre-whitening parameters.")
        self.updateBtn.grid(row=1, column=2, padx=10, pady=5)
Example #16
0
    def __init__(self, parent, windows, **kwargs):
        tk.Frame.__init__(self, parent, **kwargs)
        self.windows = windows
        self.manager = windows.manager
        self.data = windows.data
        self.root = windows.root
        self.vars = {}
        self.checkvars = []
        self._createStatus = 'disabled'
        # Regular expression to validate username and sample name
        self.re = re.compile('\A[a-zA-Z][a-zA-Z0-9_-]+\Z')

        # tkFont.Font(size=12, family='verdana', weight='bold')
        bigSize = pwgui.cfgFontSize + 2
        smallSize = pwgui.cfgFontSize - 2
        fontName = pwgui.cfgFontName

        self.bigFont = tkFont.Font(size=bigSize, family=fontName)
        self.bigFontBold = tkFont.Font(size=bigSize,
                                       family=fontName,
                                       weight='bold')

        self.projDateFont = tkFont.Font(size=smallSize, family=fontName)
        self.projDelFont = tkFont.Font(size=smallSize,
                                       family=fontName,
                                       weight='bold')

        bigfont = tkFont.Font(family="Helvetica", size=12)
        #self.option_add("*TCombobox*Listbox*Font", bigfont)
        self.option_add("*Font", bigfont)
        self.manager = Manager()

        # Header section
        headerFrame = tk.Frame(self)
        headerFrame.grid(row=0, column=0, sticky='new')
        headerText = "Create New Session"

        headerText += "  %s" % pwutils.prettyTime(dateFormat='%Y-%m-%d')

        label = tk.Label(
            headerFrame,
            text=headerText,
            font=self.bigFontBold,
            borderwidth=0,
            anchor='nw',  #bg='white',
            fg=pwgui.Color.DARK_GREY_COLOR)
        label.grid(row=0, column=0, sticky='nw', padx=(20, 5), pady=10)

        versionText = 'version: %s' % VERSION
        label2 = tk.Label(
            headerFrame,
            text=versionText,
            font=self.bigFontBold,
            borderwidth=0,
            anchor='nw',  # bg='white',
            fg=pwgui.Color.DARK_GREY_COLOR)
        headerFrame.columnconfigure(1, weight=1)
        label2.grid(row=0, column=1, sticky='ne', padx=(20, 5), pady=10)

        # Body section
        bodyFrame = tk.Frame(self, bg='white')
        bodyFrame.grid(row=1, column=0, sticky='news')
        self._fillContent(bodyFrame)

        # Add the create project button
        btnFrame = tk.Frame(self, bg='white')
        btn = HotButton(btnFrame,
                        text="Create New Session",
                        font=self.bigFontBold,
                        command=self._onAction,
                        state=self._createStatus)
        btn.grid(row=0, column=1, sticky='ne', padx=10, pady=10)
        self._newSessionBtn = btn

        # Add the Import project button
        btn = Button(btnFrame,
                     Message.LABEL_BUTTON_CANCEL,
                     Icon.ACTION_CLOSE,
                     font=self.bigFontBold,
                     command=self.windows.close)
        btn.grid(row=0, column=0, sticky='ne', padx=10, pady=10)

        btnFrame.grid(row=2, column=0, sticky='sew')
        btnFrame.columnconfigure(0, weight=1)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
Example #17
0
    def __init__(self,
                 title,
                 parent=None,
                 weight=True,
                 minsize=(400, 150),
                 icon="scipion_bn.xbm",
                 **args):
        """
         We assume the parent should be of ProjectsView
        """
        Window.__init__(self,
                        title,
                        parent.windows,
                        weight=weight,
                        icon=icon,
                        minsize=minsize,
                        enableQueue=True)

        self.parent = parent
        self.projectsPath = self.parent.manager.PROJECTS
        self.projName = tk.StringVar()
        self.projName.set('')
        self.projLocation = tk.StringVar()
        self.projLocation.set(self.projectsPath)

        content = tk.Frame(self.root)
        content.columnconfigure(0, weight=1)
        content.columnconfigure(1, weight=1)
        content.config(bg='white')
        content.grid(row=0, column=0, sticky='news', padx=5, pady=5)
        labelName = tk.Label(content,
                             text=Message.LABEL_PROJECT,
                             bg='white',
                             bd=0)
        labelName.grid(row=0, column=0, sticky='nw', padx=5, pady=5)
        entryName = tk.Entry(content,
                             bg=cfgEntryBgColor,
                             width=20,
                             textvariable=self.projName)
        entryName.grid(row=0, column=1, sticky='nw', padx=5, pady=5)

        labelCheck = tk.Label(content,
                              text="Use default location",
                              bg='white',
                              bd=0)
        labelCheck.grid(row=1, column=0, sticky='nw', padx=5, pady=5)
        self.tkCheckVar = tk.IntVar()
        btnCheck = tk.Checkbutton(content,
                                  variable=self.tkCheckVar,
                                  bg='white',
                                  bd=0)
        btnCheck.grid(row=1, column=1, sticky='nw', padx=5, pady=5)

        self.browseFrame = tk.Frame(content, bg='white')
        #self.browseFrame.columnconfigure(1, weight=1)
        self.browseFrame.grid(row=2,
                              column=0,
                              padx=0,
                              pady=0,
                              columnspan=2,
                              sticky='nw')
        self.entryBrowse = tk.Entry(self.browseFrame,
                                    bg=cfgEntryBgColor,
                                    width=40,
                                    textvariable=self.projLocation)
        self.entryBrowse.grid(row=0, column=0, sticky='nw', padx=5, pady=5)
        self.btnBrowse = IconButton(self.browseFrame,
                                    'Browse',
                                    Icon.ACTION_BROWSE,
                                    command=self._browsePath)
        self.btnBrowse.grid(row=0, column=1, sticky='e', padx=5, pady=5)

        self.initial_focus = entryName
        self.tkCheckVar.trace('w', self._onVarChanged)
        btnCheck.select()

        btnFrame = tk.Frame(content)
        btnFrame.columnconfigure(0, weight=1)
        btnFrame.grid(row=3,
                      column=0,
                      sticky='sew',
                      padx=5,
                      pady=(0, 5),
                      columnspan=2)
        btnFrame.config(bg='white')

        # Create buttons
        btnSelect = HotButton(btnFrame,
                              'Create',
                              Icon.BUTTON_SELECT,
                              command=self._select)
        btnSelect.grid(row=0, column=0, sticky='e', padx=5, pady=5)
        btnCancel = Button(btnFrame,
                           'Cancel',
                           Icon.BUTTON_CANCEL,
                           command=self.close)
        btnCancel.grid(row=0, column=1, sticky='e', padx=5, pady=5)
Example #18
0
    def __init__(self, parent, windows, **kwargs):
        tk.Frame.__init__(self, parent, bg='white', **kwargs)
        self.windows = windows
        self.manager = windows.manager
        self.root = windows.root
        self.vars = {}
        self.checkvars = []
        self.microscope = None
        self.configDict = self.windows.config
        # Regular expression to validate username and sample name
        self.re = re.compile('\A[a-zA-Z0-9][a-zA-Z0-9_-]+[a-zA-Z0-9]\Z')

        # tkFont.Font(size=12, family='verdana', weight='bold')
        bigSize = pwgui.cfgFontSize + 2
        smallSize = pwgui.cfgFontSize - 2
        fontName = pwgui.cfgFontName

        self.bigFont = tkFont.Font(size=bigSize, family=fontName)
        self.bigFontBold = tkFont.Font(size=bigSize,
                                       family=fontName,
                                       weight='bold')

        self.projDateFont = tkFont.Font(size=smallSize, family=fontName)
        self.projDelFont = tkFont.Font(size=smallSize,
                                       family=fontName,
                                       weight='bold')
        self.manager = Manager()

        # Header section
        headerFrame = tk.Frame(self, bg='white')
        headerFrame.grid(row=0, column=0, sticky='new')
        headerText = "Create New Session"

        headerText += "  %s" % pwutils.prettyTime(dateFormat='%Y-%m-%d')

        label = tk.Label(headerFrame,
                         text=headerText,
                         font=self.bigFontBold,
                         borderwidth=0,
                         anchor='nw',
                         bg='white',
                         fg=pwgui.Color.DARK_GREY_COLOR)
        label.grid(row=0, column=0, sticky='nw', padx=(20, 5), pady=10)

        # Body section
        bodyFrame = tk.Frame(self, bg='white')
        bodyFrame.grid(row=1, column=0, sticky='news')
        self._fillContent(bodyFrame)

        # Add the create project button
        btnFrame = tk.Frame(self, bg='white')
        btn = HotButton(btnFrame,
                        text="Create New Session",
                        activebackground="dark grey",
                        activeforeground='black',
                        font=self.bigFontBold,
                        command=self._onAction)
        btn.grid(row=0, column=1, sticky='ne', padx=10, pady=10)

        # Add the Cancel project button
        btn = Button(btnFrame,
                     Message.LABEL_BUTTON_CANCEL,
                     Icon.ACTION_CLOSE,
                     font=self.bigFontBold,
                     command=self.windows.close)
        btn.grid(row=0, column=0, sticky='ne', padx=10, pady=10)

        btnFrame.grid(row=2, column=0, sticky='sew')
        btnFrame.columnconfigure(0, weight=1)

        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)
Example #19
0
    def __init__(self, title, parent=None, weight=True, minsize=(400, 150),
                 icon="scipion_bn.xbm", **args):
        """
         We assume the parent should be ProjectsView
        """
        Window.__init__(self, title, parent.windows, weight=weight,
                        icon=icon, minsize=minsize, enableQueue=True)
        self.root['background'] = 'white'
        self.parent = parent
        # Dirty hack, need to add a slash for the explorer to pick up the right default path.
        self.projectsPath = getHomePath()+"/"
        self.projLocation = tk.StringVar()
        self.projLocation.set(self.projectsPath)

        self.projName = tk.StringVar()
        self.projName.set('')

        self.searchLocation = tk.StringVar()
        self.searchLocation.set('')

        content = tk.Frame(self.root)
        content.columnconfigure(0, weight=1)
        content.columnconfigure(1, weight=1)
        content.config(bg='white')
        content.grid(row=0, column=0, sticky='news',
                       padx=5, pady=5)

        # Path explorer
        labelProjectLocation = tk.Label(content, text="Project location", bg='white', bd=0)
        labelProjectLocation.grid(row=0, column=0, sticky='nw', padx=5, pady=5)

        self.entryBrowse = tk.Entry(content, bg=cfgEntryBgColor, width=40, textvariable=self.projLocation)
        self.entryBrowse.grid(row=0, column=1, sticky='nw', padx=5, pady=5)
        self.btnBrowse = IconButton(content, 'Browse', Icon.ACTION_BROWSE, highlightthickness=0,
                                    command=self._browseProjectLocation)
        self.btnBrowse.grid(row=0, column=2, sticky='e', padx=5, pady=5)

        # Copy files check
        labelCheck = tk.Label(content, text="Copy project", bg='white', borderwidth=0)
        labelCheck.grid(row=1, column=0, sticky='nw', padx=5, pady=5)

        self.tkCheckVar = tk.IntVar()
        btnCheck = tk.Checkbutton(content, variable=self.tkCheckVar, highlightthickness=0, activebackground='white',
                                  bg='white', bd=0)
        btnCheck.grid(row=1, column=1, sticky='nw', padx=0, pady=5)

        btnCopyHelp = IconButton(content, Message.LABEL_BUTTON_HELP, Icon.ACTION_HELP, highlightthickness=0,
             command=lambda: self.showInfo('If checked, \"Project location\" will be copied. Otherwise a soft link to it will be created.'))
        btnCopyHelp.grid(row=1, column=3, sticky='e', padx=2, pady=2)

        # Project name
        labelName = tk.Label(content, text='Project name (Optional)', bg='white', bd=0)
        labelName.grid(row=2, column=0, sticky='nw', padx=5, pady=5)
        entryName = tk.Entry(content, bg='white', width=20, textvariable=self.projName)
        entryName.grid(row=2, column=1, sticky='nw', padx=5, pady=5)

        # Path to search for raw data and restore broken links.
        labelSearchLocation = tk.Label(content, text="Raw files location (Optional)", bg='white', bd=0)
        labelSearchLocation.grid(row=3, column=0, sticky='nw', padx=5, pady=5)

        self.entrySearchLocation = tk.Entry(content, bg='white', width=40, textvariable=self.searchLocation)
        self.entrySearchLocation.grid(row=3, column=1, sticky='nw', padx=5, pady=5)
        self.btnSearch = IconButton(content, 'Browse', Icon.ACTION_BROWSE, highlightthickness=0, command=self._browseSearchLocation)
        self.btnSearch.grid(row=3, column=2, sticky='e', padx=5, pady=5)
        btnSearchHelp = IconButton(content, Message.LABEL_BUTTON_HELP, Icon.ACTION_HELP, highlightthickness=0,
             command=lambda: self.showInfo('Optional: Folder where raw files, binaries (movies, migcrographs,..) can be found. Used to repair broken links.'))
        btnSearchHelp.grid(row=3, column=3, sticky='e', padx=2, pady=2)

        self.initial_focus = entryName
        btnCheck.select()

        btnFrame = tk.Frame(content)
        btnFrame.columnconfigure(0, weight=1)
        btnFrame.grid(row=4, column=0, sticky='sew', padx=5, pady=(0, 5), columnspan=2)
        btnFrame.config(bg='white')

        # Create buttons
        btnSelect = HotButton(btnFrame, 'Import', Icon.BUTTON_SELECT, command=self._select)
        btnSelect.grid(row=0, column=0, sticky='e', padx=5, pady=5)
        btnCancel = Button(btnFrame, 'Cancel', Icon.BUTTON_CANCEL, command=self.close)
        btnCancel.grid(row=0, column=1, sticky='e', padx=5, pady=5)
Example #20
0
    def __init__(self,
                 parent,
                 windows,
                 template=None,
                 argsList=[],
                 showScheduleOption=True,
                 schedule=True,
                 showProjectOption=True,
                 showProject=True,
                 showProjectName=True,
                 **kwargs):

        tk.Frame.__init__(self, parent, bg='white', **kwargs)
        self.windows = windows
        self.root = windows.root
        self.vars = {}
        self.checkvars = []
        self.template = template
        self.argsList = argsList
        self.showScheduleOption = showScheduleOption
        self.schedule = schedule
        self.showProjectOption = showProjectOption
        self.showProject = showProject
        self.showProjectName = showProjectName

        bigSize = pwgui.cfgFontSize + 2
        smallSize = pwgui.cfgFontSize - 2
        fontName = pwgui.cfgFontName

        self.bigFont = tkFont.Font(size=bigSize, family=fontName)
        self.bigFontBold = tkFont.Font(size=bigSize,
                                       family=fontName,
                                       weight='bold')

        self.projDateFont = tkFont.Font(size=smallSize, family=fontName)
        self.projDelFont = tkFont.Font(size=smallSize,
                                       family=fontName,
                                       weight='bold')
        # Body section
        bodyFrame = tk.Frame(self, bg='white')
        bodyFrame.columnconfigure(0, minsize=120)
        bodyFrame.columnconfigure(1, minsize=120, weight=1)
        bodyFrame.grid(row=0, column=0, sticky='news')
        self._fillContent(bodyFrame)

        # Add the create project button
        btnFrame = tk.Frame(self, bg='white')
        btn = HotButton(btnFrame,
                        text=ACCEPT_BUTTON,
                        font=self.bigFontBold,
                        command=self._onReadDataFromTemplateForm)
        btn.grid(row=0, column=1, sticky='ne', padx=10, pady=10)

        # Add the Import project button
        btn = Button(btnFrame,
                     Message.LABEL_BUTTON_CANCEL,
                     font=self.bigFontBold,
                     command=self._closeCallback)
        btn.grid(row=0, column=0, sticky='ne', pady=10)

        btnFrame.columnconfigure(0, weight=1)
        btnFrame.grid(row=1, column=0, sticky='news')

        self.columnconfigure(0, weight=1)