예제 #1
0
    def createOwn(self):  #user decided to create their own story
        tkinter.messagebox.showinfo(
            "Create Own!", "You have chosen to create your own story!")
        self.infoText1.grid_remove()  #this is to remove the information text
        # remove the buttons
        self.madLibsButton.grid_remove()
        self.createOwnButton.grid_remove()

        #create story object
        self.story = Story()

        # The default text for the window
        content = StringVar()
        self.storyBox = Entry(self, width=40,
                              textvariable=content)  #adding it to the box
        self.storyBox.bind('<FocusIn>', self.on_entry_click)
        content.set("Story here")
        self.storyBox.config(fg='grey')
        self.storyBox.grid()

        self.readButton = Button(self,
                                 text="Read aloud",
                                 command=self.callRead)
        self.readButton.grid()

        self.saveLabel = Label(self,
                               text="Enter a filename to save your story")
        self.saveLabel.grid()
        self.saveFileName = Entry(self, width=35)
        self.saveFileName.grid()
        self.saveButton = Button(self,
                                 text="Save Story",
                                 command=self.saveStory)
        self.saveButton.grid()
예제 #2
0
def json_story_post(scrumteam, jira_connection):
    # Body
    body = '''
    {
        "jql": "filter=AWO-%s-Sprint-Story",
                    "startAt": 0,
                "maxResults" : 1000
    }
    ''' % scrumteam

    jira_connection = JiraConnection()

    jira_connection.\
            setUserAndPass(userpsw).\
            setHeader().\
            setBody(body)

    try:
        x = jira_connection.sendRequest()
    except Exception:
        raise

    story = Story(json.loads(x.decode()))

    return story.get_story()
예제 #3
0
def readInStories(inputFilenames):
    stories = []
    for fileName in inputFilenames:
        with open(fileName, 'r', encoding="UTF-8") as jsonFile:
            data = json.load(jsonFile)
            stories.append(Story(data))
    return stories
예제 #4
0
def upload():
    if request.method == "POST":
        # Grab POST data from submitted form
        input_title = request.form.get("title")
        input_file = request.files["file"]
        # Get specific user based on uid stored in session
        user = UserList.getUserByID(session["uid"])

        # Handle file upload
        isValidFile = True
        message = "Upload successful"
        filename = input_file.filename
        # Checks for valid file name / format
        if not isValidFileType(filename):
            isValidFile = False
            message = "Invalid file type"
        if isValidFile:
            # Get the directory of this current User.py script
            currPath = os.path.dirname(__file__)
            relativePath = "/userdata" + user.getDirectory()
            projectPath = currPath + relativePath + filename
            input_file.save(projectPath)
        else:
            # If invalid, return now, providing an error message
            return redirect(url_for("feed", message=message))

        # Otherwise, continue to make a new story
        newStory = Story(projectPath, input_title)
        user.addStory(newStory)
        return redirect(url_for("feed", message=message))
    else:
        # Else method is GET - display login form
        return render_template("login.html",
                               message="Must be logged in to upload.")
예제 #5
0
    def __init__(self,
                 name,
                 password,
                 directory,
                 imageURL="/static/img/default_profile.jpg"):
        # Username
        self.__name = name
        # Directory of data stored
        self.__directory = directory
        # Profile picture URL
        self.__imageURL = imageURL

        storiesList = []
        # Get the directory of this current User.py script
        currPath = os.path.dirname(__file__)
        relativePath = "userdata" + directory
        fullPath = os.path.join(currPath, relativePath)
        filesList = os.listdir(fullPath)
        for file in filesList:
            projectPath = os.path.join(fullPath, file)
            # Use the file name (sans the file ext) as the caption
            caption = file.split(".")[0]
            storiesList.append(Story(projectPath, caption))
        # Stories List
        self.__storiesList = storiesList

        # userID
        self.__userID = User.userID
        # Increment static UID by 1
        User.userID += 1
        password = password.encode("utf-8")
        hashed_password = hashlib.sha256(password)
        self.__password = hashed_password
예제 #6
0
    def run_once(self):

        self.session_1.restart_session()
        self.session_2.restart_session()

        story = Story()

        while self.session_1.is_connected() and self.session_2.is_connected():
            sleep(0.2)

            message_list_1 = self.session_1.get_local_messages()
            message_list_2 = self.session_2.get_local_messages()

            self.transfer_session_info_to_session(message_list_1, self.session_2)
            self.transfer_session_info_to_session(message_list_2, self.session_1)
            self.transfer_session_info_to_story(self.session_1.identifier, message_list_1, story)
            self.transfer_session_info_to_story(self.session_2.identifier, message_list_2, story)

            self.session_1.read_messages()
            self.session_2.read_messages()

            self.session_1.update_status()
            self.session_2.update_status()

        story.save_as_txt(self.save_folder)
