예제 #1
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.tr()
        self.lblDur = gui.Label('Durability: 0', color=UI_FONT_COLOR)
        self.td(self.lblDur)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataDur')
        e.connect(gui.CHANGE, self.updateLabelDur, e)
        self.td(e)

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

        self.tr()
        self.lblStr = gui.Label('Strength: 0', color=UI_FONT_COLOR)
        self.td(self.lblStr)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataStr')
        e.connect(gui.CHANGE, self.updateLabelStr, e)
        self.td(e)
예제 #2
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.tr()
        self.lblItemNum = gui.Label(_('Item: 0'), color=UI_FONT_COLOR)
        self.td(self.lblItemNum)

        self.tr()
        self.sliItemNum = gui.HSlider(value=0,
                                      min=0,
                                      max=99,
                                      size=10,
                                      width=120,
                                      name='selDataItemNum')
        self.sliItemNum.connect(gui.CHANGE, self.updateLabelItemNum,
                                self.sliItemNum)
        self.td(self.sliItemNum)

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

        self.tr()
        self.lblStr = gui.Label(_('Item Value: 0'), color=UI_FONT_COLOR)
        self.td(self.lblStr)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataItemVal')
        e.connect(gui.CHANGE, self.updateLabelStr, e)
        self.td(e)
예제 #3
0
    def __init__(self,value,**params):
        self.value = list(gui.parse_color(value))

        title = gui.Label("Color Picker")

        main = gui.Table()

        main.tr()

        self.color = gui.Color(self.value,width=64,height=64)
        main.td(self.color,rowspan=3,colspan=1)

        ##The sliders CHANGE events are connected to the adjust method.  The
        ##adjust method updates the proper color component based on the value
        ##passed to the method.
        ##::
        main.td(gui.Label(' Red: '),1,0)
        e = gui.HSlider(value=self.value[0],min=0,max=255,size=32,width=128,height=16)
        e.connect(gui.CHANGE,self.adjust,(0,e))
        main.td(e,2,0)
        ##

        main.td(gui.Label(' Green: '),1,1)
        e = gui.HSlider(value=self.value[1],min=0,max=255,size=32,width=128,height=16)
        e.connect(gui.CHANGE,self.adjust,(1,e))
        main.td(e,2,1)

        main.td(gui.Label(' Blue: '),1,2)
        e = gui.HSlider(value=self.value[2],min=0,max=255,size=32,width=128,height=16)
        e.connect(gui.CHANGE,self.adjust,(2,e))
        main.td(e,2,2)

        gui.Dialog.__init__(self,title,main)
예제 #4
0
    def __init__(self,settings, **params):
        # The framework GUI is just basically a HTML-like table
        # There are 2 columns right-aligned on the screen
        gui.Table.__init__(self,**params)
        self.form=gui.Form()

        fg = (255,255,255)

        # "Toggle menu"
        self.tr()
        self.td(gui.Label("F1: Toggle Menu",color=(255,0,0)),align=1,colspan=2)

        for slider in sliders:
            # "Slider title"
            self.tr()
            self.td(gui.Label(slider['text'],color=fg),align=1,colspan=2)

            # Create the slider
            self.tr()
            e = gui.HSlider(getattr(settings, slider['name']),slider['min'],slider['max'],size=20,width=100,height=16,name=slider['name'])
            self.td(e,colspan=2,align=1)

        # Add each of the checkboxes.
        for text, variable in checkboxes:
            self.tr()
            if variable == None:
                # Checkboxes that have no variable (i.e., None) are just labels.
                self.td(gui.Label(text, color=fg), align=1, colspan=2)
            else:
                # Add the label and then the switch/checkbox
                self.td(gui.Label(text, color=fg), align=1)
                self.td(gui.Switch(value=getattr(settings, variable),name=variable))
예제 #5
0
    def __init__(self,**params):
        gui.Table.__init__(self,**params)
        self.style.width = app.view_w #* app.tile_w
        self.style.height = app.view_h #* app.tile_h
        w,h = self.rect.w,self.rect.h = self.style.width,self.style.height
        
        sw = 16
        
        self.vdraw = e = vdraw(width=w-sw,height=h-sw)
        self.add(e,0,0)
        
        rect = pygame.Rect(0,0,app.level.size[0],app.level.size[1])
        tcorners = [rect.topleft,rect.topright,rect.bottomright,rect.bottomleft] 
        corners = [app.level.tile_to_view(tcorners[n]) for n in range(0,4)]
        
        minx,miny,maxx,maxy = 0xffff,0xffff,-0xffff,-0xffff
        for x,y in corners:
            minx,miny,maxx,maxy = min(minx,x),min(miny,y),max(maxx,x),max(maxy,y)

        minx -= w/2
        maxx -= w/2
        miny -= h/2
        maxy -= h/2
        
        self.vs = e = gui.VSlider(0,miny,maxy,sw*4,width=sw,height=h-sw)
        self.add(e,1,0)
        e.connect(gui.CHANGE,self.move_y,e)
        
        self.hs = e = gui.HSlider(0,minx,maxx,sw*4,width=w-sw,height=sw)
        self.add(e,0,1)
        e.connect(gui.CHANGE,self.move_x,e)
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        text_color = THECOLORS["yellow"]  #(0, 0, 255)
        
        # Make a table row in the gui (like a row in HTML).
        self.tr()
        
        # Color transfer.
        self.td( gui.Label(" Color Transfer (c): ", color=text_color), align=1)
        self.td( gui.Switch(value=False, name='colorTransfer'))
        
        # Stickiness.
        self.td( gui.Label("     Fix stickiness (s): ", color=text_color), align=1)
        self.td( gui.Switch(value=True, name='fix_Stickiness'))
        
        # Gravity.
        self.td( gui.Label("     Gravity (g): ", color=text_color))
        self.td( gui.HSlider(0,-3,3, size=20, width=100, height=16, name='gravity_factor'))
        
        # Freeze the cars.
        self.td( gui.Label("     Freeze (f): ", color=text_color))
        # Form element (freeze_button).
        freeze_button = gui.Button("v=0")
        # Note: must invoke the method to be called WITHOUT parentheses.
        freeze_button.connect( gui.CLICK, self.stop_cars)
        self.td( freeze_button)
        
        # Just a help tip for starting a new demo.
        self.td( gui.Label("       New demo (0-9)", color=THECOLORS["green"]))
