def __init__(self, explorer): QtGui.QWidget.__init__(self, None) self.explorer = explorer self.projectItem = QgsProjectItem() verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) self.toptoolbar = QtGui.QToolBar() self.toptoolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) verticalLayout.addWidget(self.toptoolbar) self.tree = ExplorerTreeWidget(self.explorer) verticalLayout.addWidget(self.tree) actions = self.projectItem.contextMenuActions(self.tree, explorer) for action in actions: self.toptoolbar.addAction(action) self.toolbar = QtGui.QToolBar() self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) layersIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/layer.png") self.layersAction = QtGui.QAction(layersIcon, "Layers", explorer) self.layersAction.triggered.connect(self.showLayers) stylesIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/style.png") self.stylesAction = QtGui.QAction(stylesIcon, "Styles", explorer) self.stylesAction.triggered.connect(self.showStyles) groupsIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/group.gif") self.groupsAction = QtGui.QAction(groupsIcon, "Groups", explorer) self.groupsAction.triggered.connect(self.showGroups) self.toolbar.addAction(self.layersAction) self.toolbar.addAction(self.stylesAction) self.toolbar.addAction(self.groupsAction) verticalLayout.addWidget(self.toolbar) self.setLayout(verticalLayout) self.lastAction = None self.layersAction.trigger()
def __init__(self, explorer): QtGui.QWidget.__init__(self, None) self.explorer = explorer self.connectionsItem = PgConnectionsItem() self.connection = None verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) horizontalLayout = QtGui.QHBoxLayout() horizontalLayout.setSpacing(2) horizontalLayout.setMargin(0) self.comboBox = QtGui.QComboBox() self.comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.comboBox.currentIndexChanged.connect(self.connectionHasChanged) horizontalLayout.addWidget(self.comboBox) self.addButton = QtGui.QPushButton() self.addButton.clicked.connect(lambda: self.addConnection(explorer)) addIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/add.png") self.addButton.setIcon(addIcon) self.addButton.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) self.refreshButton = QtGui.QPushButton() self.refreshButton.clicked.connect(self.refreshContent) refreshIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/refresh.png") self.refreshButton.setIcon(refreshIcon) self.refreshButton.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) horizontalLayout.addWidget(self.refreshButton) horizontalLayout.addWidget(self.addButton) verticalLayout.addLayout(horizontalLayout) self.tree = ExplorerTreeWidget(self.explorer) verticalLayout.addWidget(self.tree) self.setLayout(verticalLayout) self.populateComboBox() if self.connection is not None and self.connection.isValid: self.refreshContent()
def __init__(self, explorer, singletab=False): self.explorer = explorer self.singletab = singletab QtGui.QWidget.__init__(self, None) self.qgsItem = None verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) if singletab: self.tree = ExplorerTreeWidget(explorer) verticalLayout.addWidget(self.tree) else: self.tabbedPanel = QtGui.QTabWidget() self.tabbedPanel.setVisible(True) verticalLayout.addWidget(self.tabbedPanel) self.setLayout(verticalLayout) self.fillData()
def __init__(self, explorer): QtGui.QWidget.__init__(self, None) self.explorer = explorer self.catalogs = {} verticalLayout = QtGui.QVBoxLayout() verticalLayout.setSpacing(2) verticalLayout.setMargin(0) horizontalLayout = QtGui.QHBoxLayout() horizontalLayout.setSpacing(2) horizontalLayout.setMargin(0) self.comboBox = QtGui.QComboBox() self.comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.comboBox.currentIndexChanged.connect(self.catalogHasChanged) horizontalLayout.addWidget(self.comboBox) self.addButton = QtGui.QPushButton() self.addButton.clicked.connect(lambda: self.addCatalog(explorer)) addIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/add.png") self.addButton.setIcon(addIcon) self.addButton.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) self.refreshButton = QtGui.QPushButton() self.refreshButton.clicked.connect(self.refreshContent) refreshIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/refresh.png") self.refreshButton.setIcon(refreshIcon) self.refreshButton.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) self.refreshButton.setEnabled(False) horizontalLayout.addWidget(self.refreshButton) horizontalLayout.addWidget(self.addButton) verticalLayout.addLayout(horizontalLayout) self.toptoolbar = QtGui.QToolBar() self.toptoolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self.toptoolbar.setVisible(False) verticalLayout.addWidget(self.toptoolbar) self.tree = ExplorerTreeWidget(self.explorer) verticalLayout.addWidget(self.tree) self.toolbar = QtGui.QToolBar() self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) layersIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/layer.png") self.layersAction = QtGui.QAction(layersIcon, "Layers", explorer) self.layersAction.triggered.connect(lambda: self.toggleVisibility( (GsLayerItem), self.containerItems[0].contextMenuActions( self.tree, self.explorer))) workspacesIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/workspace.png") self.workspacesAction = QtGui.QAction(workspacesIcon, "Workspaces", explorer) self.workspacesAction.triggered.connect(lambda: self.toggleVisibility( (GsWorkspaceItem), self.containerItems[1].contextMenuActions( self.tree, self.explorer))) stylesIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/style.png") self.stylesAction = QtGui.QAction(stylesIcon, "Styles", explorer) self.stylesAction.triggered.connect(lambda: self.toggleVisibility( (GsStyleItem), self.containerItems[2].contextMenuActions( self.tree, self.explorer))) groupsIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/group.gif") self.groupsAction = QtGui.QAction(groupsIcon, "Groups", explorer) self.groupsAction.triggered.connect(lambda: self.toggleVisibility( (GsGroupItem), self.containerItems[3].contextMenuActions( self.tree, self.explorer))) gwcIcon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/gwc.png") self.gwcAction = QtGui.QAction(gwcIcon, "GeoWebCache", explorer) self.gwcAction.triggered.connect(lambda: self.toggleVisibility( (GwcLayerItem), self.containerItems[4].contextMenuActions( self.tree, self.explorer))) wpsIcon = QtGui.QIcon( os.path.dirname(__file__) + "/../images/process.png") self.wpsAction = QtGui.QAction(wpsIcon, "Processes", explorer) self.wpsAction.triggered.connect(lambda: self.toggleVisibility( (GsProcessItem), self.containerItems[5].contextMenuActions( self.tree, self.explorer))) self.layersAction.setEnabled(False) self.workspacesAction.setEnabled(False) self.stylesAction.setEnabled(False) self.groupsAction.setEnabled(False) self.gwcAction.setEnabled(False) self.wpsAction.setEnabled(False) self.updateActionButtons() verticalLayout.addWidget(self.toolbar) self.setLayout(verticalLayout)