Esempio n. 1
0
    def initLabelCombo(self, layer, ids):

        values = []
        for item in ids:
            uvals = layer.uniqueValues(item)
            # I don't want a list of lists but a flat list, that's why I'm doing this
            for val in uvals:
                if type(val) is unicode:
                    if uf.isNumeric(val) == False:
                        if any(char.isdigit() for char in val) == False:
                            values.append(val)
        values = sorted(set(values))

        ## initialize color list
        self.initColors(values)

        self.dock.labelCombo.clear()
        # self.dock.labelCombo.addItems(values)

        for i, item in enumerate(self.valColTuple):
            pixmap = QPixmap(16, 16)
            pixmap.fill(item[1])
            # self.dock.labelCombo.addItem(item[0])
            self.dock.labelCombo.insertItem(i, QIcon(pixmap), item[0])

        #set the currently selected label (for the first time)
        self.labelComboChanged()
    def get_preview(self, res, res_timeout):
        """
        Fetch the preview image from the internet

        :param res: The resolution of the image to be fetched
        :type res: str
        :param res_timeout: How long the request should wait for a response
        :type res_timeout: int
        """

        self.qimage = QImage()
        url = (
            "http://koordinates-tiles-d.global.ssl.fastly.net"
            "/services/tiles/v4/thumbnail/layer={0},style=auto/{1}.png".format(
                self.object_id, res))
        try:
            img_data = urllib.request.urlopen(url, timeout=res_timeout).read()
        except URLError:
            return False
        except timeout:
            return False
        self.qimage.loadFromData(img_data)
        if res == "300x200":
            self.dlg.uLabelImgPreview.setPixmap(QPixmap(self.qimage))
        else:
            self.dlg.uLabelImgPreview.setPixmap(
                QPixmap(self.qimage).scaledToHeight(200))
        return True
Esempio n. 3
0
    def __init__(self, iface):
        QDialog.__init__(self, iface.mainWindow())
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.iface = iface
        self.setupUi(self)

        # binaries
        self.leGdalBinPath.setText(Utils.getGdalBinPath())
        self.btnSetBinPath.clicked.connect(self.setBinPath)
        self.bin_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.bin_tooltip_label.setToolTip(self.tr(u"""\
A list of colon-separated (Linux and MacOS) or
semicolon-separated (Windows) paths to both binaries
and python executables.

MacOS users usually need to set it to something like
/Library/Frameworks/GDAL.framework/Versions/1.8/Programs"""))

        # python modules
        self.leGdalPymodPath.setText(Utils.getGdalPymodPath())
        self.btnSetPymodPath.clicked.connect(self.setPymodPath)
        self.pymod_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.pymod_tooltip_label.setToolTip(self.tr(u"""\
A list of colon-separated (Linux and MacOS) or
semicolon-separated (Windows) paths to python modules."""))

        # help
        self.leGdalHelpPath.setText(Utils.getHelpPath())
        self.btnSetHelpPath.clicked.connect(self.setHelpPath)
        self.help_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png'))
        self.help_tooltip_label.setToolTip(self.tr(u"""\
Useful to open local GDAL documentation instead of online help
when pressing on the tool dialog's Help button."""))
Esempio n. 4
0
 def iconDownloaded(self, reply):
     img = QImage()
     img.loadFromData(reply.readAll())
     pixmap = QPixmap(img)
     thumb = pixmap.scaled(48, 48, Qt.KeepAspectRatio,
                           Qt.SmoothTransformation)
     self.iconLabel.setPixmap(thumb)
 def createGraphImage(self):
     self.image = QPixmap(self.COMMIT_GRAPH_WIDTH, 1000).toImage()
     qp = QPainter(self.image)
     qp.fillRect(QRectF(0, 0, self.COMMIT_GRAPH_WIDTH, 1000), Qt.white);
     #qp.begin(self.image)
     self.drawLines(qp)
     qp.end()
Esempio n. 6
0
    def __init__(self, parent, datasetSize):
        """
        :type parent: gui.adjustmentDialog.AdjustmentDialog
        """
        super().__init__()
        self.parent = parent
        self.tbl = self.parent.tableThresholds
        self.model = QStandardItemModel(datasetSize[0], datasetSize[1],
                                        self.tbl)
        self.initState = True
        self.thresholdExeeded = False
        self.tbl.setModel(self.model)
        self.tbl.resizeColumnsToContents()
        self.tbl.resizeRowsToContents()
        # Icons
        self.iconOk = QIcon()
        self.iconOk.addPixmap(
            QPixmap(":/plugins/SeilaplanPlugin/gui/icons/icon_green.png"),
            QIcon.Normal, QIcon.Off)
        self.iconErr = QIcon()
        self.iconErr.addPixmap(
            QPixmap(
                ":/plugins/SeilaplanPlugin/gui/icons/icon_exclamation.png"),
            QIcon.Normal, QIcon.Off)

        self.tbl.clicked.connect(self.onClick)