예제 #7
0
    def __init__(self, ac, **params):
        gui.Container.__init__(self, **params)
        self.ac = ac
        self.ac.setFS(self)
        self.sel = False

        self.l_id = gui.Label(self.ac.getIdent(), color=(255, 255, 255))
        self.add(self.l_id, 2, 2)

        self.l_speed = gui.Label("Speed: " + str(self.ac.getSpeed()) + "kts",
                                 color=(255, 255, 255))
        self.add(self.l_speed, 2, 20)

        self.l_heading = gui.Label("Hdg: " + self.ac.getHeadingStr(),
                                   color=(255, 255, 255))
        self.add(self.l_heading, 50, 2)

        self.sli_speed = gui.HSlider(self.ac.getSpeed(),
                                     conf.get()['aircraft']['speed_min'],
                                     conf.get()['aircraft']['speed_max'],
                                     10,
                                     step=50,
                                     width=140)
        self.sli_speed.connect(gui.CHANGE, self.__slider_change)

        self.connect(gui.CLICK, self.__handle_Click)
예제 #8
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.time_label = gui.Label("Time: 0", color=BLACK)
        self.plancton_label = gui.Label("Plancton: 0", color=BLACK)
        self.male_fish_label = gui.Label("Male fish: 0", color=BLACK)
        self.female_fish_label = gui.Label("Female fish: 0", color=BLACK)
        self.predator_fish_label = gui.Label("Predators: 0", color=BLACK)
        self.ill_fish_label = gui.Label("Ill fish: 0", color=BLACK)
        self.speed_label = gui.Label("Speed ", color=BLACK)
        self.slider = gui.HSlider(0,
                                  -10,
                                  10,
                                  step=1,
                                  size=20,
                                  width=100,
                                  height=16,
                                  name='speed')

        def fullscreen_changed(btn):
            pygame.display.toggle_fullscreen()

        def change_simmulation_speed(btn):
            from main import Speed
            Speed.set_sim_speed(btn.value)

        self.tr()
        self.td(gui.Label("Statistics", color=BLACK), colspan=2)

        self.tr()
        self.td(self.time_label, align=-1)
        self.tr()
        self.td(self.speed_label, align=-1)
        self.slider.connect(gui.CHANGE, change_simmulation_speed, self.slider)
        self.td(self.slider, align=-1)

        self.tr()
        self.td(self.plancton_label, align=-1)

        self.tr()
        self.td(self.male_fish_label, align=-1)

        self.tr()
        self.td(self.female_fish_label, align=-1)

        self.tr()
        self.td(self.predator_fish_label, align=-1)

        self.tr()
        self.td(self.ill_fish_label, align=-1)
        #e = gui.HSlider(2,1,5,size=20,width=100,height=16,name='size')
        #self.td(e)

        btn = gui.Switch(value=False, name='fullscreen')
        btn.connect(gui.CHANGE, fullscreen_changed, btn)
        self.tr()
        self.td(gui.Label("Full Screen: ", color=BLACK), align=-1)
        self.td(btn, align=-1)
예제 #9
0
    def __init__(self, tStart, tEnd, tElapsed, **params):
        gui.Table.__init__(self, **params)
        self.speed = 1.0
        self.t = 0.0
        self.paused = False

        def cb_slider_changed(slider):
            self.t = slider.value

        def cb_faster():
            self.speed *= 2.0

        def cb_slower():
            self.speed /= 2.0

        def cb_pause():
            self.paused = True

        def cb_play():
            self.paused = False

        fg = (255, 255, 255)
        self.tr()
        # first row of buttons:
        #   - pause       ||
        #   - resume      >
        #   - slow down   <<
        #   - speedup     >>
        #   - time slider
        btn = gui.Button("||")
        btn.connect(gui.CLICK, cb_pause)
        self.td(btn)
        btn = gui.Button(">")
        btn.connect(gui.CLICK, cb_play)
        self.td(btn)
        btn = gui.Button("<<")
        btn.connect(gui.CLICK, cb_slower)
        self.td(btn)
        btn = gui.Button(">>")
        btn.connect(gui.CLICK, cb_faster)
        self.td(btn)
        self.td(gui.Label(""))
        self.td(gui.Label(""))
        self.td(gui.Label(""))
        self.timeslider = gui.HSlider(0.0,
                                      0.0,
                                      tElapsed,
                                      size=20,
                                      width=400,
                                      height=16,
                                      name='time',
                                      colspan=15)
        self.timeslider.connect(gui.CHANGE, cb_slider_changed, self.timeslider)
        self.td(self.timeslider)
        self.app = gui.App()
        self.app.init(self)
예제 #10
0
    def setup_menu(this):
        tbl = gui.Table(vpadding=5, hpadding=2)
        tbl.tr()

        #dlg = TestDialog()
        #def dialog_cb():
        #    dlg.open()

        #btn = gui.Button("Modal dialog", height=50)
        #btn.connect(gui.CLICK, dialog_cb)

        port = Portrait("wizard.png")
        port.add_meter("magic", (100,150,220))
        port.add_meter("stamina", (190,150,50))
        tbl.td(port)

        inv = Inventory()
        tbl.td(inv)
        this.menuArea.add(tbl, 0, 0)

        return

        # Add a button for pausing / resuming the game clock
        def pause_cb():
            return
            if (this.engine.clock.paused):
                this.engine.resume()
            else:
                this.engine.pause()

        btn = gui.Button("Pause/resume clock", height=50)
        btn.connect(gui.CLICK, pause_cb)
        tbl.td(btn)

        # Add a slider for adjusting the game clock speed
        tbl2 = gui.Table()

        timeLabel = gui.Label("Clock speed")

        tbl2.tr()
        tbl2.td(timeLabel)

        slider = gui.HSlider(value=23,min=0,max=100,size=20,height=16,width=120)

        def update_speed():
            return
            this.engine.clock.set_speed(slider.value/10.0)

        slider.connect(gui.CHANGE, update_speed)

        tbl2.tr()
        tbl2.td(slider)

        tbl.td(tbl2)

        this.menuArea.add(tbl, 0, 0)
예제 #11
0
    def __init__(self, sim):
        gui.Table.__init__(self)

        config = sim.config

        def fullscreen(btn):
            pygame.display.toggle_fullscreen()

        def designer(btn):
            sim.designerform = True

        def restart(btn):
            sim.restartform = True

        def fps_update(slider):
            sim.fps = slider.value

        fg = config['uicolor']

        self.tr()

        self.td(gui.Label(" SIMULATION "))

        td_left = {'padding_left': 25}
        td_right = {'padding_right': 25}

        btn = gui.Switch(value=False, name='fullscreen')
        btn.connect(gui.CHANGE, fullscreen, btn)
        self.td(gui.Label("full ", color=fg), align=1, style=td_left)
        self.td(btn, align=-1, style=td_right)

        td_styleb = {
            'padding_left': 5,
            'padding_right': 5,
            'padding_top': 5,
            'padding_bottom': 5
        }

        btn = gui.Button("designer")
        btn.connect(gui.CLICK, designer, btn)
        self.td(btn, style=td_styleb)

        btn = gui.Button("restart")
        btn.connect(gui.CLICK, restart, btn)
        self.td(btn, style=td_styleb)

        self.td(gui.Label("FPS:"))
        slider = gui.HSlider(value=sim.fps,
                             min=25,
                             max=config['fpsmax'],
                             size=20,
                             width=120,
                             name='fps')
        self.td(slider)
        slider.connect(gui.CHANGE, fps_update, slider)
