コード例 #1
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('', size=8, name='inpWarpMapID')
        self.td(self.inpMapID, colspan=2)

        # used for selecting the map
        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"))
コード例 #2
0
ファイル: menu.py プロジェクト: McFeod/susu-robotics
    def setup_sliders(self):
        table = gui.Table()
        table.tr()
        table.td(gui.Label('Двигатели:', font=self.font), align=-1)
        self.left_engine_slider = gui.VSlider(value=0,
                                              min=-100,
                                              max=100,
                                              size=10,
                                              width=16,
                                              height=200)
        self.right_engine_slider = gui.VSlider(value=0,
                                               min=-100,
                                               max=100,
                                               size=10,
                                               width=16,
                                               height=200)

        table.tr()
        container = gui.Container()
        table.td(container)

        left_input = gui.Input('0', font=self.font, size=4)
        right_input = gui.Input('0', font=self.font, size=4)

        def sliders_changed():
            left_input.value = str(-self.left_engine_slider.value)
            right_input.value = str(-self.right_engine_slider.value)
            self.change_engine_power(-self.left_engine_slider.value,
                                     -self.right_engine_slider.value)

        def inputs_changed():
            try:
                left = int(left_input.value)
                right = int(right_input.value)
                if abs(left) <= 100 and abs(right) <= 100:
                    self.left_engine_slider.value = -left
                    self.right_engine_slider.value = -right
                    self.change_engine_power(left, right)
            except:
                pass

        self.left_engine_slider.connect(gui.CHANGE, sliders_changed)
        self.right_engine_slider.connect(gui.CHANGE, sliders_changed)
        left_input.connect(gui.KEYDOWN, inputs_changed)
        right_input.connect(gui.KEYDOWN, inputs_changed)

        lt = gui.Table(width=35)
        lt.tr()
        lt.td(left_input, align=1)
        gt = gui.Table()
        gt.tr()
        gt.td(right_input, align=-1)
        container.add(left_input, 20, 90)
        container.add(self.left_engine_slider, 70, 0)
        container.add(self.right_engine_slider, 120, 0)
        container.add(right_input, 140, 90)

        table.tr()
        table.td(gui.Spacer(height=20, width=0))
        return table
コード例 #3
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.value = gui.Form()

        self.tr()
        self.td(gui.Label("Map Name:", color=UI_FONT_COLOR))
        self.td(gui.Input("", size=16, name="inpMapName"))

        self.tr()
        self.td(gui.Label("Warp Up:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapUp"))

        self.tr()
        self.td(gui.Label("Warp Down:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapDown"))

        self.tr()
        self.td(gui.Label("Warp Left:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapLeft"))

        self.tr()
        self.td(gui.Label("Warp Right:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapRight"))

        self.loadProperties()
コード例 #4
0
    def start_input(self, attrs):
        r = self.attrs_to_map(attrs)
        params = self.map_to_params(r)  #why bother
        #params = {}

        type_, name, value = r.get('type',
                                   'text'), r.get('name',
                                                  None), r.get('value', None)
        f = self.form
        if type_ == 'text':
            e = gui.Input(**params)
            self.map_to_connects(e, r)
            self.item.add(e)
        elif type_ == 'radio':
            if name not in f.groups:
                f.groups[name] = gui.Group(name=name)
            g = f.groups[name]
            del params['name']
            e = gui.Radio(group=g, **params)
            self.map_to_connects(e, r)
            self.item.add(e)
            if 'checked' in r: g.value = value
        elif type_ == 'checkbox':
            if name not in f.groups:
                f.groups[name] = gui.Group(name=name)
            g = f.groups[name]
            del params['name']
            e = gui.Checkbox(group=g, **params)
            self.map_to_connects(e, r)
            self.item.add(e)
            if 'checked' in r: g.value = value

        elif type_ == 'button':
            e = gui.Button(**params)
            self.map_to_connects(e, r)
            self.item.add(e)
        elif type_ == 'submit':
            e = gui.Button(**params)
            self.map_to_connects(e, r)
            self.item.add(e)
        elif type_ == 'file':
            e = gui.Input(**params)
            self.map_to_connects(e, r)
            self.item.add(e)
            b = gui.Button(value='Browse...')
            self.item.add(b)

            def _browse(value):
                d = gui.FileDialog()
                d.connect(gui.CHANGE, gui.action_setvalue, (d, e))
                d.open()

            b.connect(gui.CLICK, _browse, None)

        self._locals[r.get('id', None)] = e