Esempio n. 7
0
    def __init__(self, image):
        super().__init__()

        self.image = image
        self.checkBox = QCheckBox()
        self.checkBox.setChecked(True)
        self.checkBox.stateChanged.connect(self.checkStateChanged)
        hlayout = QHBoxLayout()
        hlayout.setMargin(0)
        hlayout.addStretch()
        hlayout.addWidget(self.checkBox)
        vlayout = QVBoxLayout()
        vlayout.setMargin(0)
        vlayout.addLayout(hlayout)
        self.label = QLabel()
        pixmap = QPixmap(PLACEHOLDER_THUMB, "SVG")
        thumb = pixmap.scaled(96, 96, Qt.KeepAspectRatio,
                              Qt.SmoothTransformation)
        self.label.setPixmap(thumb)
        self.label.setFixedSize(96, 96)

        url = f"{image['_links']['thumbnail']}?api_key={PlanetClient.getInstance().api_key()}"
        download_thumbnail(url, self)
        vlayout.addWidget(self.label)
        self.setLayout(vlayout)

        self.setFrameStyle(QFrame.Panel | QFrame.Raised)
    def __init__(self, image, sort_criteria):
        QFrame.__init__(self)
        self.image = image
        self.properties = image['properties']

        datetime = iso8601.parse_date(self.properties[sort_criteria])
        self.time = datetime.strftime('%H:%M:%S')
        self.date = datetime.strftime('%b %d, %Y')

        text = f"""{self.date}<span style="color: rgb(100,100,100);"> {self.time} UTC</span><br>
                        <b>{DAILY_ITEM_TYPES_DICT[self.properties['item_type']]}</b><br>
                    """
        url = f"{image['_links']['thumbnail']}?api_key={PlanetClient.getInstance().api_key()}"

        self.checkBox = QCheckBox("")
        self.checkBox.setChecked(True)
        self.checkBox.stateChanged.connect(self.checked_state_changed.emit)
        self.nameLabel = QLabel(text)
        self.iconLabel = QLabel()

        layout = QHBoxLayout()
        layout.setMargin(0)
        layout.addWidget(self.checkBox)
        pixmap = QPixmap(PLACEHOLDER_THUMB, 'SVG')
        thumb = pixmap.scaled(48, 48, Qt.KeepAspectRatio,
                            Qt.SmoothTransformation)
        self.iconLabel.setPixmap(thumb)
        self.iconLabel.setFixedSize(48, 48)
        self.nam = QNetworkAccessManager()
        self.nam.finished.connect(self.iconDownloaded)
        self.nam.get(QNetworkRequest(QUrl(url)))
        layout.addWidget(self.iconLabel)
        layout.addWidget(self.nameLabel)
        layout.addStretch()
        self.setLayout(layout)
Esempio n. 9
0
    def __init__(self, iface, parent=None):
        super(animationDiag, self).__init__(parent)
        self.setupUi(self)

        self.iface = iface
        self.settings = QSettings('ManySplendid', 'SRH2D_TEC_Viewer')

        pixMap1 = QPixmap(
            os.path.join(os.path.dirname(os.path.dirname(__file__)),
                         'if_arrow-up.svg'))
        icon1 = QIcon(pixMap1)
        self.moveUpBtn.setIcon(icon1)
        self.moveUpBtn.setIconSize(self.moveUpBtn.size())

        pixMap2 = QPixmap(
            os.path.join(os.path.dirname(os.path.dirname(__file__)),
                         'if_arrow-down.svg'))
        icon2 = QIcon(pixMap2)
        self.moveDownBtn.setIcon(icon2)
        self.moveDownBtn.setIconSize(self.moveDownBtn.size())
        self.timeLapseEdit.setText(str(self.settings.value('frameTimeLapse')))
        self.outputNameEdit.setText(self.settings.value('animeName'))
        self.timeLapseEdit.setText(str(self.settings.value('animeLapse')))

        self.registry = QgsMapLayerRegistry.instance()
        self.updateLayers()

        self.registry.legendLayersAdded.connect(self.newLayersAdded)
        self.registry.layersWillBeRemoved.connect(self.layersRemoved)
        self.moveUpBtn.clicked.connect(self.moveUp)
        self.moveDownBtn.clicked.connect(self.moveDown)
