Changeset 7620483
- Timestamp:
- 05/14/12 00:31:27 (13 months ago)
- Branches:
- master
- Children:
- 67f4304
- Parents:
- 28a54b8
- git-author:
- Martin Kolman <martin.kolman@…> (05/14/12 00:31:27)
- git-committer:
- Martin Kolman <martin.kolman@…> (05/14/12 00:31:27)
- Location:
- modules/gui_modules/gui_qml
- Files:
-
- 2 edited
-
gui_qml.py (modified) (3 diffs)
-
qml/InfoPage.qml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
modules/gui_modules/gui_qml/gui_qml.py
r87cd583 r7620483 118 118 platform = Platform(self.modrana) 119 119 rc.setContextProperty("platform", platform) 120 # make the modules accessible from QML 121 modules = Modules(self.modrana) 122 rc.setContextProperty("modules", modules) 120 123 # make tile loading accessible from QML 121 124 tiles = MapTiles(self) … … 262 265 """ 263 266 version = self.modrana.paths.getVersionString() 264 if version ==None:267 if version is None: 265 268 return "unknown" 266 269 else: 267 270 return version 268 269 @QtCore.Slot(result=str)270 def getPayPalUrl(self):271 m = self.modrana.getModule("info")272 if m:273 return m.getPayPalUrl()274 else:275 # fallback to hardwired link276 return "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=martin%2ekolman%40gmail%2ecom&lc=CZ&item_name=The%20modRana%20project¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted"277 271 278 272 # @QtCore.Slot() … … 313 307 return self.modrana.dmod.getDeviceIDString() == "n900" 314 308 309 class Modules(QtCore.QObject): 310 """ 311 modRana module access from QML 312 """ 313 def __init__(self, modrana): 314 QtCore.QObject.__init__(self) 315 self.modrana = modrana 316 317 @QtCore.Slot(str, str, result=str) 318 def getS(self, moduleName, functionName): 319 return self._mCall(moduleName, functionName) 320 321 @QtCore.Slot(str, str, result=bool) 322 def getB(self, moduleName, functionName): 323 return self._mCall(moduleName, functionName) 324 325 @QtCore.Slot(str, str, result=int) 326 def getI(self, moduleName, functionName): 327 return self._mCall(moduleName, functionName) 328 329 @QtCore.Slot(str, str, result=float) 330 def getF(self, moduleName, functionName): 331 return self._mCall(moduleName, functionName) 332 333 def _mCall(self, moduleName, functionName): 334 """ 335 call the getter function for a given module 336 """ 337 m = self.modrana.getModule(moduleName, None) 338 if m: 339 try: 340 function = getattr(m, functionName) 341 result = function() 342 return result 343 except Exception, e: 344 print("QML GUI: calling function %s on module %s failed" % (functionName, moduleName)) 345 print(e) 346 return None 347 else: 348 print("QML GUI: module %s not loaded" % moduleName) 349 return None 315 350 316 351 class IconImageProvider(QDeclarativeImageProvider): -
modules/gui_modules/gui_qml/qml/InfoPage.qml
r87cd583 r7620483 47 47 onClicked : { 48 48 console.log('donation button clicked') 49 Qt.openUrlExternally( platform.getPayPalUrl())49 Qt.openUrlExternally(modules.getS("info", "getPayPalUrl")) 50 50 } 51 51 }
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/trac/gps_navigace/chrome/site/nlp-logo.png)