Exemplo n.º 1
0
    def _checkNewInput(self):
        # Check if there are new micrographs to process from the input set
        localFile = self.getInputMicrographs().getFileName()
        now = datetime.now()
        self.lastCheck = getattr(self, 'lastCheck', now)
        mTime = datetime.fromtimestamp(getmtime(localFile))
        self.debug('Last check: %s, modification: %s'
                  % (prettyTime(self.lastCheck),
                     prettyTime(mTime)))
        # If the input micrographs.sqlite have not changed since our last check,
        # it does not make sense to check for new input data
        if self.lastCheck > mTime and hasattr(self, 'listOfMics'):
            return None

        self.lastCheck = now
        # Open input micrographs.sqlite and close it as soon as possible
        micDict, self.streamClosed = self._loadInputList()
        newMics = micDict.values()
        outputStep = self._getFirstJoinStep()

        if newMics:
            fDeps = self._insertNewMicsSteps(newMics)
            if outputStep is not None:
                outputStep.addPrerequisites(*fDeps)
            self.updateSteps()
Exemplo n.º 2
0
    def createProjectLabel(self, parent, projInfo, color):
        frame = tk.Frame(parent, bg=color)
        # ROW1
        # Project name
        label = tk.Label(frame, text=projInfo.projName, anchor='nw', bg=color,
                         justify=tk.LEFT, font=self.projNameFont, cursor='hand1', width=50)
        label.grid(row=0, column=0,  padx=2, pady=2, sticky='nw')
        label.bind('<Button-1>', lambda e: self.openProject(projInfo.projName))

        # ROW2
        # Timestamp line
        dateMsg = '%s%s    %s%s' % (Message.LABEL_MODIFIED, prettyDate(projInfo.mTime),
                                    Message.LABEL_CREATED, prettyTime(projInfo.cTime, time=False))
        dateLabel = tk.Label(frame, text=dateMsg, font=self.projDateFont, bg=color)
        dateLabel.grid(row=1, column=0, sticky='nw')
        # Delete action
        delLabel = tk.Label(frame, text=Message.LABEL_DELETE_PROJECT, font=self.projDelFont, bg=color, cursor='hand1')
        delLabel.grid(row=1, column=1, padx=10)
        delLabel.bind('<Button-1>', lambda e: self.deleteProject(projInfo.projName))
        # Rename action
        mvLabel = tk.Label(frame, text=Message.LABEL_RENAME_PROJECT, font=self.projDelFont, bg=color, cursor='hand1')
        mvLabel.grid(row=1, column=2)
        mvLabel.bind('<Button-1>', lambda e: self.renameProject(projInfo.projName))

        # ROW3
        if projInfo.isLink:
            linkMsg = 'link --> ' + projInfo.linkedFolder
            lblLink = tk.Label(frame, text=linkMsg, font=self.projDateFont, bg=color, fg='grey', justify=tk.LEFT)
            lblLink.grid(row=2, column=0, columnspan=3, sticky='w')

        
        return frame
Exemplo n.º 3
0
    def _doesProjectMatchFilter(self, project):
        """ Returns true if the project matches the filter"""
        # Lets' use the name anc creation date for now:
        searchString = "~".join([
            project.getName().lower(),
            prettyDate(project.mTime),
            prettyTime(project.cTime, time=False)
        ])

        return self.filter.get().lower() in searchString
Exemplo n.º 4
0
    def _checkNewInput(self):
        # Check if there are new micrographs to process from the input set
        localFile = self.getInputMicrographs().getFileName()
        now = datetime.now()
        self.lastCheck = getattr(self, 'lastCheck', now)
        mTime = datetime.fromtimestamp(getmtime(localFile))
        self.debug('Last check: %s, modification: %s' %
                   (prettyTime(self.lastCheck), prettyTime(mTime)))
        # If the input micrographs.sqlite have not changed since our last check,
        # it does not make sense to check for new input data
        if self.lastCheck > mTime and hasattr(self, 'listOfMics'):
            return None

        self.lastCheck = now
        # Open input micrographs.sqlite and close it as soon as possible
        micDict, self.streamClosed = self._loadInputList()
        newMics = micDict.values()
        outputStep = self._getFirstJoinStep()

        if newMics:
            fDeps = self._insertNewMicsSteps(newMics)
            if outputStep is not None:
                outputStep.addPrerequisites(*fDeps)
            self.updateSteps()
Exemplo n.º 5
0
 def createProjectLabel(self, parent, projInfo, color):
     frame = tk.Frame(parent, bg=color)
     label = tk.Label(frame, text=projInfo.projName, anchor='nw', bg=color, 
                      justify=tk.LEFT, font=self.projNameFont, cursor='hand1', width=50)
     label.grid(row=0, column=0,  padx=2, pady=2, sticky='nw')
     label.bind('<Button-1>', lambda e: self.openProject(projInfo.projName))
     dateMsg = '%s%s    %s%s' % (Message.LABEL_MODIFIED, prettyDate(projInfo.mTime),
                                 Message.LABEL_CREATED, prettyTime(projInfo.cTime, time=False))
     dateLabel = tk.Label(frame, text=dateMsg, font=self.projDateFont, bg=color)
     dateLabel.grid(row=1, column=0, sticky='nw')
     delLabel = tk.Label(frame, text=Message.LABEL_DELETE_PROJECT, font=self.projDelFont, bg=color, cursor='hand1')
     delLabel.grid(row=1, column=1, padx=10)
     delLabel.bind('<Button-1>', lambda e: self.deleteProject(projInfo.projName))
     mvLabel = tk.Label(frame, text=Message.LABEL_RENAME_PROJECT, font=self.projDelFont, bg=color, cursor='hand1')
     mvLabel.grid(row=1, column=2)
     mvLabel.bind('<Button-1>', lambda e: self.renameProject(projInfo.projName))
     
     return frame
Exemplo n.º 6
0
    def createProjectLabel(self, parent, projInfo, color):
        frame = tk.Frame(parent, bg=color)
        label = tk.Label(frame,
                         text=projInfo.projName,
                         anchor='nw',
                         bg=color,
                         justify=tk.LEFT,
                         font=self.projNameFont,
                         cursor='hand1',
                         width=50)
        label.grid(row=0, column=0, padx=2, pady=2, sticky='nw')
        label.bind('<Button-1>', lambda e: self.openProject(projInfo.projName))
        dateMsg = '%s%s    %s%s' % (
            Message.LABEL_MODIFIED, prettyDate(projInfo.mTime),
            Message.LABEL_CREATED, prettyTime(projInfo.cTime, time=False))
        dateLabel = tk.Label(frame,
                             text=dateMsg,
                             font=self.projDateFont,
                             bg=color)
        dateLabel.grid(row=1, column=0, sticky='nw')
        delLabel = tk.Label(frame,
                            text=Message.LABEL_DELETE_PROJECT,
                            font=self.projDelFont,
                            bg=color,
                            cursor='hand1')
        delLabel.grid(row=1, column=1, padx=10)
        delLabel.bind('<Button-1>',
                      lambda e: self.deleteProject(projInfo.projName))
        mvLabel = tk.Label(frame,
                           text=Message.LABEL_RENAME_PROJECT,
                           font=self.projDelFont,
                           bg=color,
                           cursor='hand1')
        mvLabel.grid(row=1, column=2)
        mvLabel.bind('<Button-1>',
                     lambda e: self.renameProject(projInfo.projName))

        return frame