예제 #12
0
    def __init__(self, **params):
        # todo, set slider maximum = vital mod amount
        gui.Table.__init__(self, **params)

        self.tr()
        self.lblVital = gui.Label('Vital Mod: Use the slider', color=UI_FONT_COLOR)
        self.td(self.lblVital)

        self.tr()
        e = gui.HSlider(value=0, min=0, max=10, size=10, width=120, name='selDataVit')
        e.connect(gui.CHANGE, self.updateVitalName, e)
        self.td(e)
예제 #13
0
    def __init__(self, **params):
        # todo, set slider maximum = spell amount
        gui.Table.__init__(self, **params)

        self.tr()
        self.lblSpell = gui.Label('Spell: Use the slider', color=UI_FONT_COLOR)
        self.td(self.lblSpell)

        self.tr()
        e = gui.HSlider(value=0, min=0, max=10, size=10, width=120, name='selDataSpell')
        e.connect(gui.CHANGE, self.updateSpellName, e)
        self.td(e)
예제 #14
0
파일: pyllk.py 프로젝트: ibetsun/pyllk
 def __init__(self,**params):
     fga = (255,25,0)
     title = gui.Label(u"游戏设置",font=psubfts)
     self.dfstr=[u'普  通',u'高  级',u'专  家',u'大  师']
     self.value=gui.Form()
     tab=gui.Table()
     tab.tr()
     tab.td(gui.Spacer(width=8,height=16))
     tab.tr()
     tab.td(gui.Label(u"难  度:",font=psubfts), align=1,valign=1)
     tt=gui.Table(width=200)
     sld=gui.HSlider(0,0,3,size=32,width=180,height=25,name='dif')
     dflb=gui.Label(self.dfstr[sld.value],width=180,font=psubfts,color=fga)
     sld.connect(gui.CHANGE, self.ajust,(sld,dflb))
     tt.tr()
     tt.td(dflb)
     tt.tr()
     tt.td(sld,align=0,width=240)
     tab.td(tt)
     
     tab.tr()
     tab.td(gui.Spacer(width=8,height=16))
    
     g = gui.Group(name='gstyle',value='style 1')
     tab.tr()
     tab.td(gui.Label(u"样  式:",font=psubfts),align=1)
     
     tt=gui.Table(width=200)
     tt.tr()
     tt.td(gui.Radio(g,value="style 1"),align=1)
     tt.td(gui.Image('data/s1.gif',width=36,height=36),align=-1)
     #tt.td(gui.Label(u"一",font=psubfts),align=-1)
     tt.td(gui.Radio(g,value="style 2"),align=1)
     tt.td(gui.Image('data/s2.gif',width=36,height=36),align=-1)
     tt.td(gui.Radio(g,value="style 3"),align=1)
     tt.td(gui.Image('data/s3.png',width=36,height=36),align=-1)
     tab.td(tt)
     
     tab.tr()
     tab.td(gui.Spacer(width=8,height=16))
     tab.tr()
     bv=gui.Label(u"确定",font=psubfts,color=fga)
     bt=gui.Button(bv)
     bt.connect(gui.CLICK, self.send, gui.CHANGE)
     tab.td(bt,width=120,align=1)
     bv=gui.Label(u"取消",font=psubfts,color=fga)
     bt=gui.Button(bv)
     bt.connect(gui.CLICK, self.close,None)
     tab.td(bt)
     tab.tr()
     tab.td(gui.Spacer(width=8,height=16))
     gui.Dialog.__init__(self, title, tab)
예제 #15
0
    def setup_menu(self):
        tbl = gui.Table(vpadding=5, hpadding=2)
        tbl.tr()

        dlg = TestDialog()

        def dialog_cb():
            dlg.open()

        btn = gui.Button("Modal dialog", height=50)
        btn.connect(gui.CLICK, dialog_cb)
        tbl.td(btn)

        # Add a button for pausing / resuming the game clock
        def pause_cb():
            if (self.engine.clock.paused):
                self.engine.resume()
            else:
                self.engine.pause()

        btn = gui.Button("Pause/resume clock", height=50)
        btn.connect(gui.CLICK, pause_cb)
        tbl.td(btn)

        # Add a slider for adjusting the game clock speed
        tbl2 = gui.Table()

        timeLabel = gui.Label("Clock speed")

        tbl2.tr()
        tbl2.td(timeLabel)

        slider = gui.HSlider(value=23,
                             min=0,
                             max=100,
                             size=20,
                             height=16,
                             width=120)

        def update_speed():
            self.engine.clock.set_speed(slider.value / 10.0)

        slider.connect(gui.CHANGE, update_speed)

        tbl2.tr()
        tbl2.td(slider)

        tbl.td(tbl2)

        self.menuArea.add(tbl, 0, 0)
예제 #16
0
    def __init__(self, value, on_open=None, on_close=None, **params):
        self._on_open = []
        self._on_close = []

        if on_open:
            self._on_open.append(on_open)

        if on_close:
            self._on_close.append(on_close)

        self.value = list(gui.parse_color(value))

        title = gui.Label('Color Picker')
        main = gui.Table()

        main.tr()

        self.color = gui.Color(self.value, width=64, height=64)
        main.td(self.color, rowspan=3, colspan=1)

        main.td(gui.Label(' Red: '), 1, 0)
        e = gui.HSlider(value=self.value[0], min=0, max=255, size=32, width=128, height=16)
        e.connect(gui.CHANGE, self.adjust, (0, e))
        main.td(e, 2, 0)

        main.td(gui.Label(' Green: '), 1, 1)
        e = gui.HSlider(value=self.value[1], min=0, max=255, size=32, width=128, height=16)
        e.connect(gui.CHANGE, self.adjust, (1, e))
        main.td(e, 2, 1)

        main.td(gui.Label(' Blue: '), 1, 2)
        e = gui.HSlider(value=self.value[2], min=0, max=255, size=32, width=128, height=16)
        e.connect(gui.CHANGE, self.adjust, (2, e))
        main.td(e, 2, 2)

        gui.Dialog.__init__(self, title, main, **params)
