Exemplo n.º 1
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        self.geocoder = Geocoder()

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        self.address = TextBox()
        self.address.setText("Sydney, NSW")
        self.address.addChangeListener(self.codeAddress)

        topPanel.add(self.address)

        button = Button("Geocode")
        button.addClickListener(self.codeAddress)

        topPanel.add(button)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('600', '400')
        self.add(mapPanel, DockPanel.CENTER)

        options = MapOptions(zoom=8,
                             center=LatLng(-34.397, 150.644),
                             mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)
Exemplo n.º 2
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        self.geocoder = Geocoder()

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        self.address = TextBox()
        self.address.setText("Sydney, NSW")
        self.address.addChangeListener(self.codeAddress)

        topPanel.add(self.address)

        button = Button("Geocode")
        button.addClickListener(self.codeAddress)

        topPanel.add(button)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('600', '400')
        self.add(mapPanel, DockPanel.CENTER)

        options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644),
                           mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)
Exemplo n.º 3
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        places = {
            "chicago, il": "Chicago",

            "st louis, mo": "St Louis",
            "joplin, mo": "Joplin, MO",
            "oklahoma city, ok": "Oklahoma City",
            "amarillo, tx": "Amarillo",
            "gallup, nm": "Gallup, NM",
            "flagstaff, az": "Flagstaff, AZ",

            "winona, az": "Winona",
            "kingman, az": "Kingman",
            "barstow, ca": "Barstow",
            "san bernardino, ca": "San Bernardino",
            "los angeles, ca": "Los Angeles"}

        self.start = ListBox()
        self.end = ListBox()

        for value in places:
            self.start.addItem(places[value], value)
            self.end.addItem(places[value], value)

        self.start.addChangeListener(self.calcRoute)
        self.end.addChangeListener(self.calcRoute)

        topPanel.add(self.start)
        topPanel.add(self.end)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('800', '500')
        self.add(mapPanel, DockPanel.CENTER)

        chigado = LatLng(41.850033, -87.6500523)
        options = MapOptions(zoom=7, center=chigado,
                           mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)

        # initialize the renderer
        self.directionsDisplay = DirectionsRenderer()
        self.directionsDisplay.setMap(self.map)

        self.directionsService = DirectionsService()
Exemplo n.º 4
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        places = {
            "chicago, il": "Chicago",
            "st louis, mo": "St Louis",
            "joplin, mo": "Joplin, MO",
            "oklahoma city, ok": "Oklahoma City",
            "amarillo, tx": "Amarillo",
            "gallup, nm": "Gallup, NM",
            "flagstaff, az": "Flagstaff, AZ",
            "winona, az": "Winona",
            "kingman, az": "Kingman",
            "barstow, ca": "Barstow",
            "san bernardino, ca": "San Bernardino",
            "los angeles, ca": "Los Angeles"
        }

        self.start = ListBox()
        self.end = ListBox()

        for value in places:
            self.start.addItem(places[value], value)
            self.end.addItem(places[value], value)

        self.start.addChangeListener(self.calcRoute)
        self.end.addChangeListener(self.calcRoute)

        topPanel.add(self.start)
        topPanel.add(self.end)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('800', '500')
        self.add(mapPanel, DockPanel.CENTER)

        chigado = LatLng(41.850033, -87.6500523)
        options = MapOptions(zoom=7,
                             center=chigado,
                             mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)

        # initialize the renderer
        self.directionsDisplay = DirectionsRenderer()
        self.directionsDisplay.setMap(self.map)

        self.directionsService = DirectionsService()
Exemplo n.º 5
0
    def __init__(self, **kwargs):
        DockPanel.__init__(self, **kwargs)
        self.grid = Grid(StyleName="datagrid")
        self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
        self.header = Grid(Height="50px")
        self.add(self.header, DockPanel.NORTH)
        self.add(self.sp, DockPanel.CENTER)
        cf = self.setCellHeight(self.header, "50px")
        cf = self.setCellHeight(self.sp, "100%")

        self.sortcol = 0
Exemplo n.º 6
0
    def __init__(self, **kwargs):
        DockPanel.__init__(self, **kwargs)
        self.grid = Grid(StyleName="datagrid")
        self.sp = ScrollPanel(self.grid, Width="100%", Height="100%")
        self.header = Grid(Height="50px")
        self.add(self.header, DockPanel.NORTH)
        self.add(self.sp, DockPanel.CENTER)
        cf = self.setCellHeight(self.header, "50px")
        cf = self.setCellHeight(self.sp, "100%")

        self.sortcol = 0
