示例#1
0
    def tab(self):
        """sets up the actual tab layout"""
        # Initializing the complete layout
        self.layout = QVBoxLayout()

        # The list of plots to choose from. Change the values in the listOfPlot
        # list to get different results on the page.
        plot_combo_box_label = QLabel("Basic Plot:")
        self.plot_combo_box = QComboBox()
        list_of_plot = ('Go kill a monster', 'Go kill a noble',
                        'Go kill a god', 'Bad hombres moved in',
                        'Bad hombres at the top', 'Escort quest',
                        'Go get a thing', 'Go get some cash',
                        'Go investigate the spoopy place',
                        'Go investigate the ostensibly normal place')
        self.plot_combo_box.addItems(list_of_plot)

        # This sets up the level scaling for the
        # resulting character. The current cap is at 30,
        # but the algorithm should continue to function to any level.
        level_combo_box_label = QLabel("Level:")
        self.level_combo_box = QComboBox()
        for i in range(1, 31):
            self.level_combo_box.addItem(str(i))
            i += 1

        # These are the buttons for saving and generating new quests.
        self.generate_button = QPushButton("Generate")
        self.save_button = QPushButton("Save")
        bottom_buttons_layout = QHBoxLayout()
        bottom_buttons_layout.addStretch(1)
        bottom_buttons_layout.addWidget(self.generate_button)
        bottom_buttons_layout.addWidget(self.save_button)

        # This builds the textbox that you see the resulting character in
        self.main_text_box = QTextEdit()
        text_box_layout = QHBoxLayout()
        text_box_layout.addWidget(self.main_text_box)

        controls = QScrollArea()
        controls.setFixedHeight(100)
        controls.setWidgetResizable(False)
        controls_layout = QHBoxLayout(controls)

        # This creates the layout for the controls. Any new fields should
        # follow this same general convention.
        controls.setWidget(controls_layout.widget())
        controls_layout.addWidget(level_combo_box_label)
        controls_layout.addWidget(self.level_combo_box)
        controls_layout.addWidget(plot_combo_box_label)
        controls_layout.addWidget(self.plot_combo_box)

        # Adds all of the disparate groups of controls to the total layout
        self.layout.addWidget(controls)
        self.layout.addLayout(text_box_layout)
        self.layout.addLayout(bottom_buttons_layout)
示例#2
0
    def tab(self):
        # Initializing the complete layout
        self.layout = QVBoxLayout()

        # The list of species to choose from.
        # Change the values in the listOfSpecies
        # list to get different results on the page.
        placesComboBoxLabel = QLabel("Places:")
        self.placesComboBox = QComboBox()
        listOfPlaces = ('Village', 'City', 'Cave', 'Ruins')
        self.placesComboBox.addItems(listOfPlaces)

        # This sets up the elements box
        elementsComboBoxLabel = QLabel("Element:")
        self.elementsComboBox = QComboBox()
        listOfElements = ('Plains', 'Mountain', 'Wetland', 'Volcano', 'Forest')
        self.elementsComboBox.addItems(listOfElements)

        # Toggle for hostile area
        hostileCheckBoxLabel = QLabel("Hostile:")
        self.hostileCheckBox = QCheckBox()

        # These are the buttons for saving and generating new NPCs.
        self.generateButton = QPushButton("Generate")
        self.saveButton = QPushButton("Save")
        bottomButtonsLayout = QHBoxLayout()
        bottomButtonsLayout.addStretch(1)
        bottomButtonsLayout.addWidget(self.generateButton)
        bottomButtonsLayout.addWidget(self.saveButton)

        # This builds the textbox that you see the resulting character in
        self.mainTextBox = QTextEdit()
        textBoxLayout = QHBoxLayout()
        textBoxLayout.addWidget(self.mainTextBox)

        controls = QScrollArea()
        controls.setFixedHeight(100)
        controls.setWidgetResizable(False)
        controlsLayout = QHBoxLayout(controls)

        # This creates the layout for the controls. Any new fields should
        # follow this same general convention.
        controls.setWidget(controlsLayout.widget())
        controlsLayout.addWidget(placesComboBoxLabel)
        controlsLayout.addWidget(self.placesComboBox)
        controlsLayout.addWidget(elementsComboBoxLabel)
        controlsLayout.addWidget(self.elementsComboBox)
        controlsLayout.addWidget(hostileCheckBoxLabel)
        controlsLayout.addWidget(self.hostileCheckBox)

        # Adds all of the disparate groups of controls to the total layout
        self.layout.addWidget(controls)
        self.layout.addLayout(textBoxLayout)
        self.layout.addLayout(bottomButtonsLayout)