예제 #17
0
    def setup_menu(self):
        tbl = gui.Table(vpadding=5, hpadding=2)
        tbl.tr()

        dlg = TestDialog()

        def dialog_cb():
            print("modal dialog clicked!")
            self.engine.toggle_pause()
            # if self.toggle_pause_btn.value.value == "Pause":
            #     self.toggle_pause_btn.value = "Resume"
            # else:
            #     self.toggle_pause_btn.value = "Pause"

        self.toggle_pause_btn.connect(gui.CLICK, dialog_cb)
        tbl.td(self.toggle_pause_btn)

        # Add a slider for adjusting the game clock speed
        tbl2 = gui.Table()

        timeLabel = gui.Label("Clock speed")

        tbl2.tr()
        tbl2.td(timeLabel)

        slider = gui.HSlider(value=4,
                             min=1,
                             max=30,
                             size=20,
                             height=16,
                             width=120)

        def update_speed():
            # if slider.value == 0:
            #     self.engine.pause
            # else:
            #     self.engine.resume
            self.engine.fps = slider.value

        slider.connect(gui.CHANGE, update_speed)

        tbl2.tr()
        tbl2.td(slider)

        tbl.td(tbl2)

        self.menuArea.add(tbl, 0, 0)
예제 #18
0
    def __init__(self, **params):
        self.value = range(100)
        gui.Table.__init__(self, **params)
        fg = (255, 255, 255)

        self.tr()
        self.td(gui.Label("Bet / Raise", color=fg), colspan=2)

        self.tr()
        self.td(gui.Label("Amount: ", color=fg), align=1)
        e = gui.HSlider(0,
                        0,
                        1000,
                        size=10,
                        width=500,
                        height=16,
                        name='amount')
        e.connect(gui.CHANGE, self.adjust, (0, e))
        self.td(e)
예제 #19
0
from pgu import gui
from pgu import html

app = gui.Desktop()

c = gui.Table(width=500, height=500)
c.tr()

dw = 400
data = """
<div style='margin: 8px; padding: 8px; border: 1px; border-color: #88ffff; background: #eeffff;'><img src='cuzco.png' align=right>cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. cuzco is my goat. </div>"""
doc = html.HTML(data, width=dw)
c.td(doc)

c.tr()
s = gui.HSlider(300, 200, 450, 100, width=dw)


def mychange(value):
    s, doc = value
    doc.style.width = s.value
    doc.chsize()


s.connect(gui.CHANGE, mychange, (s, doc))
c.td(s)

