当前位置: 首页>>代码示例>>Python>>正文


Python QGraphicsDropShadowEffect.setOffset方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QGraphicsDropShadowEffect.setOffset方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsDropShadowEffect.setOffset方法的具体用法?Python QGraphicsDropShadowEffect.setOffset怎么用?Python QGraphicsDropShadowEffect.setOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QGraphicsDropShadowEffect的用法示例。


在下文中一共展示了QGraphicsDropShadowEffect.setOffset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: must_glow

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
 def must_glow(widget_list):
     " apply an glow effect to the widget "
     for glow, each_widget in enumerate(widget_list):
         try:
             if each_widget.graphicsEffect() is None:
                 glow = QGraphicsDropShadowEffect(self)
                 glow.setOffset(0)
                 glow.setBlurRadius(99)
                 glow.setColor(QColor(99, 255, 255))
                 each_widget.setGraphicsEffect(glow)
                 # glow.setEnabled(False)
                 try:
                     each_widget.clicked.connect(
                         lambda: each_widget.graphicsEffect().setEnabled(True)
                         if each_widget.graphicsEffect().isEnabled() is False
                         else each_widget.graphicsEffect().setEnabled(False)
                     )
                 except:
                     each_widget.sliderPressed.connect(
                         lambda: each_widget.graphicsEffect().setEnabled(True)
                         if each_widget.graphicsEffect().isEnabled() is False
                         else each_widget.graphicsEffect().setEnabled(False)
                     )
         except:
             pass
开发者ID:juancarlospaco,项目名称:pyqt_app_template,代码行数:27,代码来源:pyqt_app_template.py

示例2: enableHoverEffect

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
 def enableHoverEffect(self):
     e = QGraphicsDropShadowEffect()
     e.setEnabled(False)
     e.setBlurRadius(2 * _trackWidth)
     e.setColor(_hoverColor)
     e.setOffset(0, 0)
     self.setGraphicsEffect(e)
     self.setAcceptHoverEvents(True)
开发者ID:Pesa,项目名称:forse,代码行数:10,代码来源:Track.py

示例3: Meterbar

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
class Meterbar(Button):
    def __init__(self, max=255, filename=None, width=None, height=None, x=0, y=0, pixmap=None, group=None, pos=None, size=None, padding=None):
        Button.__init__(self, filename, width, height, x, y, pixmap, group, pos, size, padding)
        self.max = max
        self.outer = QGraphicsRectItem(x,y,width,max + 2)
        self.outer.setPen(QPen(QColor(Qt.black), 1, Qt.SolidLine))
        self.outer.setBrush(Qt.green)
#         self.outer.hide()
        self.inner = QGraphicsRectItem(x + 1,y + 1,width - 2,max)
        self.inner.setPen(QPen(QColor(Qt.green), 1, Qt.SolidLine))
        self.inner.setBrush(Qt.blue)
        self.items = [self.outer, self.inner]
        self.current = 255
        self.effect = QGraphicsDropShadowEffect()
        self.effect.setOffset(0, 0)
        self.effect.setBlurRadius(0)
        self.effect.setColor(Qt.green)
        self.item = self.outer
        self.addEffect('shadow', self.effect, True)
        self.addAnimation('glow', Glow(15, 300, self, maxRadius=80, minRadius=5))
#         self.test(10)
    
    def test(self, x):
        self.tl = QTimeLine(10000)
        self.tl.setFrameRange(0, 10000)
        self.a = QGraphicsItemAnimation()
        self.a.setItem(self.inner)
        self.a.setTimeLine(self.tl)
#         self.a.setPosAt(0, QPointF(self.getX(), self.current))
#         self.a.setTranslationAt(1, self.getX(), self.getY() + self.max - x + 1)
        self.a.setScaleAt(0, 1, 1)
        self.a.setScaleAt(1, 1, 0.1)
        self.current = x
        self.tl.start()
        
    def update(self, x):
        x2 = 1 - (float(x) * 1.0 / float(self.max))
#         print x
#         return
        self.tl = QTimeLine(10)
        self.tl.setFrameRange(0, 10)
        self.a = QGraphicsItemAnimation()
        self.a.setItem(self.inner)
        self.a.setTimeLine(self.tl)
#         self.a.setPosAt(0, QPointF(self.getX(), self.current))
#         self.a.setTranslationAt(1, self.getX(), self.getY() + self.max - x + 1)
        self.a.setScaleAt(0, 1, self.current)
        self.a.setScaleAt(1, 1, x2)
        self.current = x
        self.tl.start()
        if x > 3 :
            self.play('glow')
        
    def setScene(self, scene):
        self.scene = scene
        for item in self.items :
            self.scene.addItem(item)
开发者ID:derekisbusy,项目名称:AnyController,代码行数:59,代码来源:widget_sixaxis.py

示例4: FaceButtonsView

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
class FaceButtonsView(QGraphicsView):

    def __init__(self, *args):
        QGraphicsView.__init__(self, *args)
        self.move(170, 90)
        self.btnSize = 40
        self.padding = 5
        self.setMaximumHeight(self.btnSize * 4)
        self.setMaximumWidth(self.btnSize * 4)
        self.setMinimumHeight(self.btnSize * 4)
        self.setMinimumWidth(self.btnSize * 4)
        self.adjustSize()
        self.setStyleSheet('background-color:transparent; border-width: 0px; border: 0px;')
        self.scene = QGraphicsScene(self)
        self.psButtons = QPixmap(os.getcwd() + '/../icons/PS3_Buttons.png')
        self.triangle = self.psButtons.copy(0, 0, 220, 225)
        self.triangle = self.triangle.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.square = self.psButtons.copy(220, 0, 220, 225)
        self.square = self.square.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.circle = self.psButtons.copy(440, 0, 220, 225)
        self.circle = self.circle.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.cross = self.psButtons.copy(660, 0, 220, 225)
        self.cross = self.cross.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.triangleItem = QGraphicsPixmapItem(self.triangle)
        self.triangleItem.setOffset(QPointF(self.btnSize + self.padding, 0))
        self.scene.addItem(self.triangleItem)
        self.squareItem = QGraphicsPixmapItem(self.square)
        self.squareItem.setOffset(QPointF(0, self.btnSize + self.padding))
        self.scene.addItem(self.squareItem)
        self.circleItem = QGraphicsPixmapItem(self.circle)
        self.circleItem.setOffset(QPointF(self.btnSize * 2 + self.padding * 2, self.btnSize + self.padding))
        self.scene.addItem(self.circleItem)
        self.crossItem = QGraphicsPixmapItem(self.cross)
        self.crossItem.setOffset(QPointF(self.btnSize + self.padding, self.btnSize * 2 + self.padding * 2))
        self.scene.addItem(self.crossItem)
        self.effect = QGraphicsDropShadowEffect()
        self.effect.setOffset(0, 0)
        self.effect.setBlurRadius(20)
        self.effect.setColor(Qt.green)
        self.triangleItem.setGraphicsEffect(self.effect)
        self.setScene(self.scene)
        self.tl2 = QTimeLine(10000)
        self.tl2.setFrameRange(0, 10000)
        self.t = QGraphicsItemAnimation()
        self.t.setItem(self.triangleItem)
        self.t.setTimeLine(self.tl2)
        self.tl2.connect(self.tl2, SIGNAL('frameChanged(int)'), self.updateEffect)
        self.effectd = 3
        self.tl2.start()

    def updateEffect(self):
        if self.effect.blurRadius() > 50:
            self.effectd = -3
        elif self.effect.blurRadius() < 5:
            self.effectd = 3
        self.effect.setBlurRadius(self.effect.blurRadius() + self.effectd)
