def __init__(self, title='Untitled', parent_win=None, win_flag=None): if parent_win is not None and win_flag is None: win_flag = QtCore.Qt.Dialog QFrame.__init__(self) if parent_win is None else QFrame.__init__( self, parent_win, win_flag) # self.setObjectName(self.__class__.__name__) layout = QVBoxLayout() self.setLayout(layout) if conf.PYFORMS_USE_QT5: layout.setContentsMargins(0, 0, 0, 0) else: layout.setMargin(0) self.title = title self.has_progress = False self._mainmenu = [] self._splitters = [] self._tabs = [] self._formset = None self._formLoaded = False self.uid = id(self) self.setAccessibleName('BaseWidget')
def init_form(self): self._form = QWidget() layout = QVBoxLayout() layout.setMargin(0) if conf.PYFORMS_USE_QT5: layout.setContentsMargins(0, 0, 0, 0) else: layout.setMargin(0) self._form.setLayout(layout) self._app = vv.use('pyqt4') self._app.Create() self._first = True Figure = self._app.GetFigureClass() self._fig = Figure(self._form) vv.figure(self._fig.nr) policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) widget = self._fig._widget widget.setSizePolicy(policy) widget.setMinimumSize(100, 100) layout.addWidget(widget) self._colorMap = vv.CM_AUTUMN self._colors_limits = None
def init_form(self): vlayout = QVBoxLayout() if conf.PYFORMS_USE_QT5: vlayout.setContentsMargins(0,0,0,0) else: vlayout.setMargin(0) self.setLayout(vlayout) self._scroll = QScrollBar(QtCore.Qt.Horizontal) scrollarea = QScrollArea() scrollarea.setMinimumHeight(140) scrollarea.setWidgetResizable(True) self._events_widget = EventsWidget(scroll=self._scroll) scrollarea.setWidget(self._events_widget) self._scroll.actionTriggered.connect(self.__scroll_changed) vlayout.addWidget(scrollarea) # The timeline widget vlayout.addWidget(self._scroll) # Add scroll self._scroll.setMaximum(0) self._scroll.setSliderPosition(0)
class Ui_ChooseSlot(object): def setupUi(self, ChooseSlot, buttonlabels): ChooseSlot.setObjectName("ChooseSlot") ChooseSlot.setWindowModality(Qt.ApplicationModal) sizePolicy = QSizePolicy(QSizePolicy.Policy(0), QSizePolicy.Policy(0)) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( ChooseSlot.sizePolicy().hasHeightForWidth()) ChooseSlot.setSizePolicy(sizePolicy) self.vboxlayout = QVBoxLayout(ChooseSlot) self.vboxlayout.setMargin(9) self.vboxlayout.setSpacing(6) self.vboxlayout.setObjectName("vboxlayout") self.vboxlayout1 = QVBoxLayout() self.vboxlayout1.setMargin(9) self.vboxlayout1.setSpacing(6) self.vboxlayout1.setObjectName("vboxlayout1") self.Label = QLabel(ChooseSlot) self.Label.setObjectName("Label") self.vboxlayout1.addWidget(self.Label) self.Buttons = [] for button in buttonlabels: self.Buttons.append(QRadioButton(ChooseSlot)) self.Buttons[-1].setObjectName("Button[%d]" % (len(self.Buttons) - 1)) self.Buttons[-1].setText( QApplication.translate("ChooseSlot", button, None, QApplication.UnicodeUTF8)) self.vboxlayout1.addWidget(self.Buttons[-1]) if len(self.Buttons): self.Buttons[0].setChecked(Qt.Checked) self.vboxlayout.addLayout(self.vboxlayout1) self.buttonBox = QDialogButtonBox(ChooseSlot) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.vboxlayout.addWidget(self.buttonBox) self.retranslateUi(ChooseSlot) ChooseSlot.resize(ChooseSlot.minimumSizeHint()) QMetaObject.connectSlotsByName(ChooseSlot) def retranslateUi(self, ChooseSlot): ChooseSlot.setWindowTitle( QApplication.translate("ChooseSlot", "Choose Slot", None, QApplication.UnicodeUTF8)) self.Label.setText( QApplication.translate("ChooseSlot", "Add Item to Slot", None, QApplication.UnicodeUTF8))
def __init__(self, parent): super().__init__(parent) self.config_widget = ConfigDialog() layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setMargin(0) self.setLayout(layout) layout.addWidget(self.config_widget) self.setObjectName('widgetOptions')
def __init__(self, parent, settings): super(ConfigOptionsPage, self).__init__(parent) self.settings = settings self.config_widget = ConfigDialog(self.settings) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setMargin(0) self.setLayout(layout) layout.addWidget(self.config_widget) self.setObjectName('GeoAtlasOptions')
def __init__(self, label='', default=None): QWidget.__init__(self) layout = QVBoxLayout() if conf.PYFORMS_USE_QT5: layout.setContentsMargins(0, 0, 0, 0) else: layout.setMargin(0) self.form.setLayout(layout) ControlBase.__init__(self, label) self.value = default
def __init__(self, quad): QWidget.__init__(self) self.setMouseTracking(True) self.quad = quad self.nameLabel = QLabel( f'<b>{quad[ID]}</b><br><span style="color:grey;">' f'{quad[PERCENT_COVERED]} % covered</span>') self.iconLabel = QLabel() pixmap = QPixmap(PLACEHOLDER_THUMB, 'SVG') thumb = pixmap.scaled(48, 48, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) self.iconLabel.setPixmap(thumb) self.checkBox = QCheckBox("") self.checkBox.stateChanged.connect(self.check_box_state_changed) layout = QHBoxLayout() layout.setMargin(0) layout.addWidget(self.checkBox) vlayout = QVBoxLayout() vlayout.setMargin(0) vlayout.addWidget(self.iconLabel) self.iconWidget = QWidget() self.iconWidget.setFixedSize(48, 48) self.iconWidget.setLayout(vlayout) layout.addWidget(self.iconWidget) layout.addWidget(self.nameLabel) layout.addStretch() self.setLayout(layout) download_thumbnail(quad[LINKS][THUMBNAIL], self) self.footprint = QgsRubberBand(iface.mapCanvas(), QgsWkbTypes.PolygonGeometry) self.footprint.setFillColor(QUADS_AOI_COLOR) self.footprint.setStrokeColor(QUADS_AOI_COLOR) self.footprint.setWidth(2) self.footprintfill = QgsRubberBand(iface.mapCanvas(), QgsWkbTypes.PolygonGeometry) self.footprintfill.setFillColor(QUADS_AOI_BODY_COLOR) self.footprintfill.setWidth(0) self.update_footprint_brush() self.hide_solid_interior() self.show_footprint() self.setStyleSheet( "QuadInstanceItemWidget{border: 2px solid transparent;}")
def __init__(self, mosaic): QWidget.__init__(self) self.mosaic = mosaic title = mosaic_title(mosaic) self.nameLabel = QLabel( f'<span style="color:black;"><b>{title}</b></span>' f'<br><span style="color:grey;">{mosaic[NAME]}</span>') self.iconLabel = QLabel() self.toolsButton = QLabel() self.toolsButton.setPixmap(COG_ICON.pixmap(QSize(18, 18))) self.toolsButton.mousePressEvent = self.showContextMenu pixmap = QPixmap(PLACEHOLDER_THUMB, "SVG") thumb = pixmap.scaled(48, 48, Qt.KeepAspectRatio, Qt.SmoothTransformation) self.iconLabel.setPixmap(thumb) self.checkBox = QCheckBox("") self.checkBox.stateChanged.connect(self.basemapSelected.emit) layout = QHBoxLayout() layout.setMargin(2) layout.addWidget(self.checkBox) vlayout = QVBoxLayout() vlayout.setMargin(0) vlayout.addWidget(self.iconLabel) self.iconWidget = QWidget() self.iconWidget.setFixedSize(48, 48) self.iconWidget.setLayout(vlayout) layout.addWidget(self.iconWidget) layout.addWidget(self.nameLabel) layout.addStretch() layout.addWidget(self.toolsButton) layout.addSpacing(10) self.setLayout(layout) if THUMB in mosaic[LINKS]: download_thumbnail(mosaic[LINKS][THUMB], self) else: THUMBNAIL_DEFAULT_URL = ( "https://tiles.planet.com/basemaps/v1/planet-tiles/" "{name}/thumb?api_key={apikey}") download_thumbnail( THUMBNAIL_DEFAULT_URL.format( name=mosaic[NAME], apikey=PlanetClient.getInstance().api_key()), self, )
class MyNavigationToolbar(NavigationToolbar) : def __init__(self, parent, canvas, direction = 'h' ) : self.canvas = canvas QWidget.__init__( self, parent ) if direction=='h' : self.layout = QHBoxLayout( self ) else : self.layout = QVBoxLayout( self ) self.layout.setMargin( 2 ) self.layout.setSpacing( 0 ) NavigationToolbar.__init__( self, canvas ) def set_message( self, s ): pass
def init_form(self): self._form = QWidget() layout = QVBoxLayout() if conf.PYFORMS_USE_QT5: layout.setContentsMargins(0,0,0,0) else: layout.setMargin(0) self._form.setLayout( layout ) self._app = vv.use('pyqt5') self._app.Create() Figure = self._app.GetFigureClass() self._fig = Figure(self._form) policy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) widget = self._fig._widget widget.setSizePolicy(policy) layout.addWidget(widget)
def value(self, value): ControlBase.label.fset(self, value) for item in range(self.form.count(), -1, -1): self.form.removeItem(item) for item in value: if isinstance(item, tuple): widget = QFrame(self.form) layout = QVBoxLayout() if conf.PYFORMS_USE_QT5: layout.setContentsMargins(0, 0, 0, 0) else: layout.setMargin(0) widget.setLayout(layout) for e in item[1]: if isinstance(e, tuple): hwidget = QFrame(self.form) hlayout = QHBoxLayout() if conf.PYFORMS_USE_QT5: hlayout.setContentsMargins(0, 0, 0, 0) else: hlayout.setMargin(0) hwidget.setLayout(hlayout) for ee in e: hlayout.addWidget(ee.form) widget.layout().addWidget(hwidget) else: widget.layout().addWidget(e.form) self.form.addItem(widget, item[0]) else: self.form.addItem(item.form, item.label)
def __init__(self, parent): super(BasemapsWidget, self).__init__(parent) self.parent = parent self.p_client = PlanetClient.getInstance() self._series = None self._initialized = False self._quads = None self.oneoff = None self.setupUi(self) self.mosaicsList = BasemapsListWidget() self.frameResults.layout().addWidget(self.mosaicsList) self.mosaicsList.setVisible(False) self.mosaicsList.basemapsSelectionChanged.connect( self.selection_changed) self.quadsTree = QuadsTreeWidget() self.quadsTree.quadsSelectionChanged.connect( self.quads_selection_changed) self.grpBoxQuads.layout().addWidget(self.quadsTree) self.renderingOptions = BasemapRenderingOptionsWidget() layout = QVBoxLayout() layout.setMargin(0) layout.addWidget(self.renderingOptions) self.frameRenderingOptions.setLayout(layout) self.aoi_filter = PlanetAOIFilter(self, self.parent, QUADS_AOI_COLOR) self.grpBoxAOI.layout().addWidget(self.aoi_filter) self.radioDownloadComplete.setChecked(True) self.buttons = [self.btnOneOff, self.btnSeries, self.btnAll] self.btnOneOff.clicked.connect( lambda: self.btn_filter_clicked(self.btnOneOff)) self.btnSeries.clicked.connect( lambda: self.btn_filter_clicked(self.btnSeries)) self.btnAll.clicked.connect( lambda: self.btn_filter_clicked(self.btnAll)) self.btnOrder.clicked.connect(self.order) self.btnExplore.clicked.connect(self.explore) self.btnCancelQuadSearch.clicked.connect(self.cancel_quad_search) self.btnNextOrderMethodPage.clicked.connect( self.next_order_method_page_clicked) self.btnBackOrderMethodPage.clicked.connect( lambda: self.stackedWidget.setCurrentWidget(self.searchPage)) self.btnBackAOIPage.clicked.connect(self.back_aoi_page_clicked) self.btnBackNamePage.clicked.connect(self.back_name_page_clicked) self.btnBackStreamingPage.clicked.connect( self.back_streaming_page_clicked) self.btnBackQuadsPage.clicked.connect(self.back_quads_page_clicked) self.btnNextQuadsPage.clicked.connect(self.next_quads_page_clicked) self.btnFindQuads.clicked.connect(self.find_quads_clicked) self.btnSubmitOrder.clicked.connect(self.submit_button_clicked) self.btnCloseConfirmation.clicked.connect(self.close_aoi_page) self.btnSubmitOrderStreaming.clicked.connect( self.submit_streaming_button_clicked) self.chkMinZoomLevel.stateChanged.connect(self.min_zoom_level_checked) self.chkMaxZoomLevel.stateChanged.connect(self.max_zoom_level_checked) levels = [str(x) for x in range(19)] self.comboMinZoomLevel.addItems(levels) self.comboMaxZoomLevel.addItems(levels) self.comboMaxZoomLevel.setCurrentIndex(len(levels) - 1) self.textBrowserOrderConfirmation.setOpenExternalLinks(False) self.textBrowserOrderConfirmation.anchorClicked.connect( show_orders_monitor) self.comboSeriesName.currentIndexChanged.connect(self.serie_selected) self.grpBoxFilter.collapsedStateChanged.connect( self.collapse_state_changed) self.lblSelectAllMosaics.linkActivated.connect( self.batch_select_mosaics_clicked) self.lblSelectAllQuads.linkActivated.connect( self.batch_select_quads_clicked) self.chkGroupByQuad.stateChanged.connect(self._populate_quads) self.chkOnlySRBasemaps.stateChanged.connect( self._only_sr_basemaps_changed) self.btnBasemapsFilter.clicked.connect(self._apply_filter) self.comboCadence.currentIndexChanged.connect(self.cadence_selected) self.textBrowserNoAccess.setOpenLinks(False) self.textBrowserNoAccess.setOpenExternalLinks(False) self.textBrowserNoAccess.anchorClicked.connect( self._open_basemaps_website)
def init_form(self): # Get the current path of the file rootPath = os.path.dirname(__file__) vlayout = QVBoxLayout() hlayout = QHBoxLayout() if conf.PYFORMS_USE_QT5: hlayout.setContentsMargins(0, 0, 0, 0) vlayout.setContentsMargins(0, 0, 0, 0) else: hlayout.setMargin(0) vlayout.setMargin(0) self.setLayout(vlayout) # Add scroll area scrollarea = QScrollArea() scrollarea.setMinimumHeight(140) scrollarea.setWidgetResizable(True) scrollarea.keyPressEvent = self.__scrollAreaKeyPressEvent scrollarea.keyReleaseEvent = self.__scrollAreaKeyReleaseEvent vlayout.addWidget(scrollarea) # vlayout.setContentsMargins(5, 5, 5, 5) # The timeline widget widget = TimelineWidget(self) widget._scroll = scrollarea # widget.setMinimumHeight(1000) scrollarea.setWidget(widget) # TODO Options buttons # btn_1 = QtGui.QPushButton("?") # btn_2 = QtGui.QPushButton("?") # vlayout_options = QtGui.QVBoxLayout() # vlayout_options.addWidget(btn_1) # vlayout_options.addWidget(btn_2) # hlayout.addLayout(vlayout_options) # hlayout.addWidget(btn_1) # hlayout.addWidget(btn_2) # Timeline zoom slider slider = QSlider(QtCore.Qt.Horizontal) slider.setFocusPolicy(QtCore.Qt.NoFocus) slider.setMinimum(1) slider.setMaximum(100) slider.setValue(10) slider.setPageStep(1) slider.setTickPosition(QSlider.NoTicks) # TicksBothSides slider.valueChanged.connect(self.__scaleSliderChange) slider_label_zoom_in = QLabel() slider_label_zoom_out = QLabel() slider_label_zoom_in.setPixmap( conf.PYFORMS_PIXMAP_EVENTTIMELINE_ZOOM_IN) slider_label_zoom_out.setPixmap( conf.PYFORMS_PIXMAP_EVENTTIMELINE_ZOOM_OUT) self._zoomLabel = QLabel("100%") hlayout.addWidget(self._zoomLabel) hlayout.addWidget(slider_label_zoom_out) hlayout.addWidget(slider) hlayout.addWidget(slider_label_zoom_in) # hlayout.setContentsMargins(5, 0, 5, 5) # Import/Export Buttons btn_import = QPushButton("Import") btn_import.setIcon(conf.PYFORMS_ICON_EVENTTIMELINE_IMPORT) btn_import.clicked.connect(self.__import) btn_export = QPushButton("Export") btn_export.setIcon(conf.PYFORMS_ICON_EVENTTIMELINE_EXPORT) btn_export.clicked.connect(self.__export) # importexport_vlayout = QtGui.QVBoxLayout() # importexport_vlayout.adimdWidget(btn_import) # importexport_vlayout.addWidget(btn_export) # hlayout.addLayout(importexport_vlayout) hlayout.addWidget(btn_import) hlayout.addWidget(btn_export) vlayout.addLayout(hlayout) self._time = widget self._scrollArea = scrollarea