app.connect(gui.QUIT, app.quit, None)
app.run(c)
pygame.quit()
예제 #20
0
def GuiSetup():
    global app
    global MotorMin, MotorMax
    global LSlider, RSlider, FSlider, ASlider
    global speedLbl, depLbl, preLbl, depInput
    global pSwitch, Pbox, Ibox, Dbox

    app = gui.Desktop()
    app.connect(gui.QUIT, app.quit, None)

    Main = gui.Table(width=900)
    Main.tr()

    # c.tr() makes a row
    # c.td(component) creates a cell

    # Top panel for displaying network status and emergancy options
    n = gui.Table()
    n.tr()

    n.td(gui.Label("Network: Status"), height=40)
    n.td(gui.Label("       "))
    emergeButton = gui.Button("In Case of Emergency")
    emergeButton.connect(gui.CLICK, emergeClick)
    n.td(emergeButton)

    #Make sub tabels to be put into c that hold seperate elements.

    #tabel on the "west" side of the frame.
    w = gui.Table()
    w.tr()
    #Radio button group
    w.tr()
    w1 = gui.Table()

    w1.tr()
    w1.td(gui.Label("PID Controls"), colspan=5, height=50)
    w1.tr()
    pidSwitch = gui.Switch(value=False)
    pidSwitch.connect(gui.CLICK, arm_disarm_Component, 0)
    w1.td(pidSwitch)
    w1.td(gui.Label("Arm "))
    w1.td(gui.Label(""), width=95, height=30)
    pidButton1 = gui.Button("Hover")
    pidButton1.connect(gui.CLICK, pidHover)
    w1.td(pidButton1, align=1)

    w.td(w1, align=-1)

    w.tr()
    w2 = gui.Table()

    w2.tr()
    depInput = gui.Input(size=6)
    w2.td(depInput, align=-1)
    w2.td(gui.Label("m "), align=-1, width=30, height=30)
    pidButton2 = gui.Button("Go to depth")
    pidButton2.connect(gui.CLICK, pidGoDepth)
    w2.td(pidButton2, align=1)

    w.td(w2, align=-1)

    #Sliders to control coeficients
    w.tr()
    w3 = gui.Table()

    #P
    w3.tr()
    #w3.td(gui.Label("Stable "))
    Pbox = gui.Input(value="0", height=16, width=120)
    w3.td(Pbox)
    w3.td(gui.Label(" Quick"), align=-1)

    #I
    w3.tr()
    #w3.td(gui.Label("Stable "))
    Ibox = gui.Input(value="0", height=16, width=120)
    w3.td(Ibox)
    w3.td(gui.Label(" Accurate"), align=-1)

    #D
    w3.tr()
    #w3.td(gui.Label("Cautious "))
    Dbox = gui.Input(value="0", height=16, width=120)
    w3.td(Dbox)
    w3.td(gui.Label(" Responsive"), align=-1)

    w.td(w3, align=-1)

    #Restore PID defaults button
    w.tr()
    w4 = gui.Table()

    w4.tr()
    pidButton3 = gui.Button("Restore PID Defaults")
    pidButton3.connect(gui.CLICK, pidDefault)
    w4.td(pidButton3, valign=1)
    w4.td(gui.Label(""), height=30)

    ##    w4.tr()
    ##    pidButton4 = gui.Button("Auto-Calibrate")
    ##    pidButton4.connect(gui.CLICK, pidCalibrate)
    ##    w4.td(pidButton4)
    ##    w4.td(gui.Label(""), height = 30)

    w.td(w4, align=-1)

    #Second panel under top panel for depth, pressure, and subsytems label
    w.tr()
    w5 = gui.Table()

    w5.tr()
    w5.td(gui.Label("Depth "), height=30, align=-1)
    depLbl = gui.Input("0", size=6)
    w5.td(depLbl, align=1)
    w5.td(gui.Label(" m"))
    w5.tr()
    w5.td(gui.Label("Pressure "), align=-1)
    preLbl = gui.Input("0", size=6)
    w5.td(preLbl, align=1)
    w5.td(gui.Label(" kPa"))

    w.td(w5, align=-1)

    #Soleniod controls
    w.tr()
    w.td(gui.Label("Solenoid Controls "), height=30, align=-1)
    w.tr()
    w6 = gui.Table()
    w6.tr()

    sol0 = gui.Switch(false)
    sol0.connect(gui.CLICK, fireSol, 0)
    w6.td(sol0)

    sol1 = gui.Switch(false)
    sol1.connect(gui.CLICK, fireSol, 1)
    w6.td(sol1)

    sol2 = gui.Switch(false)
    sol2.connect(gui.CLICK, fireSol, 2)
    w6.td(sol2)

    sol3 = gui.Switch(false)
    sol3.connect(gui.CLICK, fireSol, 3)
    w6.td(sol3)

    sol4 = gui.Switch(false)
    sol4.connect(gui.CLICK, fireSol, 4)
    w6.td(sol4)

    sol5 = gui.Switch(false)
    sol5.connect(gui.CLICK, fireSol, 5)
    w6.td(sol5)

    sol6 = gui.Switch(false)
    sol6.connect(gui.CLICK, fireSol, 6)
    w6.td(sol6)

    sol7 = gui.Switch(false)
    sol7.connect(gui.CLICK, fireSol, 7)
    w6.td(sol7)

    sol8 = gui.Switch(false)
    sol8.connect(gui.CLICK, fireSol, 8)
    w6.td(sol8)

    sol9 = gui.Switch(false)
    sol9.connect(gui.CLICK, fireSol, 9)
    w6.td(sol9)

    w.td(w6, align=0)

    w.tr()
    w.td(gui.Label("0 1 2 3 4 5 6 7 8 9"), height=30, align=0)

    # Center tabel that holds all the navigation data.
    c = gui.Table()

    #verticle sliders for motor bars and space for surface.
    c.tr()

    c1 = gui.Table()
    c1.tr()
    LSlider = gui.VSlider(value=0,
                          min=Motormin,
                          max=Motormax,
                          size=20,
                          height=120,
                          width=16)
    RSlider = gui.VSlider(value=0,
                          min=Motormin,
                          max=Motormax,
                          size=20,
                          height=120,
                          width=16)
    FSlider = gui.VSlider(value=0,
                          min=Motormin,
                          max=Motormax,
                          size=20,
                          height=120,
                          width=16)
    ASlider = gui.VSlider(value=0,
                          min=Motormin,
                          max=Motormax,
                          size=20,
                          height=120,
                          width=16)
    c1.td(LSlider, width=20, valign=1)
    c1.td(RSlider, width=20, valign=1)
    c1.td(gui.Label("  Surface  "), height=180, width=240)
    c1.td(FSlider, width=20, valign=1)
    c1.td(ASlider, width=20, valign=1)
    c1.tr()
    c1.td(gui.Label("L"))
    c1.td(gui.Label("R"))
    c1.td(gui.Label(""))
    c1.td(gui.Label("F"))
    c1.td(gui.Label("A"))

    c.td(c1)

    # Motor duty cycle bar.
    c.tr()

    c2 = gui.Table()
    c2.tr()
    c2.td(gui.Label(" Motor Duty Cycle "), height=50, colspan=3, valign=1)
    c2.tr()
    c2.td(gui.Label("0 "), height=30)
    MotormaxS = gui.HSlider(value=25,
                            min=0,
                            max=127,
                            size=20,
                            height=16,
                            width=120)
    MotormaxS.connect(gui.CHANGE, setMotorMax, MotormaxS)
    c2.td(MotormaxS)
    c2.td(gui.Label(" 100"))

    c.td(c2)

    #motor configuration graphic
    c.tr()

    c3 = gui.Table()
    c3.tr()
    c3.td(gui.Label(""), height=30)
    c3.tr()
    c3.td(gui.Label(" Motor Configuration "))
    c3.tr()
    c3.td(gui.Label("  Surface  "), height=150, width=150)
    c3.tr()
    c3.td(gui.Label(""), height=30)

    c.td(c3)

    #Radio Buttons for controling pitch and button for speed cycle.
    c.tr()

    c4 = gui.Table()
    c4.tr()
    pSwitch = gui.Switch(value=False)
    pSwitch.connect(gui.CLICK, arm_disarm_Component, 4)
    c4.td(pSwitch)
    c4.td(gui.Label("Pitch on"))
    c4.td(gui.Label("     "))

    spdCycButton = gui.Button("Speed Cycle")
    spdCycButton.connect(gui.CLICK, speedCycle)
    c4.td(spdCycButton)

    c4.tr()
    speedLbl = gui.Input("1/1", size=4, align=1)
    c4.td(speedLbl, colspan=4, align=1)

    c.td(c4)

    # East tabel for hold all the subsystems functions.
    e = gui.Table(width=200)
    e.tr()
    e.td(gui.Label(" Subsystems "), height=50)

    e.tr()

    sysSelectGroup = gui.Group(value=0)

    disarmRadio = gui.Radio(sysSelectGroup, value=0)
    disarmRadio.connect(gui.CLICK, arm_disarm_Component, 5)

    e0 = gui.Table()
    e0.tr()
    e0.td(disarmRadio, width=20)
    e0.td(gui.Label("Disarm All"))

    e.td(e0)

    # Critter Getter functions.
    e.tr()

    e1 = gui.Table()
    e1.tr()

    e1a = gui.Table()
    e1a.tr()
    e1a.td(gui.Label("Critter Getter"), height=29, align=-1)
    e1a.td(gui.Label(), width=30)
    cgRadio = gui.Radio(sysSelectGroup, value=1)
    cgRadio.connect(gui.CLICK, arm_disarm_Component, 1)
    e1a.td(cgRadio)
    e1a.td(gui.Label("Arm "))
    e1a.td(gui.Label(""), height=29, width=20)
    e1.td(e1a, align=-1)

    e1.tr()
    e1b = gui.Table()
    e1b.tr()
    e1b.td(gui.Label("Status: "), height=29, align=-1)
    critLbl = gui.Input(size=15)
    e1b.td(critLbl)
    e1.td(e1b, align=-1)

    e1.tr()

    e1b = gui.Table()
    e1b.tr()
    cgButton1 = gui.Button("Flush")
    cgButton2 = gui.Button("Extend")

    cgButton1.connect(gui.CLICK, operateWC, 1)
    cgButton2.connect(gui.CLICK, operateWC, 2)

    e1b.td(cgButton1)
    e1b.td(gui.Label(""), height=29)
    e1b.td(cgButton2)
    e1.td(e1b, align=-1)

    e.td(e1, height=120, align=-1)

    #Water Collecter functions.
    e.tr()

    e2 = gui.Table()
    e2.tr()

    e2a = gui.Table()
    e2a.tr()
    e2a.td(gui.Label("Water Collecter"), height=29, align=-1)
    e2a.td(gui.Label(), width=30)
    wcRadio = gui.Radio(sysSelectGroup, value=2)
    wcRadio.connect(gui.CLICK, arm_disarm_Component, 2)
    e2a.td(wcRadio)
    e2a.td(gui.Label("Arm "))
    e2a.td(gui.Label(""), height=29, width=20)
    e2.td(e2a, align=-1)

    e2.tr()
    e2b = gui.Table()
    e2b.tr()
    e2b.td(gui.Label("Status: "), height=29, align=-1)
    wcLbl = gui.Input(size=15)
    e2b.td(wcLbl)
    e2.td(e2b, align=-1)

    e2.tr()
    e2c = gui.Table()
    e2c.tr()
    wcButton = gui.Button("Operate")
    e2c.td(wcButton, height=29)
    e2.td(e2c, align=-1)

    e.td(e2, height=120, align=-1)

    #Cap and trade functions.
    e.tr()

    e3 = gui.Table()
    e3.tr()

    #CandTarm_disarm = gui.Group(value = 2)
    e3a = gui.Table()
    e3a.tr()
    e3a.td(gui.Label("Cap and Trade"), height=29, align=-1)
    e3a.td(gui.Label(), width=30)
    ctRadio = gui.Radio(sysSelectGroup, value=3)
    ctRadio.connect(gui.CLICK, arm_disarm_Component, 3)
    e3a.td(ctRadio)
    e3a.td(gui.Label("Arm "))
    e3a.td(gui.Label(""), height=29, width=20)
    e3.td(e3a, align=-1)

    e3.tr()
    e3b = gui.Table()
    e3b.tr()
    e3b.td(gui.Label("Status: "), height=29, align=-1)
    ctLbl = gui.Input(size=15)
    e3b.td(ctLbl)
    e3.td(e3b, align=-1)

    e3.tr()
    ctButton1 = gui.Button("Operate")
    e3.td(ctButton1, height=29, align=-1)

    e.td(e3, height=120, align=-1)

    #put it together.
    Main.tr()
    Main.td(n, colspan=3)
    Main.tr()
    Main.td(gui.Label(""), height=30)
    Main.tr()
    Main.td(w, valign=-1)
    Main.td(c, valign=-1)
    Main.td(e, valign=-1)
    Main.tr()
    Main.td(gui.Label(""), height=30)

    app.init(Main)  #Main is main tabel.
