コード例 #1
0
	def __init__(self,level):
		self.level = level

		title = gui.Label("Jump to level")

		doc = gui.Document()

		table = gui.Table()

		#table.td(gui.Label("select level"),colspan=1)

		table.tr()

		# dont set the current as default since it could be the testlevel
		#levname = level.__class__.__module__.split(".")[1]
		levname = ""

		sel = gui.Select(levname,width=150)

		self.sel = sel

		#sel.add("test level","testlevel")
		## use the import to see what level scripts are available 
		## and add the script filenames to list

		i = j = 1

		while True:
			levelName = "gamelevel" + str(i) + "_" + str(j)

			# this is bit rough way to find out the level scripts
			try:
				exec("from levels import " + levelName)	

				sel.add(levelName,levelName)
				j += 1
			except ImportError, err:
				# filter the other import errors
				if str(err) != ("cannot import name "+levelName):
					raise "excepted import error from level script "+levelName+": "+str(err)
				j = 1
				i += 1

				if i > 72: break
コード例 #2
0
    def buildMovers(self):
        actor = self.script.controls['write-group-focus'].value
        position = actor.state.position

        self.selectablesDocumentRight.add(
            gui.Label(value=getMoveString(position),
                      name='write-label-position'))
        for aDirection in directions:
            prettyDirection = aDirection.replace('_', ' ').title()
            positionButton = gui.Button(_(prettyDirection),
                                        name='write-button-direction-' +
                                        prettyDirection)
            positionButton.connect(gui.CLICK, self.changePosition, aDirection)
            self.selectablesDocumentRight.add(positionButton)
        self.spaceSelectableDocumentRight()

        positionButton = gui.Button(_("Move"), name='write-button-move')
        positionButton.connect(gui.CLICK, self.changePositionAbsolutely)
        self.selectablesDocumentRight.add(positionButton)
        self.spaceSelectableDocumentRight()
コード例 #3
0
ファイル: leveledit.py プロジェクト: PerroTron/HostilPlanet
    def __init__(self, tt, data, **params):
        title = gui.Label("Error: " + tt)
        data = str(data)

        doc = html.HTML(globals={
            'gui': gui,
            'dialog': self
        },
                        data="""
<form id='form'>

<table>
<tr><td><h1>&lt;!&gt;&nbsp;</h1>
<td>""" + data + """
<tr><td>&nbsp;
<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE);dialog.close()'>
</table>""")
        gui.Dialog.__init__(self, title, doc)

        self.value = doc['form']
コード例 #4
0
 def createTaskItem(self, task_index):
     """
     Creates a row in the Table to represent a Task.
     Displays Task name, along with 'Done','Edit','Remove' button
     """
     self.tr()
     self.td(gui.Label(self.tasks[task_index].name), colspan=3, align=-1)
     self.td(gui.Spacer(width=50,height=1))
     
     doneBtn = gui.Button("Done")
     doneBtn.connect(pygame.MOUSEBUTTONUP, self.doneFnc, self.tasks[task_index], task_index)
     self.td(doneBtn, align=0)
     
     editBtn = gui.Button("Edit")
     editBtn.connect(gui.CLICK, self.editFnc, self.tasks[task_index], task_index)
     self.td(editBtn, align=0)
     
     removeBtn = gui.Button("Remove")
     removeBtn.connect(gui.CLICK, self.removeFnc, self.tasks[task_index], task_index)
     self.td(removeBtn, align=0)
コード例 #5
0
ファイル: leveledit.py プロジェクト: PerroTron/HostilPlanet
    def __init__(self, **params):
        title = gui.Label("File not yet saved...")
        data = "Your file is not yet saved.<br>Are you sure you want to continue?"

        doc = html.HTML(globals={
            'gui': gui,
            'dialog': self
        },
                        data="""
<form id='form'>

<table>
<tr><td><h1>&lt;!&gt;&nbsp;</h1>
<td>""" + data + """
<tr><td>&nbsp;
<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE)'> <input type='button' value='Cancel' onclick='dialog.close()'>
</table>""")
        gui.Dialog.__init__(self, title, doc)

        self.value = doc['form']