コード例 #5
0
    def __init__(self,**params):
        self.task = gui.Form() # widget values get added to this dict
        self.state = None
        title = gui.Label("Task Dialog")
        table = gui.Table(width=400)
        
        # Name input
        table.tr()
        table.td(gui.Label("Name:"), colspan=1)
        table.td(gui.Input(name="name"), colspan=3)
        table.tr()
        table.td(gui.Spacer(width=1,height=5))
        
        # Notes input
        table.tr()
        table.td(gui.Label("Notes:"), colspan=1)
        table.td(gui.Input(name="notes"), colspan=3)
        table.tr()
        table.td(gui.Spacer(width=1,height=5))
        
        # Due date input
        table.tr()
        table.td(gui.Label("Due Date:"), colspan=1)
        table.td(gui.Input(name="dueDate"), colspan=3)
        table.tr()
        table.td(gui.Spacer(width=1,height=5))
        
        # tags checkbox
        table.tr()
        table.td(gui.Label("Tags:"), colspan=4, align=0)
        
        tagGroup = gui.Group(name="tags")
        table.tr()
        table.td(gui.Label("School"), colspan=2, align=1)
        table.td(gui.Checkbox(tagGroup,value="school"))
        
        table.tr()
        table.td(gui.Label("Work"), colspan=2, align=1)
        table.td(gui.Checkbox(tagGroup,value="work"))
        
        table.tr()
        table.td(gui.Label("Health"), colspan=2, align=1)
        table.td(gui.Checkbox(tagGroup,value="health"))
        
        
        table.tr()
        table.td(gui.Spacer(width=1,height=10))
        table.tr()
        self.saveBtn = gui.Button("Add Task")
        self.saveBtn.connect(gui.CLICK,self.send,gui.CHANGE)
        table.td(self.saveBtn, colspan=4)

        gui.Dialog.__init__(self,title,table)
コード例 #6
0
ファイル: map.py プロジェクト: flamedancer/mytank
    def setup_menu(this):
        td_style = {'padding_right': 10}
        tb = gui.Table(vpadding=5, hpadding=5)
        tb.tr()
        tb.td(gui.Label(u'单元格行宽'), style=td_style)
        btn1 = gui.Input(size=20)

        tb.td(btn1, style=td_style)
        tb.td(gui.Label(u'单元格列宽'), style=td_style)
        btn = gui.Input("Pause/resume clock", size=20)
        tb.td(btn, style=td_style)
        tb.tr()
        this.menuArea.add(tb, 0, 0)
コード例 #7
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()
コード例 #8
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        self.listCount = 0

        # dialogs
        openNpcDialog = OpenNPCDialog(self)

        self.value = gui.Form()

        self.tr()
        self.td(gui.Label("Map Name:", color=UI_FONT_COLOR))
        self.td(gui.Input("", size=16, name="inpMapName"))

        self.tr()
        self.td(gui.Label("Warp Up:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapUp"))

        self.tr()
        self.td(gui.Label("Warp Down:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapDown"))

        self.tr()
        self.td(gui.Label("Warp Left:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapLeft"))

        self.tr()
        self.td(gui.Label("Warp Right:", color=UI_FONT_COLOR))
        self.td(gui.Input("0", size=4, name="inpMapRight"))

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

        # npc list
        self.tr()
        e = gui.Button('Add NPC...', width=80)
        e.connect(gui.CLICK, openNpcDialog.openDialog, None)
        self.td(e)

        e = gui.Button('Remove', width=80)
        e.connect(gui.CLICK, self.removeNpc, None)
        self.td(e)

        self.tr()
        self.npcList = gui.List(width=200, height=80, name='lstNpcs')
        self.td(self.npcList, colspan=2)

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

		self._data = ''

		self._count = 1
		self.focused = False

		self.tr()
		self.chatMsg = gui.Input(size=52, focusable=False)
		self.chatMsg.connect(gui.KEYDOWN, self.lkey)
		self.td(self.chatMsg)

		self.tr()
		self.chatList = gui.List(width=480, height=170)
		self.td(self.chatList)

		self.tr()
		class Hack(gui.Spacer):
			def resize(self, width=None, height=None):
				#self.chatListBox.set_vertical_scroll(65535)
				return 1, 1

		self.td(Hack(1, 1))