예제 #21
0
파일: gui.py 프로젝트: trimlab/microMVP
    def SetupToolbox(self):
        self.ctrls = ctrls = gui.Table(width=125)

        ctrls.tr()
        ctrls.td(gui.Label(" Car Control: "), align=0)

        ctrls.tr()
        btn_run = gui.Button("Run", width=90)
        btn_run.connect(gui.CLICK, self.B_run)
        ctrls.td(btn_run)

        ctrls.tr()
        btn_stop = gui.Button("Stop", width=90)
        btn_stop.connect(gui.CLICK, self.B_stop)
        ctrls.td(btn_stop)

        ctrls.tr()
        btn_clear = gui.Button("Clear", width=90)
        btn_clear.connect(gui.CLICK, self.B_clear)
        ctrls.td(btn_clear)

        ctrls.tr()
        self.sli_v = gui.HSlider(value=100, min=0, max=100, size=20, width=120)
        ctrls.td(self.sli_v, colspan=3)

        ctrls.tr()
        ctrls.td(gui.Label(""), align=0)

        ctrls.tr()
        ctrls.td(gui.Label(" Draw Path: "))

        ctrls.tr()
        self.sel_car = sel_car = gui.Select()
        for item in utils.carInfo:
            sel_car.add("#" + str(item[0]) + ", Tag" + str(item[1]), item[1])
        ctrls.td(sel_car)

        ctrls.tr()
        ctrls.td(gui.Label(""), align=0)

        ctrls.tr()
        ctrls.td(gui.Label(" Patterns: "), align=0)

        files = [
            f for f in listdir("patterns/") if isfile(join("patterns/", f))
        ]
        ctrls.tr()
        self.sel_ptn = sel_ptn = gui.Select()
        for f in files:
            if ".py" in f:
                if ".pyc" not in f:
                    sel_ptn.add(f.split(".")[0], f)
        ctrls.td(sel_ptn)

        ctrls.tr()
        btn_pattern = gui.Button("Get Pattern", width=90)
        btn_pattern.connect(gui.CLICK, self.B_pattern)
        ctrls.td(btn_pattern)

        ctrls.tr()
        ctrls.td(gui.Label(""), align=0)

        ctrls.tr()
        ctrls.td(gui.Label("Path Planning:"), align=0)

        files = [
            f for f in listdir("algorithms/") if isfile(join("algorithms/", f))
        ]
        ctrls.tr()
        self.sel_alg = sel_alg = gui.Select()
        for f in files:
            if ".py" in f:
                if ".pyc" not in f:
                    sel_alg.add(f.split(".")[0], f)
        ctrls.td(sel_alg)

        ctrls.tr()
        btn_plan = gui.Button("Run ALG", width=90)
        btn_plan.connect(gui.CLICK, self.B_plan)
        ctrls.td(btn_plan)

        return ctrls
예제 #22
0
c.td(gui.Tool(g, gui.Label('B'), value='b'))
c.td(gui.Tool(g, gui.Label('C'), value='c'))

c.tr()
c.td(gui.Label("Input"))


def cb():
    print("Input received")


w = gui.Input(value='Cuzco', size=8)
w.connect("activate", cb)
c.td(w, colspan=3)

c.tr()
c.td(gui.Label("Slider"))
c.td(gui.HSlider(value=23, min=0, max=100, size=20, width=120), colspan=3)

c.tr()
c.td(gui.Label("Keysym"))
c.td(gui.Keysym(), colspan=3)

c.tr()
c.td(gui.Label("Text Area"), colspan=4, align=-1)

c.tr()
c.td(gui.TextArea(value="Cuzco the Goat", width=150, height=70), colspan=4)