示例#3
0
    def tab(self):
        """Sets up the tab contents"""
        # Initializing the complete layout
        self.layout = QVBoxLayout()

        # The list of items to choose from.
        # Change the values in the list_of_items
        # list to get different results on the page.
        items_combo_box_label = QLabel("Places:")
        self.items_combo_box = QComboBox()
        list_of_items = ('Light Weapon', 'One-Handed Weapon',
                         'Two-Handed Weapon', 'Ranged Weapon',
                         'Light Armor', 'Medium Armor',
                         'Heavy Armor', 'Shield', 'Jewelry',
                         'Potion', 'Gear', 'Specialty')
        self.items_combo_box.addItems(list_of_items)

        # This sets up the buffs box
        buffs_combo_box_label = QLabel("Buffs:")
        self.buffs_combo_box = QComboBox()
        list_of_buffs = ('None', 'Low', 'Medium', 'High', 'Legendary')
        self.buffs_combo_box.addItems(list_of_buffs)

        # This sets up the debuffs box
        debuffs_combo_box_label = QLabel("Debuffs:")
        self.debuffs_combo_box = QComboBox()
        list_of_debuffs = ('None', 'Low', 'Medium', 'High', 'Cursed')
        self.debuffs_combo_box.addItems(list_of_debuffs)

        # These are the buttons for saving and generating new NPCs.
        self.generate_button = QPushButton("Generate")
        self.save_button = QPushButton("Save")

        bottom_buttons_layout = QHBoxLayout()
        bottom_buttons_layout.addStretch(1)
        bottom_buttons_layout.addWidget(self.generate_button)
        bottom_buttons_layout.addWidget(self.save_button)

        # This builds the textbox that you see the resulting item in
        main_text_box = QTextEdit()
        text_box_layout = QHBoxLayout()
        text_box_layout.addWidget(main_text_box)

        # This creates the layout for the controls. Any new fields should
        # follow this same general convention.
        controls = QScrollArea()
        controls.setFixedHeight(100)
        controls.setWidgetResizable(False)
        controls_layout = QHBoxLayout(controls)

        controls.setWidget(controls_layout.widget())

        controls_layout.addWidget(items_combo_box_label)
        controls_layout.addWidget(self.items_combo_box)
        controls_layout.addWidget(buffs_combo_box_label)
        controls_layout.addWidget(self.buffs_combo_box)
        controls_layout.addWidget(debuffs_combo_box_label)
        controls_layout.addWidget(self.debuffs_combo_box)

        # Adds all of the disparate groups of controls to the total layout
        self.layout.addWidget(controls)
        self.layout.addLayout(text_box_layout)
        self.layout.addLayout(bottom_buttons_layout)
