示例#1
0
    def gen_gui(self):
        #get theme, language and end process function from omnitool API
        from omnitool.shared import lang, theme, exit_prog, exit_prog
        from omnitool.pgu_override import Quitbutton

        #initilize pygame renderer
        pygame.display.init()
        #set window title to Flatworld, from language file
        pygame.display.set_caption(lang.flat)
        #application interface
        app = gui.Desktop(theme=theme)
        #main container, table
        main = gui.Table(width=800)
        #connect the QUIT event with Omnitool API exit_prog
        app.connect(gui.QUIT, exit_prog, None)
        #add label size to table
        main.td(gui.Label(lang.fw_size))
        #size drop down selection
        size = gui.Select(width=300)
        size.add(lang.fw_tiny, 4)
        size.add(lang.fw_small, 0)
        size.add(lang.fw_medium, 1)
        size.add(lang.fw_large, 2)
        size.add(lang.fw_square, 3)
        size.value = 0
        #add it to the table
        main.td(size)
        #surface label
        main.td(gui.Label(lang.fw_surf))

        surf = [
            "Grass Block", "Corrupt Grass Block", "Jungle Grass Block",
            "Mushroom Grass Block", "Hallowed Grass Block"
        ]
        #surface drop down menu
        sur = gui.Select(width=300)
        sur.add("None", None)
        for grass in surf:
            sur.add(grass, tiles.index(grass))
        sur.value = None
        #add surface selection to table
        main.td(sur)

        #go to next line in table
        main.tr()
        #add tile label to table
        main.td(gui.Label(lang.fw_tile))
        #create tile list
        tiles_ = gui.List(300, 150)
        for tile in tiles:
            if tiles.index(tile) not in multitiles:
                tiles_.add(gui.Label(tile), value=tiles.index(tile))
        #add tile list to table
        main.td(tiles_)
        #add wall label to table
        main.td(gui.Label(lang.fw_wall))
        #create wall list
        guiwalls = gui.List(300, 150)
        for wall in walls:
            guiwalls.add(gui.Label(wall), value=walls.index(wall))
        #add wall list to table
        main.td(guiwalls)
        #next row
        main.tr()
        #Generate! button
        main.td(Quitbutton(app, lang.pt_start), colspan=4)
        #run the application and open the window
        app.run(main)
        #when it's done, instruct pygame to clean up
        pygame.display.quit()
        #attach data to plugin, to be used in run()
        self.surface = sur.value
        self.wall = guiwalls.value
        self.tile = tiles_.value
        self.size = size.value
        if self.wall == 0:
            self.wall = None
示例#2
0
 def __init__(self):  #do any initialization stuff
     self.tile_id = tiles.index("Grave Marker")  #we grab the ID of tombstone from database
示例#3
0
    def gen_gui(self):
        #get theme, language and end process function from omnitool API
        from omnitool.shared import lang, theme, exit_prog, exit_prog
        from omnitool.pgu_override import Quitbutton

        #initilize pygame renderer
        pygame.display.init()
        #set window title to Flatworld, from language file
        pygame.display.set_caption(lang.flat)
        #application interface
        app = gui.Desktop(theme=theme)
        #main container, table
        main = gui.Table(width=800)
        #connect the QUIT event with Omnitool API exit_prog
        app.connect(gui.QUIT, exit_prog, None)
        #add label size to table
        main.td(gui.Label(lang.fw_size))
        #size drop down selection
        size = gui.Select(width=300)
        size.add(lang.fw_tiny, 4)
        size.add(lang.fw_small, 0)
        size.add(lang.fw_medium, 1)
        size.add(lang.fw_large, 2)
        size.add(lang.fw_square, 3)
        size.value = 0
        #add it to the table
        main.td(size)
        #surface label
        main.td(gui.Label(lang.fw_surf))

        surf = ["Grass Block", "Corrupt Grass Block", "Jungle Grass Block",
                "Mushroom Grass Block", "Hallowed Grass Block"]
        #surface drop down menu
        sur = gui.Select(width=300)
        sur.add("None", None)
        for grass in surf:
            sur.add(grass, tiles.index(grass))
        sur.value = None
        #add surface selection to table
        main.td(sur)

        #go to next line in table
        main.tr()
        #add tile label to table
        main.td(gui.Label(lang.fw_tile))
        #create tile list
        tiles_ = gui.List(300, 150)
        for tile in tiles:
            if tiles.index(tile) not in multitiles:
                tiles_.add(gui.Label(tile), value=tiles.index(tile))
        #add tile list to table
        main.td(tiles_)
        #add wall label to table
        main.td(gui.Label(lang.fw_wall))
        #create wall list
        guiwalls = gui.List(300, 150)
        for wall in walls:
            guiwalls.add(gui.Label(wall), value=walls.index(wall))
        #add wall list to table
        main.td(guiwalls)
        #next row
        main.tr()
        #Generate! button
        main.td(Quitbutton(app, lang.pt_start), colspan=4)
        #run the application and open the window
        app.run(main)
        #when it's done, instruct pygame to clean up
        pygame.display.quit()
        #attach data to plugin, to be used in run()
        self.surface = sur.value
        self.wall = guiwalls.value
        self.tile = tiles_.value
        self.size = size.value
        if self.wall == 0:
            self.wall = None
示例#4
0
 def __init__(self):  #do any initialization stuff
     self.tile_id = tiles.index(
         "Grave Marker")  #we grab the ID of tombstone from database