app.run(c)
예제 #23
0
파일: PongUI.py 프로젝트: lono175/Maze
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        fg = (0, 255, 255)

        #self.value = 'pp'
        #self.tr()
        #self.tt = gui.Label(value = self.value,color=fg, name='gg')
        #self.td(self.tt,colspan=2)

        self.tr()
        self.td(gui.Label("alpha: ", color=fg), align=-1)
        slider = gui.HSlider(1,
                             0,
                             100,
                             size=20,
                             width=100,
                             height=16,
                             name='alphaSlider')
        label = gui.Input(value=slider.value / 100.0,
                          size=5,
                          name='alphaLabel')
        slider.connect(gui.CHANGE, self.slideChange, label.name, slider, 100.0)
        self.td(label, align=1)
        self.td(slider, colspan=2)

        self.tr()
        self.td(gui.Label("gamma: ", color=fg), align=-1)
        slider = gui.HSlider(90,
                             0,
                             100,
                             size=20,
                             width=100,
                             height=16,
                             name='gammaSlider')
        label = gui.Input(value=slider.value / 100.0,
                          size=5,
                          name='gammaLabel')
        slider.connect(gui.CHANGE, self.slideChange, label.name, slider, 100.0)
        self.td(label, align=1)
        self.td(slider, colspan=2)

        self.tr()
        self.td(gui.Label("epsilon: ", color=fg), align=-1)
        slider = gui.HSlider(10,
                             0,
                             100,
                             size=20,
                             width=100,
                             height=16,
                             name='epsilonSlider')
        label = gui.Input(value=slider.value / 100.0,
                          size=5,
                          name='epsilonLabel')
        slider.connect(gui.CHANGE, self.slideChange, label.name, slider, 100.0)
        self.td(label, align=1)
        self.td(slider, colspan=2)

        self.tr()
        self.td(gui.Label("fps: ", color=fg), align=-1)
        slider = gui.HSlider(5,
                             1,
                             500,
                             size=20,
                             width=100,
                             height=16,
                             name='fpsSlider')
        label = gui.Input(value=slider.value, size=5, name='fpsLabel')
        slider.connect(gui.CHANGE, self.slideChange, label.name, slider, 1)
        self.td(label, align=1)
        self.td(slider, colspan=2)

        self.tr()
        self.td(gui.Label("# step: ", color=fg), align=-1)
        label = gui.Input(value=0, size=10, name='stepLabel')
        self.td(label, align=1)

        self.tr()
        self.td(gui.Label("# episode: ", color=fg), align=-1)
        label = gui.Input(value=0, size=10, name='episodeLabel')
        self.td(label, align=1)

        self.tr()
        self.td(gui.Label("# rewards: ", color=fg), align=-1)
        label = gui.Input(value=0, size=10, name='rewardLabel')
        self.td(label, align=1)

        self.tr()
        start = gui.Button("Start")
        start.connect(gui.CLICK, self.start)
        self.td(start)

        stop = gui.Button("Stop")
        stop.connect(gui.CLICK, self.stop)
        self.td(stop)

        self.tr()
        button = gui.Button("Load")
        button.connect(gui.CLICK, self.load)
        self.td(button)

        button = gui.Button("Save")
        button.connect(gui.CLICK, self.save)
        self.td(button)

        self.tr()
        self.td(gui.Label("Player: ", color=fg), align=-1)

        self.tr()
        g = gui.Group(name='player_type', value='SARSA')
        self.td(gui.Label("  SARSA: ", color=fg), align=-1)
        r = gui.Radio(g, value='SARSA')
        r.connect(gui.CLICK, self.changePlayer, r.value)
        self.td(r)

        #self.tr()
        #self.td(gui.Label("  Q_Learning: ",color=fg),align=-1)
        #r = gui.Radio(g,value='Q_Learning')
        #r.connect(gui.CLICK, self.changePlayer, r.value)
        #self.td(r)

        self.tr()
        self.td(gui.Label("  Human: ", color=fg), align=-1)
        r = gui.Radio(g, value='Human')
        r.connect(gui.CLICK, self.changePlayer, r.value)
        self.td(r)
예제 #24
0
    def __init__(self,**params):
        gui.Table.__init__(self,**params)

        def fullscreen_changed(btn):
            #pygame.display.toggle_fullscreen()
            print("TOGGLE FULLSCREEN")

        def stars_changed(slider):
            n = slider.value - len(stars)
            if n < 0:
                for i in range(n,0): 
                    stars.pop()
            else:
                for i in range(0,n):
                    stars.append([random.randrange(-WIDTH*span,WIDTH*span),
                                  random.randrange(-HEIGHT*span,HEIGHT*span),
                                  random.randrange(1,dist)])

        fg = (255,255,255)

        self.tr()
        self.td(gui.Label("Phil's Pygame GUI",color=fg),colspan=2)
        
        self.tr()
        self.td(gui.Label("Speed: ",color=fg),align=1)
        e = gui.HSlider(100,-500,500,size=20,width=100,height=16,name='speed')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Size: ",color=fg),align=1)
        e = gui.HSlider(2,1,5,size=20,width=100,height=16,name='size')
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Quantity: ",color=fg),align=1)
        e = gui.HSlider(100,1,1000,size=20,width=100,height=16,name='quantity')
        e.connect(gui.CHANGE, stars_changed, e)
        self.td(e)
        
        self.tr()
        self.td(gui.Label("Color: ",color=fg),align=1)
        
        
        default = "#ffffff"
        color = gui.Color(default,width=64,height=10,name='color')
        color_d = ColorDialog(default)

        color.connect(gui.CLICK,color_d.open,None)
        self.td(color)
        def update_col():
            color.value = color_d.value
        color_d.connect(gui.CHANGE,update_col)
        
        btn = gui.Switch(value=False,name='fullscreen')
        btn.connect(gui.CHANGE, fullscreen_changed, btn)

        self.tr()
        self.td(gui.Label("Full Screen: ",color=fg),align=1)
        self.td(btn)
        
        self.tr()
        self.td(gui.Label("Warp Speed: ",color=fg),align=1)
        self.td(gui.Switch(value=False,name='warp'))
예제 #25
0
    def setup_menu(this):
        tbl = gui.Table(vpadding=5, hpadding=2)
        tbl.tr()

        def inc_changed_x1(slider):
            this.engine.plasma_inc_x[0] = slider.value
        def inc_changed_x2(slider):
            this.engine.plasma_inc_x[1] = slider.value
        def inc_changed_y1(slider):
            this.engine.plasma_inc_y[0] = slider.value
        def inc_changed_y2(slider):
            this.engine.plasma_inc_y[1] = slider.value

        def offset_changed_x1(slider):
            this.engine.off_x1 = slider.value
        def offset_changed_x2(slider):
            this.engine.off_x2 = slider.value
        def offset_changed_y1(slider):
            this.engine.off_y1 = slider.value
        def offset_changed_y2(slider):
            this.engine.off_y2 = slider.value

        def dump_info():
            print('inc x = %s' % str(this.engine.plasma_inc_x))
            print('inc y = %s' % str(this.engine.plasma_inc_y))
            print('off x = (%d,%d)' % (this.engine.off_x1, this.engine.off_x2))
            print('off y = (%d,%d)' % (this.engine.off_y1, this.engine.off_y2))

        # inc x0
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, inc_changed_x1, slider)
        tbl.td(slider)

        # inc x1
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, inc_changed_x2, slider)
        tbl.td(slider)

        # inc y0
        tbl.tr()
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, inc_changed_y1, slider)
        tbl.td(slider)

        # inc y1
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, inc_changed_y2, slider)
        tbl.td(slider)


        # off x0
        tbl.tr()
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, offset_changed_x1, slider)
        tbl.td(slider)

        # off x1
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, offset_changed_x2, slider)
        tbl.td(slider)

        # off y0
        tbl.tr()
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, offset_changed_y1, slider)
        tbl.td(slider)

        # off y1
        slider = gui.HSlider(value=0,min=0,max=255,size=10,width=256)
        slider.connect(gui.CHANGE, offset_changed_y2, slider)
        tbl.td(slider)


        tbl.tr()
        button = gui.Button('Dump info')
        button.connect(gui.CLICK, dump_info)
        tbl.td(button)

        this.menuArea.add(tbl, 0, 0)
