| Line | |
|---|
| 1 | #
|
|---|
| 2 | # HelloWorld.py - displays the number of actually open layers
|
|---|
| 3 | #
|
|---|
| 4 | from javax.swing import JOptionPane
|
|---|
| 5 | from org.openstreetmap.josm import Main
|
|---|
| 6 |
|
|---|
| 7 | def getMapView():
|
|---|
| 8 | if Main.main == None:
|
|---|
| 9 | return None
|
|---|
| 10 | if Main.main.map == None:
|
|---|
| 11 | return None
|
|---|
| 12 | return Main.main.map.mapView
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | numlayers = 0
|
|---|
| 16 | mv = getMapView()
|
|---|
| 17 | if mv != None:
|
|---|
| 18 | numlayers = mv.getNumLayers()
|
|---|
| 19 |
|
|---|
| 20 | JOptionPane.showMessageDialog(Main.parent, "[Python] Hello World! You have %s layer(s)." % numlayers)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.