开发者ID:derekisbusy,项目名称:AnyController,代码行数:58,代码来源:custom_widgets.py

示例5: DpadView

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
class DpadView(QGraphicsView):

    def __init__(self, *args):
        QGraphicsView.__init__(self, *args)
        self.move(2, 90)
        self.btnSize = 75
        self.padding = -35
        self.setMaximumHeight(self.btnSize * 2 + 20)
        self.setMaximumWidth(self.btnSize * 2 + 20)
        self.setMinimumHeight(self.btnSize * 2 + 20)
        self.setMinimumWidth(self.btnSize * 2 + 20)
        self.adjustSize()
        self.setStyleSheet('background-color:transparent; border-width: 0px; border: 0px;')
        self.scene = QGraphicsScene(self)
        self.left = QPixmap(os.getcwd() + '/../icons/left.png')
        self.left = self.left.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.right = QPixmap(os.getcwd() + '/../icons/right.png')
        self.right = self.right.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.up = QPixmap(os.getcwd() + '/../icons/up.png')
        self.up = self.up.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.down = QPixmap(os.getcwd() + '/../icons/down.png')
        self.down = self.down.scaled(self.btnSize, self.btnSize, Qt.KeepAspectRatio)
        self.leftItem = QGraphicsPixmapItem(self.left)
        self.leftItem.setOffset(QPointF(0, self.btnSize + self.padding))
        self.scene.addItem(self.leftItem)
        self.rightItem = QGraphicsPixmapItem(self.right)
        self.rightItem.setOffset(QPointF(self.btnSize * 2 + self.padding * 2, self.btnSize + self.padding))
        self.scene.addItem(self.rightItem)
        self.upItem = QGraphicsPixmapItem(self.up)
        self.upItem.setOffset(QPointF(self.btnSize + self.padding, 0))
        self.scene.addItem(self.upItem)
        self.downItem = QGraphicsPixmapItem(self.down)
        self.downItem.setOffset(QPointF(self.btnSize + self.padding, self.btnSize * 2 + self.padding * 2))
        self.scene.addItem(self.downItem)
        self.effect = QGraphicsDropShadowEffect()
        self.effect.setOffset(0, 0)
        self.effect.setBlurRadius(20)
        self.effect.setColor(Qt.green)
        self.downItem.setGraphicsEffect(self.effect)
        self.setScene(self.scene)
        self.tl2 = QTimeLine(10000)
        self.tl2.setFrameRange(0, 10000)
        self.t = QGraphicsItemAnimation()
        self.t.setItem(self.downItem)
        self.t.setTimeLine(self.tl2)
        self.tl2.connect(self.tl2, SIGNAL('frameChanged(int)'), self.updateEffect)
        self.effectd = 3
        self.tl2.start()

    def updateEffect(self):
        if self.effect.blurRadius() > 50:
            self.effectd = -3
        elif self.effect.blurRadius() < 5:
            self.effectd = 3
        self.effect.setBlurRadius(self.effect.blurRadius() + self.effectd)
开发者ID:derekisbusy,项目名称:AnyController,代码行数:57,代码来源:custom_widgets.py

示例6: must_glow

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
 def must_glow(widget_list):
     ' apply an glow effect to the widget '
     for glow, each_widget in enumerate(widget_list):
         try:
             if each_widget.graphicsEffect() is None:
                 glow = QGraphicsDropShadowEffect(self)
                 glow.setOffset(0)
                 glow.setBlurRadius(99)
                 glow.setColor(QColor(99, 255, 255))
                 each_widget.setGraphicsEffect(glow)
                 glow.setEnabled(True)
         except:
             pass
开发者ID:Zekom,项目名称:webutil,代码行数:15,代码来源:main.py

示例7: HighlightEdit

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
class HighlightEdit(QLineEdit):
    clicked = pyqtSignal(name="clicked")

    def __init__(self, parent):
        QLineEdit.__init__(self, parent)
        self._highlight_effect = QGraphicsDropShadowEffect(self)
        self._highlight_effect.setOffset(0.0)
        self._highlight_effect.setBlurRadius(5.0)
        self._highlight_effect.setColor(QColor(50, 50, 200))
        self.setGraphicsEffect(self._highlight_effect)
        self._highlight_effect.setEnabled(False)

        self.clear_button = QToolButton(self)
        self.clear_button.setIcon(QIcon.fromTheme("edit-clear", QIcon("icons/delete_icon.png")))
        self.clear_button.setCursor(Qt.ArrowCursor)
        self.clear_button.setStyleSheet("QToolButton { border: none; padding: 1.5px; }")
        icon_size = int(self.sizeHint().height() * 0.65)
        self.clear_button.setIconSize(QSize(icon_size, icon_size))
        self.clear_button.clicked.connect(self.clear)
        # self.clear_button.hide()

        # some padding stuff
        frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        self.setStyleSheet(
            "QLineEdit {{ padding-right: {}px; }} ".format(self.clear_button.sizeHint().width() + frameWidth)
        )

    # create a signal on doubleclick events
    def mouseDoubleClickEvent(self, ev):
        ev.accept()
        self.clicked.emit()

    # fix up the clear button positioning
    def resizeEvent(self, ev):
        sz = self.clear_button.sizeHint()

        frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        self.clear_button.move(
            self.rect().right() - frameWidth - sz.width(), (self.rect().bottom() + 1 - sz.height()) / 2
        )

    # a slot for turning the graphics effect on and off
    @pyqtSlot(bool)
    def highlight(self, val):
        self._highlight_effect.setEnabled(val)
开发者ID:gwillz,项目名称:EagleEye,代码行数:47,代码来源:highlight_edit.py

