示例#1
0
 def loadStory(self, path):
     if not path: return
     try:
         self.story = stream.story.Story.load(path)
     except:
         self.story = None
         widgets.messageBox(self, "Couldn't load story from: " + path, "Error loading story")
         return
     util.filesystem.ensureDirectoryExists(self.story.getPeopleDir())
     util.filesystem.ensureDirectoryExists(self.story.getUnrecognizedPeopleDir())
     self.SetTitle(self.story.name)
     #self.story.clearDb()
     self.story.recrawl("video", stream.models.Video)
     self.reloadTimeline()
     self.reloadPeoplePanel()
示例#2
0
def ask(question,choices=None,default=None,timeout=None):
    """Ask a question and present possible answers.

    Return answer.
    """
    if choices:
        return widgets.messageBox(question,'question',choices)

    if choices is None:
        if default is None:
            default = choices[0]
        items = [ [question, default] ]
    else:
        items = [ [question, choices, 'combo', default] ]

    res,accept = widgets.InputDialog(items,'Ask Question').getResult(timeout)
    GD.gui.update()
    if accept:
        return res[question]
    else:
        return default
示例#3
0
def ask(question,choices=None,default=None,**kargs):
    """Ask a question and present possible answers.

    Return answer if accepted or default if rejected.
    The remaining arguments are passed to the InputDialog getResult method.
    """
    if choices:
        return widgets.messageBox(question,'question',choices)

    if choices is None:
        if default is None:
            default = choices[0]
        items = [ [question, default] ]
    else:
        items = [ [question, choices, 'combo', default] ]

    res = widgets.InputDialog(items,'Ask Question').getResult(**kargs)
    if GD.gui:
        GD.gui.update()
    if res:
        return res[question]
    else:
        return default
示例#4
0
def info(message,actions=['OK']):
    """Show a neutral message and wait for user acknowledgement."""
    widgets.messageBox(message,'info',actions)
示例#5
0
def warning(message,actions=['OK']):
    """Show a warning message and wait for user acknowledgement."""
    widgets.messageBox(message,'warning',actions)
示例#6
0
def error(message,actions=['OK']):
    """Show an error message and wait for user acknowledgement."""
    widgets.messageBox(message,'error',actions)