示例#1
0
文件: Polygon.py 项目: d3vgru/pyjs
def PolygonOptions(adict):
    """Accepts a dictionary of options. If necessary, transforms "paths" from
    python list or encoded string to javascript array."""
    if adict.has_key("paths"):
        try:
            if isinstance(adict["paths"], (list, tuple)):
                adict["paths"] = listToJs(adict["paths"])
            elif isinstance(adict["paths"], basestring):  #Gmaps
                adict["paths"] = decodePoly(adict["paths"])
        except:  #isinstance throws exception for raw javascript objects.
            pass  #That means it's already good.
    return dictToJs(adict)
示例#2
0
def PolygonOptions(adict):
    """Accepts a dictionary of options. If necessary, transforms "paths" from
    python list or encoded string to javascript array."""
    if adict.has_key("paths"):
        try:
            if isinstance(adict["paths"], (list, tuple)):
                adict["paths"] = listToJs(adict["paths"])
            elif isinstance(adict["paths"], basestring):  # Gmaps
                adict["paths"] = decodePoly(adict["paths"])
        except:  # isinstance throws exception for raw javascript objects.
            pass  # That means it's already good.
    return dictToJs(adict)
def GeocoderRequest(**params):
    return dictToJs(params)
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __pyjamas__ import JS

from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs #, gmapsPyObjectToJs


GeocoderStatus = JS("$wnd.google.maps.GeocoderStatus")
GeocoderLocationType = JS("$wnd.google.maps.GeocoderLocationType")


geocoderResultsFields = dictToJs(
    {"results": 'l', "types": 'l', "address_components": 'l',
     "results[]": 'd', "address_components[]": 'd', "geometry": 'd',
     "result": 'd'})


# translates a geocoderResults structure from js to python
# and vice-versa

def translateGeocoderResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    geocoderResultsFields, pyToJs)


# translates just one element of the geocoderResults
# (because it is used inside directionsResults...)
def translateGeocoderResult(jsResult, pyToJs=False):
    return translateGmapsObject(jsResult, "result", \
示例#5
0
def InfoWindowOptions(**params):
    return dictToJs(params)
示例#6
0
文件: Map.py 项目: anandology/pyjamas
def NavigationControlOptions(**params):
    return dictToJs(params)
示例#7
0
def DirectionsRequest(**params):
    return dictToJs(params)
示例#8
0
文件: Marker.py 项目: Afey/pyjs
def MarkerOptions(**params):
    return dictToJs(params)
示例#9
0
def DirectionsRendererOptions(**params):
    return dictToJs(params)
示例#10
0
def ScaleControlOptions(**params):
    return dictToJs(params)
示例#11
0
def NavigationControlOptions(**params):
    return dictToJs(params)
示例#12
0
def MapTypeControlOptions(**params):
    return dictToJs(params)
示例#13
0
def MapOptions(**params):
    return dictToJs(params)
示例#14
0
文件: Map.py 项目: anandology/pyjamas
def ScaleControlOptions(**params):
    return dictToJs(params)
示例#15
0
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __pyjamas__ import JS

from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs  #, gmapsPyObjectToJs

GeocoderStatus = JS("$wnd['google']['maps']['GeocoderStatus']")
GeocoderLocationType = JS("$wnd['google']['maps']['GeocoderLocationType']")

geocoderResultsFields = dictToJs({
    "results": 'l',
    "types": 'l',
    "address_components": 'l',
    "results[]": 'd',
    "address_components[]": 'd',
    "geometry": 'd',
    "result": 'd'
})

# translates a geocoderResults structure from js to python
# and vice-versa


def translateGeocoderResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    geocoderResultsFields, pyToJs)


# translates just one element of the geocoderResults
示例#16
0
def GeocoderRequest(**params):
    return dictToJs(params)
示例#17
0
from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs
from pyjamas.gmaps.Geocoder import translateGeocoderResult

DirectionsStatus = JS("$wnd.google.maps.DirectionsStatus")

DirectionsTravelMode = JS("$wnd.google.maps.DirectionsTravelMode")

DirectionsUnitSystem = JS("$wnd.google.maps.DirectionsUnitSystem")

directionsResultsFields = dictToJs({
    "trips": 'l',
    "warnings": 'l',
    "routes": 'l',
    "steps": 'l',
    "results": 'd',
    "trips[]": 'd',
    "routes[]": 'd',
    "steps[]": 'd',
    "start_geocode": translateGeocoderResult,
    "end_geocode": translateGeocoderResult
})

# translates a directions results structure from js to python
# and vice-versa


def translateDirectionsResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    directionsResultsFields, pyToJs)

示例#18
0
from pyjamas.gmaps.Utils import translateGmapsObject, dictToJs
from pyjamas.gmaps.Geocoder import translateGeocoderResult


DirectionsStatus = JS("$wnd.google.maps.DirectionsStatus")


DirectionsTravelMode = JS("$wnd.google.maps.DirectionsTravelMode")


DirectionsUnitSystem = JS("$wnd.google.maps.DirectionsUnitSystem")


directionsResultsFields = dictToJs(
    {"trips": 'l', "warnings": 'l', "routes": 'l', "steps": 'l',
    "results": 'd', "trips[]": 'd', "routes[]": 'd', "steps[]": 'd',

    "start_geocode": translateGeocoderResult,
    "end_geocode": translateGeocoderResult})


# translates a directions results structure from js to python
# and vice-versa


def translateDirectionsResults(jsResults, pyToJs=False):
    return translateGmapsObject(jsResults, "results", \
                                    directionsResultsFields, pyToJs)


class DirectionsService:
示例#19
0
def DirectionsRequest(**params):
    return dictToJs(params)
示例#20
0
def DirectionsRendererOptions(**params):
    return dictToJs(params)
示例#21
0
文件: Map.py 项目: anandology/pyjamas
def MapTypeControlOptions(**params):
    return dictToJs(params)