def setUpClass(cls): cls.explorer = OpenGeoExplorer(singletab = True) cls.cat = Catalog("http://boundless-test:8080/geoserver/rest", "admin", "geoserver") cls.catalogs = {"catalog": cls.cat} cleanCatalog(cls.cat) cls.cat.create_workspace(WORKSPACE, "http://test1.com") cls.cat.create_workspace(WORKSPACEB, "http://test2.com")
def initGui(self): actions = self.iface.mainWindow().menuBar().actions() self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle("OpenGeo") for action in actions: if action.text() == 'OpenGeo': self.menu = action.menu() break icon = QIcon(os.path.dirname(__file__) + "/images/opengeo.png") self.explorerAction = QAction(icon, "OpenGeo Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.menu.addAction(self.explorerAction) settings = QSettings() singletab = settings.value("/OpenGeo/Settings/General/SingleTabUI", True, bool) self.explorer = OpenGeoExplorer(singletab=singletab) self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) self.iface.legendInterface().itemAdded.connect( self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.connect( self.explorer.updateQgisContent) if not settings.value("/OpenGeo/Settings/General/ExplorerVisible", False, bool): self.explorer.hide() self.explorer.visibilityChanged.connect(self._explorerVisiblityChanged) icon = QIcon(os.path.dirname(__file__) + "/images/config.png") self.configAction = QAction(icon, "OpenGeo Explorer settings", self.iface.mainWindow()) self.configAction.triggered.connect(self.openSettings) self.menu.addAction(self.configAction) icon = QIcon(os.path.dirname(__file__) + "/images/help.png") self.helpAction = QAction(icon, "OpenGeo Explorer help", self.iface.mainWindow()) self.helpAction.triggered.connect(self.showHelp) self.menu.addAction(self.helpAction) menuBar = self.iface.mainWindow().menuBar() menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu)
def setUpClass(cls): cls.explorer = OpenGeoExplorer(singletab=True) cls.cat = Catalog("http://localhost:8080/geoserver/rest", "admin", "geoserver") utils.populateCatalog(cls.cat) cls.catalogItem = GsCatalogItem(cls.cat, "catalog", "") cls.explorer.explorerWidget.gsItem.addChild(cls.catalogItem) cls.catalogItem.populate() cls.tree = cls.explorer.explorerWidget.tree
def setUpClass(cls): cls.explorer = OpenGeoExplorer(singletab=True) cls.cat = utils.getGeoServerCatalog().catalog utils.populateCatalog(cls.cat) cls.catalogItem = GsCatalogItem(cls.cat, "catalog", "") cls.explorer.explorerWidget.gsItem.addChild(cls.catalogItem) cls.catalogItem.populate() cls.tree = cls.explorer.explorerWidget.tree cls.conn = utils.getPostgresConnection() cls.pgItem = PgConnectionItem(cls.conn) cls.explorer.explorerWidget.pgItem.addChild(cls.pgItem) # @TODO - make tests pass using importer cls.useRestApi = QSettings().setValue( "/OpenGeo/Settings/GeoServer/UseRestApi", True)
def initGui(self): actions = self.iface.mainWindow().menuBar().actions() self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle("OpenGeo") for action in actions: if action.text() == 'OpenGeo': self.menu = action.menu() break icon = QIcon(os.path.dirname(__file__) + "/images/opengeo.png") self.explorerAction = QAction(icon, "OpenGeo Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.menu.addAction(self.explorerAction) settings = QSettings() singletab = settings.value("/OpenGeo/Settings/General/SingleTabUI", True, bool) self.explorer = OpenGeoExplorer(singletab = singletab) self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) self.iface.legendInterface().itemAdded.connect(self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.connect(self.explorer.updateQgisContent) self.iface.legendInterface().groupRelationsChanged.connect(self.explorer.updateQgisContent) self.iface.projectRead.connect(self.explorer.updateQgisContent) self.iface.newProjectCreated.connect(self.explorer.updateQgisContent) if not settings.value("/OpenGeo/Settings/General/ExplorerVisible", False, bool): self.explorer.hide() self.explorer.visibilityChanged.connect(self._explorerVisiblityChanged) icon = QIcon(os.path.dirname(__file__) + "/images/config.png") self.configAction = QAction(icon, "OpenGeo Explorer settings", self.iface.mainWindow()) self.configAction.triggered.connect(self.openSettings) self.menu.addAction(self.configAction) icon = QIcon(os.path.dirname(__file__) + "/images/help.png") self.helpAction = QAction(icon, "OpenGeo Explorer help", self.iface.mainWindow()) self.helpAction.triggered.connect(self.showHelp) self.menu.addAction(self.helpAction) menuBar = self.iface.mainWindow().menuBar() menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu)
class GroupDialogTests(ExplorerIntegrationTest): explorer = OpenGeoExplorer(singletab=True) def testGroupDialogWithEmptyName(self): dialog = LayerGroupDialog(self.cat) dialog.nameBox.setText("") okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) self.assertIsNone(dialog.group) self.assertEquals("QLineEdit{background: yellow}", dialog.nameBox.styleSheet()) def testGroupDialogWithNameContaingBlankSpaces(self): dialog = LayerGroupDialog(self.cat) dialog.nameBox.setText("my group") dialog.table.cellWidget(0, 0).setChecked(True) okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) self.assertIsNotNone(dialog.group) self.assertEquals("my_group", dialog.group.name) def testSelectAllButton(self): dialog = LayerGroupDialog(self.cat) QTest.mouseClick(dialog.selectAllButton, Qt.LeftButton) for i in range(dialog.table.rowCount()): self.assertTrue(dialog.table.cellWidget(i, 0).isChecked()) QTest.mouseClick(dialog.selectAllButton, Qt.LeftButton) for i in range(dialog.table.rowCount()): self.assertFalse(dialog.table.cellWidget(i, 0).isChecked()) def testCannotEditName(self): group = self.cat.get_layergroup(GROUP) self.assertIsNotNone(group) dialog = LayerGroupDialog(self.cat, group) self.assertFalse(dialog.nameBox.isEnabled())
def initGui(self): self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle("OpenGeo") icon = QIcon(os.path.dirname(__file__) + "/images/opengeo.png") self.explorerAction = QAction(icon, "OpenGeo Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.menu.addAction(self.explorerAction) icon = QIcon(os.path.dirname(__file__) + "/images/config.png") self.configAction = QAction(icon, "Settings", self.iface.mainWindow()) self.configAction.triggered.connect(self.openSettings) self.menu.addAction(self.configAction) menuBar = self.iface.mainWindow().menuBar() menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu) settings = QSettings() singletab = settings.value("/OpenGeo/Settings/General/SingleTabUI", True, bool) self.explorer = OpenGeoExplorer(singletab = singletab) self.explorer.hide() self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) self.iface.legendInterface().itemAdded.connect(self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.connect(self.explorer.updateQgisContent)
class OpenGeoPlugin: def __init__(self, iface): self.iface = iface config.iface = iface def unload(self): self.menu.deleteLater() self.iface.legendInterface().itemAdded.disconnect( self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.disconnect( self.explorer.updateQgisContent) def initGui(self): actions = self.iface.mainWindow().menuBar().actions() self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle("OpenGeo") for action in actions: if action.text() == 'OpenGeo': self.menu = action.menu() break icon = QIcon(os.path.dirname(__file__) + "/images/opengeo.png") self.explorerAction = QAction(icon, "OpenGeo Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.menu.addAction(self.explorerAction) settings = QSettings() singletab = settings.value("/OpenGeo/Settings/General/SingleTabUI", True, bool) self.explorer = OpenGeoExplorer(singletab=singletab) self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) self.iface.legendInterface().itemAdded.connect( self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.connect( self.explorer.updateQgisContent) if not settings.value("/OpenGeo/Settings/General/ExplorerVisible", False, bool): self.explorer.hide() self.explorer.visibilityChanged.connect(self._explorerVisiblityChanged) icon = QIcon(os.path.dirname(__file__) + "/images/config.png") self.configAction = QAction(icon, "OpenGeo Explorer settings", self.iface.mainWindow()) self.configAction.triggered.connect(self.openSettings) self.menu.addAction(self.configAction) icon = QIcon(os.path.dirname(__file__) + "/images/help.png") self.helpAction = QAction(icon, "OpenGeo Explorer help", self.iface.mainWindow()) self.helpAction.triggered.connect(self.showHelp) self.menu.addAction(self.helpAction) menuBar = self.iface.mainWindow().menuBar() menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu) def _explorerVisiblityChanged(self, visible): settings = QSettings() settings.setValue("/OpenGeo/Settings/General/ExplorerVisible", visible) def showHelp(self): HELP_URL = "http://qgis.boundlessgeo.com/static/docs/index.html" webbrowser.open(HELP_URL) def openExplorer(self): self.explorer.updateQgisContent() self.explorer.show() def openSettings(self): dlg = ConfigDialog(self.explorer) dlg.exec_()
class CreateCatalogDialogTests(unittest.TestCase): explorer = OpenGeoExplorer(singletab = True) def setUp(self): self.cat = getGeoServerCatalog() def testCreateCatalogDialog(self): dialog = DefineCatalogDialog(self.explorer) dialog.nameBox.setText("name") dialog.urlBox.setText("http://boundless-test:8080/geoserver") dialog.passwordBox.setText("password") dialog.usernameBox.setText("username") okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) self.assertTrue(dialog.ok) self.assertEquals("username", dialog.username) self.assertEquals("password", dialog.password) self.assertEquals("name", dialog.name) self.assertEquals("http://boundless-test:8080/geoserver/rest", dialog.url) settings = QSettings() settings.endGroup() settings.beginGroup("/OpenGeo/GeoServer/name") settings.remove("") settings.endGroup() def testCreateCatalogDialogWithUrlWithoutProtocol(self): dialog = DefineCatalogDialog(self.explorer) dialog.nameBox.setText("name") dialog.urlBox.setText("boundless-test:8080/geoserver") dialog.passwordBox.setText("password") dialog.usernameBox.setText("username") okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) self.assertTrue(dialog.ok) self.assertEquals("username", dialog.username) self.assertEquals("password", dialog.password) self.assertEquals("name", dialog.name) self.assertEquals("http://boundless-test:8080/geoserver/rest", dialog.url) settings = QSettings() settings.endGroup() settings.beginGroup("/OpenGeo/GeoServer/name") settings.remove("") settings.endGroup() def testCreateCatalogDialogUsingExistingName(self): self.explorer.catalogs()["name"] = self.cat dialog = DefineCatalogDialog(self.explorer) dialog.nameBox.setText("name") okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) self.assertEquals("name_2", dialog.name) settings = QSettings() settings.beginGroup("/OpenGeo/GeoServer/name") settings.remove("") settings.endGroup() settings.beginGroup("/OpenGeo/GeoServer/name_2") settings.remove("") settings.endGroup() del self.explorer.catalogs()["name"] def testLastCatalogNameIsShownByDefault(self): dialog = DefineCatalogDialog(self.explorer) dialog.nameBox.setText("catalogname") dialog.urlBox.setText("boundless-test:8081/geoserver") okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) self.assertTrue(dialog.ok) self.assertEquals("catalogname", dialog.name) self.assertEquals("http://boundless-test:8081/geoserver/rest", dialog.url) dialog = DefineCatalogDialog(self.explorer) self.assertEquals("catalogname", dialog.nameBox.text()) self.assertEquals("boundless-test:8081/geoserver", dialog.urlBox.text()) okWidget = dialog.buttonBox.button(dialog.buttonBox.Ok) QTest.mouseClick(okWidget, Qt.LeftButton) settings = QSettings() settings.endGroup() settings.beginGroup("/OpenGeo/GeoServer/catalogname") settings.remove("") settings.endGroup()
def setUpClass(cls): cls.explorer = OpenGeoExplorer(singletab = True) cls.conn1 = getPostgresConnection("conn1") cls.conn2 = getPostgresConnection("conn2") cls.toImport = [layers.resolveLayer(PT1)]
def setUpClass(cls): cls.conn = getPostgresConnection() cls.explorer = OpenGeoExplorer(singletab=True) cls.tree = cls.explorer.explorerWidget.tree
class OpenGeoPlugin: def __init__(self, iface): self.iface = iface config.iface = iface def unload(self): self.menu.deleteLater() self.iface.legendInterface().itemAdded.disconnect(self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.disconnect(self.explorer.updateQgisContent) self.iface.legendInterface().groupRelationsChanged.disconnect(self.explorer.updateQgisContent) self.iface.projectRead.connect(self.explorer.updateQgisContent) self.iface.newProjectCreated.connect(self.explorer.updateQgisContent) pem.removePkiTempFiles(self.explorer.catalogs()) self.explorer.deleteLater() def initGui(self): actions = self.iface.mainWindow().menuBar().actions() self.menu = QMenu(self.iface.mainWindow()) self.menu.setTitle("OpenGeo") for action in actions: if action.text() == 'OpenGeo': self.menu = action.menu() break icon = QIcon(os.path.dirname(__file__) + "/images/opengeo.png") self.explorerAction = QAction(icon, "OpenGeo Explorer", self.iface.mainWindow()) self.explorerAction.triggered.connect(self.openExplorer) self.menu.addAction(self.explorerAction) settings = QSettings() singletab = settings.value("/OpenGeo/Settings/General/SingleTabUI", True, bool) self.explorer = OpenGeoExplorer(singletab = singletab) self.iface.addDockWidget(Qt.RightDockWidgetArea, self.explorer) self.iface.legendInterface().itemAdded.connect(self.explorer.updateQgisContent) self.iface.legendInterface().itemRemoved.connect(self.explorer.updateQgisContent) self.iface.legendInterface().groupRelationsChanged.connect(self.explorer.updateQgisContent) self.iface.projectRead.connect(self.explorer.updateQgisContent) self.iface.newProjectCreated.connect(self.explorer.updateQgisContent) if not settings.value("/OpenGeo/Settings/General/ExplorerVisible", False, bool): self.explorer.hide() self.explorer.visibilityChanged.connect(self._explorerVisiblityChanged) icon = QIcon(os.path.dirname(__file__) + "/images/config.png") self.configAction = QAction(icon, "OpenGeo Explorer settings", self.iface.mainWindow()) self.configAction.triggered.connect(self.openSettings) self.menu.addAction(self.configAction) icon = QIcon(os.path.dirname(__file__) + "/images/help.png") self.helpAction = QAction(icon, "OpenGeo Explorer help", self.iface.mainWindow()) self.helpAction.triggered.connect(self.showHelp) self.menu.addAction(self.helpAction) menuBar = self.iface.mainWindow().menuBar() menuBar.insertMenu(self.iface.firstRightStandardMenu().menuAction(), self.menu) def _explorerVisiblityChanged(self, visible): settings = QSettings() settings.setValue("/OpenGeo/Settings/General/ExplorerVisible", visible) def showHelp(self): HELP_URL = "http://qgis.boundlessgeo.com/static/docs/index.html" webbrowser.open(HELP_URL) def openExplorer(self): self.explorer.updateQgisContent() self.explorer.show() def openSettings(self): dlg = ConfigDialog(self.explorer) dlg.exec_()