コード例 #10
0
ファイル: menulogin.py プロジェクト: Irtorius/pyorpg-client
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.value = gui.Form()
        self.engine = None

        def btnLogin(btn):
            self.engine.doLogin()

        def btnRegister(btn):
            g.gameState = MENU_REGISTER

            if g.tcpConn is None:
                g.gameEngine.initConnection()

        self.tr()
        self.td(gui.Input(name="username", value="Username"))

        self.tr()
        self.td(gui.Password(name="password", value="password"))

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

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

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

        self.tr()
        btn = gui.Button("Register", width=120)
        btn.connect(gui.CLICK, btnRegister, None)
        self.td(btn)
コード例 #11
0
ファイル: pguLoadFile.py プロジェクト: deadlyedge/Piano
def loadFrame():
    def open_file_browser(arg):
        d = gui.FileDialog('Load NoteMap file', path='records')
        d.connect(gui.CHANGE, handle_file_browser_closed, d)
        d.open()

    def handle_file_browser_closed(dlg):
        if dlg.value:
            input_file.value = dlg.value
        app.quit()

    app = gui.Desktop()
    main = gui.Container(width=500,
                         height=400)  # , background=(220, 220, 220) )
    # main.add(gui.Label("File Dialog Example", cls="h1"), 20, 20)
    td_style = {'padding_right': 10}
    t = gui.Table()
    t.tr()
    t.td(gui.Label('File Name:'), style=td_style)
    input_file = gui.Input()
    t.td(input_file, style=td_style)
    b = gui.Button("Browse...")
    t.td(b, style=td_style)
    b.connect(gui.CLICK, open_file_browser, None)

    main.add(t, 20, 100)

    app.run(main)
    return input_file.value
コード例 #12
0
ファイル: dialog.py プロジェクト: tcjinaz/nxtIDE
    def build_background_select(self):
        background = gui.Table()
        background.td(gui.Label("Room background:"), 
                      style={'padding_right': 6})
        self.background_input = gui.Input(size=16)
        inp = gui.Button('...')
        inp.connect(gui.CLICK, self.file_dialog_open, None)

        self.bckg_group = gui.Group(name='background', value='')
        t = gui.Table()
        t.tr()
        t.td(gui.Radio(self.bckg_group, value=''))
        t.td(gui.Label('None'), align=-1, style={'padding_left': 4})
        t.tr()
        custom_bckg = gui.Radio(self.bckg_group, value='custom')
        t.td(custom_bckg)
        t.td(self.background_input, style={'padding_left': 4})
        t.td(inp, style={'padding_left': 4})
        
        if self.bckg is not None and self.bckg != "None"\
                and os.path.exists(self.bckg):
            self.background_input.value = self.bckg
            custom_bckg.click()

        background.td(t)

        return background
コード例 #13
0
    def __init__(self, engine, **params):
        gui.Container.__init__(self, **params)

        self.engine = engine
        self.value = gui.Form()

        # item editor state
        self.itemNum = None

        # dialogs

        # menu title
        self.tTitle = gui.Table(width=272, height=32)

        self.tTitle.tr()
        self.tTitle.td(gui.Label("NPC Editor", name='npcTitle', color=UI_FONT_COLOR))

        # content
        self.tContent = gui.Table(width=272, height=123)

        self.tContent.tr()


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

        self.tContent.tr()
        self.tContent.td(gui.Label('Behaviour:', color=UI_FONT_COLOR), colspan=2)
        self.tContent.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.tContent.td(e, colspan=2)

        # data input
        self.tData = gui.Table(width=272, height=75)

        # bottom buttons
        self.tBottom = gui.Table(width=272, height=200)

        self.tBottom.tr()
        self.saveButton = gui.Button("Add NPC", width=100, height=40)
        self.saveButton .connect(gui.CLICK, self.saveNPC, None)
        self.tBottom.td(self.saveButton)

        e = gui.Button("Cancel", width=100, height=40)
        e.connect(gui.CLICK, self.cancel, None)
        self.tBottom.td(e)

        self.add(self.tTitle, 0, 0)
        self.add(self.tContent, 0, 100)
        self.add(self.tData, 0, 255)
        self.add(self.tBottom, 0, 368)
コード例 #14
0
    def __init__(self, value="", **params):
        self.ev_manager = params['ev_manager']
        self.ev_manager.register_listener(self)
        self.highs_table = config.current_highs
        self.score = params['score']
        self.data = params['data']
        title = gui.Label("New High Score!")
        main = gui.Table()

        self.gui_form = gui.Form()

        main.tr()
        main.td(gui.Label("Please enter your name:"))
        main.tr()
        self.name_field = gui.Input(value=value, name='player_name')
        main.td(self.name_field)
        main.tr()
        submit_button = gui.Button("Submit")
        main.td(submit_button)
        submit_button.connect(gui.CLICK, self.submit, None)
        submit_button.connect(gui.CLOSE, self.close, None)

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

        self.ev_manager.post(FreezeCards())
コード例 #15
0
ファイル: gui_app.py プロジェクト: jajadinimueter/Antz
def create_attribute_field(ctx, solver, attribute):
    # create the control
    converter = attribute.converter
    name = attribute.name
    prop = attribute.prop
    default = attribute.default
    if converter == bool:
        field = gui.Switch(value=default)
    elif converter in (int, float, Decimal):
        field = gui.Input(value=default, size=10, align=1)
    else:
        field = gui.Input(value=default, size=10, align=-1)
    label = gui.Label(name)
    field.connect(gui.CHANGE, attr_changer,
                  (ctx, solver, prop, field, converter))
    return label, field