コード例 #6
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.value = gui.Form()

        self.tr()
        self.td(gui.Label("Map ID: ", color=UI_FONT_COLOR), colspan=2)

        self.tr()
        self.inpMapID = gui.Input('0', size=8, name='inpWarpMapID')
        self.td(self.inpMapID, colspan=2)

        # used for selecting the map - todo
        '''
        mapDialog = MapSelectorDialog(self.inpMapID)

        self.tr()
        e = gui.Button('Choose map...')
        e.connect(gui.CLICK, mapDialog.openDialog, None)
        self.td(e, colspan=2)
        '''

        self.tr()
        self.td(gui.Spacer(10, 20))

        self.tr()
        self.td(gui.Label("Warp-To Position", color=UI_FONT_COLOR), colspan=2)

        self.tr()
        self.td(gui.Label("X: ", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpWarpX"))

        self.tr()
        self.td(gui.Label("Y: ", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpWarpY"))

        self.tr()
        self.td(gui.Spacer(10, 20))

        self.tr()
        label = gui.Label("Left click to add warp", color=UI_FONT_COLOR)
        self.td(label, colspan=2)

        self.tr()
        label = gui.Label("Right click to remove warp", color=UI_FONT_COLOR)
        self.td(label, colspan=2)

        # initialize the alert dialog
        self.alertDialog = EmptyFieldAlertDialog()
コード例 #7
0
ファイル: dialog.py プロジェクト: tcjinaz/nxtIDE
    def build_sensors(self):
        sensors_group = gui.Group(value=self.inp['type'])
        sensors = gui.Table()
        sensors.tr()
        sensors.td(gui.Tool(sensors_group, 
                        gui.Image(p('icons/light.png')), value='light'))
        sensors.tr()
        sensors.td(gui.Tool(sensors_group, 
                        gui.Image(p('icons/sonic.png')), value='sonic'))
        sensors.tr()
        sensors.td(gui.Tool(sensors_group, 
                        gui.Image(p('icons/touch.png')), value='touch'))
        sensors.tr()
        sensors.td(gui.Tool(sensors_group,
                        gui.Image(p('icons/compass.png')), value='compass'))
        sensors.tr()
        sensors.td(gui.Tool(sensors_group, gui.Label('None'), value=''))

        sensors_group.connect(gui.CHANGE, self.sensor_change, sensors_group)
        
        return sensors
コード例 #8
0
    def __init__(self,**params):
        title = gui.Label("New Picture...")
        
        ##Note how the global variables are set for the scripting of HTML
        ##::        
        picker = ColorDialog("#ffffff")
        doc = html.HTML(globals={'gui':gui,'dialog':self,'picker':picker},data="""
<form id='form'>

<table>

<tr><td colspan='2' align='center'>
Size
<tr><td colspan='2' align='center'>
<table>
<tr><td align=right>Width: <td><input type='text' size='4' value='256' name='width'>
<tr><td align=right>Height: <td><input type='text' size='4' value='256' name='height'>
</table>

<tr><td>Format<td>Background

<tr><td>
<input type='radio' name='format' value='rgb' checked> RGB<br>
<input type='radio' name='format' value='bw'> Grayscale
<td>
<input type='radio' name='background' value='#000000'> Black<br>
<input type='radio' name='background' value='#ffffff' checked> White<br>
<input type='radio' name='background' value='custom'> <object type='gui.Color' width=48 height=16 value='#ffffff' name='custom' border=1 onclick='picker.open()'>

<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE)'> <input type='button' value='Cancel' onclick='dialog.close()'>

</table>

""")
        gui.Dialog.__init__(self,title,doc)
        
        picker.connect(gui.CHANGE,gui.action_setvalue,(picker,doc['form']['custom']))
        ##
        
        self.value = doc['form']
コード例 #9
0
    def __init__(self, stacks, playerName):
        # 1. get input arguments
        self.stacks = stacks
        self._playerName = playerName
        # create a group of stacks for selection
        self.group = gui.Group(value=None)
        # 2. load audios
        pygame.mixer.init()
        self._click = pygame.mixer.Sound(strings.Audio.click)
        self._confirm = pygame.mixer.Sound(strings.Audio.confirm)
        # 3. create the drafting window which includes a lable and a container
        # 3.1 crate the lable
        lableStr = 'Drafing Window for ' + self._playerName
        title = gui.Label(lableStr)
        # 3.2 create a container to show all un-distributed stacks of cards and confirm button
        self.stacksContainer = gui.Container(width=400, height=400)
        self.stacksTbl = gui.Table()

        # create a confirm button for the human player to confirm his/her selection
        self.confirmButton = gui.Button("Confirm")

        # define the the things need to do before close the drafting window
        def clsDialog(self):
            # get the final selected item
            self._selectedItem = self.group.value
            # play the confirm audio
            self._confirm.play()
            if self._selectedItem is not None:
                self.stacksContainer.remove(self.stacksTbl)

        self.confirmButton.connect(gui.CLICK, clsDialog, self)
        # add confirm button to container
        self.stacksContainer.add(self.confirmButton, 300, 370)

        # initialie Drafting dialog
        gui.Dialog.__init__(self,
                            title,
                            self.stacksContainer,
                            name='draftingDialog')
コード例 #10
0
    def build_slots(self):
        slots_group = gui.Group(value=self.inputs[self.port]['slot'])
        slots = gui.Table()

        wslots = [self.inputs[self.port]['slot']] + self.slots

        for slot in [1, 2, 3]:
            slots.tr()
            if slot in wslots:
                slots.td(
                    gui.Tool(slots_group,
                             gui.Image(p('icons/slot%d.png' % (slot))),
                             value=slot))
            else:
                slots.td(gui.Image(p('icons/slot%d.png' % (slot))))

        slots.tr()
        slots.td(gui.Tool(slots_group, gui.Label('None'), value=''))

        slots_group.connect(gui.CHANGE, self.slot_change, slots_group)

        return slots
コード例 #11
0
ファイル: leveledit.py プロジェクト: PerroTron/HostilPlanet
    def __init__(self, **params):
        title = gui.Label("Save As...")

        doc = html.HTML(globals={
            'gui': gui,
            'dialog': self
        },
                        data="""
<form id='form'>

<table>

<tr><td colspan=2>File Name: <input type='file' size=20 name='fname' value=''>

<tr><td>&nbsp;

<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE)'> <input type='button' value='Cancel' onclick='dialog.close()'>

</table>""")
        gui.Dialog.__init__(self, title, doc)

        self.value = doc['form']
コード例 #12
0
ファイル: tab.py プロジェクト: sugar-activities/4602-activity
    def __init__(self, script):
        gui.Table.__init__(self,
                           width=geom['tab'].width,
                           height=geom['tab'].height)

        self.script = script

        panels = [
            filePanel.FilePanel, backdropPanel.BackdropPanel,
            actorPanel.ActorPanel, writePanel.WritePanel,
            theaterPanel.TheaterPanel
        ]
        curPanel = 0

        self.activePanel = panels[curPanel](self.script)
        self.activePanel.build()
        self.panelHolder = gui.Container(width=geom['panel'].width,
                                         height=geom['panel'].height)
        self.panelHolder.add(self.activePanel, 0, 0)

        self.tabGroup = gui.Group('tab-group-panels', panels[curPanel])
        self.tabGroup.connect(gui.CHANGE, self.changePanel)

        buttonHeight = geom['tab'].height / len(panels) * 3 / 5
        buttonWidth = geom['tab'].width * 3 / 5
        self.panelLabels = {}
        for aPanel in panels:
            self.tr()
            panelLabel = gui.Label(aPanel.name,
                                   name='tab-label-panels-' + aPanel.name)
            self.panelLabels[aPanel] = panelLabel
            aPanel.sourceTab = self
            panelTool = gui.Tool(self.tabGroup,
                                 panelLabel,
                                 aPanel,
                                 width=buttonWidth,
                                 height=buttonHeight,
                                 name='tab-tool-panels-' + aPanel.name)
            self.td(panelTool, style={'padding': 10})
コード例 #13
0
    def __init__(self, parent_class, instance):
        self.instance = instance
        self.parent_class = parent_class
        self.depth = 0
        self.parent = None
        self.color = "Red"
        self._target = None
        self.label = "Null"
        self.has_child = False
        self.drop_down_visible = True

        self.drop_down_box = pgui.Switch({'value':True})
        self.drop_down_box.style.off = texture["gray_triangle_off"]
        self.drop_down_box.style.on = texture["gray_triangle_on"]

        self.arrow_check = pgui.Switch()
        self.arrow_check.value = False
        self.arrow = Arrow(self.instance, self.target, GREEN, 1)
        self.arrow.visible = False
        def change_visiblity_arrow(value):
            self.arrow.visible = not self.arrow_check.value

        self.arrow_check.connect(pgui.CLICK, change_visiblity_arrow, None)

        if instance is not None:
            self.instance.create(self.arrow)
        # self.arrow_check.style.off = texture["gray_triangle_off"]
        # self.arrow_check.style.on = texture["gray_triangle_on"]


        def change_visiblity(value):
            self.drop_down_visible = not self.drop_down_box.value
            self.parent_class.update()

        self.drop_down_box.connect(pgui.CLICK, change_visiblity, None)
        self.name_box = pgui.Label(self.label)
        self.name_box.set_font(font["ui_font_1"])
        self.name_box.style.color = LIGHT_GRAY
コード例 #14
0
ファイル: leveledit.py プロジェクト: PerroTron/HostilPlanet
    def __init__(self, **params):
        title = gui.Label("Open...")

        def load_vals(fname, form):
            if not ini.has_section(fname): return

            for k, v in ini.items(fname):
                if k in form:
                    form[k].value = v

        doc = html.HTML(globals={
            'load_vals': load_vals,
            'ini': ini,
            'gui': gui,
            'dialog': self
        },
                        data="""<form id='form'><table>
        
        <tr><td align=right>File Name:&nbsp;<td  align=left><input type='file' size=20 name='fname' value='' onchange='load_vals(self.value,form)'>

        <tr><td align=right>Level&nbsp;<br>Type:&nbsp;
        <td align=left><input type=radio name='class' value='pgu.tilevid.Tilevid' checked> Tile<br><input type=radio name='class' value='pgu.isovid.Isovid'> Isometric<br><input type=radio name='class' value='pgu.hexvid.Hexvid'> Hexoganol
        
        <tr><td align=right>Tiles:&nbsp;<td align=left><input type='text' size=20 name='tiles' value='%(tiles)s'>
        <tr><td align=right>Codes:&nbsp;<td align=left><input type='text' size=20 name='codes' value='%(codes)s'>
        
        <tr><td align=right>Tile Width:&nbsp;<td align=left><input type='text' size='4' value='%(tile_w)s' name='tile_w'>
        <tr><td align=right>Tile Height:&nbsp;<td align=left><input type='text' size='4' value='%(tile_h)s' name='tile_h'>


<tr><td>&nbsp;

<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE)'> <input type='button' value='Cancel' onclick='dialog.close()'>

</table>""" % ini_to_dict('None'))
        gui.Dialog.__init__(self, title, doc)

        self.value = doc['form']
コード例 #15
0
ファイル: __init__.py プロジェクト: John-AZ1/omnitool
    def __init__(self, n=None):

        main = gui.Table()
        gui.Dialog.__init__(self, gui.Label(lang.settings), main)

        liste = gui.List(200, 114)
        liste.value = themename
        themes = "themes"
        for dire in os.listdir(themes):
            liste.add(str(dire), value=dire)
        self.liste = liste

        liste = gui.Select()
        liste.value = cache["columns"]
        for x in (1, 2, 3, 4, 5):
            liste.add(str(x), value=x)
        self.columns = liste

        backupswitch = gui.Switch()
        backupswitch.value = cache["do_backup"]
        self.backup = backupswitch
        sizelist = gui.Select(value=thumbsize)
        sizelist.add(lang.none, 0)
        sizelist.add(lang.small, (420.0, 120.0))
        sizelist.add(lang.medium, (630.0, 180.0))
        sizelist.add(lang.large, (840.0, 240.0))
        sizelist.add(lang.very_large, (1260.0, 360.0))
        self.sizelist = sizelist
        main.td(gui.Label(lang.warning, color=(127, 0, 0)), colspan=2)
        main.tr()
        main.td(gui.Label(lang.theme_select))
        main.td(gui.Label(lang.thumbsize))
        main.tr()
        main.td(self.liste, rowspan=5)
        main.td(sizelist)
        main.tr()
        main.td(gui.Label(lang.world_columns), col=1, row=3)
        main.tr()
        main.td(self.columns, col=1, row=4)
        main.tr()
        main.td(gui.Label(lang.mk_backups), col=1, row=5)
        main.tr()
        main.td(backupswitch, col=1, row=6)

        self.open()
コード例 #16
0
ファイル: __init__.py プロジェクト: John-AZ1/omnitool
    def __init__(self, world):
        main = gui.Table()
        gui.Dialog.__init__(
            self, gui.Label(lang.wa_worldactionmenu.format(world.name)), main)

        imgopen = Button(lang.wa_imageopen, self.bundle, (open_image, world))
        renderopen = Button(lang.wa_renderopen, self.bundle,
                            (runrender, world, False))
        updatemap = Button(lang.wa_update, self.bundle, (regen_map, world))
        superimg = Button(lang.wa_super, self.bundle, (runrender, world, True))
        main.td(imgopen)
        main.tr()
        main.td(renderopen)
        main.tr()
        main.td(superimg)
        if "tedit" in cache and os.path.exists(cache["tedit"]):
            editopen = Button(lang.wa_teditopen, self.bundle,
                              (open_tedit, world))
            main.tr()
            main.td(editopen)
        main.tr()
        main.td(updatemap)
        self.open()
コード例 #17
0
    def buildIdeaGenerator(self):
        ideaButton = gui.Button(_("New Idea"), name='write-button-newTwist')
        ideaButton.connect(gui.CLICK, self.generateNewIdea)
        self.selectablesDocumentLeft.add(ideaButton)

        self.selectablesDocumentLeft.add(gui.Spacer(20, 5))

        useButton = gui.Button(_("Use Idea"), name='write-button-useTwist')
        useButton.connect(gui.CLICK, self.useIdea)
        self.selectablesDocumentLeft.add(useButton)

        self.spaceSelectableDocumentLeft()

        self.selectablesDocumentTable.tr()

        self.selectablesDocumentTable.td(gui.Label(value=_("Current Idea:")))
        self.selectablesDocumentTable.tr()

        longestPlotTwist = self.script.getLongestTwist()
        ideaLabel = gui.WidthLabel(value=longestPlotTwist,
                                   width=geom['scriptPanel'].width,
                                   name='write-label-twist')
        self.selectablesDocumentTable.td(ideaLabel)
        ideaLabel.value = self.plotTwist
コード例 #18
0
ファイル: leveledit.py プロジェクト: allencch/Speckpater
	def __init__(self,**params):
		title = gui.Label("Load...")
		
		options = ""
		
		files = glob.glob(os.path.join('levels', '*.lev'))
		limit = 10
		for file in files:
			limit = limit - 1
			if limit < 0: break
			fn = os.path.basename(file)
			n = os.path.splitext(fn)[0]
			options += "<option value='" + n + "'>" + fn
		
		doc = html.HTML(globals={'gui':gui,'dialog':self},data="""
<form id='form'>

<table width="200" height="70">


<tr>

<td>Level file: <td> <select name="fname">
""" + options + """
</select>


<tr>

<tr><td colspan=2><input type='button' value='Okay' onclick='dialog.send(gui.CHANGE)'> <input type='button' value='Cancel' onclick='dialog.close()'>

</table>""")

		gui.Dialog.__init__(self,title,doc)

		self.value = doc['form']	
コード例 #19
0
ファイル: menu.py プロジェクト: McFeod/susu-robotics
    def setup_file_dialog(self, panel_width):
        def open_file_browser(arg):
            dialog = gui.FileDialog()
            dialog.connect(gui.CHANGE, handle_file_browser_closed, dialog)
            self.open(dialog)

        def handle_file_browser_closed(dlg):
            if dlg.value:
                input_file.value = dlg.value
                self.load_file(dlg.value)

        table = gui.Table()
        table.tr()
        table.td(gui.Label('Лабиринт:', font=self.font), align=-1)
        input_file = gui.Input(font=self.font)
        table.tr()
        table.td(input_file)
        button = gui.Button('Файл...', font=self.font)
        table.tr()
        table.td(button, align=1)
        table.tr()
        table.td(gui.Spacer(height=20, width=panel_width))
        button.connect(gui.CLICK, open_file_browser, None)
        return table
コード例 #20
0
    def levelup(self):
        self.lvl += 1
        self.xp -= 100
        app = gui.Desktop()
        app.connect(gui.QUIT, app.quit, None)
        c = gui.Table()
        c.tr()
        c.td(gui.Label("Character levelup"), colspan=4)
        c.tr()
        c.td(gui.Label("Name :" + self.name))
        c.tr()
        c.td(gui.Label("Level :" + str(self.lvl)))
        c.tr()
        c.td(gui.Label("Strength " + str(self.strength)))
        c.td(gui.Label("Spirit " + str(self.spirit)))
        c.td(gui.Label("Agility " + str(self.agility)))
        c.tr()
        g = gui.Group(value=1)
        c.td(gui.Radio(g, value=1))
        c.td(gui.Radio(g, value=2))
        c.td(gui.Radio(g, value=3))

        def doneit():
            if globalconst.DEBUG:
                print g.value
            if g.value == 1:
                self.strength += 1
                self.healthmax = 5 * self.strength
            if g.value == 2:
                self.spirit += 1
                self.energymax = 5 * (self.strength + self.spirit +
                                      self.agility)
            if g.value == 3:
                self.agility += 1

        btn = gui.Button("Done")
        btn.connect(gui.CLICK, doneit)
        btn.connect(gui.CLICK, app.quit)
        c.tr()
        c.td(btn, colspan=4)
        app.run(c)
コード例 #21
0
ファイル: laptimer.py プロジェクト: puvadeee/bluebrain
    def __init__(self, playerNum, **params):
        gui.Table.__init__(self, height=640,
                           **params)  #hpadding=10, vpadding=10,
        fg = (128, 0, 0)
        labelFg = (200, 200, 200)
        self.playerNum = playerNum
        self.lapCountLabel = gui.Label("       ",
                                       color=fg,
                                       style={'font': roboticaLargeFont})
        self.bestLapTimeLabel = gui.Label("",
                                          color=fg,
                                          style={'font': roboticaMediumFont})
        self.currentLapTimeLabel = gui.Label(
            "", color=fg, style={'font': roboticaMediumFont})

        # last lap time
        self.tr()
        self.td(
            gui.Label("Laps:",
                      align=-1,
                      color=labelFg,
                      style={'font': roboticaMediumFont}))
        self.td(self.lapCountLabel, align=0)

        self.tr()
        self.td(
            gui.Label("Best:",
                      align=-1,
                      color=(0, 200, 0),
                      style={'font': roboticaMediumFont}))
        self.td(self.bestLapTimeLabel, align=-1)
        self.tr()
        self.td(
            gui.Label("Last:",
                      align=-1,
                      color=(0, 0, 200),
                      style={'font': roboticaMediumFont}))
        self.td(self.currentLapTimeLabel, align=-1)

        self.reset()
コード例 #22
0
ファイル: __init__.py プロジェクト: John-AZ1/omnitool
def run():
    global app
    global worldnames
    global worlds
    global display_worlds

    try:
        loc = myterraria / "Game Launcher" / "omnitool.gli3"
        data = {
            "appAuthor": __author__ + " (Berserker66)",
            "appName": "Omnitool",
            "appPath": os.path.abspath(sys.argv[0]),
            "appVersion": __version__.__repr__()
        }
        with loc.open("wt") as f:
            f.write(json.dumps(data, indent=4))
    except:
        import traceback

        print(
            "Could not register to GameLauncher 3. Maybe it just isn't installed. Exception:"
        )
        traceback.print_exc()

    try:
        worldnames = list(get_worlds())
    except FileNotFoundError:
        worldnames = []
        print("Omnitool has found no worlds")

    use_override = True
    if use_override:
        app = MyApp(theme=theme)
    else:
        import pgu
        app = pgu.gui.App(theme=theme)
    worlds = []
    ts = [
        threading.Thread(target=get_world, args=(world, worlds))
        for world in worldnames
    ]
    tuple(t.start() for t in ts)
    pad = 10
    x = 0

    data = [
        ("Omnitool/" + lang.settings, Settings, None),
        ("Omnitool/" + "Language", Language, None),
        ("Omnitool/" + lang.report_issue, webbrowser.open,
         "https://github.com/Berserker66/omnitool/issues"),
        ("Omnitool/" + lang.exit, exit_prog, None),
        (lang.start + "/" + lang.terraria, webbrowser.open,
         "steam://rungameid/105600"),
    ]

    if "tedit" in cache and os.path.exists(cache["tedit"]):

        def run_tedit(n):
            subprocess.Popen(cache["tedit"],
                             cwd=os.path.split(cache["tedit"])[0])

        data.append((lang.start + "/TEdit", run_tedit, None))
    if "terrafirma" in cache:
        if os.path.exists(cache["terrafirma"]):

            def run_terrafirma(n):
                subprocess.Popen(cache["terrafirma"],
                                 cwd=os.path.split(cache["terrafirma"])[0])

            data.append((lang.start + "/Terrafirma", run_terrafirma, None))
    data.extend([
        (lang.open + "/" + lang.imagefolder, open_dir, images),
        (lang.open + "/" + lang.backupfolder, open_dir,
         myterraria / "WorldsBackup"),
        (lang.open + "/" + lang.themes, open_dir, Path.cwd() / "themes"),
        (lang.visit + "/" + lang.donate, webbrowser.open,
         r"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JBZM8LFAGDK4N"
         ),
        (lang.visit + "/Patreon", webbrowser.open,
         r"https://www.patreon.com/Berserker55"),
        (lang.visit + "/" + lang.homepage, webbrowser.open,
         r"http://forums.terraria.org/index.php?threads/omnitool-world-creation-mapping-backups-and-more.14664/"
         ),
        (lang.visit + "/" + lang.wiki, webbrowser.open,
         "http://terraria.gamepedia.com/Terraria_Wiki"),
        (lang.visit + "/GameLauncher GUI", webbrowser.open,
         "http://forums.terraria.org/index.php?threads/game-launcher-3-2-1-5.1061/"
         ),
    ])
    forbidden = ["flatworld", "planetoids", "worldify", "arena"]
    for plug in plugins_:
        if plug[0] not in forbidden and plug[2] != "injector":
            data.append(("Plugins/%s" % plug[1], start_proc,
                         (relay_launch_plugin, [plug[1], plug])))
    os.environ["SDL_VIDEO_WINDOW_POS"] = "20,50"

    app.connect(gui.QUIT, exit_prog, None)
    main = gui.Table()

    menu = gui.Menus(data)
    main.td(gui.Spacer(pad, pad))
    main.td(menu, colspan=5, align=-1)
    main.td(gui.Spacer(pad, pad))
    main.tr()
    update = gui.Table()
    update.td(gui.Label(""))
    main.td(update, col=1, colspan=5, align=-1)

    main.tr()
    width = 190
    worldify = GenButton(lang.worldify, IMAGE, width=width)
    planetoids = GenButton(lang.planetoids, PLANET, width=width)
    dungeon = GenButton(lang.arena, DUNGEON, width=width)
    flat = GenButton(lang.flat, FLAT, width=width)

    tuple(t.join() for t in ts)
    expected_h = 170 * len(worlds) // cache["columns"] + 100
    pygame.display.init()
    available_h = max([res[1] for res in pygame.display.list_modes()])
    if expected_h > available_h:
        print("GUI expected to be higher than monitor height, adding columns")
        cache["columns"] = max(cache["columns"] + 1,
                               1 + (170 * len(worlds)) // (available_h - 100))
    del (ts)
    newworldtable = gui.Table()
    newworldtable.td(gui.Spacer(10, 10))
    newworldtable.td(gui.Label(lang.new), align=-1)
    newworldtable.tr()
    newworldtable.td(gui.Spacer(10, 10))
    newworldtable.td(worldify)
    newworldtable.td(gui.Spacer(10, 10))
    newworldtable.td(planetoids)
    newworldtable.td(gui.Spacer(10, 10))
    newworldtable.td(dungeon)
    newworldtable.td(gui.Spacer(10, 10))
    newworldtable.td(flat)
    newworldtable.tr()
    newworldtable.td(gui.Spacer(10, 10))
    main.td(newworldtable, colspan=6)
    main.tr()
    worldtable = gui.Table()
    main.td(worldtable, colspan=6)

    def display_worlds(optionchange=False):
        worldtable.clear()
        x = 0
        for w in worlds:
            if x % cache["columns"] == 0:
                worldtable.tr()
            wtab = gui.Table()
            wtab.td(w.info, colspan=2)
            wtab.tr()
            if thumbsize:
                wtab.td(w.image, colspan=2)
            else:
                wtab.td(gui.Spacer(1, 20))
            wtab.tr()
            wtab.td(gui.Spacer(pad, pad))
            wtab.tr()

            wtab.td(gui.Spacer(420, 25), colspan=2)
            wtab.tr()

            worldtable.td(gui.Spacer(pad, 1))
            worldtable.td(wtab)

            x += 1
        if x % cache["columns"] == 0:
            worldtable.tr()

        worldtable.td(gui.Spacer(12, 12))
        if app.widget:
            print("Window Reset!")
            app.resize()
            app.repaint()
            size = pygame.display.get_surface().get_size()
            data = {
                "size": size,
                "w": size[0],
                "h": size[1],
                "reload": True if optionchange else False
            }

            pygame.event.post(pygame.event.Event(pygame.VIDEORESIZE, data))

    display_worlds()
    print("GUI Matrix created, initializing..")
    pygame.display.quit()
    pygame.display.init()
    pygame.display.set_caption("Terraria Omnitool V%s | %d Bit" %
                               (__version__.__repr__(), bit))

    def make_resize(worlds, app, main):
        def resize(self, ev):
            if app.first and not app.zoomed:
                app.first = False
            else:
                padding = 50
                if hasattr(ev, "reload") and ev.reload == True:
                    thumb_w, thumb_h = cache["thumbsize"]
                    for w in worlds:
                        w.override_thumb((thumb_w, thumb_h))
                        w.info.style.width = thumb_w
                        w.thumbsize = (thumb_w, thumb_h)
                else:
                    thumb_w = max((ev.w - padding) // cache["columns"], 420)
                    thumb_h = int(thumb_w / 3.5)

                    for w in worlds:
                        w.override_thumb((thumb_w, thumb_h))
                        w.info.style.width = thumb_w
                        w.thumbsize = (thumb_w, thumb_h)

                app.rect.size = main.rect.size = main.w, main.h = main.resize()
                if sys.platform.startswith("win"):
                    if windll.user32.IsZoomed(
                            pygame.display.get_wm_info()['window']):
                        s = pygame.display.set_mode(ev.size, pygame.RESIZABLE)
                        app.rect.size = pygame.display.get_surface().get_size()
                        app.zoomed = True
                    else:
                        s = pygame.display.set_mode((main.w, main.h),
                                                    pygame.RESIZABLE)
                        app.zoomed = False
                else:
                    s = pygame.display.set_mode((main.w, main.h),
                                                pygame.RESIZABLE)
                    app.zoomed = False

                app.screen = s
                app.first = True

        return resize

    app.on_resize = make_resize(worlds, app, main)
    app.init(main, None)

    main.rect.h = max(main.rect.height, 250)
    if cache["thumbsize"]:
        pygame.display.set_mode((main.rect.size[0] - 2, main.rect.size[1] - 2),
                                pygame.SWSURFACE | pygame.RESIZABLE)
    else:
        pygame.display.set_mode(main.rect.size, pygame.SWSURFACE)
    info = Info()
    info.name = "Info"
    info.daemon = False

    updater = Updater(update)
    updater.daemon = False

    if cache["do_backup"]:
        b = Backupper()
        b.name = "Backup"
        b.start()
    redrawer = Redrawer()
    redrawer.start()
    info.start()
    updater.start()
    app.run(main)
コード例 #23
0
ファイル: gui5.py プロジェクト: garred/only_fighters
from pgu import gui

# Load an alternate theme to show how it is done. You can also
# specify a path (absolute or relative) to your own custom theme:
#
#   app = gui.Desktop(theme=gui.Theme("path/to/theme"))
#
app = gui.Desktop()
app.connect(gui.QUIT, app.quit, None)

##The table code is entered much like HTML.
##::
c = gui.Table()

c.tr()
c.td(gui.Label("Gui Widgets"), colspan=4)


def cb():
    print("Clicked!")


btn = gui.Button("Click Me!")
btn.connect(gui.CLICK, cb)

c.tr()
c.td(gui.Label("Button"))
c.td(btn, colspan=3)
##

c.tr()
コード例 #24
0
    def update(self):

        if self.health < 0:
            self.health = 0
        if self.energy < 0:
            self.energy = 0
        if self.health == 0:
            app = gui.Desktop()
            app.connect(gui.QUIT, app.quit, None)
            e = gui.Button("Game Over")
            e.connect(gui.CLICK, app.quit, None)
            c = gui.Table()
            c.tr()

            c.td(gui.Label(self.name))
            c.td(gui.Label(str(self.lvl)))

            c.tr()
            c.td(e, colspan=2)
            app.run(c)
            self.kill()

        if self.xp >= 100:
            self.levelup()
            if globalconst.DEBUG:
                print self.lvl
        if self.health < self.healthmax:
            t = time.time()
            if globalconst.DEBUG:
                print t - self.restTime
            if (t - self.restTime) > (
                    30 - (30 / 10) * math.log(self.agility, 2)
            ):  #this calcul should be an attribut or such thing ...
                self.health += self.spirit + self.strength
                if self.health > self.healthmax:
                    self.health = self.healthmax
                self.restTime = t

        if self.health == self.healthmax and self.energy < self.energymax:
            t = time.time()
            if globalconst.DEBUG:
                print t - self.restTime
            if (t - self.restTime) > (5 -
                                      (5 / 10) * math.log(self.agility, 2)):
                self.energy += self.spirit
                if self.energy > self.energymax:
                    self.energy = self.energymax
                self.restTime = t

        x, y = self.position
        x += self.action[0] + self.action[1]
        y += self.action[2] + self.action[3]
        self.position = (x, y)
        self.rect = self.image.get_rect()
        self.rect.center = self.position

        image = self.PILimage.copy()

        manavoid = (float)(self.energymax - self.energy) / self.energymax
        healthvoid = (float)(self.healthmax - self.health) / self.healthmax

        beginPixelHealth = healthvoid * image.size[0]
        beginPixelMana = manavoid * image.size[0]

        beginPixelHealth = (int)(beginPixelHealth)
        beginPixelMana = (int)(beginPixelMana)

        boxhealth = (0, 0, image.size[0] - beginPixelHealth, 2)
        boxmana = (0, 2, image.size[0] - beginPixelMana, 4)

        healthbar = Image.new('RGB', (image.size[0] - beginPixelHealth, 2),
                              (0, 255, 0))
        manabar = Image.new('RGB', (image.size[0] - beginPixelMana, 2),
                            (0, 0, 255))

        image.paste(healthbar, boxhealth)
        image.paste(manabar, boxmana)
        #format==PNG
        image = image.convert('RGBA')
        imgstr = image.tostring()

        self.image = pygame.image.fromstring(imgstr, image.size, 'RGBA')

        self.event()
コード例 #25
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.value = gui.Form()
        self.engine = None

        def btnRegister(btn):
            def isLoginLegal(username, password):
                if len(username) > 3 and len(password) > 3:
                    return True
                else:
                    alertMessageDialog(
                        msg=
                        'Username and password must be larger than 3 characters.',
                        title='An error occured')

            def isStringLegal(string):
                restricted = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

                for i in range(len(string)):
                    if string[i] not in restricted:
                        # todo: msgbox (not valid)
                        alertMessageDialog(
                            msg=
                            'The name is not valid! The name may only contain a-z and 0-9.',
                            title='An error occured')
                        return False

                return True

            def checkPasswords(password1, password2):
                if password1 == password2:
                    return True

            username = self.value.items()[0][1]
            password = self.value.items()[1][1]
            passwordConfirm = self.value.items()[2][1]

            if isLoginLegal(username, password):
                if checkPasswords(password, passwordConfirm):
                    if isStringLegal(username):
                        g.tcpConn.sendNewAccount(username, password)

                else:
                    # todo: msgbox
                    alertMessageDialog(msg='The passwords don\'t match.',
                                       title='An error occured')

        def btnCancel(btn):
            g.gameState = MENU_LOGIN

        self.tr()
        self.td(gui.Label('Username:'******'Password:'******'Confirm password:', color=(255, 255, 255)))
        self.tr()
        self.td(gui.Password(name="passwordConfirm", value="password"))

        self.tr()
        self.td(gui.Spacer(0, 30))

        self.tr()
        btn = gui.Button("Create", width=120)
        btn.connect(gui.CLICK, btnRegister, None)
        self.td(btn)

        self.tr()
        self.td(gui.Spacer(0, 5))

        self.tr()
        btn = gui.Button("Cancel", width=120)
        btn.connect(gui.CLICK, btnCancel, None)
        self.td(btn)
コード例 #26
0
ファイル: flatworld.py プロジェクト: John-AZ1/omnitool
    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
コード例 #27
0
    def __init__(self,**params):
        title = gui.Label("New Picture...")

        ##Once a form is created, all the widgets that are added with a name
        ##are added to that form.
        ##::
        self.value = gui.Form()

        t = gui.Table()

        t.tr()
        t.td(gui.Label("Size"),align=0,colspan=2)

        tt = gui.Table()
        tt.tr()
        tt.td(gui.Label("Width: "),align=1)
        tt.td(gui.Input(name="width",value=256,size=4))
        tt.tr()
        tt.td(gui.Label("Height: "),align=1)
        tt.td(gui.Input(name="height",value=256,size=4))
        t.tr()
        t.td(tt,colspan=2)
        ##

        t.tr()
        t.td(gui.Spacer(width=8,height=8))
        t.tr()
        t.td(gui.Label("Format",align=0))
        t.td(gui.Label("Background",align=0))

        t.tr()
        g = gui.Group(name="format",value="rgb")
        tt = gui.Table()
        tt.tr()
        tt.td(gui.Radio(g,value="rgb"))
        tt.td(gui.Label(" RGB"),align=-1)
        tt.tr()
        tt.td(gui.Radio(g,value="bw"))
        tt.td(gui.Label(" Grayscale"),align=-1)
        t.td(tt,colspan=1)

        g = gui.Group(name="color",value="#ffffff")
        tt = gui.Table()
        tt.tr()
        tt.td(gui.Radio(g,value="#000000"))
        tt.td(gui.Label(" Black"),align=-1)
        tt.tr()
        tt.td(gui.Radio(g,value="#ffffff"))
        tt.td(gui.Label(" White"),align=-1)
        tt.tr()

        default = "#ffffff"
        radio = gui.Radio(g,value="custom")
        color = gui.Color(default,width=40,height=16,name="custom")
        picker = ColorDialog(default)

        color.connect(gui.CLICK,gui.action_open,{'container':t,'window':picker})
        picker.connect(gui.CHANGE,gui.action_setvalue,(picker,color))

        tt.td(radio)
        tt.td(color)

        t.td(tt,colspan=1)

        t.tr()
        t.td(gui.Spacer(width=8,height=8))

        ##The okay button CLICK event is connected to the Dailog's
        ##send event method.  It will send a gui.CHANGE event.
        ##::
        t.tr()
        e = gui.Button("Okay")
        e.connect(gui.CLICK,self.send,gui.CHANGE)
        t.td(e)
        ##

        e = gui.Button("Cancel")
        e.connect(gui.CLICK,self.close,None)
        t.td(e)

        gui.Dialog.__init__(self,title,t)
コード例 #28
0
ファイル: menuchar.py プロジェクト: Cosmotronic/pyorpg-client
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.value = gui.Form()
        self.engine = None

        def btnNextChar(btn):
            self.engine.charIndex += 1
            self.engine.updateCharSelection()

        def btnPrevChar(btn):
            self.engine.charIndex -= 1
            self.engine.updateCharSelection()

        def btnUseChar(btn=None):
            if self.lblPlayerName.value != 'Create a new character':
                g.tcpConn.sendUseChar(self.engine.charIndex - 1)
                g.gameEngine.setState(MENU_INGAME)
            else:
                # new char
                g.tcpConn.sendGetClasses()
                g.gameEngine.setState(MENU_NEWCHAR)

        def btnDelChar(btn):
            print "not yet implemented"

        self.tr()
        self.lblPlayerName = gui.Label('#PLAYER_NAME',
                                       antialias=0,
                                       color=(255, 0, 0),
                                       font=g.charSelFont)
        self.td(self.lblPlayerName, colspan=3, valign=1, align=0)

        self.tr()
        self.lblPlayerExtra = gui.Label('#PLAYER_LEVEL_CLASS',
                                        antialias=0,
                                        color=(255, 0, 0),
                                        font=g.charSelFont,
                                        name='lblExtra')
        self.td(self.lblPlayerExtra, colspan=3, align=0)

        self.tr()
        btn = gui.Button("Previous", width=160, height=40)
        btn.connect(gui.CLICK, btnPrevChar, None)
        self.td(btn)
        self.td(gui.Spacer(300, 160))
        btn = gui.Button("Next", width=160, height=40)
        btn.connect(gui.CLICK, btnNextChar, None)
        self.td(btn)

        self.tr()
        self.td(gui.Spacer(0, 0))
        self.btnSelChar = gui.Button("Use Character", width=160, height=30)
        self.btnSelChar.connect(gui.CLICK, btnUseChar, None)
        self.td(self.btnSelChar)
        self.td(gui.Spacer(0, 0))

        self.tr()
        self.td(gui.Spacer(0, 20))

        self.tr()
        self.td(gui.Spacer(0, 0))
        btn = gui.Button("Delete Character", width=160, height=30)
        btn.connect(gui.CLICK, btnDelChar, None)
        self.td(btn)
        self.td(gui.Spacer(0, 0))
コード例 #29
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.value = gui.Form()
        self.engine = None

        def btnRegister(btn):
            def isLoginLegal(username, password):
                if len(username) > 3 and len(password) > 3:
                    return True
                else:
                    print "username and password must be larger 3 characters"

            def isStringLegal(string):
                restricted = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

                for i in range(len(string)):
                    if string[i] not in restricted:
                        # todo: msgbox (not valid)
                        print "name is not valid"
                        return False

                return True

            def checkPasswords(password1, password2):
                if password1 == password2:
                    return True

            username = self.value.items()[0][1]
            password = self.value.items()[1][1]
            passwordConfirm = self.value.items()[2][1]

            if isLoginLegal(username, password):
                if checkPasswords(password, passwordConfirm):
                    if isStringLegal(username):
                        g.tcpConn.sendNewAccount(username, password)
                        print "Created user " + username

                        # return to login screen
                        g.gameEngine.setState(MENU_LOGIN)
                else:
                    # todo: msgbox
                    print "passwords didn't match"

        def btnCancel(btn):
            g.gameState = MENU_LOGIN

        self.tr()
        self.td(gui.Label('Username:'******'Password:'******'Confirm password:', color=(255, 255, 255)))
        self.tr()
        self.td(gui.Password(name="passwordConfirm", value="password"))

        self.tr()
        self.td(gui.Spacer(0, 30))

        self.tr()
        btn = gui.Button("Create", width=120)
        btn.connect(gui.CLICK, btnRegister, None)
        self.td(btn)

        self.tr()
        self.td(gui.Spacer(0, 5))

        self.tr()
        btn = gui.Button("Cancel", width=120)
        btn.connect(gui.CLICK, btnCancel, None)
        self.td(btn)
コード例 #30
0
    def build(self):
        panel.Panel.build(self)
        backdropDocument = gui.Document(width=geom['panel'].width, align=0)
        back = self.script.backdrop

        backdropGroup = gui.Group('backdrop-group-backdrops', back)
        backdropGroup.connect(gui.CHANGE, self.changeBackdrop)

        start = self.backdropIndex
        end = min(len(backdrops), self.backdropIndex + self.backdropsOnscreen)

        for aBackdrop in backdrops[start:end]:
            thumbPath = os.path.join('games/broadway/backdrops',
                                     aBackdrop + '_thumb.png')
            filePath = aBackdrop
            backdropToolTable = gui.Table()
            backdropToolTable.tr()
            backdropToolTable.td(gui.Image(thumbPath))
            backdropToolTable.tr()
            backdropToolTable.td(gui.Label(_(string.capwords(aBackdrop))))
            backdropTool = gui.Tool(backdropGroup,
                                    backdropToolTable,
                                    filePath,
                                    style={'margin': 4},
                                    name='backdrop-tool-backdrops-' +
                                    aBackdrop)
            backdropDocument.add(backdropTool)
            backdropDocument.add(gui.Spacer(4, 6))

        #Custom Backdrop from local source
        customBackdropButton = gui.Button(
            _("Your's"),
            name='backdrop-button-backdrops-custom',
            style={
                'width': 80,
                'height': 32
            })
        customBackdropButton.connect(gui.CLICK, self.externalBackdrop)

        #Custom Backdrop from online source (teacher)
        teacherBackdropButton = gui.Button(
            _("Teacher's"),
            name='backdrop-button-backdrops-teacher',
            style={
                'width': 80,
                'height': 32
            },
            disabled=not hacks['server'])
        teacherBackdropButton.connect(gui.CLICK, self.teacherBackdrop)

        backdropGroup.connect(gui.CHANGE, self.changeBackdrop)
        self.groups = backdropGroup

        navigationButtons = gui.Table(width=geom['panel'].width)
        navigationButtons.tr()
        maxSize = (len(backdrops) - self.backdropsOnscreen - 1)
        size = geom['panel'].width * 3 / 4 / (
            1 + (maxSize / float(self.backdropsOnscreen)))
        progressBar = gui.HSlider(value=self.backdropIndex,
                                  min=0,
                                  max=maxSize,
                                  size=size,
                                  step=1,
                                  disabled=True,
                                  width=geom['panel'].width * 3 / 4,
                                  style={
                                      'padding': 4,
                                      'margin': 10
                                  })
        navigationButtons.td(progressBar, colspan=5)
        navigationButtons.tr()
        homeButton = gui.Button(gui.Image(images['go-first']))
        homeButton.connect(gui.CLICK, self.gotoBackdropPage, 0)
        navigationButtons.td(homeButton)
        previousButton = gui.Button(gui.Image(images['go-back']))
        previousButton.connect(gui.CLICK, self.gotoBackdropPage,
                               self.backdropIndex - self.backdropsOnscreen)
        navigationButtons.td(previousButton)
        if start == end:
            label = _("No backdrops loaded")
        elif (end - start) == 1:
            label = _("Backdrop %(index)d") % {"index": (start + 1)}
        else:
            label = _("Backdrops %(start_index)d to %(end_index)d") % {
                "start_index": start + 1,
                "end_index": end
            }
        navigationButtons.td(gui.Label(label))
        forwardButton = gui.Button(gui.Image(images['go-next']))
        forwardButton.connect(gui.CLICK, self.gotoBackdropPage,
                              self.backdropIndex + self.backdropsOnscreen)
        navigationButtons.td(forwardButton)
        endButton = gui.Button(gui.Image(images['go-last']))
        endButton.connect(gui.CLICK, self.gotoBackdropPage, len(backdrops))
        navigationButtons.td(endButton)

        self.add(backdropDocument, 0, 30)
        self.add(navigationButtons, 0, geom['panel'].height // 2 + 25)
        self.add(customBackdropButton, 10, 50)
        self.add(teacherBackdropButton, 10, 100)
        self.owningWidgets.append(customBackdropButton)
        self.owningWidgets.append(teacherBackdropButton)
        self.owningWidgets.append(backdropDocument)
        self.owningWidgets.append(navigationButtons)