Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 3
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)
Exemplo n.º 4
0
def requestInteger(message):
    return SimpleInput.getIntNumber(message)
Exemplo n.º 5
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)
Exemplo n.º 6
0
def requestInteger(message):
    return SimpleInput.getIntNumber(message)