コード例 #16
0
ファイル: console.py プロジェクト: jasonbogovich/nxtIDE
    def __init__(self, init_code=None, init_text=None, ps1='>>>', **params):
        
        self._locals = {}

        self.commands = []
        self.lastcmd = 0

        title = gui.Label("Interactive console")

        self.container = gui.Container(background= (255, 255, 255))

        t = gui.Table(width=env.w + env.WALL_HEIGHT*2 + 300 , height=85)
        t.tr()

        self.lines = gui.Table(background=(255, 255, 255))

        self.box = gui.ScrollArea(self.lines, env.w + env.WALL_HEIGHT*2 + 300,
                135, hscrollbar=False, vscrollbar=True, background=(255, 255, 255))
        self.box.set_vertical_scroll(100)
        t.td(self.box)

        font = pygame.font.Font("theme/Inconsolata.ttf", 14)

        t.tr()
        
        it = gui.Table()

        it.td(gui.Label(' ' + ps1 + ' ', font=font))

        dx = 1 if sys.platform.startswith('linux') else 0
        self.line = gui.Input(size=(8*22 - len(ps1)*8 - dx), font=font)
        self.line.connect(gui.KEYDOWN, self.lkey)
        #self.line.connect(gui.MOUSEBUTTONDOWN, self.lkey)
        it.td(self.line)


        t.td(it)
        t.tr()

        t.td(Hack(1, 1, self.box))

        self.container.add(t, 0, 0)

        if init_code is not None :
            code = compile(init_code, '<string>', 'single')
            eval(code,globals(),self._locals)
 
        if init_text is not None:
            _stdout = sys.stdout
            s = sys.stdout = StringStream(self.lines)
            
            val = self.line.value
            print(init_text)

            sys.stdout = _stdout
 
        self.ps1 = ps1

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

        def btnNextClass(btn):
            self.engine.classIndex += 1
            self.engine.updateClassSelection()

        def btnPrevClass(btn):
            self.engine.classIndex -= 1
            self.engine.updateClassSelection()

        def btnCreateChar(btn):
            self.engine.createCharacter()

        def btnCancel(btn):
            g.gameState = MENU_CHAR

        self.tr()
        self.lblCharName = gui.Label(_('Character Name'),
                                     color=(255, 255, 255))
        self.td(self.lblCharName, colspan=3, valign=1)

        self.tr()
        self.inpCharName = gui.Input(name='inpCharName', value='')
        self.td(self.inpCharName, colspan=3)

        self.tr()
        self.lblClassName = gui.Label(_('CLASS NAME'), color=(255, 255, 255))
        self.td(self.lblClassName, colspan=3, valign=1)

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

        self.tr()
        self.td(gui.Spacer(0, 0))
        self.btnSelChar = gui.Button(_("Create Character"),
                                     width=160,
                                     height=30)
        self.btnSelChar.connect(gui.CLICK, btnCreateChar, 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("Cancel", width=160, height=30)
        btn.connect(gui.CLICK, btnCancel, None)
        self.td(btn)
        self.td(gui.Spacer(0, 0))
コード例 #18
0
def main_function():
    # On évite PGU pour Michel
    if len(sys.argv) >= 4 and sys.argv[1] == "--michel":
        ip = sys.argv[2]
        port = int(sys.argv[3])

        jeu(ip, port)

    else:
        app = gui.Desktop(theme=gui.Theme("data/themes/clean"))
        app.connect(gui.QUIT, app.quit, None)

        table = gui.Table()

        # Titre
        table.tr()
        table.td(gui.Label("Connexion au serveur"), colspan=4)

        # IP
        table.tr()
        table.td(gui.Label("IP :"))

        champ_ip = gui.Input(value="127.0.0.1", 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)

        # Bouton connexion
        table.tr()
        bouton_conn = gui.Button("Connexion")
        table.td(bouton_conn)

        def lancer_jeu(valeurs):
            (ip, port) = valeurs
            jeu(ip.value, int(port.value))
            sys.exit(0)

        bouton_conn.connect(gui.CLICK, lancer_jeu, (champ_ip, champ_port))

        app.run(table)
コード例 #19
0
 def buildNameInput(self):
     newActor = self.script.controls['actor-group-focus'].value
     nameInput = gui.Input(name='actor-input-name',
                           value=newActor.name,
                           size=30)
     nameInput.connect(gui.BLUR, self.changeName)
     self.editablesDocumentLeft.add(gui.Label(_("Name: ")))
     self.editablesDocumentLeft.add(nameInput)
     self.spaceEditablesDocumentLeft()
コード例 #20
0
    def __init__(self, config):
        title = gui.Label("New simulation")
        t = gui.Table()

        t.tr()
        t.td(gui.Label("Bots:"), align=1)
        t.td(gui.Input(name="n", value=config['n'], size=4), align=-1)

        def open_file_browser(arg):
            d = gui.FileDialog()
            d.connect(gui.CHANGE, handle_file_browser_closed, d)
            d.open()

        def handle_file_browser_closed(dlg):
            if dlg.value: program.value = dlg.value

        t.tr()
        t.td(gui.Label('Program:'))
        program = gui.Input(name="program", value=config['program'])
        t.td(program)
        b = gui.Button("Browse...")
        b.connect(gui.CLICK, open_file_browser, gui.CHANGE)
        t.td(b)

        t.tr()
        t.td(gui.Label("Formation:"))
        e = gui.Select(name="formation", value=config['formation'])
        e.add("Circle", 'CIRCLE')
        e.add("Piled", 'PILED')
        e.add("Line", 'LINE')
        e.add("Random", 'RANDOM')
        t.td(e, align=-1)

        t.tr()
        e = gui.Button("Okay")
        e.connect(gui.CLICK, self.send, gui.CHANGE)
        t.td(e, align=-1)

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

        self.value = None
        gui.Dialog.__init__(self, title, t)
コード例 #21
0
ファイル: main.py プロジェクト: annnaarkh/project
 def __init__(self, title):
     self.title = gui.Label(title)
     t = gui.Table()
     t.tr()
     self.line = gui.Input(size=49)
     self.line.connect(gui.KEYDOWN, self.lkey)
     t.td(self.line)
     main = gui.Container(width=20, height=20)
     # passing the 'height' parameter resulting in a typerror when paint was called
     gui.Dialog.__init__(self, self.title, t)
コード例 #22
0
ファイル: savegame.py プロジェクト: davidfraser/rinkhals
    def __init__(self, title_txt, button_txt, allow_new, cls="dialog"):
        self.value = None
        self.save_folder = config.config.save_folder

        self.save_games = {}
        self._populate_save_games()

        if allow_new:
            self.name_input = gui.Input()
        else:
            self.name_input = None

        td_style = {
            'padding_left': 4,
            'padding_right': 4,
            'padding_top': 2,
            'padding_bottom': 2,
        }

        self.save_list = gui.List(width=350, height=250)
        games = self.save_games.keys()
        games.sort()
        for name in games:
            self.save_list.add(name, value=name)
        self.save_list.set_vertical_scroll(0)
        self.save_list.connect(gui.CHANGE, self._save_list_change)

        self.image_container = gui.Container()

        button_ok = gui.Button(button_txt)
        button_ok.connect(gui.CLICK, self._click_ok)

        button_cancel = gui.Button("Cancel")
        button_cancel.connect(gui.CLICK, self._click_cancel)

        body = gui.Table()
        body.tr()
        body.td(self.save_list, style=td_style, colspan=2)
        body.td(self.image_container, style=td_style, colspan=2)
        body.tr()
        if self.name_input:
            body.td(gui.Label("Save as:"), style=td_style, align=1)
            body.td(self.name_input, style=td_style)
        else:
            body.td(gui.Spacer(0, 0), style=td_style, colspan=2)
        body.td(button_ok, style=td_style, align=1)
        body.td(button_cancel, style=td_style, align=1)

        title = gui.Label(title_txt, cls=cls + ".title.label")
        gui.Dialog.__init__(self, title, body)

        if games:
            self.save_list.group.value = games[0]
コード例 #23
0
ファイル: test.py プロジェクト: thaynewalker/mousetrap
 def __init__(self, tmr, delay, **params):
     params.setdefault('cls', 'dialog')
     gui.table.Table.__init__(self, **params)
     self.timer = tmr
     self.delay = delay
     self.popuptime = tmr() + self.delay
     self.opened = False
     a = random.randint(4, 10)
     b = random.randint(2, 10)
     self.tr()
     self.td(gui.Label("%dX%d" % (a, b)), align=-1, cls=self.cls + '.bar')
     #clos = gui.button.Icon(self.cls+".bar.close")
     #self.td(clos,align=1,cls=self.cls+'.bar')
     self.tr()
     self.w = gui.Input(value='', size=18)
     self.w.connect("activate", self.checkAnswer, (self.w, a, b))
     self.td(self.w)
コード例 #24
0
ファイル: gui.py プロジェクト: Mohnatcin/pyorpg-client
    def __init__(self, **params):
        gui.Table.__init__(self, **params)
        self.value = gui.Form()
        self.engine = None

        self._data = ''

        self._count = 1
        self.focused = False

        def clickChatMsg(value):
            # disable movement when chat msg is mouse clicked
            if self.focused:
                self.focused = False
            else:
                self.focused = True

            g.canMoveNow = False

        self.tr()
        self.chatMsg = gui.Input(maxlength=128, width=468, focusable=False)
        self.chatMsg.connect(gui.CLICK, clickChatMsg, None)
        self.chatMsg.connect(gui.KEYDOWN, self.lkey)
        self.td(self.chatMsg)

        self.tr()
        self.chatList = gui.Table()
        self.box = gui.ScrollArea(self.chatList,
                                  width=480,
                                  height=172,
                                  hscrollbar=False)
        self.td(self.box)

        self.tr()

        class Hack(gui.Spacer):
            def __init__(self, box):
                super(gui.Spacer, self).__init__()
                self.box = box

            def resize(self, width=None, height=None):
                self.box.set_vertical_scroll(65535)
                return 1, 1

        dirtyHack = Hack(self.box)
        self.td(dirtyHack)
コード例 #25
0
ファイル: game.py プロジェクト: AntoineMahe/python-rpg-game
def creationpopup(character):
   
    app = gui.Desktop()
    app.connect(gui.QUIT,app.quit,None)
    c = gui.Table()
    c.tr()
    c.td(gui.Label("Character creation"),colspan=4)
    c.tr()
    c.td(gui.Label("Name :"))
    w = gui.Input(value='noname',size=8)
    c.td(w,colspan=3)
    c.tr()
    def doneit():
	character.name=w.value
    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)