예제 #7
0
파일: main.py 프로젝트: Meowcolm024/cl-gal
def main():
    plot = Story()
    st = plot.get_start()
    while True:
        printer(st)
        if plot.checkpoint == plot.end:
            break
        st = plot.select_checkpoint()
예제 #8
0
    def get_story():
        if len(stories) <= 0:
            import_stories()
        #  chooses story randomly
        index = random.randrange(len(stories))
        new_story = Story(stories[index])
        #  removes this story from list so that it won't be repeated
        del stories[index]

        return new_story
예제 #9
0
from Person import Person
from Story import Story
from Car import Car
from School import School
from Choice import Choice
import time

if __name__ == '__main__':
    story = Story()
    story.introduce()
    story.wait(3)
    story.Begining()
    story.wait(3)
    choice = Choice()
    choice.choice1()
    story.wait(3)
    story.Transmission()
    story.wait(3)
    story.interview()
    story.wait(3)
    story.Fightingyears()
    story.wait(3)
    story.endline()
    choice.choice2()
예제 #10
0
def test_storyfile_json():
    jfile = open("jira_story.json")

    story = Story(json.loads(jfile.read()))

    return story.get_story()
예제 #11
0
    def loadStories(self):
        storyNum = 0
        for st in self.gamedata.stories.story:
            storyNum += 1
            currStory = Story(storyNum, st.name.cdata, st.startRoom.cdata,
                              st.description.cdata)

            for room in st.room:
                currRoom = Room(room.name.cdata, room.description.cdata,
                                room.art.cdata, room.interactables.cdata)
                currStory.addRoom(currRoom)

            for item in st.item:
                currItem = Item(item.name.cdata, item.description.cdata,
                                item.sellable.cdata, item.value.cdata)
                currStory.addItem(currItem)

            for interactable in st.interactable:
                currInteractable = Interactable(
                    interactable.name.cdata, interactable.description.cdata,
                    interactable.requiredEffects.cdata.split(','))
                #this is fine, we can just check for req effect name in player's effect list
                for action in interactable.action:
                    currAction = Action(
                        action.name.cdata, action.description.cdata,
                        action.failDescription.cdata, action.item.cdata,
                        action.requiredEffects.cdata,
                        action.givenEffects.cdata, action.removedEffects.cdata,
                        action.requiredItems.cdata, action.givenItems.cdata,
                        action.removedItems.cdata, action.newDesc.cdata,
                        action.newItems.cdata, action.newArt.cdata,
                        action.newInteractables.cdata)

                    currInteractable.addAction(currAction)
                currStory.addInteractable(currInteractable)

            for effect in st.effect:
                try:
                    effectName = effect.name.cdata
                    if effect.isRoomChange.cdata == "True" and effect.isRoomChange[
                            'roomname'] == '':
                        raise invalidSetup(Exception)
                    currEffect = Effect(effect.name.cdata,
                                        effect.description.cdata,
                                        effect.isRoomChange.cdata,
                                        effect.isRoomChange['roomname'])
                except AttributeError:
                    currEffect = Effect(effect.name.cdata,
                                        effect.description.cdata)
                except invalidSetup:
                    print('Warning: InvalidEffect - EFFECT[' + effectName +
                          '] STORY[' + currStory.name + '] ROOMCHANGE INGORED')
                    currEffect = Effect(effect.name.cdata,
                                        effect.description.cdata)
                currStory.addEffect(currEffect)

            player = Player(st.player.name.cdata, st.player.description.cdata,
                            st.player.effects.cdata, st.player.items.cdata,
                            st.player.art.cdata)
            currStory.setPlayer(player)

            self.stories.append(currStory)
예제 #12
0
파일: game.py 프로젝트: MaticVerbic/P1
from player import Player
from Enemy import *
from inventory import *
from npc import *
from fight import Fight
from Story import Story

p = Player("asd")
s = Story(p)
print(s.greeting())
s.chap1()
"""
f = Fight(p, anidict["Rat"])
p.app_weapons(weaponsdict["copper sword"])
p.equip_weapon(p.weapons["copper sword"])
p.app_armor(armordict["cloth armor"])
p.equip_armor(p.armor["cloth armor"])

print(f.fight_c())
print(p.experience)

for name in vendorsdict:
    print(name, vendorsdict[name].inventory)

for w in weaponsdict:
    print(vars(weaponsdict[w]))

for hi in healthitems: 
    print(vars(healthitems[hi]))

for a in armordict: