Example #1
0
def decorate_welcome_icon(icon, background_color):
    """Return a `QIcon` with a circle shaped background.
    """
    welcome_icon = QIcon()
    sizes = [32, 48, 64, 80]
    background_color = NAMED_COLORS.get(background_color, background_color)
    background_color = QColor(background_color)
    grad = radial_gradient(background_color)
    for size in sizes:
        icon_pixmap = icon.pixmap(5 * size / 8, 5 * size / 8)
        icon_size = icon_pixmap.size()
        icon_rect = QRect(QPoint(0, 0), icon_size)

        pixmap = QPixmap(size, size)
        pixmap.fill(QColor(0, 0, 0, 0))
        p = QPainter(pixmap)
        p.setRenderHint(QPainter.Antialiasing, True)
        p.setBrush(QBrush(grad))
        p.setPen(Qt.NoPen)
        ellipse_rect = QRect(0, 0, size, size)
        p.drawEllipse(ellipse_rect)
        icon_rect.moveCenter(ellipse_rect.center())
        p.drawPixmap(icon_rect.topLeft(), icon_pixmap)
        p.end()

        welcome_icon.addPixmap(pixmap)

    return welcome_icon
Example #2
0
 def menuAction(menu, title, res):
     action = QAction(title, self)
     icon = QIcon()
     icon.addPixmap(QPixmap(res))
     action.setIcon(icon)
     menu.addAction(action)
     return action
Example #3
0
class ResultsDialog(BASE, WIDGET):

    def __init__(self):
        super(ResultsDialog, self).__init__(None)
        self.setupUi(self)

        self.keyIcon = QIcon()
        self.keyIcon.addPixmap(self.style().standardPixmap(QStyle.SP_FileIcon))

        self.tree.itemClicked.connect(self.changeResult)

        self.fillTree()

        if self.lastUrl:
            self.webView.load(self.lastUrl)

    def fillTree(self):
        elements = ProcessingResults.getResults()
        if len(elements) == 0:
            self.lastUrl = None
            return
        for element in elements:
            item = TreeResultItem(element)
            item.setIcon(0, self.keyIcon)
            self.tree.addTopLevelItem(item)
        self.lastUrl = QUrl(elements[-1].filename)

    def changeResult(self):
        item = self.tree.currentItem()
        if isinstance(item, TreeResultItem):
            url = QUrl(item.filename)
            self.webView.load(url)
Example #4
0
    def __init__(self, parent, canvasLayer):
        QTreeWidgetItem.__init__(self)
        self.legend = parent
        self.canvasLayer = canvasLayer
        self.canvasLayer.layer().setLayerName( self.legend.normalizeLayerName( unicode( self.canvasLayer.layer().name() ) ) )
        self.setText(0, self.canvasLayer.layer().name())
        self.isVect = (self.canvasLayer.layer().type() == 0) # 0: Vector, 1: Raster
        self.layerId = self.canvasLayer.layer().id()
        self.setSizeHint(0, QSize(24, 24))
        self.setCheckState(0, Qt.Checked)

        pm = QPixmap(22, 22)
        icon = QIcon()

        if self.isVect:
            renderer = self.canvasLayer.layer().rendererV2() 
            sym = renderer.symbols()[0]
            img = QImage(sym.asImage(QSize(22, 22)))
            pix = pm.fromImage(img)
            icon.addPixmap(pix, QIcon.Normal, QIcon.On)
            self.vectorLayerSymbology(self.canvasLayer.layer())
        else:
            pm = self.canvasLayer.layer().previewAsPixmap(QSize(22, 22))
            icon.addPixmap(pm)
            self.rasterLayerSymbology(self.canvasLayer.layer())

        self.setIcon(0, icon)
        self.setToolTip(0, self.canvasLayer.layer().attribution())
        layerFont = QFont()
        layerFont.setBold(True)
        self.setFont(0, layerFont)
Example #5
0
class ResultsDialog(QDialog, Ui_DlgResults):

    def __init__(self):
        QDialog.__init__(self)
        self.setupUi(self)

        self.keyIcon = QIcon()
        self.keyIcon.addPixmap(self.style().standardPixmap(QStyle.SP_FileIcon))

        self.tree.itemClicked.connect(self.changeResult)

        self.fillTree()

        if self.lastUrl:
            self.webView.load(self.lastUrl)

    def fillTree(self):
        elements = ProcessingResults.getResults()
        if len(elements) == 0:
            self.lastUrl = None
            return
        for element in elements:
            item = TreeResultItem(element)
            item.setIcon(0, self.keyIcon)
            self.tree.addTopLevelItem(item)
        self.lastUrl = QUrl(elements[-1].filename)

    def changeResult(self):
        item = self.tree.currentItem()
        if isinstance(item, TreeResultItem):
            url = QUrl(item.filename)
            self.webView.load(url)
Example #6
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.current_language = "en_US"
        self.uiTranslator = QTranslator()
        self.uiTranslator.load(":/languages/tr_en_US.qm")

        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.layout = QGridLayout()
        self.setLayout(self.layout)

        # Left Top corner of grid, Logo
        self.logo = QLabel("Logo")
        self.logo.setPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")))
        self.layout.addWidget(self.logo, 0, 0)

        # Right Top corner of grid, Infos
        self.aboutInfo = QLabel("About Info", openExternalLinks=True)
        self.aboutInfo.setWordWrap(True)
        self.layout.addWidget(self.aboutInfo, 0, 1)

        # Right Bottom corner of grid, Close Button
        self.buttonBox = QDialogButtonBox()
        self.closeButton = self.buttonBox.addButton("Close", QDialogButtonBox.AcceptRole)
        self.layout.addWidget(self.buttonBox, 1, 1)
        self.connect(self.closeButton, SIGNAL("clicked()"), self.close)

        self.retranslate()
Example #7
0
def main() :
    try :
        nodeAddr = readAddr( sys.argv[1] )
    except :
        nodeAddr = ('208.78.96.185', 10001) # ('210.210.1.102',10001) 
    seedNodes = [nodeAddr]
    app = QApplication( sys.argv )
    icon = QIcon()
    for iconSize in [48,32,24,16] :
        icon.addPixmap( QPixmap(':/images/cspace%d.png'%iconSize) )
    app.setWindowIcon( icon )
    app.setQuitOnLastWindowClosed( False )
    reactor = Qt4Reactor()
    if not checkSettingsVersion() :
        return
    logFile = LogFile( localSettings() )
    sys.stdout = logFile
    sys.stderr = logFile
    logging.getLogger().addHandler( logging.StreamHandler() )
    initdelaygc( reactor )
    mainWin = MainWindow( seedNodes, reactor )
    mainWin.show()
    app.exec_()
    global execFileAfterExit
    if execFileAfterExit is not None :
        p = execFileAfterExit
        args = [p]
        startingDir = os.path.split( p )[0]
        spawnProcess( p, args, os.environ, startingDir, 0 )
Example #8
0
def main() :
    try :
        nodeAddr = readAddr( sys.argv[1] )
    except :
        nodeAddr = ('210.210.1.102',10001)
    seedNodes = [nodeAddr]
    app = QApplication( sys.argv )
    icon = QIcon()
    for iconSize in [48,32,24,16] :
        icon.addPixmap( QPixmap(':/images/cspace%d.png'%iconSize) )
    app.setWindowIcon( icon )
    app.setQuitOnLastWindowClosed( False )
    reactor = Qt4Reactor()
    if not checkSettingsVersion() :
        return
    logFile = LogFile( localSettings() )
    sys.stdout = logFile
    sys.stderr = logFile
    logging.getLogger().addHandler( logging.StreamHandler() )
    initdelaygc( reactor )
    mainWin = MainWindow( seedNodes, reactor )
    mainWin.show()
    app.exec_()
    global execFileAfterExit
    if execFileAfterExit is not None :
        p = execFileAfterExit
        args = [p]
        startingDir = os.path.split( p )[0]
        spawnProcess( p, args, os.environ, startingDir, 0 )
Example #9
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.current_language = "en_US"
        self.uiTranslator = QTranslator()
        self.uiTranslator.load(":/languages/tr_en_US.qm")

        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.layout = QGridLayout()
        self.setLayout(self.layout)

        # Left Top corner of grid, Logo
        self.logo = QLabel("Logo")
        self.logo.setPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")))
        self.layout.addWidget(self.logo, 0, 0)

        # Right Top corner of grid, Infos
        self.aboutInfo = QLabel("About Info", openExternalLinks=True)
        self.aboutInfo.setWordWrap(True)
        self.layout.addWidget(self.aboutInfo, 0, 1)

        # Right Bottom corner of grid, Close Button
        self.buttonBox = QDialogButtonBox()
        self.closeButton = self.buttonBox.addButton("Close", QDialogButtonBox.AcceptRole)
        self.layout.addWidget(self.buttonBox, 1, 1)
        self.connect(self.closeButton, SIGNAL("clicked()"), self.close)

        self.retranslate()
Example #10
0
    def changeSymbologySettings( self, theMapLayer, itemList ):
        if not theMapLayer:
            return

        # Remove previous symbology items
        self.takeChildren()

        # Add the name of classification field as the first symbology item
        renderer = theMapLayer.renderer()
        if renderer.name() == "Graduated Symbol" or \
            renderer.name() == "Unique Value":
            fields = theMapLayer.pendingFields()
            self.child = QTreeWidgetItem( self )
            self.child.setText( 0, fields[ renderer.classificationAttributes()[ 0 ] ].name() )
            childFont = QFont()
            childFont.setItalic( True )
            self.child.setFont( 0, childFont )

        # Add the new symbology items
        for i in range( len( itemList ) ):
            self.child = QTreeWidgetItem( self )
            self.child.setText( 0, unicode( itemList[ i ][ 0 ] ) )
            iconChild = QIcon()
            iconChild.addPixmap( itemList[ i ][ 1 ] )
            self.child.setIcon( 0, iconChild )

            childFont = QFont()
            childFont.setPointSize( 9 )
            self.child.setFont( 0, childFont )
Example #11
0
    def load(self, name, size = 128, forceCache = False):
        icon = QIcon()
        size = int(size)
        self.pixmap = QPixmap()
        if not type(name) in (list, tuple):
            name = [str(name)]
        if forceCache or self._forceCache:
            for _name in name:
                for _size in self.iconSizes:
                    if (QPixmapCache.find('$qt'+str(_name)+str(_size),
                        self.pixmap)):
                        logging.debug('Icon %s returned from cache' % _name)
                        return self.pixmap

        logging.debug('Getting icon : %s size: %s' % (','.join(name), size))
        pix = self.findIcon(name, size)
        if pix.isNull():
            for _size in self.iconSizes:
                pix = self.findIcon(name, _size)
                if not pix.isNull():
                    if size == _size:
                        return pix
                    icon.addPixmap(pix)
            if icon.isNull():
                return self.pixmap
            return icon.pixmap(QSize(size, size))
        return pix
Example #12
0
 def icon(self):
     if self.icon_name and not self._icon:
         print "Creating icon %s for %s" % (self.icon_name, self.__class__.__name__)
         icon = QIcon()
         icon.addPixmap(QPixmap(self.icon_name), QIcon.Normal, QIcon.Off)
         self.__class__._icon = icon
     return self._icon
Example #13
0
 def __init__(self, thread, parent):
     QDialog.__init__(self, parent)
     self.ui = Ui_PlotPreview()
     self.ui.setupUi(self)
     self.parent = parent
     icon = QIcon()
     icon.addPixmap(QPixmap(":/icons/reload.png"), QIcon.Normal, QIcon.Off)
     self.update_btn = QPushButton(icon, "Update")
     self.ui.buttonBox.addButton(self.update_btn, QDialogButtonBox.ApplyRole)
     self.update_btn.clicked.connect(self.render_image)
     self._pix = None
     self._image_list = None
     self._thread = thread
     self.scene = QGraphicsScene()
     self.scene.setSceneRect(0,0,1,1)
     self.ui.imageView.setScene(self.scene)
     self.pix_item = None
     self.ui.imageView.setEnabled(False)
     self.ui.imageView.setInteractive(False)
     self.ui.imageView.setDragMode(QGraphicsView.ScrollHandDrag)
     self.pic_w = None
     self.pic_c = None
     self.show_pic_w = None
     self.show_pic_c = None
     timer = QTimer(self)
     timer.setSingleShot(True)
     timer.setInterval(500)
     self.timer = timer
     timer.timeout.connect(self.render_image)
     if parameters.instance.use_OpenGL:
         self.ui.imageView.setViewport(QGLWidget(QGLFormat(QGL.SampleBuffers)))
Example #14
0
def QIcon_from_Icon(icon):
    """ Convert the given Enaml Icon into a QIcon.

    Parameters
    ----------
    icon : Icon
        The Enaml Icon object.

    Returns
    -------
    result : QIcon
        The QIcon instance for the given Enaml icon.

    """
    qicon = QIcon()
    for icon_image in icon.images:
        image = icon_image.image
        if not image:
            continue
        mode = ICON_MODE[icon_image.mode]
        state = ICON_STATE[icon_image.state]
        qimage = get_cached_qimage(image)
        qpixmap = QPixmap.fromImage(qimage)
        qicon.addPixmap(qpixmap, mode, state)
    return qicon
Example #15
0
    def load(self, name, size=128, forceCache=False):
        icon = QIcon()
        size = int(size)
        self.pixmap = QPixmap()
        if not type(name) in (list, tuple):
            name = [str(name)]
        if forceCache or self._forceCache:
            for _name in name:
                for _size in self.iconSizes:
                    if (QPixmapCache.find('$qt' + str(_name) + str(_size),
                                          self.pixmap)):
                        logging.debug('Icon %s returned from cache' % _name)
                        return self.pixmap

        logging.debug('Getting icon : %s size: %s' % (','.join(name), size))
        pix = self.findIcon(name, size)
        if pix.isNull():
            for _size in self.iconSizes:
                pix = self.findIcon(name, _size)
                if not pix.isNull():
                    if size == _size:
                        return pix
                    icon.addPixmap(pix)
            if icon.isNull():
                return self.pixmap
            return icon.pixmap(QSize(size, size))
        return pix
Example #16
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.resize(600, 375)
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)
        self.treeWidget = QTreeWidget(self)
        self.treeWidget.setMaximumSize(200, 1500)

        self.virux = QTreeWidgetItem(self.treeWidget)
        self.virux.setExpanded(True)
        icon = QIcon()
        icon.addPixmap(QPixmap("data/logo.png"), QIcon.Normal, QIcon.On)
        self.virux.setIcon(0, icon)
        item_1 = QTreeWidgetItem(self.virux)
        item_1 = QTreeWidgetItem(self.virux)
        self.dialog = QTreeWidgetItem(self.treeWidget)
        self.dialog.setExpanded(True)
        item_1 = QTreeWidgetItem(self.dialog)
        item_1 = QTreeWidgetItem(self.dialog)
        self.treeWidget.header().setVisible(False)

        self.gridLayout.addWidget(self.treeWidget, 0, 0, 1, 1)
        self.groupBox = QGroupBox(self)
        self.groupBox.setFlat(True)

        self.gridLayout_3 = QGridLayout(self.groupBox)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.widget = QWidget(self.groupBox)
        self.gridLayout_4 = QGridLayout(self.widget)
        self.gridLayout_4.setMargin(0)
        self.gridLayout_4.setSpacing(0)
        self.gridLayout_4.setMargin(0)
        spacerItem = QSpacerItem(300, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        self.gridLayout_4.addItem(spacerItem, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.widget, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 1)
        self.pButton = QPushButton(self)
        self.pButton.setText("asd")
        self.pButton.setDefault(True)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.addButton(self.pButton, QDialogButtonBox.AcceptRole)
        #self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 2)


        self.setWindowTitle("Virux Ayarlar")
        self.treeWidget.headerItem().setText(0, "")
        self.treeWidget.topLevelItem(0).setText(0, u"Virux")
        self.treeWidget.topLevelItem(0).child(0).setText(0, u"Virux1")
        self.treeWidget.topLevelItem(0).child(1).setText(0, u"Virux2")
        self.treeWidget.topLevelItem(1).setText(0, u"Dialog")
        self.treeWidget.topLevelItem(1).child(0).setText(0, u"Dialog1")
        self.treeWidget.topLevelItem(1).child(1).setText(0, u"Dialog2")
        self.groupBox.setTitle(u"GroupBox")
        self.groupYaz()

        self.treeWidget.itemPressed.connect(self.lale)
Example #17
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.resize(600, 375)
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)
        self.treeWidget = QTreeWidget(self)
        self.treeWidget.setMaximumSize(200, 1500)

        self.virux = QTreeWidgetItem(self.treeWidget)
        self.virux.setExpanded(True)
        icon = QIcon()
        icon.addPixmap(QPixmap("data/logo.png"), QIcon.Normal, QIcon.On)
        self.virux.setIcon(0, icon)
        item_1 = QTreeWidgetItem(self.virux)
        item_1 = QTreeWidgetItem(self.virux)
        self.dialog = QTreeWidgetItem(self.treeWidget)
        self.dialog.setExpanded(True)
        item_1 = QTreeWidgetItem(self.dialog)
        item_1 = QTreeWidgetItem(self.dialog)
        self.treeWidget.header().setVisible(False)

        self.gridLayout.addWidget(self.treeWidget, 0, 0, 1, 1)
        self.groupBox = QGroupBox(self)
        self.groupBox.setFlat(True)

        self.gridLayout_3 = QGridLayout(self.groupBox)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.widget = QWidget(self.groupBox)
        self.gridLayout_4 = QGridLayout(self.widget)
        self.gridLayout_4.setMargin(0)
        self.gridLayout_4.setSpacing(0)
        self.gridLayout_4.setMargin(0)
        spacerItem = QSpacerItem(300, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.gridLayout_4.addItem(spacerItem, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.widget, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 1)
        self.pButton = QPushButton(self)
        self.pButton.setText("asd")
        self.pButton.setDefault(True)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.addButton(self.pButton, QDialogButtonBox.AcceptRole)
        #self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 2)

        self.setWindowTitle("Virux Ayarlar")
        self.treeWidget.headerItem().setText(0, "")
        self.treeWidget.topLevelItem(0).setText(0, u"Virux")
        self.treeWidget.topLevelItem(0).child(0).setText(0, u"Virux1")
        self.treeWidget.topLevelItem(0).child(1).setText(0, u"Virux2")
        self.treeWidget.topLevelItem(1).setText(0, u"Dialog")
        self.treeWidget.topLevelItem(1).child(0).setText(0, u"Dialog1")
        self.treeWidget.topLevelItem(1).child(1).setText(0, u"Dialog2")
        self.groupBox.setTitle(u"GroupBox")
        self.groupYaz()

        self.treeWidget.itemPressed.connect(self.lale)
Example #18
0
 def setIcon(self, icon):
     super(RecordButton, self).setIcon(icon)
     on_icon = QIcon(icon)
     off_icon = QIcon(icon)
     for size in off_icon.availableSizes(QIcon.Normal, QIcon.On):
         pixmap = off_icon.pixmap(size, QIcon.Normal, QIcon.Off)
         off_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
     self.animation_icons = [on_icon, off_icon]
Example #19
0
 def set_Button(self, imageName):
     if imageName == None or imageName == "":
         self.imageButton.setVisible(False)
         return
     icon = QIcon()
     icon.addPixmap(QPixmap(("Resource/" + imageName)), QIcon.Normal, QIcon.Off)
     self.imageButton.setIcon(icon)
     self.imageButton.setVisible(True)
Example #20
0
def get_icon(data):
    image = QImage()
    bytearr = QByteArray.fromBase64(data)
    image.loadFromData(bytearr, "PNG")
    pixmap = QPixmap.fromImage(image)
    icon = QIcon()
    icon.addPixmap(pixmap)
    return icon
Example #21
0
 def setIcon(self, icon):
     super(RecordButton, self).setIcon(icon)
     on_icon = QIcon(icon)
     off_icon = QIcon(icon)
     for size in off_icon.availableSizes(QIcon.Normal, QIcon.On):
         pixmap = off_icon.pixmap(size, QIcon.Normal, QIcon.Off)
         off_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
     self.animation_icons = [on_icon, off_icon]
Example #22
0
    def setWidgetIcon(self, iconName):
        iconNames = self.getIconNames(iconName)
        icon = QIcon()
        for name in iconNames:
            pix = QPixmap(name)
            icon.addPixmap(pix)

        self.setWindowIcon(icon)
Example #23
0
def get_icon(data):
    image = QImage()
    bytearr = QByteArray.fromBase64(data)
    image.loadFromData(bytearr, "PNG")
    pixmap = QPixmap.fromImage(image)
    icon = QIcon()
    icon.addPixmap(pixmap)
    return icon
Example #24
0
class BooleanDelegate(QItemDelegate):
    def __init__(self, role, pixmap_on, pixmap_off, text_on, text_off, style_on, style_off, parent=None):
        QItemDelegate.__init__(self, parent)
        self.pixmap_on = pixmap_on
        self.pixmap_off = pixmap_off
        self.text_on = text_on
        self.text_off = text_off
        self.style_on = style_on
        self.style_off = style_off
        self.role = role

        self.icon = QIcon()
        self.icon.addPixmap(pixmap_on, QIcon.Normal, QIcon.On)
        self.icon.addPixmap(pixmap_off, QIcon.Normal, QIcon.Off)

    def createEditor(self, parent, option, index):
        button = QPushButton(self.icon, u'', parent)
        button.setCheckable(True)
        button.setAutoFillBackground(True)
        button.setFocusPolicy(Qt.NoFocus)

        #local function, has knowledge of button (a delegate is stateless).
        def setstyle(checked):
            if checked:
                style = self.style_on
                text = self.text_on
            else:
                style = self.style_off
                text = self.text_off
            button.setStyleSheet(style)
            button.setText(text)

        def emit():
            self.setModelData(button, index.model(), index)

        button.setstyle = setstyle
        self.connect(button, SIGNAL('clicked(bool)'), button.setstyle)
        self.connect(button, SIGNAL('clicked(bool)'), self.setClicked)
        self.connect(button, SIGNAL('toggled(bool)'), emit)

        return button

    def setClicked(self):
        self.emit(SIGNAL("clicked"))

    def setEditorData(self, button, index):
        value = index.model().data(index, self.role).toBool()
        button.setstyle(value)
        if value:
            checkstate = Qt.Checked
        else:
            checkstate = Qt.Unchecked

        button.setChecked(checkstate)

    def setModelData(self, editor, model, index):
        allow = editor.isChecked()
        model.setData(index, QVariant(allow), self.role)
Example #25
0
    def __init__(self, config, db):
        FreeseerApp.__init__(self)

        self.config = config
        self.db = db

        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.resize(960, 400)

        self.mainWidget = QWidget()
        self.mainLayout = QHBoxLayout()
        self.mainWidget.setLayout(self.mainLayout)
        self.setCentralWidget(self.mainWidget)

        self.editorWidget = ReportEditorWidget()
        self.editorWidget.editor.setColumnHidden(5, True)

        self.mainLayout.addWidget(self.editorWidget)

        # Initialize geometry, to be used for restoring window positioning.
        self.geometry = None

        #
        # Setup Menubar
        #
        self.actionExportCsv = QAction(self)
        self.actionExportCsv.setObjectName(_fromUtf8("actionExportCsv"))

        # Actions
        self.menuFile.insertAction(self.actionExit, self.actionExportCsv)
        # --- End Menubar

        #
        # Report Editor Connections
        #

        # Editor Widget
        self.connect(self.editorWidget.removeButton, SIGNAL('clicked()'), self.remove_talk)
        self.connect(self.editorWidget.clearButton, SIGNAL('clicked()'), self.confirm_reset)
        self.connect(self.editorWidget.closeButton, SIGNAL('clicked()'), self.close)

        # Main Window Connections
        self.connect(self.actionExportCsv, SIGNAL('triggered()'), self.export_reports_to_csv)
        self.connect(self.editorWidget.editor, SIGNAL('clicked (const QModelIndex&)'), self.editorSelectionChanged)

        # Load default language
        actions = self.menuLanguage.actions()
        for action in actions:
            if action.data().toString() == self.config.default_language:
                action.setChecked(True)
                self.translate(action)
                break

        self.load_failures_model()
        self.editorWidget.editor.resizeColumnsToContents()
        self.editorWidget.editor.resizeRowsToContents()
Example #26
0
    def start_roadnet(self):
        """
        Start the plugin.  Log in the user, connect to database, load layers,
        set toolbar up appropriately.
        """
        if config.DEBUG_MODE:
            print('DEBUG_MODE: Starting roadNet')

        # Check the database
        if (self.params['RNDataStorePath'] == '') or (self.params['DbName']
                                                      == ''):
            if not self.run_change_db_path():
                return
        db_path = os.path.join(self.params['RNDataStorePath'],
                               self.params['DbName'])
        try:
            database.check_file(db_path)
        except IOError:
            if not self.run_change_db_path():
                return
        # Log the user in
        login.login_and_get_role(self.params)
        self.toolbar.set_state(self.params['role'])
        if self.params['role'] == 'init':
            return
        # Open database and model
        self.db = database.open_working_copy(self.params)  # params knows role
        database.update_geometry_statistics(self.db)
        self.model = database.get_model(self.db)
        # Add layers + connect edit signals, zoom to rdpoly
        self.add_rdpoly_layer()  # Layer added as self.rdpoly
        self.add_esu_layer()  # Layer added as self.esu + selector tool init
        self.params['session_includes_edits'] = False
        # Create the street browser instance
        if config.DEBUG_MODE:
            print('DEBUG_MODE: Initialising street browser')
        self.street_browser_dk = StreetBrowserDlg(self.params)
        self.street_browser_dk.setWindowFlags(Qt.WindowMaximizeButtonHint
                                              | Qt.WindowMinimizeButtonHint)
        rn_icon = QIcon()
        rn_icon.addPixmap(
            QPixmap(os.path.join(self.plugin_dir, "image", "rn_logo_v2.png")))
        self.street_browser_dk.setWindowIcon(rn_icon)
        self.street_browser = StreetBrowser(self.iface, self.street_browser_dk,
                                            self.model, self.db, self.params)
        self.disable_srwr()  # Hide SRWR tab
        self.street_browser.set_buttons_initial_state(self.params['role'])
        if config.DEBUG_MODE:
            print('DEBUG_MODE: Initialising street selector tool')
        # Initialise selector tool
        self.selector_tool = EsuSelectorTool(self.street_browser_dk,
                                             self.iface, self.esu,
                                             self.toolbar, self.db,
                                             self.street_browser.mapper)
        # Start RAMP
        if self.params['RAMP'] == 'true':
            self.ramp.start_ramp()
        self.roadnet_started = True
Example #27
0
    def __init__(self):
        QWidget.__init__(self)
        self.resize(350, 225)
        self.setMinimumSize(QSize(350, 225))
        self.setMaximumSize(QSize(400, 250))
        self.setWindowTitle(QApplication.applicationName() + " " +
                            QApplication.applicationVersion())

        icon = QIcon()
        icon.addPixmap(QPixmap(":/resim/parcala.png"))
        self.setWindowIcon(icon)

        self.gridLayout = QGridLayout(self)

        self.parcalaButton = QPushButton(self)
        self.parcalaButton.setMinimumSize(QSize(150, 50))
        self.parcalaButton.setText(self.trUtf8("Parçala"))
        self.parcalaButton.clicked.connect(self.parcala)
        self.gridLayout.addWidget(self.parcalaButton, 3, 0, 1, 1)

        self.birlestirButton = QPushButton(self)
        self.birlestirButton.setMinimumSize(QSize(150, 50))
        self.birlestirButton.setText(self.trUtf8("Birleştir"))
        self.birlestirButton.clicked.connect(self.birlestir)
        self.gridLayout.addWidget(self.birlestirButton, 3, 2, 1, 1)

        self.dogrulaButton = QPushButton(self)
        self.dogrulaButton.setMinimumSize(QSize(150, 50))
        self.dogrulaButton.setText(self.trUtf8("Doğrula"))
        self.dogrulaButton.clicked.connect(self.dogrula)
        self.gridLayout.addWidget(self.dogrulaButton, 7, 0, 1, 1)

        self.hakkindaButton = QPushButton(self)
        self.hakkindaButton.setMinimumSize(QSize(150, 50))
        self.hakkindaButton.setText(self.trUtf8("Hakkında"))
        self.hakkindaButton.clicked.connect(self.hakkinda)
        self.gridLayout.addWidget(self.hakkindaButton, 7, 2, 1, 1)

        self.bilgiLabel = QLabel(self)
        self.bilgiLabel.setText(
            self.trUtf8(u"%s %s \u00a9 2011 - www.metehan.us" %
                        (QApplication.applicationName(),
                         QApplication.applicationVersion())))
        self.bilgiLabel.setAlignment(Qt.AlignCenter)
        self.gridLayout.addWidget(self.bilgiLabel, 9, 0, 1, 3)

        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 3, 1, 1, 1)
        spacerItem1 = QSpacerItem(0, 20, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem1, 4, 1, 1, 1)
        spacerItem2 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem2, 2, 1, 1, 1)
        spacerItem3 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem3, 8, 1, 1, 1)
Example #28
0
    def __init__(self, group):
        super(GroupQListWidgetItem, self).__init__()

        self.group = group
        icon = QIcon()
        icon.addPixmap(QPixmap("{}group.png".format(
            Config.img_media)), QIcon.Normal, QIcon.Off)
        self.setIcon(icon)
        self.init_text()
Example #29
0
    def __init__(self):
        ##@var _widget
        # Widget de la ventana principal
        self._widget = MainWindowWidget()
        ##@var _ui
        # Referecia a la interfaz de la vantana principal @see @ref MainWindow::_widget
        self._ui = self._widget.ui
        ui = self._ui
        ##@var _planes
        # Visualización inicial de la imagen según los tres planos del cuerpo
        self._planes = ThreePlanesVisualization(ui.threePlanes)
        ##@var _processed_planes
        # Visualización de la imagen procesada
        self._processed_planes = ThreePlanesVisualization(ui.threePlanesResult)
        #conección de señales de Qt
        ui.useImage.clicked.connect(self._update_image)
        ui.processImage.clicked.connect(self._processImage)
        ui.actionCargar_imagen.triggered.connect(self._load_image)
        ui.actionCargar_serie.triggered.connect(self._load_series)
        ui.actionGuardar.triggered.connect(self._save_image)
        ui.actionGuardar_2.triggered.connect(self._save_configuration)
        ui.actionCargar_configuraci_n.triggered.connect(
            self._load_configuration)
        ui.imagesList.itemSelectionChanged.connect(self._update_use_button)
        ui.actionAcerca_de.triggered.connect(self._about)
        ui.propertiesTree.itemChanged.connect(self._update_current_image_name)
        ##@var _images_ui_syncronyzer
        # Sincronizador de las propiedades de los filros
        self._images_ui_synchronizer = ImageUiSync(ui.propertiesTree,
                                                   ui.imagesList)
        ##@var _filters_ui_synchronizer
        # Sincronizador de las propiedades de las imágenes
        self._filters_ui_synchronizer = FiltersUiSync(ui.filtersTree)
        ##@var _segmentation_data
        # Muestra la información de la segmentación
        self._segmentation_data = SegmentationData()
        self._widget.addDockWidget(Qt.TopDockWidgetArea,
                                   self._segmentation_data._widget)
        self._segmentation_data._widget.setFloating(True)
        icon = QIcon()
        icon.addPixmap(QPixmap(":/icons/seleccion/show_data.png"),
                       QIcon.Normal, QIcon.Off)
        self._segmentation_data._widget.setWindowIcon(icon)
        self._segmentation_data._widget.toggleViewAction().trigger()
        action = self._segmentation_data._widget.toggleViewAction()
        action.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_D))
        action.setIcon(icon)
        trans = QObject()
        action.setToolTip(trans.tr("Datos de la segmentación"))
        action.setIconText(trans.tr("Datos de la segmentación"))
        action.setStatusTip(
            trans.tr("Mostrar/Ocultar los datos de la segmentación."))
        ui.menuVer.addAction(action)
        ui.toolBar.addAction(action)

        ui.actionAyuda_de_BrainApp.triggered.connect(self._help)
Example #30
0
class StreamButton(QToolButton):
    hidden = pyqtSignal()
    shown  = pyqtSignal()

    def __init__(self, parent=None):
        super(StreamButton, self).__init__(parent)
        self.default_icon = QIcon()
        self.alternate_icon = QIcon()
        self.clicked.connect(self._clicked)

    def _clicked(self):
        super(StreamButton, self).setIcon(self.default_icon)

    def _get_accepted(self):
        return not self.isChecked()

    def _set_accepted(self, accepted):
        super(StreamButton, self).setIcon(self.alternate_icon)
        self.setChecked(not accepted)

    accepted = property(_get_accepted, _set_accepted)
    del _get_accepted, _set_accepted

    def _get_active(self):
        return self.isEnabled()

    def _set_active(self, active):
        self.setEnabled(bool(active))

    active = property(_get_active, _set_active)
    del _get_active, _set_active

    @property
    def in_use(self):
        return self.isVisibleTo(self.parent())

    def setVisible(self, visible):
        super(StreamButton, self).setVisible(visible)
        signal = self.shown if visible else self.hidden
        signal.emit()

    def setIcon(self, icon):
        self.default_icon = icon
        self.alternate_icon = QIcon(icon)
        normal_sizes = icon.availableSizes(QIcon.Normal, QIcon.On)
        selected_sizes = icon.availableSizes(QIcon.Selected, QIcon.On)
        selected_additional_sizes = [size for size in selected_sizes if size not in normal_sizes]
        for size in normal_sizes + selected_additional_sizes:
            pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
            self.alternate_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
        disabled_sizes = icon.availableSizes(QIcon.Disabled, QIcon.On)
        selected_additional_sizes = [size for size in selected_sizes if size not in disabled_sizes]
        for size in disabled_sizes + selected_additional_sizes:
            pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
            self.alternate_icon.addPixmap(pixmap, QIcon.Disabled, QIcon.On)
        super(StreamButton, self).setIcon(icon)
Example #31
0
class StreamButton(QToolButton):
    hidden = pyqtSignal()
    shown  = pyqtSignal()

    def __init__(self, parent=None):
        super(StreamButton, self).__init__(parent)
        self.default_icon = QIcon()
        self.alternate_icon = QIcon()
        self.clicked.connect(self._clicked)

    def _clicked(self):
        super(StreamButton, self).setIcon(self.default_icon)

    def _get_accepted(self):
        return not self.isChecked()

    def _set_accepted(self, accepted):
        super(StreamButton, self).setIcon(self.alternate_icon)
        self.setChecked(not accepted)

    accepted = property(_get_accepted, _set_accepted)
    del _get_accepted, _set_accepted

    def _get_active(self):
        return self.isEnabled()

    def _set_active(self, active):
        self.setEnabled(bool(active))

    active = property(_get_active, _set_active)
    del _get_active, _set_active

    @property
    def in_use(self):
        return self.isVisibleTo(self.parent())

    def setVisible(self, visible):
        super(StreamButton, self).setVisible(visible)
        signal = self.shown if visible else self.hidden
        signal.emit()

    def setIcon(self, icon):
        self.default_icon = icon
        self.alternate_icon = QIcon(icon)
        normal_sizes = icon.availableSizes(QIcon.Normal, QIcon.On)
        selected_sizes = icon.availableSizes(QIcon.Selected, QIcon.On)
        selected_additional_sizes = [size for size in selected_sizes if size not in normal_sizes]
        for size in normal_sizes + selected_additional_sizes:
            pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
            self.alternate_icon.addPixmap(pixmap, QIcon.Normal, QIcon.On)
        disabled_sizes = icon.availableSizes(QIcon.Disabled, QIcon.On)
        selected_additional_sizes = [size for size in selected_sizes if size not in disabled_sizes]
        for size in disabled_sizes + selected_additional_sizes:
            pixmap = icon.pixmap(size, QIcon.Selected, QIcon.On)
            self.alternate_icon.addPixmap(pixmap, QIcon.Disabled, QIcon.On)
        super(StreamButton, self).setIcon(icon)
Example #32
0
 def createCheckButton(self, offIcon, onIcon):
     i = QIcon()
     i.addPixmap( offIcon.pixmap(64), QIcon.Normal, QIcon.Off)
     i.addPixmap(  onIcon.pixmap(64), QIcon.Normal, QIcon.On)
     b = QToolButton()
     b.setFixedSize(64,64)
     b.setCheckable(True)
     b.setIcon(i)
     b.setStyleSheet("* { background: transparent }")
     return b
Example #33
0
    def __init__(self, parent=None):
        super(AboutWidget, self).__init__(parent)

        self.current_language = "en_US"
        self.uiTranslator = QTranslator()
        self.uiTranslator.load(":/languages/tr_en_US.qm")

        self.fontSize = self.font().pixelSize()
        self.fontUnit = "px"
        if self.fontSize == -1:  # Font is set as points, not pixels.
            self.fontUnit = "pt"
            self.fontSize = self.font().pointSize()

        icon = QIcon()
        self.logoPixmap = QPixmap(_fromUtf8(":/freeseer/logo.png"))
        icon.addPixmap(self.logoPixmap, QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.mainLayout = QGridLayout()
        self.setLayout(self.mainLayout)

        # Logo
        self.logo = QLabel("Logo")
        # To offset the logo so that it's to the right of the title
        self.logo.setStyleSheet("QLabel {{ margin-left: {} {} }}".format(
            self.set_width_with_dpi(90) + (self.fontSize * 2.5),
            self.fontUnit))
        self.logo.setPixmap(
            self.logoPixmap.scaledToHeight(self.set_height_with_dpi(80)))
        self.mainLayout.addWidget(self.logo, 0, 0, Qt.AlignTop)

        # Info
        self.aboutInfo = QLabel("About Info", openExternalLinks=True)
        self.aboutInfo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.aboutInfo.setWordWrap(True)
        self.mainLayout.addWidget(self.aboutInfo, 0, 0)

        # Buttons
        self.buttonsLayout = QHBoxLayout()
        self.issueButton = QPushButton("Report an issue")
        self.docsButton = QPushButton("Freeseer documentation")
        self.contactButton = QPushButton("Contact us")
        self.buttonsLayout.insertWidget(0, self.docsButton)
        self.buttonsLayout.insertWidget(1, self.issueButton)
        self.buttonsLayout.insertWidget(2, self.contactButton)

        self.mainLayout.addLayout(self.buttonsLayout, 2, 0)

        self.connect(self.docsButton, SIGNAL('clicked()'), self.openDocsUrl)
        self.connect(self.issueButton, SIGNAL('clicked()'),
                     self.openNewIssueUrl)
        self.connect(self.contactButton, SIGNAL('clicked()'),
                     self.openContactUrl)

        self.retranslate()
Example #34
0
 def _createDocNameItem(self,docName):
     """
     Create a template document standard item.
     """
     #Set icon
     icon = QIcon()
     icon.addPixmap(QPixmap(":/plugins/stdm/images/icons/document.png"), QIcon.Normal, QIcon.Off)
     
     dnItem = QStandardItem(icon,docName)
     
     return dnItem
    def _createDocNameItem(self, docName):
        """
        Create a template document standard item.
        """
        #Set icon
        icon = QIcon()
        icon.addPixmap(QPixmap(":/plugins/stdm/images/icons/document.png"),
                       QIcon.Normal, QIcon.Off)

        dnItem = QStandardItem(icon, docName)

        return dnItem
Example #36
0
    def setupUi(self, Model, Controle):
        self.setMaximumSize(578, 430)
        self.setMinimumSize(578, 430)
        self.resize(578, 430)
        self.centralWidget = WidgetTemperatures(self, Model, Controle)
        self.setCentralWidget(self.centralWidget)
        self.setWindowTitle("Monitor de Temperatura")

        icon = QIcon()
        diretorio = "View\\Imagens\\favicon.ico"
        icon.addPixmap(QPixmap(diretorio), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
Example #37
0
 def changeSymbologySettings(self, theMapLayer, itemList):
     if not theMapLayer:
         return
     # Remove previous symbology items
     self.takeChildren()
     # Add the new symbology items
     for i in range(len(itemList)):
         self.child = QTreeWidgetItem(self)
         self.child.setSizeHint(0, QSize(18, 18))
         self.child.setText(0, unicode(itemList[i][0]))
         iconChild = QIcon()
         iconChild.addPixmap(itemList[i][1])
         self.child.setIcon(0, iconChild)
Example #38
0
    def __init__(self, parent=None):
        super(AboutWidget, self).__init__(parent)

        self.current_language = "en_US"
        self.uiTranslator = QTranslator()
        self.uiTranslator.load(":/languages/tr_en_US.qm")

        self.fontSize = self.font().pixelSize()
        self.fontUnit = "px"
        if self.fontSize == -1:  # Font is set as points, not pixels.
            self.fontUnit = "pt"
            self.fontSize = self.font().pointSize()

        icon = QIcon()
        self.logoPixmap = QPixmap(_fromUtf8(":/freeseer/logo.png"))
        icon.addPixmap(self.logoPixmap, QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.mainLayout = QGridLayout()
        self.setLayout(self.mainLayout)

        # Logo
        self.logo = QLabel("Logo")
        # To offset the logo so that it's to the right of the title
        self.logo.setStyleSheet("QLabel {{ margin-left: {} {} }}"
            .format(self.set_width_with_dpi(90) + (self.fontSize * 2.5), self.fontUnit))
        self.logo.setPixmap(self.logoPixmap.scaledToHeight(self.set_height_with_dpi(80)))
        self.mainLayout.addWidget(self.logo, 0, 0, Qt.AlignTop)

        # Info
        self.aboutInfo = QLabel("About Info", openExternalLinks=True)
        self.aboutInfo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.aboutInfo.setWordWrap(True)
        self.mainLayout.addWidget(self.aboutInfo, 0, 0)

        # Buttons
        self.buttonsLayout = QHBoxLayout()
        self.issueButton = QPushButton("Report an issue")
        self.docsButton = QPushButton("Freeseer documentation")
        self.contactButton = QPushButton("Contact us")
        self.buttonsLayout.insertWidget(0, self.docsButton)
        self.buttonsLayout.insertWidget(1, self.issueButton)
        self.buttonsLayout.insertWidget(2, self.contactButton)

        self.mainLayout.addLayout(self.buttonsLayout, 2, 0)

        self.connect(self.docsButton, SIGNAL('clicked()'), self.openDocsUrl)
        self.connect(self.issueButton, SIGNAL('clicked()'), self.openNewIssueUrl)
        self.connect(self.contactButton, SIGNAL('clicked()'), self.openContactUrl)

        self.retranslate()
Example #39
0
    def __init__(self, owner):
        super(OwnerQListWidgetItem, self).__init__()

        self.owner = owner

        if isinstance(owner, int):
            logo = ""
        else:
            logo = "user_active" if self.owner.isactive else "user_deactive"
        icon = QIcon()
        icon.addPixmap(QPixmap(u"{}{}.png".format(Config.img_cmedia, logo)),
                       QIcon.Normal, QIcon.Off)
        self.setIcon(icon)
        self.init_text()
    def __init__(self, xmlPath, treeControl, parent=None):
        """ Constructor """
        if xmlPath is None or not os.path.isfile(xmlPath):
            msg = "..."
            q = QMessageBox(QMessageBox.Warning, "Could not find that file",
                            msg)
            q.setStandardButtons(QMessageBox.Ok)
            i = QIcon()
            i.addPixmap(QPixmap("..."), QIcon.Normal)
            q.setWindowIcon(i)
            q.exec_()
        else:
            self.tree = treeControl
            self.model = QStandardItemModel()
            # Set up an invisible root item for the tree.
            #self.treeRoot = self.model.invisibleRootItem()
            self.treeRoot = QStandardItem("Root Item")
            self.model.appendRow(self.treeRoot)
            self.tree.setModel(self.model)
            self.tree.doubleClicked.connect(self.item_doubleClicked)
            self.tree.customContextMenuRequested.connect(self.openMenu)
            self.tree.setDragEnabled(True)

            self.xmlTreeDir = os.path.join(os.path.dirname(__file__),
                                           "Resources/XML/")
            self.xmlProjfile = xmlPath
            self.xmlProjDir = os.path.dirname(xmlPath)
            self.namespace = "{http://tempuri.org/ProjectDS.xsd}"
            self.xmlTreePath = None

            # Load the GCD Project (the raw data that will be used to populate the tree)
            # instead of ET.fromstring(xml)
            self.xmlProjectDoc = self.LoadXMLFile(self.xmlProjfile)

            if self.FindTreeParser():
                print "got ya"
                # Load the tree file (the rules we use to build the tree)

            else:
                print "This is an error"

            # Set up the first domino for the recursion
            projectName = self.xmlProjectDoc.find("Project/name")
            if projectName is not None:
                self.treeRoot.setText(projectName.text)

            self.LoadNode(None, self.xmlTemplateDoc.find("node"),
                          self.xmlProjectDoc)
            self.tree.expandToDepth(5)
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setObjectName("SplitSectorDlg")
        self.ui = Ui_SplitSector()
        self.ui.setupUi(self)
#         self.ui.txtTo.textChanged.connect(self.txtToChanged)
#         self.ui.txtRadius.textChanged.connect(self.txtRadiusChanged)
        self.numTo = 0
        self.numRadius = 0
        self.ui.btnMeasureDegreeTo.clicked.connect(self.btnMeasureDegreeTo_clicked)
        self.ui.btnMeasureRadius.clicked.connect(self.btnMeasureRadius_clicked)

        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/dlgIcon.png"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
Example #42
0
 def __init_toolbar(self):
     """Inicializa la toolbar"""
     #self.setIconSize(QtCore.QSize(64,64))
     #self.ui.toolBar.setIconSize(QtCore.QSize(64,64))
     self.__boton1 = QtGui.QToolButton(self.ui.toolBar)
     self.ui.toolBar.addWidget(self.__boton1)
     self.__boton1.setText("ABRIR")
     icono=QIcon()
     icono.addPixmap(self.__gestortemas.icono_abrir())
     self.__boton1.setIcon(icono)
     self.__boton2 = QtGui.QToolButton(self.ui.toolBar)
     self.__boton2.setText("GUARDAR")
     icono = QIcon()
     icono.addPixmap(self.__gestortemas.icono_guardar())
     self.__boton2.setIcon(icono)
     self.ui.toolBar.addWidget(self.__boton2)
Example #43
0
    def __init__(self, xmlPath, treeControl, parent = None):
        """ Constructor """
        if xmlPath is None or not os.path.isfile(xmlPath):
            msg = "..."
            q = QMessageBox(QMessageBox.Warning, "Could not find that file",  msg)
            q.setStandardButtons(QMessageBox.Ok);
            i = QIcon()
            i.addPixmap(QPixmap("..."), QIcon.Normal)
            q.setWindowIcon(i)
            q.exec_()
        else:
            self.tree = treeControl
            self.model = QStandardItemModel()
            # Set up an invisible root item for the tree.
            #self.treeRoot = self.model.invisibleRootItem()
            self.treeRoot = QStandardItem("Root Item")
            self.model.appendRow(self.treeRoot)
            self.tree.setModel(self.model)
            self.tree.doubleClicked.connect(self.item_doubleClicked)
            self.tree.customContextMenuRequested.connect(self.openMenu)
            self.tree.setDragEnabled(True)

            # This is the GCD projet viewer so no harm in hardcoding this for now.
            self.xmlTreePath = os.path.join(os.path.dirname(__file__), "Resources/XML/gcd_tree.xml")
            self.xmlProjfile = xmlPath
            self.xmlProjDir = os.path.dirname(xmlPath)
            self.namespace = "{http://tempuri.org/ProjectDS.xsd}"
            
            # Load the tree file (the rules we use to build the tree)
            self.xmlTemplateDoc = ET.parse(self.xmlTreePath)
            # Load the GCD Project (the raw data that will be used to populate the tree)
            # instead of ET.fromstring(xml)
            with open(self.xmlProjfile, 'r') as myfile:
                data=myfile.read().replace('\n', '')
                it = ET.iterparse(StringIO(data))
                for _, el in it:
                    if '}' in el.tag:
                        el.tag = el.tag.split('}', 1)[1]  # strip all namespaces
                self.xmlProjectDoc = it.root
                        
            # Set up the first domino for the recursion         
            projectName = self.xmlProjectDoc.find("Project/Name")
            if projectName is not None:
                self.treeRoot.setText(projectName.text)
   
            self.LoadNode(None, self.xmlTemplateDoc.find("node"), self.xmlProjectDoc)
            self.tree.expandToDepth(5)
Example #44
0
    def startUI(self):        
        
#        self.stackedWidget.setCurrentIndex(0)
        self.dtPicker.setAlignment(Qt.AlignHCenter)
        
    
        self.btnAdd = QPushButton(self.groupBox)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnAdd.sizePolicy().hasHeightForWidth())
        self.btnAdd.setSizePolicy(sizePolicy)
        self.btnAdd.setMaximumSize(QSize(22, 16777215))
        icon = QIcon()
        icon.addPixmap(QPixmap(":/icons/res/list-add.png"), QIcon.Normal, QIcon.Off)
        self.btnAdd.setIcon(icon)
        self.btnAdd.clicked.connect(self.addRow)
        
        self.btnRemove = QPushButton(self)
        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.btnRemove.sizePolicy().hasHeightForWidth())
        self.btnRemove.setSizePolicy(sizePolicy)
        self.btnRemove.setMaximumSize(QSize(22, 16777215))
        icon1 = QIcon()
        icon1.addPixmap(QPixmap(":/icons/res/list-remove.png"), QIcon.Normal, QIcon.Off)
        self.btnRemove.setIcon(icon1)
        self.btnRemove.clicked.connect(self.removeRow)
        
        
        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.addWidget(self.dtPicker)
        self.horizontalLayout.addWidget(self.btnAdd)
        self.horizontalLayout.addWidget(self.btnRemove)
        self.verticalLayout.addLayout(self.horizontalLayout)
        self.verticalLayout.addWidget(self.tableDetails)
#        self.verticalLayout.addWidget(self.stackedWidget)
    
        self.tableDetails.setEditTriggers( QTableView.AllEditTriggers)
        self.tableNavigation.setVisible(False)
        self.txtSearch.setVisible(False)
        self.label_4.setVisible(False)
        self.groupBox.setVisible(False)
        self.setWindowModality(Qt.WindowModal)
        self.setWindowTitle("Balance Inicial")
Example #45
0
    def __init__(self, provid_clt):
        super(ProviderOrClientQListWidgetItem, self).__init__()

        self.provid_clt = provid_clt
        self.setSizeHint(QSize(0, 30))
        icon = QIcon()

        if isinstance(self.provid_clt, str):
            print("kkkkk")
        else:
            icon.addPixmap(
                QPixmap("{}.png".format(
                    Config.img_media + "debt" if self.provid_clt.is_indebted() else Config.img_cmedia + "user_active")),
                QIcon.Normal, QIcon.Off)

        self.setIcon(icon)
        self.init_text()
Example #46
0
    def __init__(self, provid_clt):
        super(ProviderOrClientQListWidgetItem, self).__init__()

        self.provid_clt = provid_clt
        self.setSizeHint(QSize(0, 30))
        icon = QIcon()

        if not isinstance(self.provid_clt, str):
            icon.addPixmap(
                QPixmap("{}.png".format(Config.img_media +
                                        "debt" if self.provid_clt.is_indebted(
                                        ) else Config.img_cmedia +
                                        "user_active")), QIcon.Normal,
                QIcon.Off)

        self.setIcon(icon)
        self.init_text()
    def settings(self):
        # CRIANDO O LINEEDIT PARA MOSTRAR O CAMINHO DO ARQUIVO
        self.lineEditWay = QLineEdit(self.parent)
        self.lineEditWay.setReadOnly(True)

        self.addWidget(self.lineEditWay)

        # CRIANDO O BOTAO PARA SELECIONAR O ARQUIVO
        self.btnBrowser = QPushButton(self.parent)
        self.btnBrowser.setText("Browser...")
        self.btnBrowser.clicked.connect(self.parent.messageBox)
        icon = QIcon()
        diretorio = "View\\Imagens\\pasta.png"
        icon.addPixmap(QPixmap(diretorio), QIcon.Normal, QIcon.Off)
        self.btnBrowser.setIcon(icon)

        # ADIONANDO OS WIDGETS NO LAYOUT
        self.addWidget(self.btnBrowser)
Example #48
0
    def settings(self):
        # CRIANDO O LINEEDIT PARA MOSTRAR O CAMINHO DO ARQUIVO
        self.lineEditWay = QLineEdit(self.parent)
        self.lineEditWay.setReadOnly(True)

        self.addWidget(self.lineEditWay)

        # CRIANDO O BOTAO PARA SELECIONAR O ARQUIVO
        self.btnBrowser = QPushButton(self.parent)
        self.btnBrowser.setText("Browser...")
        self.btnBrowser.clicked.connect(self.parent.messageBox)
        icon = QIcon()
        diretorio = "View\\Imagens\\pasta.png"
        icon.addPixmap(QPixmap(diretorio), QIcon.Normal, QIcon.Off)
        self.btnBrowser.setIcon(icon)

        # ADIONANDO OS WIDGETS NO LAYOUT
        self.addWidget(self.btnBrowser)
Example #49
0
 def init(cls):
     if cls._qapp is None:
         qapp = QApplication([
             "", "-style", "Cleanlooks"
         ])  #crear la aplicación con el estilo que va a usar
         cls._qapp = qapp  #fijar la aplicación de Qt global
         cls._qtTranslator = QTranslator()  #crear un traductor de QT
         if cls._qtTranslator.load(
                 "qt_es"):  # para los diálogos estándares
             qapp.installTranslator(
                 cls._qtTranslator)  #instalar el traductor
         qapp.setApplicationName("BrainApp")
         qapp.setApplicationVersion("0.1")
         icon = QIcon()
         icon.addPixmap(QPixmap(":/icons/seleccion/main_icon.png"),
                        QIcon.Normal, QIcon.Off)
         qapp.setWindowIcon(icon)
         WaitProcess.init()
    def uiStateInit(self):
        self.ui.grbMostCritical.setVisible(False)
        self.ui.grbResult_2.setVisible(False)
        self.ui.btnUpdateQA.setVisible(False)
        self.ui.btnUpdateQA_2.setVisible(False)
        self.ui.btnExportResult.setVisible(False)
        self.ui.btnEvaluate.setVisible(False)
        self.ui.btnPDTCheck.setVisible(False)
        self.ui.frm_cmbObstSurface.setVisible(False)
        self.ui.tabCtrlGeneral.removeTab(1)

        icon = QIcon()
        icon.addPixmap(QPixmap(("Resource/Calculator.bmp")), QIcon.Normal,
                       QIcon.Off)
        self.ui.btnConstruct.setIcon(icon)
        self.ui.btnConstruct.setToolTip("Calculate")

        return FlightPlanBaseDlg.uiStateInit(self)
Example #51
0
    def setupUi(self, nodeActions):
        self.actionScan = QAction(self)

        icon = QIcon()
        icon.addPixmap(QPixmap(QString.fromUtf8(":/scan")), QIcon.Normal,
                       QIcon.On)
        self.actionScan.setIcon(icon)
        self.actionScan.setObjectName(QString.fromUtf8("actionScan"))

        self.actionReport_node = QAction(self)
        icon = QIcon()
        icon.addPixmap(QPixmap(QString.fromUtf8(":/report")), QIcon.Normal,
                       QIcon.On)
        self.actionReport_node.setIcon(icon)
        self.actionReport_node.setObjectName(
            QString.fromUtf8("actionReport_Node"))

        Ui_nodeActions.setupUi(self, nodeActions)
Example #52
0
    def __init__(self, parent=None, special_actions=[]):
        QWidget.__init__(self, parent=parent)
        self.setupUi(self)

        self.popup = None

        self.figure = Figure()
        self.figure.subplots_adjust(left=0.08,
                                    right=0.92,
                                    top=0.92,
                                    bottom=0.08)
        self.canvas = FigureCanvas(self.figure)
        self.canvas.setParent(parent)
        self.special_actions = []

        tw = QWidget()
        self.button_layout = QHBoxLayout(tw)
        self.button_layout.setSizeConstraint(QLayout.SetFixedSize)

        icon = QIcon()
        icon.addPixmap(QPixmap(get_image_path('popup_icon.png')), QIcon.Normal,
                       QIcon.Off)
        self.toolButton = QToolButton(parent=None)
        self.toolButton.setIcon(icon)
        self.toolButton.setIconSize(QSize(16, 16))
        self.toolButton.clicked.connect(self.popup_clicked)
        self.toolButton.setStatusTip('Expand into new window')
        self.button_layout.addWidget(self.toolButton)

        for sa in special_actions:
            icon = QIcon()
            icon.addPixmap(QPixmap(get_image_path(sa.icon_path)), QIcon.Normal,
                           QIcon.Off)
            tb = QToolButton(parent=tw)
            tb.setIcon(icon)
            tb.setIconSize(QSize(16, 16))
            tb.clicked.connect(sa.execute)
            self.special_actions.append(sa)
            self.button_layout.addWidget(tb)

        self.verticalLayout.addWidget(tw)
        self.verticalLayout.addWidget(self.canvas)
Example #53
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.aboutWidget = AboutWidget()

        icon = QIcon()
        icon.addPixmap(QPixmap(_fromUtf8(":/freeseer/logo.png")), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)

        self.layout = QGridLayout()
        self.setLayout(self.layout)

        self.layout.addWidget(self.aboutWidget)

        # Right Bottom corner of grid, Close Button
        self.buttonBox = QDialogButtonBox()
        self.closeButton = self.buttonBox.addButton("Close", QDialogButtonBox.AcceptRole)
        self.layout.addWidget(self.buttonBox, 1, 1)
        self.connect(self.closeButton, SIGNAL("clicked()"), self.close)

        self.setWindowTitle("About Freeseer")
Example #54
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setObjectName("FixToleranceAreaDlg")

        self.resize(470, 400)
        QgisHelper.matchingDialogSize(self, 650, 450)
        ui = Ui_FixToleranceArea()
        ui.setupUi(self)
        self.parametersPanel = ui

        self.uiStateInit()
        self.initParametersPan()
        self.setWindowTitle(SurfaceTypes.FixToleranceArea)

        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/dlgIcon.png"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(icon)
        self.resultLayerList1 = []
        self.resultLayerList2 = []
        self.surfaceType2 = SurfaceTypes.FixConstruction
        self.surfaceType1 = SurfaceTypes.OverheadTolerance
Example #55
0
def get_icon(name, default=None, resample=False):
    """Return image inside a QIcon object
    default: default image name or icon
    resample: if True, manually resample icon pixmaps for usual sizes
    (16, 24, 32, 48, 96, 128, 256). This is recommended for QMainWindow icons 
    created from SVG images on non-Windows platforms due to a Qt bug (see 
    http://code.google.com/p/spyderlib/issues/detail?id=1314)."""
    if default is None:
        icon = QIcon(get_image_path(name))
    elif isinstance(default, QIcon):
        icon_path = get_image_path(name, default=None)
        icon = default if icon_path is None else QIcon(icon_path)
    else:
        icon = QIcon(get_image_path(name, default))
    if resample:
        icon0 = QIcon()
        for size in (16, 24, 32, 48, 96, 128, 256, 512):
            icon0.addPixmap(icon.pixmap(size, size))
        return icon0
    else:
        return icon
Example #56
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        palette = QPalette()
        brush = QBrush(QColor(255, 255, 255, 255))
        brush.setStyle(Qt.SolidPattern)
        palette.setBrush(QPalette.Active, QPalette.Base, brush)
        palette.setBrush(QPalette.Active, QPalette.Window, brush)
        palette.setBrush(QPalette.Inactive, QPalette.Base, brush)
        palette.setBrush(QPalette.Inactive, QPalette.Window, brush)
        palette.setBrush(QPalette.Disabled, QPalette.Base, brush)
        palette.setBrush(QPalette.Disabled, QPalette.Window, brush)
        self.setPalette(palette)
        self.ui = Ui_FlightPlannerSimpleBase()
        self.ui.setupUi(self)
        ''' buttons clicked connect '''
        self.ui.btnClose.clicked.connect(self.reject)
        #         self.ui.btnClose_2.clicked.connect(self.reject)
        self.ui.btnConstruct.clicked.connect(self.btnConstruct_Click)
        self.ui.btnPDTCheck.clicked.connect(self.btnPDTCheck_Click)
        self.ui.btnUpdateQA.clicked.connect(self.btnUpdateQA_Click)
        #         self.ui.btnEvaluate.clicked.connect(self.btnEvaluate_Click)
        self.ui.btnOpenData.clicked.connect(self.openData)
        self.ui.btnSaveData.clicked.connect(self.saveData)
        self.ui.btnExportResult.clicked.connect(self.exportResult)
        self.ui.btnExportResult.setDisabled(True)
        self.ui.btnExportResult.setVisible(False)
        ''' properties '''
        self.parametersPanel = None
        self.ui.btnUpdateQA.setVisible(False)
        # self.ui.btnUpdateQA_2.setVisible(False)

        self.uiStateInit()
        #         self.obstacleTableInit()
        self.ui.btnPDTCheck.setVisible(False)

        icon = QIcon()
        icon.addPixmap(QPixmap("Resource/btnImage/dlgIcon.png"), QIcon.Normal,
                       QIcon.Off)
        self.setWindowIcon(icon)
        self.resultLayerList = []
    def __init__(self, parent, filter_dlg, db, model):
        self.parent = parent  # Parent is the street browser instance
        self.filter_dlg = filter_dlg
        self.db = db
        self.model = model
        self.table_view = self.filter_dlg.ui.resultsTableView
        self.table_view.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.table_view.horizontalHeader().setStretchLastSection(True)
        self.table_view.resizeColumnsToContents()
        self.plugin_dir = os.path.dirname(__file__)
        self.filter_dlg.setWindowFlags(Qt.CustomizeWindowHint
                                       | Qt.WindowCloseButtonHint)
        app_root = os.path.dirname(os.path.dirname(__file__))
        rn_icon = QIcon()
        rn_icon.addPixmap(
            QPixmap(os.path.join(app_root, "image", "rn_logo_v2.png")))
        self.filter_dlg.setWindowIcon(rn_icon)
        self.connect_filters()
        # Setup custom proxy
        self.proxy = MultiFilterProxyModel()  # Inherits QSortFilterProxyModel
        self.proxy.setSourceModel(self.model)
        self.proxy.setDynamicSortFilter(True)
        self.table_view.setModel(self.proxy)
        # Only show required cols
        self.hide_columns()
        # Various setups for filtering
        self.set_header_data()
        self.relate_lookup_tables(self.model)
        self.populate_comboboxes()
        self.quick_find_dlg = None

        # Connect buttons
        self.filter_dlg.ui.gotoRecordPushButton.clicked.connect(
            lambda: self.goto_record(close=True))
        self.filter_dlg.ui.mapPushButton.clicked.connect(self.zoom_to_record)
        self.filter_dlg.ui.quickFindPushButton.clicked.connect(
            self.quick_find_show)

        self.update_filter_counter()