def on_delete_layout(self, name):
     """ Handles the user reqesting a specified layout to be deleted.
     """
     if error(message="Delete the '%s' layout?" % name,
              title='Delete Layout Warning',
              parent=self.control):
         self._delete_layout(name)
    def close(self, info, is_ok):
        if is_ok:
            name = info.object.name.strip()
            if name == '':
                warning(info.ui.control,
                        'No name specified',
                        title='Save Layout Error')
                return False
            if name in self.names:
                return error(message='%s is already defined. Replace?' % name,
                             title='Save Layout Warning',
                             parent=info.ui.control)

        return True
Exemplo n.º 3
0
 def isUserInputGood(self):
     """runs a bunch of checks and provides a warning if user has written a bad eagle log.
     Returns True if the user has written a good eagle log and false if they havent"""
     issueStrings = []
     if self.axisList.series == "None":
         issueStrings.append("You have no Series selected, are there really no series for this log? If there are multiple series note this down in the Comments box.")
     if len(self.purposeBlock.textBlock)<200:
         issueStrings.append("The purpose text of your librarian is less than 200 characters. This is too short! Describe the measurement so that you could remember what you are doing in 2 years time.")
     if len(self.resultsBlock.textBlock)<200:
         issueStrings.append("The results text of your librarian is less than 200 characters. This is too short! Describe the results so that you can understand what was learnt in 2 years time. If this doesn't need to be long why do you need to save the log?")
     numberOfIssues = len(issueStrings)
     if numberOfIssues == 0:
         return True
     else:
         finalString = "There are issues with your Eagle Log\nPlease check the below points. If you are happy to continue press OK, otherwise press cancel and correct these issues.\n"
         finalString+= "u\n\u2022".join(issueStrings)
         return traitsui.error(message=finalString)
Exemplo n.º 4
0
    def close(self, info, is_ok):
        if is_ok:
            name = info.object.name.strip()
            if name == "":
                warning(
                    info.ui.control,
                    "No name specified",
                    title="Save Layout Error",
                )
                return False
            if name in self.names:
                return error(
                    message="%s is already defined. Replace?" % name,
                    title="Save Layout Warning",
                    parent=info.ui.control,
                )

        return True