skylarkdrones / pyqtlet

pyqtlet brings Leaflet maps to PyQt5.
Other
30 stars 8 forks source link

create map with options #24

Open goodsw4all opened 5 years ago

goodsw4all commented 5 years ago

Hi, @samhattangady

First of all, Thanks for your great work. it helps me a lot. I just found a problem when creating MAP with options, it did nothing. I guess the problem is that options in jsObject has single-quote. So I tried modifying below, it seems to work. (FYI : I'm not good at javascript and python)

Have a good day

    def _initJs(self):
        jsObject = 'L.map("map"'
        if self.options:
            jsObject += ', {options}'.format(options=self._stringifyForJs(self.options))
        jsObject += ')'
        # Unless remove single quote, options doesn't work
        jsObject = jsObject.replace('\'', '')
        print(jsObject)
        self._createJsObject(jsObject)
samhattangady commented 5 years ago

Thanks for this. I will look into it.