Esempio n. 10
0
    def update_style_preview(self, layer):
        syms = layer.renderer().symbols(QgsRenderContext())

        # only display the first symbol
        if len(syms) > 0:
            pix = QPixmap()
            pix.convertFromImage(syms[0].bigSymbolPreviewImage())
            self.ui.stylePreview.setPixmap(pix)
Esempio n. 11
0
    def __init__(self, parent=None):
        self.parent = parent
        super(AboutWidget, self).__init__()
        self.setupUi(self)

        self.logo_geopublichealth.setPixmap(QPixmap(resource('icon-100.png')))
        self.logo_ird.setPixmap(QPixmap(resource('logo_ird.png')))
        self.logo_umr.setPixmap(QPixmap(resource('espace-dev.png')))
Esempio n. 12
0
 def set_icon(self, path):
     """
     Set the forms icon preview
     :param path: The path to icon.
     """
     pixmap = QPixmap(path)
     w = self.iconlabel.width()
     h = self.iconlabel.height()
     self.iconlabel.setPixmap(pixmap.scaled(w, h, Qt.KeepAspectRatio))
Esempio n. 13
0
 def setsplash(self, splash):
     """
     Set the project image to the given image.
     :param splash: The path to the image to use as a the splash screen.
     """
     pixmap = QPixmap(splash)
     w = self.splashlabel.width()
     h = self.splashlabel.height()
     self.splashlabel.setPixmap(pixmap.scaled(w, h, Qt.KeepAspectRatio))
Esempio n. 14
0
    def resetPhoto(self):
        TOMsMessageLog.logMessage("In formCamera::resetPhoto ... ",
                                  level=Qgis.Info)

        pixmap = QPixmap(self.currFileName)
        if pixmap.isNull():
            pass
        else:
            self.FIELD.setPixmap(pixmap)
            self.FIELD.setScaledContents(True)
Esempio n. 15
0
    def loadImage(self, data, scaled=True, fromfile=True):
        """
            Load the image into the widget using a bytearray

            An empty picture will result in the default placeholder
            image.
        """
        if data is None or not data:
            self.removeImage()
            return

        if fromfile:
            pix = QPixmap(data)
        elif isinstance(data, QPixmap):
            pix = data
        else:
            pix = QPixmap()
            r = pix.loadFromData(data, 'JPG')
            if not r:
                pix = QPixmap(data)

        self._orignalimage = QPixmap(pix)

        h = self.maximumHeight()
        if scaled:
            pix = pix.scaledToHeight(h, Qt.SmoothTransformation)

        self.image.setPixmap(pix)
        self.isDefault = False
Esempio n. 16
0
    def __init__(self, iface):
        self.iface = iface
        self.canvas = self.iface.mapCanvas()
        self.plugin_dir = os.path.dirname(__file__)
        self.uc = UserCommunication(iface, 'Serval')
        self.load_settings()
        self.raster = None
        self.handler = None
        self.spin_boxes = None
        self.exp_dlg = None
        self.exp_builder = None
        self.block_pts_layer = None
        self.px, self.py = [0, 0]
        self.last_point = QgsPointXY(0, 0)
        self.rbounds = None
        self.changes = dict()  # dict with rasters changes {raster_id: RasterChanges instance}
        self.project = QgsProject.instance()
        self.crs_transform = None
        self.all_touched = None
        self.selection_mode = None
        self.spatial_index_time = dict()  # {layer_id: creation time}
        self.spatial_index = dict()  # {layer_id: spatial index}
        self.selection_layers_count = 1
        self.debug = DEBUG
        self.logger = get_logger() if self.debug else None

        self.menu = u'Serval'
        self.actions = []
        self.actions_always_on = []
        self.toolbar = self.iface.addToolBar(u'Serval Main Toolbar')
        self.toolbar.setObjectName(u'Serval Main Toolbar')
        self.toolbar.setToolTip(u'Serval Main Toolbar')

        self.sel_toolbar = self.iface.addToolBar(u'Serval Selection Toolbar')
        self.sel_toolbar.setObjectName(u'Serval Selection Toolbar')
        self.sel_toolbar.setToolTip(u'Serval Selection Toolbar')

        # Map tools
        self.probe_tool = QgsMapToolEmitPoint(self.canvas)
        self.probe_tool.setObjectName('ServalProbeTool')
        self.probe_tool.setCursor(QCursor(QPixmap(icon_path('probe_tool.svg')), hotX=2, hotY=22))
        self.probe_tool.canvasClicked.connect(self.point_clicked)
        self.draw_tool = QgsMapToolEmitPoint(self.canvas)
        self.draw_tool.setObjectName('ServalDrawTool')
        self.draw_tool.setCursor(QCursor(QPixmap(icon_path('draw_tool.svg')), hotX=2, hotY=22))
        self.draw_tool.canvasClicked.connect(self.point_clicked)
        self.selection_tool = RasterCellSelectionMapTool(self.iface, self.uc, self.raster, debug=self.debug)
        self.selection_tool.setObjectName('RasterSelectionTool')
        self.map_tool_btn = dict()  # {map tool: button activating the tool}

        self.iface.currentLayerChanged.connect(self.set_active_raster)
        self.project.layersAdded.connect(self.set_active_raster)
        self.canvas.mapToolSet.connect(self.check_active_tool)

        self.register_exp_functions()