示例8: Dial

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
class Dial(QGraphicsItem):
    """
    Dial
    """
    
    def __init__(self):
        super(Dial, self).__init__()
        
        self.angle = 0

        # Colors
        self.color               = QColor(120, 120, 120, 255)
        self.notchColor          = QColor(115, 115, 115, 255)
        self.normalBorderColor   = QColor(  255,  255,  255, 30  )
        self.selectedBorderColor = QColor( 255, 191,   0, 102 )
        self.textColor           = QColor(  30,  30,  30, 255 )
        self.shadowColor         = QColor(0, 0, 0, 75)
        self.selectedShadowColor = QColor( 100, 100, 100, 255 )

        # Settings
        self.width, self.height = 75, 75
        
        # Drop Shadow
        self.shadowBlurRadius = 8
        self.shadow = QGraphicsDropShadowEffect()
        self.shadow.setBlurRadius(self.shadowBlurRadius)
        self.shadow.setOffset(0, 0.5)
        self.shadow.setColor(self.shadowColor)
        self.setGraphicsEffect(self.shadow)
        
        # Painter Definitions
        self.pen = QPen()
        gradient = QRadialGradient(self.boundingRect().center() + QPointF(0, -20), 80)
        gradient.setColorAt(0, self.color.lighter(117))
        gradient.setColorAt(1, self.color)
        self.brush = QBrush(gradient)
        self.font  = QFont()
        self.pen.setWidth(1)
        self.pen.setColor(self.normalBorderColor)
        self.brush.setColor(self.color)
        self.font.setPointSize(10)
        
        # Nodegraph Definitions
        self.dragPoint  = None
        self.dragAngle  = 0
        self.dragFactor = 0

        # Notch Specifications
        self.notch = DialNotch()
        self.notch.setParentItem(self)
        self.updateNotch()

    def boundingRect(self):
        """
        Overrides QGraphicsItem's boundingRect() virtual public function and 
        returns a valid bounding rect based on calculated width and height.
        """
        return QRectF(0, 0, self.width, self.height).adjusted(
            -self.shadowBlurRadius, -self.shadowBlurRadius, 
             self.shadowBlurRadius,  self.shadowBlurRadius)

    def paint(self, painter, option, widget):
        """
        Overrides QGraphicsItem's paint() virtual public function.
        """
        painter.setPen(self.pen)
        painter.setBrush(self.brush)
        painter.drawEllipse(self.boundingRect())

    def mousePressEvent(self, event):
        self.dragPoint  = event.scenePos()
        self.dragAngle  = self.angle
        part     = self.height / 2
        distance = event.pos().y() - part
        if distance == 0:
            self.dragFactor = 0
        else:
            self.dragFactor = part / distance

    def mouseMoveEvent(self, event):
        scenePos = event.scenePos()
        d = scenePos - self.dragPoint
        self.angle = self.dragAngle + d.x() * self.dragFactor
        self.updateNotch()

    def mouseReleaseEvent(self, event):
        self.dragPoint = None
        self.dragAngle = 0

    def updateNotch(self):
        f  = 0.02
        dx = (self.width  - self.notch.width)  / 2
        dy = (self.height - self.notch.height) / 2
        x  = math.sin(math.radians(self.angle)) * dx + dx
        y  = math.cos(math.radians(self.angle)) * dy + dy
        self.notch.setPos(x, y)
开发者ID:jsdir,项目名称:giza,代码行数:98,代码来源:widgets.py

示例9: initialize

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]

#.........这里部分代码省略.........
        self.srcdir.setCompleter(self.completer)
        self.btn2 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
        self.btn2.setToolTip(
            'Specify Extra search path to look for setuptools/distribute/pip')
        self.btn2.clicked.connect(lambda: self.srcdir.setText(str(
            QFileDialog.getExistingDirectory(self.dock,
            'Please, Open a Extra search path to look for setuptools/pip...',
            path.expanduser("~")))))
        self.prefx.setPlaceholderText('Prompt prefix for this environment')
        self.prefx.setToolTip('''
        Specify a custom alternative prompt prefix for this environment.
        Defaults to Empty,this is optional,short prefix are recommended.''')
        self.btn3 = QPushButton(QIcon.fromTheme("face-smile-big"), 'Suggestion')
        self.btn3.setToolTip('Suggest me a Random CLI prompt prefix !')
        self.btn3.clicked.connect(lambda: self.prefx.setText(choice((getuser(),
        'tesla', 'einstein', 'turing', 'ritchie', 'darwin', 'curie', 'planck',
        'lovelace', 'dijsktra', 'galileo', 'schroedinger', 'perlman', 'hopper',
        'newton', 'pasteur', 'maxwell', 'aristotle‎', 'volta', 'mendelev',
        'bohr', 'crick', 'watson', 'archimedes', 'nash', 'fermi', 'dirac',
        'feynman', 'kepler', 'copernicus', 'lorentz', 'faraday', 'heisenberg',
        ))))
        vboxg1 = QVBoxLayout(self.group1)
        for each_widget in (
            QLabel(' Target directory dath: '), self.outdir, self.btn1,
            QLabel(' Extra search path: '), self.srcdir, self.btn2,
            QLabel(' CLI Prompt prefix (Optional): '), self.prefx, self.btn3):
            vboxg1.addWidget(each_widget)

        self.group2 = QGroupBox()
        self.group2.setTitle(' Options ')
        self.group2.setCheckable(True)
        self.group2.setGraphicsEffect(QGraphicsBlurEffect(self))
        self.group2.graphicsEffect().setEnabled(False)
        self.group2.toggled.connect(self.toggle_options_group)
        self.qckb1, self.combo1 = QCheckBox(' Use Debug'), QDoubleSpinBox()
        self.qckb2 = QCheckBox(' Clear out the target directory')
        self.qckb3 = QCheckBox(' System-wide Python Packages')
        self.qckb4 = QCheckBox(' Unzip Setuptool or Distribute to virtualenv')
        self.qckb5 = QCheckBox(' Force the use of SetupTools')
        self.qckb6 = QCheckBox(' Never download packages')
        self.qckb7 = QCheckBox(' Delete .PYC files from virtualenv')
        self.qckb8 = QCheckBox(' Open target directory later')
        self.qckb9 = QCheckBox(' Save a LOG file to target later')
        self.qckb10 = QCheckBox(' No install PIP in the new virtualenv')
        self.qckb11 = QCheckBox('Save Bash script to reproduce virtenv later')
        self.chrt = QCheckBox('LOW CPU priority for Backend Process')
        self.combo1.setValue(2.7)
        self.combo1.setMaximum(3.4)
        self.combo1.setMinimum(2.4)
        self.combo1.setDecimals(1)
        self.combo1.setSingleStep(0.1)
        try:
            self.vinfo = QLabel('<small><b> Virtualenv Version: </b>' +
                            getoutput('virtualenv --version', shell=1).strip())
        except:
            self.vinfo = QLabel('Warning: Failed to query Virtualenv Backend!')
        [a.setChecked(True) for a in (self.qckb1, self.qckb4, self.qckb7,
                                self.chrt, self.qckb8, self.qckb9, self.qckb11)]
        vboxg2 = QVBoxLayout(self.group2)
        for each_widget in (self.qckb1, self.qckb2, self.qckb3, self.qckb4,
            self.qckb5, self.qckb6, self.qckb7, self.qckb8, self.qckb9,
            self.qckb10, self.qckb11, QLabel(' Python interpreter version: '),
            self.combo1, QLabel(' Backend CPU priority: '), self.chrt):
            vboxg2.addWidget(each_widget)

        self.button = QPushButton(' Make Virtualenv ')
        self.button.setCursor(QCursor(Qt.PointingHandCursor))
        self.button.setMinimumSize(75, 50)
        self.button.clicked.connect(self.run)
        glow = QGraphicsDropShadowEffect(self)
        glow.setOffset(0)
        glow.setBlurRadius(99)
        glow.setColor(QColor(99, 255, 255))
        self.button.setGraphicsEffect(glow)
        self.output = QTextEdit(''' " Let the future tell the truth,
        and evaluate each one according to his work and accomplishments.
        The present is theirs; the future, for which I really worked, is mine. "
        -Nikola Tesla. ''')

        class TransientWidget(QWidget):
            ' persistant widget thingy '
            def __init__(self, widget_list):
                ' init sub class '
                super(TransientWidget, self).__init__()
                vbox = QVBoxLayout(self)
                for each_widget in widget_list:
                    vbox.addWidget(each_widget)

        tw = TransientWidget((self.group1, self.group2, QLabel('Backend Logs'),
                              self.output, self.vinfo, self.button))
        self.scrollable, self.dock = QScrollArea(), QDockWidget()
        self.scrollable.setWidgetResizable(True)
        self.scrollable.setWidget(tw)
        self.dock.setWindowTitle(__doc__)
        self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
        self.dock.setWidget(self.scrollable)
        ExplorerContainer().addTab(self.dock, "Virtualenv")
        QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
            ).clicked.connect(lambda:
            QMessageBox.information(self.dock, __doc__, HELPMSG))
开发者ID:juancarlospaco,项目名称:virtualenv-gui,代码行数:104,代码来源:virtualenv-gui.py

示例10: __init__

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.configOptions, self.checkBoxList, self.configBool = {}, {}, None
        # Check for root privileges
        if geteuid() != 0:
            msg = ("{} is not root. You need to run with root priviliges\n"
                   "Please use kdesudo, gksu or sudo/sux.").format(getuser())
            QMessageBox.critical(self, __doc__ + "- Error", msg)
            sys.exit(1)
        else:
            msg = "This tool is running with root priviliges."
            QMessageBox.warning(self, __doc__ + "- Warning", msg)
        # title, icon and sizes
        self.setWindowTitle(__doc__)
        self.setMinimumSize(600, 600)
        self.setMaximumSize(2048, 2048)
        self.resize(600, 600)
        self.setWindowIcon(QIcon.fromTheme("preferences-system"))
        self.menuBar().addMenu("&File").addAction("Exit", exit)
        QShortcut("Ctrl+q", self, activated=lambda: self.close())
        # main group
        main_group = QGroupBox("Module configuration")
        self.setCentralWidget(main_group)
        self.layout = QVBoxLayout(main_group)
        # scrollarea widgets
        self.scrollArea, self.window = QScrollArea(), QWidget()
        self.layout.addWidget(self.scrollArea)
        self.vbox = QVBoxLayout(self.window)
        # Graphic effect
        glow = QGraphicsDropShadowEffect(self)
        glow.setOffset(0)
        glow.setBlurRadius(99)
        glow.setColor(QColor(99, 255, 255))
        self.scrollArea.setGraphicsEffect(glow)
        glow.setEnabled(True)
        # config loading stuff
        self.findConfig(CONFIG_DIR)
        for eachOption in tuple(self.configOptions.keys()):

            self.readConfig(eachOption, self.configOptions)
            self.subLayout = QHBoxLayout()

            self.checkBoxName = "checkBox_" + eachOption
            checkBoxList = QCheckBox(self.checkBoxName, self)
            self.checkBoxList[self.checkBoxName] = checkBoxList
            checkBoxList.setObjectName(self.checkBoxName)
            checkBoxList.setText("Enable module {}".format(eachOption))

            if self.tooltip is not '':
                checkBoxList.setToolTip(self.tooltip)
            else:
                tooltip = "Configuration settings for {}".format(eachOption)
                checkBoxList.setToolTip(tooltip)

            if self.configBool:
                checkBoxList.setChecked(True)

            self.subLayout.addWidget(checkBoxList)
            self.vbox.addLayout(self.subLayout)
        self.scrollArea.setWidget(self.window)

        # Bottom Buttons Bar
        self.pushButtonSleep = QPushButton("Sleep")
        self.pushButtonSleep.setToolTip("Trigger Suspend to RAM aka Sleep")
        self.pushButtonSleep.clicked.connect(self.sleep)
        self.pushButtonHibernate = QPushButton("Hibernate")
        self.pushButtonHibernate.setToolTip("Trigger Suspend to Disk Hibernate")
        self.pushButtonHibernate.clicked.connect(self.hibernate)
        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setStandardButtons(
            QDialogButtonBox.Ok | QDialogButtonBox.Close |
            QDialogButtonBox.Help)
        self.buttonBox.addButton(self.pushButtonHibernate,
                                 QDialogButtonBox.ActionRole)
        self.buttonBox.addButton(self.pushButtonSleep,
                                 QDialogButtonBox.ActionRole)
        self.layout.addWidget(self.buttonBox)
        self.buttonBox.rejected.connect(exit)
        self.buttonBox.accepted.connect(self.writeConfig)
        self.buttonBox.helpRequested.connect(lambda: open_new_tab(WEBPAGE_URL))
开发者ID:tivek,项目名称:laptop-mode-tools,代码行数:82,代码来源:LMT.py

示例11: initialize

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]

#.........这里部分代码省略.........
        self.cpulag, self.gpulag = QSpinBox(), QSpinBox()
        self.lang, self.agent = QComboBox(), QComboBox()
        self.lang.addItems(['EN', 'ES', 'PT', 'JA', 'ZH', 'DE', 'RU', 'FR'])
        self.agent.addItems(['Default', 'Android', 'MeeGo', 'Desktop'])
        self.fonts = QLineEdit()
        self.width.setMaximum(9999)
        self.width.setMinimum(100)
        self.width.setValue(480)
        self.height.setMaximum(9999)
        self.height.setMinimum(100)
        self.height.setValue(800)
        self.zoom.setMaximum(999)
        self.zoom.setMinimum(1)
        self.zoom.setValue(100)
        self.ram.setMaximum(999)
        self.ram.setMinimum(1)
        self.ram.setValue(100)
        self.dpi.setMaximum(200)
        self.dpi.setMinimum(50)
        self.dpi.setValue(96)
        self.cpulag.setMaximum(9999)
        self.cpulag.setMinimum(0)
        self.cpulag.setValue(1)
        self.gpulag.setMaximum(9999)
        self.gpulag.setMinimum(0)
        self.gpulag.setValue(1)
        vboxg1 = QVBoxLayout(self.group1)
        for each_widget in (self.ckcss1, self.ckcss2, self.ckcss3, self.ckcss4,
            self.ckcss5, self.ckcss6, self.ckcss7, self.ckcss8,
            QLabel('Width Pixels of the emulated device screen'), self.width,
            QLabel('Height Pixels of the emulated device screen'), self.height,
            QLabel('Zoom Percentage of emulated screen'), self.zoom,
            QLabel('RAM MegaBytes of the emulated device'), self.ram,
            QLabel('Language of the emulated device'), self.lang,
            QLabel('D.P.I. of the emulated device'), self.dpi,
            QLabel('User-Agent of the emulated device'), self.agent,
            QLabel('CPU Core Lag Miliseconds of emulated device'), self.cpulag,
            QLabel('GPU Video Lag Miliseconds of emulated device'), self.gpulag,
            QLabel('Extra Fonts Directory Full Path'), self.fonts):
            vboxg1.addWidget(each_widget)

        self.group2 = QGroupBox()
        self.group2.setTitle(' General ')
        self.nice, self.opera = QSpinBox(), QLineEdit(path.expanduser("~"))
        self.nice.setValue(20)
        self.nice.setMaximum(20)
        self.nice.setMinimum(0)
        self.opera.setCompleter(self.completer)
        if path.exists(CONFIG_FILE):
            with codecs.open(CONFIG_FILE, encoding='utf-8') as fp:
                self.opera.setText(fp.read())
        self.open2 = QPushButton(QIcon.fromTheme("folder-open"), 'Open')
        self.open2.setCursor(QCursor(Qt.PointingHandCursor))
        self.open2.clicked.connect(lambda: self.opera.setText(str(
            QFileDialog.getOpenFileName(self.dock, "Open Opera Mobile Emulator",
            path.expanduser("~"),
            'Opera Mobile Emulator Executable(opera-mobile-emulator)'))))
        self.help1 = QLabel('''<a href=
            "http://www.opera.com/developer/mobile-emulator">
            <small><center>Download Opera Mobile Emulator !</a>''')
        self.help1.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
        self.help1.setOpenExternalLinks(True)
        vboxg4 = QVBoxLayout(self.group2)
        for each_widget in (QLabel(' Backend CPU priority: '), self.nice,
            QLabel(' Opera Mobile Emulator Full Path: '), self.opera,
            self.open2, self.help1):
            vboxg4.addWidget(each_widget)

        self.button = QPushButton('Preview on Mobile')
        self.button.setCursor(QCursor(Qt.PointingHandCursor))
        self.button.setMinimumSize(100, 50)
        self.button.clicked.connect(self.run)
        glow = QGraphicsDropShadowEffect(self)
        glow.setOffset(0)
        glow.setBlurRadius(99)
        glow.setColor(QColor(99, 255, 255))
        self.button.setGraphicsEffect(glow)
        glow.setEnabled(True)

        class TransientWidget(QWidget):
            ' persistant widget thingy '
            def __init__(self, widget_list):
                ' init sub class '
                super(TransientWidget, self).__init__()
                vbox = QVBoxLayout(self)
                for each_widget in widget_list:
                    vbox.addWidget(each_widget)

        tw = TransientWidget((QLabel('<b>Mobile Browser Emulator'),
            self.group0, self.group1, self.group2, self.output, self.button, ))
        self.scrollable, self.dock = QScrollArea(), QDockWidget()
        self.scrollable.setWidgetResizable(True)
        self.scrollable.setWidget(tw)
        self.dock.setWindowTitle(__doc__)
        self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
        self.dock.setWidget(self.scrollable)
        ExplorerContainer().addTab(self.dock, "Mobile")
        QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
          ).clicked.connect(lambda: QMessageBox.information(self.dock, __doc__,
            HELPMSG))
开发者ID:juancarlospaco,项目名称:mobile,代码行数:104,代码来源:main.py

示例12: initialize

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]

#.........这里部分代码省略.........
        self.qckb6 = QCheckBox('No Byte Compile to .PYC or Delete .PYC later')
        self.qckb7 = QCheckBox('Dont touch sys.path when running tests')
        self.qckb8 = QCheckBox('Traverse all paths of a package')
        self.qckb9 = QCheckBox('Dont capture STDOUT, print STDOUT on the fly')
        self.qckb10 = QCheckBox('Clear all Logging handlers')
        for a in (self.qckb6, self.qckb7, self.qckb8, self.qckb9, self.qckb10):
            vboxgr.addWidget(a)
            a.setToolTip(a.text())
        vboxcon, self.framew = QHBoxLayout(co), QComboBox()
        [vboxcon.addWidget(a) for a in (groupl, groupr)]
        self.chrt = QCheckBox('LOW CPU priority for Backend Process')
        self.framew.addItems(['nosetests', 'PyTest', 'DocTest', 'Unittest',
                              'Django_Test', 'Django-Nose', 'None'])
        self.framew.currentIndexChanged.connect(lambda:  #FIXME refactor for 3
            QMessageBox.information(self.dock, __doc__, '<b>Only Nose for now'))
        self.framew.currentIndexChanged.connect(lambda:  #FIXME refactor for 3
            self.framew.setCurrentIndex(0))
        vboxg1 = QVBoxLayout(self.tab1)
        for each_widget in (QLabel('<b>Framework'), self.framew, self.chrt, co):
            vboxg1.addWidget(each_widget)

        self.t2ck1, self.t2sp1 = QCheckBox('Activate Coverage'), QSpinBox()
        self.t2ck2 = QCheckBox('Erase previously collected Coverage before run')
        self.t2ck3 = QCheckBox('Include all tests modules in Coverage reports')
        self.t2ck4 = QCheckBox('Include all python files on working directory')
        self.t2ck5 = QCheckBox('Produce HTML Coverage reports information')
        self.t2ck6 = QCheckBox('Include Branch Coverage in Coverage reports')
        self.t2sp1.setRange(10, 90)
        self.t2sp1.setValue(75)
        vboxg2 = QVBoxLayout(self.tab2)
        for each_widget in (QLabel('<b>Min Percentage'), self.t2sp1, self.t2ck1,
            self.t2ck2, self.t2ck3, self.t2ck4, self.t2ck5, self.t2ck6):
            vboxg2.addWidget(each_widget)

        groupi, groupd, vbxg3 = QGroupBox(), QGroupBox(), QHBoxLayout(self.tab3)
        vboxgi, vboxgd = QVBoxLayout(groupi), QVBoxLayout(groupd)
        self.t3ck1 = QCheckBox('Activate DocTest to find and run doctests')
        self.t3ck2 = QCheckBox('Look for any doctests in tests modules too')
        self.t3ck3 = QCheckBox('Activate isolation (Do Not use with Coverage!)')
        self.t3ck4 = QCheckBox('Use Detailed Errors, evaluate failed asserts')
        for a in (self.t3ck1, self.t3ck2, self.t3ck3, self.t3ck4):
            vboxgi.addWidget(a)
            a.setToolTip(a.text())
        self.t3ck5 = QCheckBox('Disable special handling of SkipTest exception')
        self.t3ck6 = QCheckBox('Run the tests that failed in the last test run')
        self.t3ck7 = QCheckBox('Use AllModules, Collect tests from all modules')
        self.t3ck8 = QCheckBox('Collect tests names only, do Not run any tests')
        for a in (self.t3ck5, self.t3ck6, self.t3ck7, self.t3ck8):
            vboxgd.addWidget(a)
            a.setToolTip(a.text())
        [vbxg3.addWidget(a) for a in (groupi, groupd)]

        self.t4le1, self.t4le2 = QLineEdit(), QLineEdit(path.expanduser("~"))
        self.t4le1.setCompleter(self.completer)
        self.t4le2.setCompleter(self.completer)
        self.t4le1.setPlaceholderText(' /full/path/to/a/folder/ ')
        self.t4le2.setPlaceholderText(' /full/path/to/a/folder/ ')
        le1b = QPushButton(QIcon.fromTheme("folder-open"), 'Open')
        le1b.setMinimumSize(50, 50)
        le1b.clicked.connect(lambda: self.t4le1.setText(
            QFileDialog.getExistingDirectory(None, '', path.expanduser("~"))))
        le2b = QPushButton(QIcon.fromTheme("folder-open"), 'Open')
        le2b.clicked.connect(lambda: self.t4le2.setText(
            QFileDialog.getExistingDirectory(None, '', path.expanduser("~"))))
        vboxg4 = QVBoxLayout(self.tab4)
        for a in (QLabel('<b>Directory to look for Tests'), self.t4le1, le1b,
            QLabel('<b>Directory to generate HTML Coverage'), self.t4le2, le2b):
            vboxg4.addWidget(a)
            a.setToolTip(a.text())

        self.t5le1 = QLineEdit(r'(?:^|[\b_\./-])[Tt]est')
        self.t5le2 = QLineEdit()
        self.t5le3, vboxg5 = QLineEdit(), QVBoxLayout(self.tab5)
        r = QPushButton('Reset')
        r.clicked.connect(lambda: self.t5le1.setText(r'(?:^|[\b_\./-])[Tt]est'))
        for a in (QLabel('<b>Matching Name Regex to be test'), self.t5le1, r,
            QLabel('<b>Force Include Regex Tests'), self.t5le2,
            QLabel('<b>Force Exclude Regex Tests'), self.t5le3):
            vboxg5.addWidget(a)
            a.setToolTip(a.text())

        self.output = QTextEdit(''' Engineering is the art of making what you
            want from things you can get.    -Dhobi''')
        self.runbtn = QPushButton(QIcon.fromTheme("face-sad"), 'Start Testing!')
        self.runbtn.setMinimumSize(75, 50)
        self.runbtn.clicked.connect(self.run)
        glow = QGraphicsDropShadowEffect(self)
        glow.setOffset(0)
        glow.setBlurRadius(99)
        glow.setColor(QColor(99, 255, 255))
        self.runbtn.setGraphicsEffect(glow)
        self.kbt = QPushButton(QIcon.fromTheme("application-exit"), 'Kill')
        self.kbt.clicked.connect(lambda: self.process.kill())
        vboxg6 = QVBoxLayout(self.tab6)
        for each_widget in (QLabel('Logs'), self.output, self.runbtn, self.kbt):
            vboxg6.addWidget(each_widget)
        [a.setChecked(True) for a in (self.chrt, self.qckb2, self.qckb3,
                                      self.qckb10, self.t2ck1, self.t2ck2,
                                      self.t2ck5, self.t3ck1, self.t3ck4)]
        self.mainwidget.setCurrentIndex(4)
开发者ID:juancarlospaco,项目名称:testrunner,代码行数:104,代码来源:main.py

示例13: initialize

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
    def initialize(self, *args, **kwargs):
        " Init Main Class "
        super(Main, self).initialize(*args, **kwargs)
        self.infile = QLineEdit(path.expanduser("~"))
        self.infile.setPlaceholderText(' /full/path/to/file ')
        self.infile.returnPressed.connect(self.run)
        self.completer, self.dirs = QCompleter(self), QDirModel(self)
        self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot)
        self.completer.setModel(self.dirs)
        self.completer.setCaseSensitivity(Qt.CaseInsensitive)
        self.completer.setCompletionMode(QCompleter.PopupCompletion)
        self.infile.setCompleter(self.completer)

        self.menu = QMenu('Base64')
        self.menu.aboutToShow.connect(self.build_submenu)
        self.ex_locator = self.locator.get_service('explorer')
        self.ex_locator.add_project_menu(self.menu, lang='all')

        self.open = QPushButton(QIcon.fromTheme("folder-open"), 'Open')
        self.open.setCursor(QCursor(Qt.PointingHandCursor))
        self.open.clicked.connect(lambda: self.infile.setText(str(
            QFileDialog.getOpenFileName(self.dock, "Open a File to Encode...",
            path.expanduser("~"), ';;'.join(['{}(*.{})'.format(e.upper(), e)
            for e in ['*', 'jpg', 'png', 'webp', 'svg', 'gif', 'webm']])))))
        self.chckbx1 = QCheckBox('Use basic Caesar Cipher (ROT13)')
        self.chckbx1.setToolTip('Use "string".decode("rot13") to Decipher ! ')
        self.chckbx2 = QCheckBox('Use "data:type/subtype;base64,..."')
        self.chckbx2.setChecked(True)
        self.chckbx3 = QCheckBox('Copy encoded output to Clipboard')
        self.chckbx4 = QCheckBox('Use URL-Safe Base64 Encoder')
        self.combo1 = QComboBox()
        self.combo1.addItems(['Do Not Generate Code', 'Generate CSS embed Code',
            'Generate Python Embed Code', 'Generate HTML embed Code',
            'Generate JS embed Code', 'Generate QML embed Code'])
        self.combo1.currentIndexChanged.connect(self.combo_changed)

        self.output = QTextEdit('''
        We can only see a short distance ahead,
        but we can see plenty there that needs to be done.
        - Alan Turing ''')
        self.output.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

        self.button = QPushButton(QIcon.fromTheme("face-cool"), 'Encode BASE64')
        self.button.setCursor(QCursor(Qt.PointingHandCursor))
        self.button.setMinimumSize(100, 50)
        self.button.clicked.connect(self.run)
        glow = QGraphicsDropShadowEffect(self)
        glow.setOffset(0)
        glow.setBlurRadius(99)
        glow.setColor(QColor(99, 255, 255))
        self.button.setGraphicsEffect(glow)
        glow.setEnabled(True)

        class TransientWidget(QWidget):
            ' persistant widget thingy '
            def __init__(self, widget_list):
                ' init sub class '
                super(TransientWidget, self).__init__()
                vbox = QVBoxLayout(self)
                for each_widget in widget_list:
                    vbox.addWidget(each_widget)

        tw = TransientWidget((QLabel('<i>Encode file as plain text string</i>'),
            QLabel('<b>File to Encode:'), self.infile, self.open, self.chckbx2,
            self.chckbx3, self.chckbx1, self.chckbx4,
            QLabel('<b>Embedding Template Code:'), self.combo1,
            QLabel(' <b>Base64 String Output: '), self.output,
            QLabel('<center><small><i>' + ''.join((__doc__, __version__,
                   __license__, 'by', __author__))), self.button
        ))
        self.scrollable, self.dock = QScrollArea(), QDockWidget()
        self.scrollable.setWidgetResizable(True)
        self.scrollable.setWidget(tw)
        self.dock.setWindowTitle(__doc__)
        self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
        self.dock.setWidget(self.scrollable)
        ExplorerContainer().addTab(self.dock, "Base64")
        self.guimode = QComboBox(self.dock)
        self.guimode.addItems(['Full Mode', 'Simple Mode'])
        self.guimode.currentIndexChanged.connect(self.guimode_change)
开发者ID:juancarlospaco,项目名称:base64,代码行数:82,代码来源:main.py

示例14: initialize

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]

#.........这里部分代码省略.........
        self.ckdbg4 = QCheckBox('Allow compile edited C++ file, debug changes')
        self.ckdbg5 = QCheckBox('Use experimental features')
        vboxg7 = QVBoxLayout(self.group7)
        for each_widget in (self.ckdbg1, self.ckdbg2, self.ckdbg3,
                            self.ckdbg4, self.ckdbg5):
            vboxg7.addWidget(each_widget)
            each_widget.setToolTip(each_widget.text())

        self.group8 = QGroupBox()
        self.group8.setTitle(' Tracing ')
        self.cktrc1 = QCheckBox('Show Scons in non-quiet mode, showing command')
        self.cktrc2 = QCheckBox('Show Progress information and statistics')
        self.cktrc3 = QCheckBox('Show Verbose output details')
        vboxg8 = QVBoxLayout(self.group8)
        for each_widget in (self.cktrc1, self.cktrc2, self.cktrc3):
            vboxg8.addWidget(each_widget)
            each_widget.setToolTip(each_widget.text())

        self.group9 = QGroupBox()
        self.group9.setTitle(' Extras ')
        self.group9.setCheckable(True)
        self.group9.toggled.connect(self.group9.hide)
        self.nice = QSpinBox()
        self.nice.setValue(20)
        self.nice.setMaximum(20)
        self.nice.setMinimum(0)
        self.ckxtr1 = QCheckBox('Open Target Directory later')
        self.ckxtr2 = QCheckBox('Save a LOG file to target later')
        self.ckxtr3 = QCheckBox('Save SH Bash script to reproduce Nuitka build')
        try:
            self.vinfo = QLabel('<center> <b> Nuitka Backend Version: </b>' +
                            getoutput('nuitka --version',).strip())
        except:
            self.vinfo = QLabel('<b>Warning: Failed to query Nuitka Backend!')
        vboxg9 = QVBoxLayout(self.group9)
        for each_widget in (QLabel('Backend CPU Priority'), self.nice,
                            self.ckxtr1, self.ckxtr2, self.ckxtr3, self.vinfo):
            vboxg9.addWidget(each_widget)

        self.group10 = QGroupBox()
        self.group10.setTitle(' Documentation ')
        self.group10.setCheckable(True)
        self.group10.toggled.connect(self.group10.hide)
        vboxg10 = QVBoxLayout(self.group10)
        for each_widget in (QLabel('''<a href=
            "file:///usr/share/doc/nuitka/README.pdf.gz">
            <small><center> Nuitka User Documentation Local PDF </a>'''),
            QLabel('''<a href=
            "file:///usr/share/doc/nuitka/Developer_Manual.pdf.gz">
            <small><center> Nuitka Developer Documentation Local PDF </a>'''),
            QLabel('''<a href="http://nuitka.net/doc/user-manual.html">
            <small><center> Nuitka User Documentation On Line HTML </a>'''),
            QLabel('''<a href="http://nuitka.net/doc/developer-manual.html">
            <small><center> Nuitka Developer Documentation On Line HTML </a>''')
             ):
            vboxg10.addWidget(each_widget)
            each_widget.setOpenExternalLinks(True)
            each_widget.setTextInteractionFlags(Qt.LinksAccessibleByMouse)

        [a.setChecked(True) for a in (self.ckgrl1, self.ckgrl2, self.ckgrl4,
            self.ckgrl5, self.ckgrl6, self.ckgrl7, self.ckgrl8, self.ckrec0,
            self.ckrec1, self.ckrec2, self.ckexe1, self.ckcgn2, self.ckdbg1,
            self.ckdbg3, self.ckdbg4, self.ckdbg5, self.cktrc1, self.cktrc2,
            self.cktrc3, self.ckxtr1, self.ckxtr2, self.ckxtr3,)]

        self.button = QPushButton(QIcon.fromTheme("face-cool"),
                                  'Compile Python')
        self.button.setCursor(QCursor(Qt.PointingHandCursor))
        self.button.setMinimumSize(100, 50)
        self.button.clicked.connect(self.run)
        glow = QGraphicsDropShadowEffect(self)
        glow.setOffset(0)
        glow.setBlurRadius(99)
        glow.setColor(QColor(99, 255, 255))
        self.button.setGraphicsEffect(glow)

        class TransientWidget(QWidget):
            ' persistant widget thingy '
            def __init__(self, widget_list):
                ' init sub class '
                super(TransientWidget, self).__init__()
                vbox = QVBoxLayout(self)
                for each_widget in widget_list:
                    vbox.addWidget(each_widget)

        tw = TransientWidget((
            QLabel('<b>Python Code to Binary Executable Compiler'), self.group0,
            self.group6, self.group1, self.group2, self.group3, self.group4,
            self.group5, self.group7, self.group8, self.group9, self.group10,
            self.button, ))
        self.scrollable, self.dock = QScrollArea(), QDockWidget()
        self.scrollable.setWidgetResizable(True)
        self.scrollable.setWidget(tw)
        self.dock.setWindowTitle(__doc__)
        self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
        self.dock.setWidget(self.scrollable)
        ExplorerContainer().addTab(self.dock, "Nuitka")
        QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
          ).clicked.connect(lambda: QMessageBox.information(self.dock, __doc__,
            HELPMSG))
开发者ID:juancarlospaco,项目名称:nuitka-ninja,代码行数:104,代码来源:main.py

示例15: SixAxisView

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setOffset [as 别名]
class SixAxisView(QGraphicsView):

    def __init__(self, *args):
        QGraphicsView.__init__(self, *args)
        self.move(20, 240)
        self.outerD = 125
        self.innerD = 35
        self.innerRange = 48
        self.inputRange = 256
        self.thresh = 3
        self.padding = 40
        self.marginTop = 10
        self.worker = QSixAxisThread()
        self.worker.valueUpdated.connect(self.moveJoysticks)
        self.worker.start()
        self.setContentsMargins(0, 0, 0, 0)
        self.setMaximumHeight(180)
        self.setMaximumWidth(420)
        self.setMinimumHeight(240)
        self.setMinimumWidth(300)
        self.adjustSize()
        self.scene = QGraphicsScene(self)
        self.outerCircle1 = QGraphicsEllipseItem(0, self.marginTop, self.outerD, self.outerD)
        self.outerCircle1.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
        self.outerCircle1.setBrush(Qt.gray)
        self.innerCircle1 = QGraphicsEllipseItem(self.outerD / 2 - self.innerD / 2, self.outerD / 2 - self.innerD / 2 + self.marginTop, self.innerD, self.innerD)
        self.innerCircle1.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
        self.innerCircle1.setBrush(Qt.lightGray)
        self.scene.addItem(self.outerCircle1)
        self.scene.addItem(self.innerCircle1)
        self.outerCircle2 = QGraphicsEllipseItem(self.outerD + self.padding, self.marginTop, self.outerD, self.outerD)
        self.outerCircle2.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
        self.outerCircle2.setBrush(Qt.gray)
        self.innerCircle2 = QGraphicsEllipseItem(self.outerD + self.padding + self.outerD / 2 - self.innerD / 2, self.outerD / 2 - self.innerD / 2 + self.marginTop, self.innerD, self.innerD)
        self.innerCircle2.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
        self.innerCircle2.setBrush(Qt.lightGray)
        self.scene.addItem(self.outerCircle2)
        self.scene.addItem(self.innerCircle2)
        self.setScene(self.scene)
        self.setStyleSheet('background-color:transparent; border-width: 0px; border: 0px;')
        self.currentX = 0
        self.currentY = 0
        self.currentA = 0
        self.currentZ = 0
        self.psBtn = QPixmap(os.getcwd() + '/../icons/bt_PS.png')
        self.psBtn = self.psBtn.scaled(50, 50, Qt.KeepAspectRatio)
        self.psItem = QGraphicsPixmapItem(self.psBtn)
        self.psItem.setOffset(QPointF(self.outerD - 4, 0))
        self.effect = QGraphicsDropShadowEffect()
        self.effect.setOffset(0, 0)
        self.effect.setBlurRadius(20)
        self.effect.setColor(Qt.green)
        self.psItem.setGraphicsEffect(self.effect)
        self.scene.addItem(self.psItem)
        self.tl2 = QTimeLine(10000)
        self.tl2.setFrameRange(0, 10000)
        self.c = QGraphicsItemAnimation()
        self.c.setItem(self.psItem)
        self.c.setTimeLine(self.tl2)
        self.tl2.connect(self.tl2, SIGNAL('frameChanged(int)'), self.updateEffect)
        self.effectd = 3
        self.tl2.start()

    def updateEffect(self):
        if self.effect.blurRadius() > 50:
            self.effectd = -3
        elif self.effect.blurRadius() < 5:
            self.effectd = 3
        self.effect.setBlurRadius(self.effect.blurRadius() + self.effectd)

    def update(self, *args, **kwargs):
        return QGraphicsView.update(self, *args, **kwargs)

    def moveJoysticks(self, x, y, a, z, l3, r3):
        x2 = x * self.innerRange / self.inputRange - self.innerRange / 2
        y2 = y * self.innerRange / self.inputRange - self.innerRange / 2
        a2 = a * self.innerRange / self.inputRange - self.innerRange / 2
        z2 = z * self.innerRange / self.inputRange - self.innerRange / 2
        if -self.thresh <= x2 <= self.thresh:
            x2 = 0
        if -self.thresh <= y2 <= self.thresh:
            y2 = 0
        if -self.thresh <= a2 <= self.thresh:
            a2 = 0
        if -self.thresh <= z2 <= self.thresh:
            z2 = 0
        self.tl = QTimeLine(10)
        self.tl.setFrameRange(0, 10)
        self.a = QGraphicsItemAnimation()
        self.a.setItem(self.innerCircle1)
        self.a.setTimeLine(self.tl)
        self.a.setPosAt(0, QPointF(self.currentX, self.currentY))
        self.a.setTranslationAt(1, x2, y2)
        if l3:
            self.innerCircle1.setPen(QPen(QColor(Qt.white), 1, Qt.SolidLine))
            self.innerCircle1.setBrush(QColor(200, 225, 3))
        else:
            self.innerCircle1.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
            self.innerCircle1.setBrush(Qt.lightGray)
        if r3:
#.........这里部分代码省略.........
开发者ID:derekisbusy,项目名称:AnyController,代码行数:103,代码来源:custom_widgets.py


注:本文中的PyQt4.QtGui.QGraphicsDropShadowEffect.setOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。