コード例 #26
0
    def __init__(self, **params):
        gui.Table.__init__(self, **params)

        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, 20))

        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, 20))

        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)
コード例 #27
0
    def build_background_select(self):
        background = gui.Table()
        background.td(gui.Label("Room background:"),
                      style={'padding_right': 6})
        self.background_input = gui.Input(size=16)
        inp = gui.Button('...')
        inp.connect(gui.CLICK, self.file_dialog_open, None)

        self.bckg_group = gui.Group(name='background', value='')
        t = gui.Table()
        t.tr()
        t.td(gui.Radio(self.bckg_group, value=''))
        t.td(gui.Label('None'), align=-1, style={'padding_left': 4})
        t.tr()
        t.td(gui.Radio(self.bckg_group, value='custom'))
        t.td(self.background_input, style={'padding_left': 4})
        t.td(inp, style={'padding_left': 4})

        background.td(t)

        return background
コード例 #28
0
    def __init__(self,**params):
        title = gui.Label("Save As...")

        t = gui.Table()

        self.value = gui.Form()

        t.tr()
        t.td(gui.Label("Save: "))
        t.td(gui.Input(name="fname"),colspan=3)

        t.tr()
        e = gui.Button("Okay")
        e.connect(gui.CLICK,self.send,gui.CHANGE)
        t.td(e,colspan=2)

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

        gui.Dialog.__init__(self,title,t)