Esempio n. 17
0
 def run5(self):
     self.dlg5.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg5.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg5.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg5.esporta_prog()
 def resetIcons(self):
     axial_icon = QPixmap(os.path.dirname(__file__) + "/custom_icons/axial_disabled.png")
     self.axialButton.setIcon(QIcon(axial_icon))
     self.axialButton.setIconSize(QSize(40, 40))
     segment_icon = QPixmap(os.path.dirname(__file__) + "/custom_icons/segment_disabled.png")
     self.segmentButton.setIcon(QIcon(segment_icon))
     self.segmentButton.setIconSize(QSize(40, 40))
     unlink_icon = QPixmap(os.path.dirname(__file__) + "/custom_icons/unlink_disabled.png")
     self.unlinksButton.setIcon(QIcon(unlink_icon))
     self.unlinksButton.setIconSize(QSize(40, 40))
     return
Esempio n. 19
0
 def addFinishedResponse(response):
     if not response['isOk']:
         return response
     if 'data' in response: # The user can quickly change a item
         pixmap = QPixmap()
         if not pixmap.loadFromData( response['data'] ):
             response['isOk'] = False
             response['message'] = 'Invalid image from Mapbiomas server'
         else:
             response['thumbnail'] = pixmap
     return response
Esempio n. 20
0
    def __init__(self, iface):
        self.iface = iface
        self.canvas = self.iface.mapCanvas()
        self.plugin_dir = os.path.dirname(__file__)
        self.uc = UserCommunication(iface, 'Serval')
        self.mode = 'probe'
        self.bands = None
        self.raster = None
        self.px, self.py = [0, 0]
        self.last_point = QgsPointXY(0, 0)
        self.undos = defaultdict(list)
        self.redos = defaultdict(list)
        self.qgis_project = QgsProject()

        self.menu = u'Serval'
        self.actions = []
        self.toolbar = self.iface.addToolBar(u'Serval')
        self.toolbar.setObjectName(u'Serval')
        self.toolbar.setToolTip(u'Serval Toolbar')

        # Map tools
        self.probeTool = QgsMapToolEmitPoint(self.canvas)
        self.probeTool.setObjectName('ServalProbeTool')
        self.probeTool.setCursor(
            QCursor(QPixmap(icon_path('probe_tool.svg')), hotX=2, hotY=22))
        self.probeTool.canvasClicked.connect(self.point_clicked)
        self.drawTool = QgsMapToolEmitPoint(self.canvas)
        self.drawTool.setObjectName('ServalDrawTool')
        self.drawTool.setCursor(
            QCursor(QPixmap(icon_path('draw_tool.svg')), hotX=2, hotY=22))
        self.drawTool.canvasClicked.connect(self.point_clicked)
        self.gomTool = QgsMapToolEmitPoint(self.canvas)
        self.gomTool.setObjectName('ServalGomTool')
        self.gomTool.setCursor(
            QCursor(QPixmap(icon_path('gom_tool.svg')), hotX=5, hotY=19))
        self.gomTool.canvasClicked.connect(self.point_clicked)

        self.mColorButton = QgsColorButton()
        icon1 = QIcon(icon_path('mIconColorBox.svg'))
        self.mColorButton.setIcon(icon1)
        self.mColorButton.setMinimumSize(QSize(40, 24))
        self.mColorButton.setMaximumSize(QSize(40, 24))
        self.mColorButton.colorChanged.connect(self.set_rgb_from_picker)

        self.b1SBox = BandSpinBox()
        self.b2SBox = BandSpinBox()
        self.b3SBox = BandSpinBox()
        self.sboxes = [self.b1SBox, self.b2SBox, self.b3SBox]
        for sb in self.sboxes:
            sb.user_hit_enter.connect(self.change_cell_value_key)

        self.iface.currentLayerChanged.connect(self.set_active_raster)
        self.qgis_project.layersAdded.connect(self.set_active_raster)
        self.canvas.mapToolSet.connect(self.check_active_tool)