示例#4
0
文件: npc.py 项目: treymerkley/yendor
class Tab:
    """Sets up the tab structure"""
    def __init__(self):
        self.tab()

    def tab(self):
        """Sets up the tab contents"""
        # Initializing the complete layout
        self.layout = QVBoxLayout()

        # The list of species to choose from. Change the values
        # in the listOfSpecies list to get different results on the page.
        species_combo_box_label = QLabel("Species:")
        self.species_combo_box = QComboBox()
        list_of_species = ('Dragonborn', 'Dwarf', 'Eldarin', 'Elf', 'Halfling',
                           'Human', 'Tiefling', 'Goblin', 'Slime',
                           'Random Appropriate Monster')
        self.species_combo_box.addItems(list_of_species)

        # This sets up the level scaling for the resulting
        # character. The current cap is at 30, but the
        # algorithm should continue to function to any level.
        level_combo_box_label = QLabel("Level:")
        self.level_combo_box = QComboBox()
        for i in range(1, 31):
            self.level_combo_box.addItem(str(i))
            i += 1

        # This sets up the list of classes. Only four basic
        # classes are here now, but to add more, add a comma
        # after the last item and write in whatever you
        # want, as long as it's in single quotes
        classes_combo_box_label = QLabel("Class:")
        self.classes_combo_box = QComboBox()
        list_of_classes = ('Fighter', 'Ranger', 'Rogue', 'Mage', 'Cleric')
        self.classes_combo_box.addItems(list_of_classes)

        # This sets up the elements box
        elements_combo_box_label = QLabel("Element:")
        self.elements_combo_box = QComboBox()
        list_of_elements = ('Neutral', 'Aerial', 'Earthen', 'Aquatic',
                            'Burning', 'Frozen', 'Botanic', 'Poisonous')
        self.elements_combo_box.addItems(list_of_elements)

        # This is a toggle modifier to increase the strength
        # of the monster and the loot it's carrying. It's
        # entirely optional and can be removed, or the strength
        # of the modifier can be changed in the "math" folder.
        boss_check_box_label = QLabel("Boss:")
        self.boss_check_box = QCheckBox()

        # These are the buttons for saving and generating new NPCs.

        self.generate_button = QPushButton("Generate")
        self.generate_button.clicked.connect(self.generate_button_pressed)
        self.save_button = QPushButton("Save")

        bottom_buttons_layout = QHBoxLayout()
        bottom_buttons_layout.addStretch(1)
        bottom_buttons_layout.addWidget(self.generate_button)
        bottom_buttons_layout.addWidget(self.save_button)

        # This builds the textbox that you see the resulting character in

        self.main_text_box = QTextEdit()
        text_box_layout = QHBoxLayout()
        text_box_layout.addWidget(self.main_text_box)

        # This creates the layout for the controls. Any new fields should
        # follow this same general convention.
        self.controls = QScrollArea()
        self.controls.setFixedHeight(100)
        self.controls.setWidgetResizable(False)
        self.controls_layout = QHBoxLayout(self.controls)

        self.controls.setWidget(self.controls_layout.widget())

        self.controls_layout.addWidget(level_combo_box_label)
        self.controls_layout.addWidget(self.level_combo_box)
        self.controls_layout.addWidget(species_combo_box_label)
        self.controls_layout.addWidget(self.species_combo_box)
        self.controls_layout.addWidget(classes_combo_box_label)
        self.controls_layout.addWidget(self.classes_combo_box)
        self.controls_layout.addWidget(elements_combo_box_label)
        self.controls_layout.addWidget(self.elements_combo_box)
        self.controls_layout.addWidget(boss_check_box_label)
        self.controls_layout.addWidget(self.boss_check_box)

        # Adds all of the disparate groups of controls to the total layout
        self.layout.addWidget(self.controls)
        self.layout.addLayout(text_box_layout)
        self.layout.addLayout(bottom_buttons_layout)

    def generate_button_pressed(self):
        """send variables to the charactergen.py"""
        self.local_level_string = self.level_combo_box.currentText()
        self.species_string = self.species_combo_box.currentText()
        self.classes_string = self.classes_combo_box.currentText()
        self.elements_string = self.elements_combo_box.currentText()
        if self.boss_check_box == Qt.Checked:
            self.boss_string = "true"
        else:
            self.boss_string = "false"
        self.result_string = charactergen.generate_character(self)
        self.main_text_box.setPlainText(self.result_string)