コード例 #29
0
    def __init__(self, config):
        title = gui.Label("New design")
        t = gui.Table()

        t.tr()
        t.td(gui.Label("Bots:"), align=1)
        t.td(gui.Input(name="n", value=config['n'], size=4), align=-1)

        ## TODO: what here?

        t.tr()
        e = gui.Button("Okay")
        e.connect(gui.CLICK, self.send, gui.CHANGE)
        t.td(e, align=-1)

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

        self.value = None
        gui.Dialog.__init__(self, title, t)
コード例 #30
0
    def __init__(self, mainMenu, songName, score, message):
        self._mainMenu = mainMenu
        self._songName = songName
        self._score = score

        # Create the title
        titleLabel = gui.Label("Add your score")
        space = titleLabel.style.font.size(" ")

        # Create the document to put stuff in to
        width = 400
        height = 130
        document = gui.Document(width=width)

        # Create the description
        self._addText(message, space, document)

        # Create the user input label
        document.block(align=-1)
        userLabel = gui.Label('Name: ')
        document.add(userLabel)

        # Create the user input field
        self._userInput = gui.Input("Anonymous")
        document.add(self._userInput)

        # Add the Cancel button
        document.br(space[1])
        document.block(align=-1)
        cancelButton = gui.Button('Cancel')
        cancelButton.connect(gui.CLICK, self.close)
        document.add(cancelButton)

        # Add the Submit button
        submitButton = gui.Button('Submit')
        submitButton.connect(gui.CLICK, self._saveHighScore)
        document.add(submitButton)

        gui.Dialog.__init__(self, titleLabel,
                            gui.ScrollArea(document, width, height))