本文整理汇总了Python中PyQt4.QtGui.QGraphicsDropShadowEffect.setBlurRadius方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsDropShadowEffect.setBlurRadius方法的具体用法?Python QGraphicsDropShadowEffect.setBlurRadius怎么用?Python QGraphicsDropShadowEffect.setBlurRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsDropShadowEffect
的用法示例。
在下文中一共展示了QGraphicsDropShadowEffect.setBlurRadius方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: must_glow
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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
示例2: enableHoverEffect
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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)
示例3: Meterbar
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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)
示例4: FaceButtonsView
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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)
示例5: select
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [as 别名]
def select(self):
if not self.__selected:
self.set_selected(True)
effect = QGraphicsDropShadowEffect()
effect.setBlurRadius(20)
effect.setXOffset(0)
effect.setYOffset(0)
effect.setColor(QColor(0, 0, 0, 180))
self.setGraphicsEffect(effect)
self.raise_()
示例6: DpadView
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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)
示例7: select
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [as 别名]
def select(self, val: bool):
if val:
effect = QGraphicsDropShadowEffect()
effect.setBlurRadius(20)
effect.setXOffset(0)
effect.setYOffset(0)
effect.setColor(QColor(0, 0, 0, 180))
self.setGraphicsEffect(effect)
self.raise_()
else:
eff = self.graphicsEffect()
del eff
self.setGraphicsEffect(None)
示例8: must_glow
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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
示例9: HighlightEdit
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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)
示例10: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [as 别名]
def __init__(self, parent=None, workdir=None, fontsize=42):
super(BillboardDisplay, self).__init__(parent)
self.workdir = workdir
self.logger = logging.getLogger('display')
self.logger.info('Working directory: {}'.format(self.workdir))
self.current_display = os.path.join(self.workdir, 'current.jpg')
desktop = QDesktopWidget()
self.display = QWidget(self)
size = desktop.availableGeometry(desktop.primaryScreen());
self.display.resize(size.width(), size.height())
self.display.setWindowTitle("Billboard")
self.image_label = QLabel(self.display)
self.image_label.resize(size.width(), size.height())
self.text_label = QLabel(self.display)
self.text_label.resize(size.width(), size.height())
self.text_label.setMargin(100)
self.text_label.setStyleSheet('''
QLabel {{
font-size: {}pt;
font-weight: bold;
color: #eeeeee;
text-align: center;
}}
'''.format(fontsize))
self.text_label.setWordWrap(True)
self.text_label.setAlignment(Qt.AlignCenter)
dse = QGraphicsDropShadowEffect()
dse.setBlurRadius(0)
dse.setXOffset(5)
dse.setYOffset(5)
dse.setColor(QColor(0, 0, 0, 255))
self.text_label.setGraphicsEffect(dse)
QObject.connect(self, SIGNAL("updateimage"),
self.display_image)
QObject.connect(self, SIGNAL("updatecurrent"),
self.take_screenshot)
示例11: initialize
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [as 别名]
def initialize(self, *args, **kwargs):
" Init Main Class "
super(Main, self).initialize(*args, **kwargs)
self.locator.get_service("menuApp").add_action(
QAction(QIcon.fromTheme("edit-select-all"), "Create Setup.py", self, triggered=lambda: self.get_dialog())
)
self.dialog, self.group0 = QDialog(), QGroupBox()
self.group0.setTitle(" Setup.py Creator ")
self.pkgname, self.version = QLineEdit(), QDoubleSpinBox()
self.urlproj, self.licence = QLineEdit("https://www."), QLineEdit("GPL")
self.authors, self.emails = QLineEdit(getuser()), QLineEdit("@mail.com")
self.descrip, self.button = QLineEdit(), QPushButton("Make Setup.py !")
self.choices, self.indents = QComboBox(), QSpinBox()
self.metada = QCheckBox("Use SheBang and Metadata")
self.nosetest = QCheckBox("Use Nose Tests Framework integration")
self.metada.setChecked(True)
self.chckbx1 = QCheckBox("Copy output to ClipBoard when done")
self.choices.addItems(["from distutils.core import setup", "import distutils.core"])
self.indents.setValue(4)
self.indents.setMaximum(8)
self.indents.setMinimum(0)
self.indents.setSingleStep(2)
self.version.setValue(0.1)
self.version.setMinimum(0.1)
self.version.setDecimals(1)
self.version.setSingleStep(0.1)
self.button.setMinimumSize(400, 50)
self.button.clicked.connect(self.make_setupy)
glow = QGraphicsDropShadowEffect(self)
glow.setOffset(0)
glow.setBlurRadius(99)
glow.setColor(QColor(99, 255, 255))
self.button.setGraphicsEffect(glow)
inf = QLabel(
"""<a href="http://guide.python-distribute.org/future.html"
><center><i>INFO: This is Deprecated Legacy Packaging.</a>"""
)
inf.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
inf.setOpenExternalLinks(True)
vboxg0 = QVBoxLayout(self.group0)
for each_widget in (
QLabel("<b>Package Name"),
self.pkgname,
QLabel("<b>Version"),
self.version,
QLabel("<b>URL"),
self.urlproj,
QLabel("<b>Licence"),
self.licence,
QLabel("<b>Author"),
self.authors,
QLabel("<b>Mail"),
self.emails,
QLabel("<b>Description"),
self.descrip,
QLabel("<b>Imports"),
self.choices,
QLabel("<b>Indentation Spaces "),
self.indents,
self.metada,
self.chckbx1,
self.nosetest,
inf,
QLabel("<center><small><i>{}".format(HELPMSG)),
self.button,
):
vboxg0.addWidget(each_widget)
try:
each_widget.setToolTip(each_widget.text())
except:
pass
QVBoxLayout(self.dialog).addWidget(self.group0)
示例12: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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))
示例13: initialize
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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))
示例14: initialize
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [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))
示例15: CImprovedPanel
# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setBlurRadius [as 别名]
class CImprovedPanel(QFrame):
def __init__(self, parent=None):
QFrame.__init__(self, parent)
#FADING
self.__opacity_effect = QGraphicsOpacityEffect()
self.__fading_timer = QTimer(parent)
self.__fading_timer.timeout.connect(self.__on_fading_timer)
self.__FADE_TYPE = Enum("IN", "OUT")
self.__fade_time = 20
self.__opacity = 1.0
self.__opacity_fading_coefficient = 0.02
self.__selected_fade_type = self.__FADE_TYPE.IN
self.resizeEvent = self.__onResize
#MOVE
self.__move_animation_type = QEasingCurve.Linear
self.__move_time = 350
self.__is_moving = False
#RESIZE
self.__resize_animation_type = QEasingCurve.Linear
self.__resize_time = 700
self.__is_resizing = False
#PIXMAP & MASCHERA
self.__pmap = QPixmap(self.size())
self.__pmap_fname = ""
self.__show_mask_preview = False
#SHADOW
self.__shadow_Xoffset = 3.0 #default value
self.__shadow_Yoffset = 3.0 #default value
self.__shadow_blur_radius = 8.0 #default value
self.__shadow_color = QColor(38,38,38,150) #default value
self.__shadow_effect = QGraphicsDropShadowEffect()
self.__shadow_effect.setXOffset(self.__shadow_Xoffset)
self.__shadow_effect.setYOffset(self.__shadow_Yoffset)
self.__shadow_effect.setBlurRadius(self.__shadow_blur_radius)
self.__shadow_effect.setColor(self.__shadow_color)
self._shadow_visible = False
##FUNZIONI PER FADING
def fadeIn(self):
"""
Labels fades in from completely invisible to completely visible.
"""
self.__opacity = 0.0
self.__selected_fade_type = self.__FADE_TYPE.IN
self.__fading_timer.start(self.__fade_time)
def fadeOut(self):
"""
Labels fades out from completely visible to completely invisible.
"""
self.__selected_fade_type = self.__FADE_TYPE.OUT
self.__fading_timer.start(self.__fade_time)
def setFadeTime(self, value):
""" Sets fading time. Everytime interval is reached, alpha is increased (or decreased) by __opacity_fading_coefficient.
@param value: fade time (msec)
@type value: int
"""
self.__fade_time = value
def getFadeTime(self):
return self.__fade_time
fadeInterval = QtCore.pyqtProperty("int", getFadeTime, setFadeTime)
def setFadeCoefficient(self, value):
""" Sets fading coefficient. Alpha is increased (or decreased) by this value.
@param value: coefficient (min 0.0 - max 1.0)
@type value: float
"""
self.__opacity_fading_coefficient = value
def getFadeCoefficient(self):
return self.__opacity_fading_coefficient
fadeCoefficient = QtCore.pyqtProperty("double", getFadeCoefficient, setFadeCoefficient)
def __on_fading_timer(self):
if self.__selected_fade_type == self.__FADE_TYPE.OUT:
if self.__opacity > 0:
self.__opacity -= self.__opacity_fading_coefficient
self.__opacity_effect.setOpacity(self.__opacity)
self.setGraphicsEffect(self.__opacity_effect)
else:
self.__fading_timer.stop()
if self.__selected_fade_type == self.__FADE_TYPE.IN:
if self.__opacity <= 1.0:
self.__opacity += self.__opacity_fading_coefficient
self.__opacity_effect.setOpacity(self.__opacity)
self.setGraphicsEffect(self.__opacity_effect)
else:
self.__fading_timer.stop()
#.........这里部分代码省略.........