Example #1
0
    def actionPerformed(self, event):
        actionCommand = event.getActionCommand()
        selection = self.list.getSelectedIndex()

        if actionCommand == COMMAND_PLAY_MOVIE:
            self.movie.play()

        elif actionCommand == COMMAND_ADD_IMG:
            self.listModel.addElement(media.pickAFile())
            self.updateMovie()

        elif actionCommand == COMMAND_ADD_DIR:
            self.addImagesFromDirectoryIntoListModel(media.pickAFolder())
            self.updateMovie()

        elif actionCommand == COMMAND_DELETE_IMG:
            if selection >= 0:
                self.listModel.remove(selection)
                self.updateMovie()

        elif actionCommand == COMMAND_CLEAR_IMG:
            self.listModel.clear()
            self.updateMovie()

        elif actionCommand == COMMAND_MOVE_UP:
            if selection > 0:
                itemAbove = self.listModel.get(selection - 1)
                itemBelow = self.listModel.get(selection)
                self.listModel.set(selection - 1, itemBelow)
                self.listModel.set(selection, itemAbove)
                self.list.setSelectedIndex(selection - 1)
                self.updateMovie()

        elif actionCommand == COMMAND_MOVE_DOWN:
            if selection >= 0 and selection < self.listModel.size() - 1:
                itemAbove = self.listModel.get(selection)
                itemBelow = self.listModel.get(selection + 1)
                self.listModel.set(selection, itemBelow)
                self.listModel.set(selection + 1, itemAbove)
                self.list.setSelectedIndex(selection + 1)
                self.updateMovie()

        elif actionCommand == COMMAND_CHANGE_FPS:
            self.fps = SimpleInput.getIntNumber(
                "Enter the number of frames per second")

        else:
            pass
Example #2
0
    def actionPerformed(self, event):
        actionCommand = event.getActionCommand()
        selection = self.list.getSelectedIndex()

        if actionCommand == COMMAND_PLAY_MOVIE:
            self.movie.play()

        elif actionCommand == COMMAND_ADD_IMG:
            self.listModel.addElement(media.pickAFile())
            self.updateMovie()

        elif actionCommand == COMMAND_ADD_DIR:
            self.addImagesFromDirectoryIntoListModel(media.pickAFolder())
            self.updateMovie()

        elif actionCommand == COMMAND_DELETE_IMG:
            if selection >= 0:
                self.listModel.remove(selection)
                self.updateMovie()

        elif actionCommand == COMMAND_CLEAR_IMG:
            self.listModel.clear()
            self.updateMovie()

        elif actionCommand == COMMAND_MOVE_UP:
            if selection > 0:
                itemAbove = self.listModel.get(selection - 1)
                itemBelow = self.listModel.get(selection)
                self.listModel.set(selection - 1, itemBelow)
                self.listModel.set(selection, itemAbove)
                self.list.setSelectedIndex(selection - 1)
                self.updateMovie()

        elif actionCommand == COMMAND_MOVE_DOWN:
            if selection >= 0 and selection < self.listModel.size() - 1:
                itemAbove = self.listModel.get(selection)
                itemBelow = self.listModel.get(selection + 1)
                self.listModel.set(selection, itemBelow)
                self.listModel.set(selection + 1, itemAbove)
                self.list.setSelectedIndex(selection + 1)
                self.updateMovie()

        elif actionCommand == COMMAND_CHANGE_FPS:
            self.fps = SimpleInput.getIntNumber(
                "Enter the number of frames per second")

        else:
            pass
Example #3
0
def requestString(message):
    return SimpleInput.getString(message)
Example #4
0
def requestIntegerInRange(message, min, max):
    if min >= max:
        print "requestIntegerInRange(message, min, max): min >= max not allowed"
        raise ValueError

    return SimpleInput.getIntNumber(message, min, max)
Example #5
0
def requestInteger(message):
    return SimpleInput.getIntNumber(message)
Example #6
0
def requestString(message):
    return SimpleInput.getString(message)
Example #7
0
def requestIntegerInRange(message, min, max):
    if min >= max:
        print "requestIntegerInRange(message, min, max): min >= max not allowed"
        raise ValueError

    return SimpleInput.getIntNumber(message, min, max)
Example #8
0
def requestInteger(message):
    return SimpleInput.getIntNumber(message)