예제 #26
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.value = gui.Form()

        # dialogs
        openItemDialog = OpenItemDialog(self)

        # item information
        self.itemNum = None
        self.itemVal = 0

        self.tr()
        self.td(gui.Label('Attack message:', color=UI_FONT_COLOR))
        self.tr()
        self.td(gui.Input('', size=26, name='inpNpcAttackSay'), valign=-1)

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

        self.tr()
        self.lblRan = gui.Label('Range: 0', color=UI_FONT_COLOR)
        self.td(self.lblRan)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=20,
                        size=10,
                        width=120,
                        name='selDataRan')
        e.connect(gui.CHANGE, self.updateLabelRan, e)
        self.td(e)

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

        self.tr()
        self.lblDropChance = gui.Label('Drop Chance: 0 (0%)',
                                       color=UI_FONT_COLOR)
        self.td(self.lblDropChance)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=50,
                        size=10,
                        width=120,
                        name='selDataDropChance')
        e.connect(gui.CHANGE, self.updateLabelDropChance, e)
        self.td(e)

        self.tr()
        self.lblDropItem = gui.Label('Drop Item: None', color=UI_FONT_COLOR)
        self.td(self.lblDropItem)

        self.tr()
        e = gui.Button("Choose item...", width=100)
        e.connect(gui.CLICK, openItemDialog.openDialog, None)
        self.td(e, colspan=2)

        self.tr()
        self.lblDropItemVal = gui.Label('Drop Item Value: 1',
                                        color=UI_FONT_COLOR)
        self.td(self.lblDropItemVal)

        self.tr()
        e = gui.HSlider(value=1,
                        min=1,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataDropItemVal')
        e.connect(gui.CHANGE, self.updateLabelDropItemVal, e)
        self.td(e)
    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)
예제 #28
0
파일: Serveur.py 프로젝트: simsor/BomberLAN
        champ_ip = gui.Input(value="0.0.0.0", size=15)
        table.td(champ_ip, colspan=3)

        # Port d'écoute
        table.tr()
        table.td(gui.Label("Port : "))

        champ_port = gui.Input(value="8888", size=5)
        table.td(champ_port, colspan=3)

        # Nombre de joueurs
        table.tr()
        table.td(gui.Label("Nombre joueurs :"))

        slider_nb = gui.HSlider(value=2, min=2, max=4, size=5, width=150)
        champ_nb = gui.Label("2")

        def maj_nb(valeurs):
            (champ, slider) = valeurs
            champ.value = str(slider.value)
            champ.repaint()

        slider_nb.connect(gui.CHANGE, maj_nb, (champ_nb, slider_nb))

        table.td(slider_nb, colspan=3)
        table.tr()
        table.td(champ_nb, colspan=4)

        # Bouton GO
        table.tr()
예제 #29
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.value = gui.Form()

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

        self.tr()
        self.lblStr = gui.Label('Strength: 0', color=UI_FONT_COLOR)
        self.td(self.lblStr)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataStr')
        e.connect(gui.CHANGE, self.updateLabelStr, e)
        self.td(e)

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

        self.tr()
        self.lblDef = gui.Label('Defense: 0', color=UI_FONT_COLOR)
        self.td(self.lblDef)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataDef')
        e.connect(gui.CHANGE, self.updateLabelDef, e)
        self.td(e)

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

        self.tr()
        self.lblMag = gui.Label('Magic: 0', color=UI_FONT_COLOR)
        self.td(self.lblMag)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataMag')
        e.connect(gui.CHANGE, self.updateLabelMag, e)
        self.td(e)

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

        self.tr()
        self.lblSpd = gui.Label('Speed: 0', color=UI_FONT_COLOR)
        self.td(self.lblSpd)

        self.tr()
        e = gui.HSlider(value=0,
                        min=0,
                        max=99,
                        size=10,
                        width=120,
                        name='selDataSpd')
        e.connect(gui.CHANGE, self.updateLabelSpd, e)
        self.td(e)
예제 #30
0
    def __init__(self, parent=None, **params):
        gui.Table.__init__(self, **params)

        self.parent = parent

        self.value = gui.Form()

        # dialogs
        openNpcDialog = OpenNPCDialog(self)

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

        self.tr()
        e = gui.Button("Open NPC...", width=100)
        e.connect(gui.CLICK, openNpcDialog.openDialog, None)
        self.td(e, colspan=2)

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

        self.tr()
        self.td(gui.Label('Name:', color=UI_FONT_COLOR), colspan=2)
        self.tr()
        self.td(gui.Input('', size=26, name='inpNpcName'),
                colspan=2,
                valign=-1)

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

        self.tr()
        self.td(gui.Label('Behaviour:', color=UI_FONT_COLOR), colspan=2)
        self.tr()
        e = gui.Select(name='selBehaviour')
        e.add('Attack on sight', 0)
        e.add('Attack when attacked', 1)
        e.add('Friendly', 2)
        e.add('Shopkeeper', 3)
        e.add('Guard', 4)
        e.value = 0
        #e.connect(gui.CHANGE, self.updateType, None)
        self.td(e, colspan=2)

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

        self.tr()
        self.lblSpawnSecs = gui.Label('Respawn rate: 0 secs',
                                      color=UI_FONT_COLOR)
        self.td(self.lblSpawnSecs, colspan=2)

        self.tr()
        e = gui.HSlider(value=5,
                        min=5,
                        max=120,
                        size=10,
                        width=120,
                        name='selDataSpawnSecs')
        e.connect(gui.CHANGE, self.updateLabelSpawnSecs, e)
        self.td(e, colspan=2)