Exemplo n.º 7
0
 def __init__(self):
     DockPanel.__init__(self)
     self.grids = {}
     self.g = Grid()
     self.g.setCellSpacing("0px")
     self.g.setCellPadding("8px")
     self.title = HTML(" ")
     self.title.setStyleName("rightpanel-title")
     self.add(self.title, DockPanel.NORTH)
     self.setCellWidth(self.title, "100%")
     self.setCellHorizontalAlignment(self.title,
                                     HasHorizontalAlignment.ALIGN_LEFT)
     self.add(self.g, DockPanel.CENTER)
Exemplo n.º 8
0
 def __init__(self):
     DockPanel.__init__(self)
     self.grids = {}
     self.g = Grid()
     self.g.setCellSpacing("0px")
     self.g.setCellPadding("8px")
     self.title = HTML(" ")
     self.title.setStyleName("rightpanel-title")
     self.add(self.title, DockPanel.NORTH)
     self.setCellWidth(self.title, "100%")
     self.setCellHorizontalAlignment(self.title,
                                     HasHorizontalAlignment.ALIGN_LEFT)
     self.add(self.g, DockPanel.CENTER)
Exemplo n.º 9
0
    def __init__(self, title):
        DockPanel.__init__(self)
        self.grid = FlexTable()
        title = HTML(title)
        self.add(title, DockPanel.NORTH)
        self.setCellHorizontalAlignment(title,
                                        HasHorizontalAlignment.ALIGN_LEFT)
        self.add(self.grid, DockPanel.CENTER)
        self.grid.setBorderWidth("0px")
        self.grid.setCellSpacing("0px")
        self.grid.setCellPadding("4px")

        self.formatCell(0, 0)
        self.grid.setHTML(0, 0, " ")
Exemplo n.º 10
0
    def __init__(self, title):
        DockPanel.__init__(self)
        self.grid = FlexTable()
        title = HTML(title)
        self.add(title, DockPanel.NORTH)
        self.setCellHorizontalAlignment(title,
                                        HasHorizontalAlignment.ALIGN_LEFT)
        self.add(self.grid, DockPanel.CENTER)
        self.grid.setBorderWidth("0px")
        self.grid.setCellSpacing("0px")
        self.grid.setCellPadding("4px")

        self.formatCell(0, 0)
        self.grid.setHTML(0, 0, " ")
Exemplo n.º 11
0
    def __init__(self, width, height, gametype):
        """Initialize the GameCanvas and construct the layout

        :param width:  width of the game canvas in pixels
        :type width:  int
        :param height:  height of the game canvas in pixels
        :type height:  int
        :param gametype:  type of game to be loaded
        :type gametype:  str
        """
        DockPanel.__init__(self,HorizontalAlignment=HasAlignment.ALIGN_CENTER,Spacing=10)
        
        if gametype == 'Chess':
            self.game = Chess()
            self.boardtype = self.game.boardtype
            self.images = []
            for i in self.game.pieces:
                self.images.append('./images/Chess/'+str(i.player)+str(i.name)+'.svg')
            self.images = list(set(self.images))  #eliminate duplicates
            
        self.GC = GameCanvas(width, height, self.game)
        loadImages(self.images, self)
        self.GC.addMouseListener(self)
        
        self.b = Button("Make Move", self, StyleName='teststyle')
        self.cell1 = TextBox(StyleName='boxStyle')
        self.cell2 = TextBox(StyleName='boxStyle')

        self.cellPanel = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
        self.cellPanel.add(self.cell1)
        self.cellPanel.add(self.cell2)

        self.mover = VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_CENTER)
        self.mover.add(self.cellPanel)
        self.mover.add(self.b)
    
        self.add(self.GC, DockPanel.CENTER)
        self.add(self.mover, DockPanel.EAST)
Exemplo n.º 12
0
 def __init__(self):
     DockPanel.__init__(self,
                       #BorderWidth=1,Padding=8,
                       HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                       VerticalAlignment=HasAlignment.ALIGN_MIDDLE)
Exemplo n.º 13
0
 def __init__(self):
     DockPanel.__init__(
         self,
         #BorderWidth=1,Padding=8,
         HorizontalAlignment=HasAlignment.ALIGN_CENTER,
         VerticalAlignment=HasAlignment.ALIGN_MIDDLE)