Esempio n. 1
0
def QGIS(request):
    app = QGIS.init()
    def fin():
        print ("teardown QGIS")
        QgsApplication.exitQgis()

    request.addfinalizer(fin)
    return app  # provide the fixture value
Esempio n. 2
0
import os
import sys
import data

from parfait import render_template, map_layers, open_project, QGIS, load_vector, add_layer


app = QGIS.init()

def test_open_project():
    pfile = data.test_file("project.qgs")
    with open_project(pfile) as project:
        layers = map_layers("points")
        assert len(layers) == 1
        assert layers[0].name() == "points"

def test_load_layer():
    filename = data.test_file("points.shp")
    layer = load_vector(filename)
    assert layer.name() == os.path.basename(filename)
    assert layer.source() == filename
    assert layer.isValid()
Esempio n. 3
0
    screen.refresh()

    global scr, pad, aboutwindow, legendwindow, mapwindow, modeline
    scr = screen
    pad = EditPad()
    modeline = ModeLine()
    mapwindow = Map()
    legendwindow = Legend()
    aboutwindow = AboutWindow()

    legendwindow.render_legend()
    mapwindow.render_map()

    screen.addstr(0, 0, "ASCII")
    screen.addstr(0, 5, " QGIS Enterprise", curses.color_pair(4))
    screen.refresh()

    if config.get('showhelp', True):
        show_help()

    pad.focus()


app = QGIS.init(guienabled=False)

if __name__ == "__main__":
    logging.info("Staring QGIS ASCII :)")
    logging.info("ASCII QGIS because we can")
    curses.wrapper(main)
Esempio n. 4
0
import os
import sys
import data

from parfait import render_template, map_layers, open_project, QGIS, load_vector, add_layer

app = QGIS.init()


def test_open_project():
    pfile = data.test_file("project.qgs")
    with open_project(pfile) as project:
        layers = map_layers("points")
        assert len(layers) == 1
        assert layers[0].name() == "points"


def test_load_layer():
    filename = data.test_file("points.shp")
    layer = load_vector(filename)
    assert layer.name() == os.path.basename(filename)
    assert layer.source() == filename
    assert layer.isValid()
Esempio n. 5
0
        except KeyError:
            update_cmd_status("Unknown command: {}".format(message), colors['red'])
            continue

        global lastcmd
        lastcmd = message

        func = cmd()
        if not func:
            update_cmd_status(entercommandstr)
            continue

        try:
            qanda = func.send(None)
            while True:
                edit.clear()
                update_cmd_status(qanda.question, color=curses.color_pair(qanda.type))
                message = pad.edit(validate=handle_key_event).strip()
                qanda = func.send(message)
        except StopIteration:
            edit.clear()
            edit.refresh()
            update_cmd_status(entercommandstr)

app = QGIS.init(guienabled=False)

if __name__ == "__main__":
    logging.info("Staring QGIS ASCII :)")
    logging.info("ASCII QGIS because we can")
    curses.wrapper(main)