示例#5
0
    def tab(self):
        """sets up the actual tab layout"""
        # Initializing the complete layout
        self.layout = QVBoxLayout()

        name_line_edit_label = QLabel("Name:")
        self.name_line_edit = QLineEdit()

        # This sets up the level scaling for
        # the resulting character. The current
        # cap is at 30, but the algorithm should
        # continue to function to any level.
        level_combo_box_label = QLabel("Level:")
        self.level_combo_box = QComboBox()
        for i in range(1, 31):
            self.level_combo_box.addItem(str(i))
            i += 1

        # This sets up the elements box
        size_combo_box_label = QLabel("Size:")
        self.size_combo_box = QComboBox()
        list_of_sizes = ('Fine', 'Diminutive', 'Tiny', 'Small',
                         'Medium', 'Large', 'Huge', 'Gargantuan',
                         'Colossal')
        self.size_combo_box.addItems(list_of_sizes)

        # This sets up the elements box
        skills_combo_box_label = QLabel("Skills:")
        self.skills_combo_box = QComboBox()
        list_of_skills = ('Babble', 'Blindsense', 'Blindsight', 'Breath Weapon',
                          'Constrict', 'Create Spawn', 'Damage Reduction',
                          'Darkvision', 'Enslave', 'Etherealness',
                          'Fast Healing', 'Firey Aura', 'Flight',
                          'Improved Grab', 'Incorporeality', 'Invisibility',
                          'Leader', 'Low-Light Vision', 'Earth Mastery',
                          'Water Mastery', 'Fire Mastery', 'Air Mastery',
                          'Mindless', 'Natural Cunning', 'Pounce',
                          'Powerful Charge', 'Push', 'Rake', 'Regeneration',
                          'Scent', 'Snatch', 'Stonecunning', 'Swallow Whole',
                          'Torment', 'Trample', 'Tremorsense')
        self.skills_combo_box.addItems(list_of_skills)

        # This is a toggle modifier to increasethe strength
        # of the monster and the loot it's carrying. It's
        # entirely optional and can be removed, or the
        # strength of the modifier can be changed in the "math" folder.
        boss_check_box_label = QLabel("Boss:")
        self.boss_check_box = QCheckBox()

        # These are the buttons for saving and generating new NPCs.
        self.save_button = QPushButton("Save")
        bottom_buttons_layout = QHBoxLayout()
        bottom_buttons_layout.addStretch(1)
        bottom_buttons_layout.addWidget(self.save_button)

        # This builds the textbox that you see the resulting character in
        main_text_box = QTextEdit()
        text_box_layout = QHBoxLayout()
        text_box_label = QLabel("Description: ")
        text_box_layout.addWidget(text_box_label)
        text_box_layout.addWidget(main_text_box)

        # This creates the layout for the controls. Any new fields should
        # follow this same general convention.
        controls = QScrollArea()
        controls.setFixedHeight(100)
        controls.setWidgetResizable(False)
        controls_layout = QHBoxLayout(controls)

        controls.setWidget(controls_layout.widget())

        controls_layout.addWidget(level_combo_box_label)
        controls_layout.addWidget(self.level_combo_box)
        controls_layout.addWidget(name_line_edit_label)
        controls_layout.addWidget(self.name_line_edit)
        controls_layout.addWidget(skills_combo_box_label)
        controls_layout.addWidget(self.skills_combo_box)
        controls_layout.addWidget(size_combo_box_label)
        controls_layout.addWidget(self.size_combo_box)
        controls_layout.addWidget(boss_check_box_label)
        controls_layout.addWidget(self.boss_check_box)

        # Adds all of the disparate groups of controls to the total layout
        self.layout.addWidget(controls)
        self.layout.addLayout(text_box_layout)
        self.layout.addLayout(bottom_buttons_layout)