Esempio n. 21
0
 def run10(self):
     self.dlg10.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg10.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg10.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg10.edita()
Esempio n. 22
0
 def run7(self):
     self.dlg7.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg7.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg7.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg7.controllo()
Esempio n. 23
0
 def run6(self):
     self.dlg6.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg6.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg6.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg6.copia()
Esempio n. 24
0
 def run1(self):
     self.dlg1.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg1.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg1.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg1.nuovo()
Esempio n. 25
0
 def run2(self):
     self.dlg2.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg2.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg2.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg2.aggiorna()
Esempio n. 26
0
 def GetIcon(icon):
     ''' Get Icon for Custom Informative Message '''
     if icon == "Question":
         i = QPixmap(":/imgFMV/images/Question.png")
     elif icon == "Information":
         i = QPixmap(":/imgFMV/images/Information.png")
     elif icon == "Warning":
         i = QPixmap(":/imgFMV/images/Warning.png")
     else:
         i = QPixmap(":/imgFMV/images/Critical.png")
     return i
Esempio n. 27
0
 def run3(self):
     self.dlg3.igag.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-igag.png'))
     self.dlg3.cnr.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-cnr.png'))
     self.dlg3.labgis.setPixmap(
         QPixmap(self.plugin_dir + os.sep + "img" + os.sep +
                 'logo-labgis.png'))
     self.dlg3.help()
Esempio n. 28
0
 def filename(self, value):
     self._filename = value
     self.selectbutton.setVisible(self.valid)
     self.deletebutton.setVisible(self.valid)
     if self.valid:
         self.attachmentloaded.emit()
         self.attachmentInfoLabel.setText(self.filename)
         self.attachmentImage.setPixmap(QPixmap(":/icons/view-attachment"))
     else:
         self.attachmentremoved.emit()
         self.attachmentInfoLabel.setText("")
         self.attachmentImage.setPixmap(QPixmap(":/icons/attachment"))
Esempio n. 29
0
    def set_thumbnail(self, img):
        thumbnail = QPixmap(img)
        self.thumbnails.append(
            thumbnail.scaled(96, 96, Qt.KeepAspectRatio,
                             Qt.SmoothTransformation))

        if len(self.images) == len(self.thumbnails):
            bboxes = [img[GEOMETRY] for img in self.images]
            pixmap = createCompoundThumbnail(bboxes, self.thumbnails)
            thumb = pixmap.scaled(128, 128, Qt.KeepAspectRatio,
                                  Qt.SmoothTransformation)
            self.labelThumbnail.setPixmap(thumb)
Esempio n. 30
0
 def update_logo_preview(self):
     """Update logo based on the current logo path."""
     logo_path = self.organisation_logo_path_line_edit.text()
     if os.path.exists(logo_path):
         icon = QPixmap(logo_path)
         label_size = self.organisation_logo_label.size()
         label_size.setHeight(label_size.height() - 2)
         label_size.setWidth(label_size.width() - 2)
         scaled_icon = icon.scaled(label_size, Qt.KeepAspectRatio)
         self.organisation_logo_label.setPixmap(scaled_icon)
     else:
         self.organisation_logo_label.setText(tr("Logo not found"))
Esempio n. 31
0
 def update_logo_preview(self):
     """Update logo based on the current logo path."""
     logo_path = self.organisation_logo_path_line_edit.text()
     if os.path.exists(logo_path):
         icon = QPixmap(logo_path)
         label_size = self.organisation_logo_label.size()
         label_size.setHeight(label_size.height() - 2)
         label_size.setWidth(label_size.width() - 2)
         scaled_icon = icon.scaled(
             label_size, Qt.KeepAspectRatio)
         self.organisation_logo_label.setPixmap(scaled_icon)
     else:
         self.organisation_logo_label.setText(tr("Logo not found"))
Esempio n. 32
0
	def setLinesThrendColor(self, color):
		self.linesThrendColor = QColor( color )
		pixmap = QPixmap( 20,20 )
		pixmap.fill( self.linesThrendColor )
		self.linesThrendColorBtn.setIcon( QIcon(pixmap) )
Esempio n. 33
0
	def setTitleColor(self, color):
		self.titleColor = QColor( color )
		pixmap = QPixmap( 20,20 )
		pixmap.fill( self.titleColor )
		self.titleColorBtn.setIcon( QIcon(pixmap) )
Esempio n. 34
0
	def setLabelsColor(self, color):
		self.labelsColor = QColor( color )
		pixmap = QPixmap( 20,20 )
		pixmap.fill( self.labelsColor )
		self.labelsColorBtn.setIcon( QIcon(pixmap) )
Esempio n. 35
0
	def setPointsReplicasColor(self, color):
		self.pointsReplicasColor = QColor( color )
		pixmap = QPixmap( 20,20 )
		pixmap.fill( self.pointsReplicasColor )
		self.pointsReplicasColorBtn.setIcon( QIcon(pixmap) )
    def __init__(self, geoservice, image_ba, parent=None, extent_renderer=None):
        QWidget.__init__(self, parent)

        self.extent_renderer = extent_renderer

        self.layout = QHBoxLayout(self)
        self.layout.setContentsMargins(5, 10, 5, 10)
        self.setLayout(self.layout)

        self.service_icon = QLabel(self)
        self.service_icon.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.service_icon.resize(24, 24)

        qimg = QImage.fromData(image_ba)
        pixmap = QPixmap.fromImage(qimg)
        self.service_icon.setPixmap(pixmap)
        self.layout.addWidget(self.service_icon)

        self.service_desc_layout = QGridLayout(self)
        self.service_desc_layout.setSpacing(0)
        self.layout.addLayout(self.service_desc_layout)

        self.service_name = QLabel(self)
        self.service_name.setTextFormat(Qt.RichText)
        self.service_name.setWordWrap(True)
        self.service_name.setText(u"   <strong> {} </strong>".format(geoservice.get('name', u"")))
        self.service_desc_layout.addWidget(self.service_name, 0, 0, 1, 3)

        self.service_type = QLabel(self)
        self.service_type.setTextFormat(Qt.RichText)
        self.service_type.setWordWrap(True)
        self.service_type.setText(geoservice.get('type', u"").upper() + " ")
        self.service_desc_layout.addWidget(self.service_type, 1, 0)

        self.service_deteils = QLabel(self)
        self.service_deteils.setTextFormat(Qt.RichText)
        self.service_deteils.setWordWrap(True)
        self.service_deteils.setOpenExternalLinks(True)
        self.service_deteils.setText(u"<a href=\"{0}\">{1}</a>, ".format(
            Client().geoservice_info_url(geoservice.get('id', u"")),
            self.tr('details')
        ))
        self.service_desc_layout.addWidget(self.service_deteils, 1, 1)

        self.service_report = QLabel(self)
        self.service_report.setTextFormat(Qt.RichText)
        self.service_report.setWordWrap(True)
        self.service_report.setOpenExternalLinks(True)
        self.service_report.setText(u"<a href=\"{0}\">{1}</a><div/>".format(
            Client().geoservice_report_url(geoservice.get('id', u"")),
            self.tr('report a problem')
        ))
        self.service_desc_layout.addWidget(self.service_report, 1, 2)
        self.service_desc_layout.setColumnStretch(2, 1)


        self.status_label = QLabel(self)
        self.status_label.setTextFormat(Qt.RichText)
        self.status_label.setText(u'\u2022')


        status = geoservice.get('cumulative_status', u'')
        if status == 'works':
            self.status_label.setStyleSheet("color: green; font-size: 30px")
        if status == 'failed':
            self.status_label.setStyleSheet("color: red; font-size: 30px")
        if status == 'problematic':
            self.status_label.setStyleSheet("color: yellow; font-size: 30px")
        self.layout.addWidget(self.status_label)


        self.addButton = QToolButton()
        self.addButton.setText(self.tr("Add"))
        self.addButton.clicked.connect(self.addToMap)
        self.layout.addWidget(self.addButton)
        
        self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)

        self.geoservice = geoservice
        self.image_ba = image_ba