本文整理汇总了Python中PyQt4.QtGui.QGroupBox.isChecked方法的典型用法代码示例。如果您正苦于以下问题:Python QGroupBox.isChecked方法的具体用法?Python QGroupBox.isChecked怎么用?Python QGroupBox.isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGroupBox
的用法示例。
在下文中一共展示了QGroupBox.isChecked方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Score
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
class Score(_base.Group, scoreproperties.ScoreProperties):
@staticmethod
def title(_=_base.translate):
return _("Score")
def createWidgets(self, layout):
self.pieceLabel = QLabel()
self.piece = QLineEdit()
self.pieceLabel.setBuddy(self.piece)
self.opusLabel = QLabel()
self.opus = QLineEdit()
self.opusLabel.setBuddy(self.opus)
self.scoreProps = QGroupBox(checkable=True, checked=False)
scoreproperties.ScoreProperties.createWidgets(self)
grid = QGridLayout()
grid.addWidget(self.pieceLabel, 0 ,0)
grid.addWidget(self.piece, 0, 1)
grid.addWidget(self.opusLabel, 1, 0)
grid.addWidget(self.opus, 1, 1)
layout.addLayout(grid)
layout.addWidget(self.scoreProps)
layout = QVBoxLayout()
self.scoreProps.setLayout(layout)
scoreproperties.ScoreProperties.layoutWidgets(self, layout)
scorewiz = self.scoreProps.window()
self.setPitchLanguage(scorewiz.pitchLanguage())
scorewiz.pitchLanguageChanged.connect(self.setPitchLanguage)
def translateWidgets(self):
self.pieceLabel.setText(_("Piece:"))
self.opusLabel.setText(_("Opus:"))
self.scoreProps.setTitle(_("Properties"))
scoreproperties.ScoreProperties.translateWidgets(self)
def accepts(self):
return (StaffGroup, _base.Part)
def makeNode(self, node):
score = ly.dom.Score(node)
h = ly.dom.Header()
piece = self.piece.text().strip()
opus = self.opus.text().strip()
if piece:
h['piece'] = ly.dom.QuotedString(piece)
if opus:
h['opus'] = ly.dom.QuotedString(opus)
if len(h):
score.append(h)
return score
def globalSection(self, builder):
if self.scoreProps.isChecked():
return scoreproperties.ScoreProperties.globalSection(self, builder)
示例2: SphereWidget
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
class SphereWidget(QWidget):
"""
Widget for editing sphere's parameters
"""
signalObjetChanged = pyqtSignal(SphereParam, name='signal_objet_changed')
def __init__(self, parent=None, param=None):
super(SphereWidget, self).__init__(parent)
if param is None:
self.param = SphereParam()
else:
self.param = param
gbC_lay = QVBoxLayout()
l_cmap = QLabel("Cmap ")
self.cmap = list(get_colormaps().keys())
self.combo = QComboBox(self)
self.combo.addItems(self.cmap)
self.combo.currentIndexChanged.connect(self.updateParam)
self.param.dict["colormap"] = self.cmap[0]
hbox = QHBoxLayout()
hbox.addWidget(l_cmap)
hbox.addWidget(self.combo)
gbC_lay.addLayout(hbox)
self.sp = []
# subdiv
lL = QLabel("subdiv")
self.sp.append(QSpinBox())
self.sp[-1].setMinimum(0)
self.sp[-1].setMaximum(6)
self.sp[-1].setValue(self.param.dict["subdiv"])
# Layout
hbox = QHBoxLayout()
hbox.addWidget(lL)
hbox.addWidget(self.sp[-1])
gbC_lay.addLayout(hbox)
# signal's
self.sp[-1].valueChanged.connect(self.updateParam)
# Banded
self.gbBand = QGroupBox(u"Banded")
self.gbBand.setCheckable(True)
hbox = QGridLayout()
lL = QLabel("nbr band", self.gbBand)
self.sp.append(QSpinBox(self.gbBand))
self.sp[-1].setMinimum(0)
self.sp[-1].setMaximum(100)
# Layout
hbox = QHBoxLayout()
hbox.addWidget(lL)
hbox.addWidget(self.sp[-1])
self.gbBand.setLayout(hbox)
gbC_lay.addWidget(self.gbBand)
# signal's
self.sp[-1].valueChanged.connect(self.updateParam)
self.gbBand.toggled.connect(self.updateParam)
gbC_lay.addStretch(1.0)
hbox = QHBoxLayout()
hbox.addLayout(gbC_lay)
self.setLayout(hbox)
self.updateMenu()
def updateParam(self, option):
"""
update param and emit a signal
"""
tab = ["subdiv", "nbr_band"]
for pos, name in enumerate(tab):
self.param.dict[name] = self.sp[pos].value()
self.param.dict["banded"] = self.gbBand.isChecked()
self.param.dict["colormap"] = self.combo.currentText()
# emit signal
self.signalObjetChanged.emit(self.param)
def updateMenu(self, param=None):
"""
Update menus
"""
if param is not None:
self.param = param
# Lock signals
self.blockSignals(True)
for wid in self.sp:
wid.blockSignals(True)
tab = ["subdiv", "nbr_band"]
for pos, name in enumerate(tab):
self.sp[pos].setValue(self.param.dict[name])
self.gbBand.setChecked(self.param.dict["banded"])
# unlock signals
self.blockSignals(False)
for wid in self.sp:
wid.blockSignals(False)
self.signalObjetChanged.emit(self.param)
示例3: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
#.........这里部分代码省略.........
def readOutput(self):
"""Read and append sphinx-build output to the logBrowser"""
self.output.append(str(self.process.readAllStandardOutput()).strip())
def readErrors(self):
"""Read and append sphinx-build errors to the logBrowser"""
self.output.append(self.formatErrorMsg(str(
self.process.readAllStandardError())))
def formatErrorMsg(self, msg):
"""Format error messages in red color"""
return self.formatMsg(msg, 'red')
def formatInfoMsg(self, msg):
"""Format informative messages in blue color"""
return self.formatMsg(msg, 'green')
def formatMsg(self, msg, color):
"""Format message with the given color"""
return '<font color="{}">{}</font>'.format(color, msg)
def make_virtualenv(self):
' make virtualenv from contextual sub menu '
self.outdir.setText(self.ex_locator.get_current_project_item().path)
self.run()
def run(self):
' run the actions '
self.output.clear()
self.output.append(self.formatInfoMsg(
'INFO: OK: Starting at {}'.format(datetime.now())))
self.button.setDisabled(True)
# Parse Values
arg0 = '' if self.qckb10.isChecked() is False else '--no-pip '
arg1 = '--quiet ' if self.qckb1.isChecked() is False else '--verbose '
arg2 = '' if self.qckb2.isChecked() is False else '--clear '
arg3 = '' if self.qckb3.isChecked() is False else '--system-site-packages '
arg4 = '' if self.qckb4.isChecked() is False else '--unzip-setuptools '
arg5 = '' if self.qckb5.isChecked() is False else '--setuptools '
arg6 = '' if self.qckb6.isChecked() is False else '--never-download '
# if the target is empty return
if not len(str(self.outdir.text()).strip()):
self.output.append(self.formatErrorMsg('ERROR: FAIL: Target empty'))
self.button.setEnabled(True)
return
else:
self.output.append(self.formatInfoMsg(
'INFO: OK: Output Directory is {}'.format(self.outdir.text())))
# prefix
prf = str(self.prefx.text()).upper().strip().replace(' ', '')
arg10 = '' if prf is '' else '--prompt="{}_" '.format(prf)
self.output.append(self.formatInfoMsg('INFO: Prefix: {}'.format(arg10)))
# extra search dir
src = str(self.srcdir.text()).strip()
arg11 = '' if src is '' else '--extra-search-dir="{}" '.format(src)
self.output.append(self.formatInfoMsg(' INFO: Extra: {}'.format(arg11)))
self.output.append(self.formatInfoMsg(
' INFO: OK: Write Logs ?: {} '.format(self.qckb9.isChecked())))
self.output.append(self.formatInfoMsg(
' INFO: OK: Open Directory ?: {} '.format(self.qckb8.isChecked())))
# run the subprocesses
cmd = '{}virtualenv {}{}{}{}{}{}{}-p python{} {}{} {}'.format(
'chrt --verbose -i 0 ' if self.chrt.isChecked() is True else '',
arg0, arg1, arg2, arg3, arg4, arg5, arg6,
self.combo1.value(), arg11, arg10, str(self.outdir.text()).strip())
self.output.append(self.formatInfoMsg('INFO:OK:Command:{}'.format(cmd)))
示例4: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
class Main(plugin.Plugin):
' main class for plugin '
def initialize(self, *args, **kwargs):
' class init '
super(Main, self).initialize(*args, **kwargs)
self.process = QProcess()
self.process.readyReadStandardOutput.connect(self.readOutput)
self.process.readyReadStandardError.connect(self.readErrors)
self.process.finished.connect(self._process_finished)
self.process.error.connect(self._process_finished)
# directory auto completer
self.completer, self.dirs = QCompleter(self), QDirModel(self)
self.dirs.setFilter(QDir.Dirs | QDir.NoDotAndDotDot)
self.completer.setModel(self.dirs)
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
self.completer.setCompletionMode(QCompleter.PopupCompletion)
menu = QMenu('Clones')
menu.addAction('Analyze for Code Clones here', lambda: self.make_clon())
self.locator.get_service('explorer').add_project_menu(menu, lang='all')
self.group1 = QGroupBox()
self.group1.setTitle(' Target ')
self.outdir, self.igndir = QLineEdit(path.expanduser("~")), QLineEdit()
self.outdir.setCompleter(self.completer)
self.btn1 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
self.btn1.clicked.connect(lambda: self.outdir.setText(str(
QFileDialog.getExistingDirectory(self.dock,
'Please, Open a Target Directory...', path.expanduser("~")))))
self.btn1a = QPushButton(QIcon.fromTheme("face-smile"),
'Get from Ninja active project')
self.btn1a.clicked.connect(lambda: self.outdir.setText(
self.locator.get_service('explorer').get_current_project_item().path))
self.ignckb, self.ignmor = QComboBox(), QTextEdit()
self.ignckb.addItems(['Single Directory', 'Multiple Directories CSV'])
self.ignckb.currentIndexChanged.connect(self.on_ignore_changed)
self.ignmor.hide()
self.igndir.setPlaceholderText('Exclude directory')
self.igndir.setCompleter(self.completer)
self.btn2 = QPushButton(QIcon.fromTheme("document-open"), ' Open ')
self.btn2.clicked.connect(lambda: self.igndir.setText(str(
QFileDialog.getExistingDirectory(self.dock,
'Please, Open a Ignore Directory...', path.expanduser("~")))))
vboxg1 = QVBoxLayout(self.group1)
for each_widget in (QLabel('<b>Target directory path: '), self.outdir,
self.btn1, self.btn1a, QLabel('<b>Ignore directory path: '),
self.ignckb, self.ignmor, self.igndir, self.btn2, ):
vboxg1.addWidget(each_widget)
self.group2 = QGroupBox()
self.group2.setTitle(' Output ')
self.outfle = QLineEdit(path.join(path.expanduser("~"), 'output.html'))
self.outfle.setPlaceholderText('Exclude directory')
self.outfle.setCompleter(self.completer)
self.btn3 = QPushButton(QIcon.fromTheme("document-save"), ' Save ')
self.btn3.clicked.connect(lambda: self.outfle.setText(
QFileDialog.getSaveFileName(self.dock, 'Save', path.expanduser("~"),
'XML(*.xml)' if self.xmlo.isChecked() is True else 'HTML(*.html)')))
vboxg2 = QVBoxLayout(self.group2)
for each_widget in (QLabel('<b>Output report file path:'),
self.outfle, self.btn3):
vboxg2.addWidget(each_widget)
self.group3 = QGroupBox()
self.group3.setTitle(' Options ')
self.group3.setCheckable(True)
self.group3.setGraphicsEffect(QGraphicsBlurEffect(self))
self.group3.graphicsEffect().setEnabled(False)
self.group3.toggled.connect(self.toggle_options_group)
self.qckb1, self.qckb2 = QCheckBox('Recursive'), QCheckBox('Time-less')
self.qckb3, self.qckb4 = QCheckBox('Force Diff'), QCheckBox('Fast Mode')
self.qckb5, self.tm = QCheckBox('Save a LOG file to target'), QLabel('')
self.xmlo = QCheckBox('XML Output instead of HTML')
self.opeo = QCheckBox('Open Clones Report when done')
self.chrt = QCheckBox('LOW CPU priority for Backend Process')
self.mdist, self.hdep, self.output = QSpinBox(), QSpinBox(), QTextEdit()
self.ign_func = QLineEdit('test, forward, backward, Migration')
self.mdist.setValue(5)
self.hdep.setValue(1)
self.mdist.setToolTip('''<b>Maximum amount of difference between pair of
sequences in clone pair (5 default).Larger value more false positive''')
self.hdep.setToolTip('''<b>Computation can be speeded up by increasing
this value, but some clones can be missed (1 default)''')
[a.setChecked(True) for a in (self.qckb1, self.qckb3, self.qckb5,
self.chrt, self.opeo)]
vboxg3 = QVBoxLayout(self.group3)
for each_widget in (self.qckb1, self.qckb2, self.qckb3, self.qckb4,
self.qckb5, self.chrt, self.xmlo, self.opeo,
QLabel('<b>Max Distance Threshold:'), self.mdist,
QLabel('<b>Max Hashing Depth:'), self.hdep,
QLabel('<b>Ignore code block prefix:'), self.ign_func):
vboxg3.addWidget(each_widget)
self.group4, self.auto = QGroupBox(), QComboBox()
self.group4.setTitle(' Automation ')
self.group4.setCheckable(True)
self.group4.setToolTip('<font color="red"><b>WARNING:Advanced Setting!')
self.group4.toggled.connect(lambda: self.group4.hide())
self.auto.addItems(['Never run automatically', 'Run when File Saved',
#.........这里部分代码省略.........
示例5: LeadSheet
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
class LeadSheet(VocalPart, _base.ChordNames):
@staticmethod
def title(_=_base.translate):
return _("Lead sheet")
def createWidgets(self, layout):
self.label = QLabel(wordWrap=True)
self.chords = QGroupBox(checkable=True, checked=True)
layout.addWidget(self.label)
layout.addWidget(self.chords)
box = QVBoxLayout()
self.chords.setLayout(box)
_base.ChordNames.createWidgets(self, box)
self.accomp = QCheckBox()
layout.addWidget(self.accomp)
VocalPart.createWidgets(self, layout)
def translateWidgets(self):
VocalPart.translateWidgets(self)
_base.ChordNames.translateWidgets(self)
self.label.setText('<i>{0}</i>'.format(_(
"The Lead Sheet provides a staff with chord names above "
"and lyrics below it. A second staff is optional.")))
self.chords.setTitle(_("Chord names"))
self.accomp.setText(_("Add accompaniment staff"))
self.accomp.setToolTip(_(
"Adds an accompaniment staff and also puts an accompaniment "
"voice in the upper staff."))
def build(self, data, builder):
"""Create chord names, song and lyrics.
Optionally a second staff with a piano accompaniment.
"""
if self.chords.isChecked():
_base.ChordNames.build(self, data, builder)
if self.accomp.isChecked():
p = ly.dom.ChoirStaff()
#TODO: instrument names ?
#TODO: different midi instrument for voice and accompaniment ?
s = ly.dom.Sim(p)
mel = ly.dom.Sim(ly.dom.Staff(parent=s))
v1 = ly.dom.Voice(parent=mel)
s1 = ly.dom.Seq(v1)
ly.dom.Text('\\voiceOne', s1)
a = data.assignMusic('melody', 1)
ly.dom.Identifier(a.name, s1)
s2 = ly.dom.Seq(ly.dom.Voice(parent=mel))
ly.dom.Text('\\voiceTwo', s2)
a = data.assignMusic('accRight', 0)
ly.dom.Identifier(a.name, s2)
acc = ly.dom.Seq(ly.dom.Staff(parent=s))
ly.dom.Clef('bass', acc)
a = data.assignMusic('accLeft', -1)
ly.dom.Identifier(a.name, acc)
if self.ambitus.isChecked():
# We can't use \addlyrics when the voice has a \with {}
# section, because it creates a nested Voice context.
# So if the ambitus engraver should be added to the Voice,
# we don't use \addlyrics but create a new Lyrics context.
# So in that case we don't use addStanzas, but insert the
# Lyrics contexts manually inside our ChoirStaff.
v1.cid = ly.dom.Reference('melody')
ly.dom.Line('\\consists "Ambitus_engraver"', v1.getWith())
count = self.stanzas.value() # number of stanzas
if count == 1:
l = ly.dom.Lyrics()
s.insert_before(acc.parent(), l)
a = self.assignLyrics(data, 'verse')
ly.dom.Identifier(a.name, ly.dom.LyricsTo(v1.cid, l))
else:
for i in range(count):
l = ly.dom.Lyrics()
s.insert_before(acc.parent(), l)
a = self.assignLyrics(data, 'verse', i + 1)
ly.dom.Identifier(a.name, ly.dom.LyricsTo(v1.cid, l))
else:
self.addStanzas(data, v1)
else:
a = data.assignMusic('melody', 1)
p = ly.dom.Staff()
ly.dom.Identifier(a.name, ly.dom.Seq(p))
self.addStanzas(data, p)
if self.ambitus.isChecked():
ly.dom.Line('\\consists "Ambitus_engraver"', p.getWith())
data.nodes.append(p)
示例6: NetWorkSettingWidget
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
#.........这里部分代码省略.........
QCoreApplication.instance().installTranslator(m_pTranslator)
"""显示重启网络的状态信息"""
if status == "Start":
self.waitingDlg.setHintInfo(self.tr("network is restarting, waiting..."))
elif status == "Success":
self.waitingDlg.setHintInfo(self.tr("network start success!"))
vmtype = StoreInfoParser.instance().getVmType()
if vmtype == "offline":
pass
elif status == "Failed":
self.waitingDlg.setHintInfo(self.tr("network restart failed!"))
else:
return
if self.waitingDlg.isHidden():
self.waitingDlg.exec_()
def slotSave(self):
language = StoreInfoParser.instance().getLanguage()
m_pTranslator = QTranslator()
exePath = "./"
if language == "chinese":
QmName = "zh_CN.qm"
else:
QmName = "en_US.qm"
if(m_pTranslator.load(QmName, exePath)):
QCoreApplication.instance().installTranslator(m_pTranslator)
if not self.checkInputValid():
return
if self.autoGetIpCheckbox.isChecked():
netconf = self.setDynamicNetwork()
elif self.staticIpGroupbox.isChecked():
netconf = self.setStaticNetwork()
#重新启动网络
self.restartNetworkTD.setNetConf(netconf)
self.restartNetworkTD.start()
return
def getCmdExecValueT(self, cmd):
"""得到命令执行的结果"""
statusOutput = commands.getstatusoutput(cmd)
monitorList = statusOutput[1].split("\n")
return monitorList
def getNetDnsType(self):
typeList = ["dhcp","dhcp"]
networkInfo = self.getCmdExecValueT("../lib/ccr_jytcapi network")
for item in networkInfo:
if len(item.split(":")) == 2:
if item.split(":")[0] == "conf":
if item.split(":")[1] == "0":
typeList[0] = "dhcp"
else:
typeList[0] = "static"
else:
pass
DNSStatus = StoreInfoParser.instance().getDNSStatus()
if DNSStatus == None:
pass
else:
示例7: EthernetEditor
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
class EthernetEditor(QFrame):
def __init__(self, ethernet, parent=None):
QFrame.__init__(self, parent)
self.ethernet = ethernet
self.buildGUI()
self.fillValues()
def buildGUI(self):
#general setup
form = QFormLayout(self)
self.label = OptionnalLine(hint="Optional interface name")
form.addRow(self.tr("Interface name"), self.label)
self.speed_group = QButtonGroup()
self.speed_box = QGroupBox(tr("Force an ethernet speed"))
speed_layout = QVBoxLayout(self.speed_box)
self.speed_GFull = QRadioButton(tr("Gigabit full duplex"))
self.speed_GHalf = QRadioButton(tr("Gigabit half duplex"))
self.speed_100Full = QRadioButton(tr("100 Mb Full duplex"))
self.speed_100Half = QRadioButton(tr("100 Mb Half duplex"))
self.speed_10Full = QRadioButton(tr("10 Mb Full duplex"))
self.speed_10Half = QRadioButton(tr("10 Mb Half duplex"))
def toggle(value):
if value:
self.speed_GFull.click()
self.speed_box.setCheckable(True)
self.speed_box.setChecked(Qt.Unchecked)
self.connect(self.speed_box, SIGNAL('toggled(bool)'), toggle)
for item in (
self.speed_GFull,
self.speed_GHalf,
self.speed_100Full,
self.speed_100Half,
self.speed_10Full,
self.speed_10Half,
):
self.speed_group.addButton(item)
speed_layout.addWidget(item)
form.addRow(self.speed_box)
def fillValues(self):
name = self.ethernet.user_label
if name != "":
self.label.setText(name)
self.label.checkEmpty()
self.label.setStyleSheet('')
if self.ethernet.eth_auto:
self.speed_box.setChecked(Qt.Unchecked)
return
self.speed_box.setChecked(Qt.Checked)
if self.ethernet.eth_duplex == Ethernet.FULL:
if self.ethernet.eth_speed == 10:
button = self.speed_10Full
elif self.ethernet.eth_speed == 100:
button = self.speed_100Full
else:
button = self.speed_GFull
else:
if self.ethernet.eth_speed == 10:
button = self.speed_10Half
elif self.ethernet.eth_speed == 100:
button = self.speed_100Half
else:
button = self.speed_GHalf
button.setChecked(Qt.Checked)
def getConfig(self):
auto = not self.speed_box.isChecked()
if auto:
return True, None, None
selection = self.speed_group.checkedButton()
if selection is self.speed_GFull:
return False, 1000, Ethernet.FULL
elif self.speed_GHalf:
return False, 1000, Ethernet.HALF
elif self.speed_100Full:
return False, 100, Ethernet.FULL
elif self.speed_100Half:
return False, 100, Ethernet.HALF
elif self.speed_10Full:
return False, 10, Ethernet.FULL
elif self.speed_10Half:
return False, 10, Ethernet.HALF
assert False, "this selection is unknown"
def setName(self):
new_name = self.label.value()
#.........这里部分代码省略.........
示例8: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
#.........这里部分代码省略.........
vbox.addWidget(each_widget)
tw = TransientWidget((QLabel('<b>HTML5/CSS3/JS Optimizer Compressor'),
self.group0, self.group1, self.group2, self.group3, self.group4,
self.button, ))
self.scrollable = QScrollArea()
self.scrollable.setWidgetResizable(True)
self.scrollable.setWidget(tw)
self.dock = QDockWidget()
self.dock.setWindowTitle(__doc__)
self.dock.setStyleSheet('QDockWidget::title{text-align: center;}')
self.dock.setMinimumWidth(350)
self.dock.setWidget(self.scrollable)
ec.addTab(self.dock, "Web")
QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
).clicked.connect(lambda: QMessageBox.information(self.dock, __doc__,
HELPMSG))
def run(self):
' run the string replacing '
if self.source.currentText() == 'Local File':
with open(path.abspath(str(self.infile.text()).strip()), 'r') as f:
txt = f.read()
elif self.source.currentText() == 'Remote URL':
txt = urlopen(str(self.inurl.text()).strip()).read()
elif self.source.currentText() == 'Clipboard':
txt = str(self.output.toPlainText()) if str(self.output.toPlainText()) is not '' else str(QApplication.clipboard().text())
else:
txt = self.editor_s.get_text()
self.output.clear()
self.befor.setMaximum(len(txt) + 10)
self.after.setMaximum(len(txt) + 10)
self.befor.setValue(len(txt))
txt = txt.lower() if self.chckbx1.isChecked() is True else txt
txt = condense_style(txt) if self.ckhtml0.isChecked() is True else txt
txt = condense_script(txt) if self.ckhtml0.isChecked() is True else txt
txt = condense_doctype(txt) if self.ckhtml1.isChecked() is True else txt
txt = condense_href_src(txt) if self.ckhtml2 is True else txt
txt = clean_unneeded_tags(txt) if self.ckhtml4.isChecked() is True else txt
txt = condense_doc_ready(txt) if self.ckjs1.isChecked() is True else txt
txt = jsmin(txt) if self.ckjs0.isChecked() is True else txt
txt = remove_comments(txt) if self.ckcss1.isChecked() is True else txt
txt = condense_whitespace(txt) if self.ckcss10.isChecked() is True else txt
txt = remove_empty_rules(txt) if self.ckcss4.isChecked() is True else txt
txt = remove_unnecessary_whitespace(txt) if self.ckcss2.isChecked() is True else txt
txt = remove_unnecessary_semicolons(txt) if self.ckcss3.isChecked() is True else txt
txt = condense_zero_units(txt) if self.ckcss6.isChecked() is True else txt
txt = condense_multidimensional_zeros(txt) if self.ckcss7.isChecked() is True else txt
txt = condense_floating_points(txt) if self.ckcss8.isChecked() is True else txt
txt = normalize_rgb_colors_to_hex(txt) if self.ckcss5.isChecked() is True else txt
txt = condense_hex_colors(txt) if self.ckcss9.isChecked() is True else txt
txt = wrap_css_lines(txt, 80) if self.ckcss12.isChecked() is True else txt
txt = condense_semicolons(txt) if self.ckcss11.isChecked() is True else txt
txt = condense_font_weight(txt) if self.ckcss13.isChecked() is True else txt
txt = condense_std_named_colors(txt) if self.ckcss14.isChecked() is True else txt
# txt = condense_xtra_named_colors(txt) if self.ckcss14.isChecked() is True else txt # FIXME
txt = condense_percentage_values(txt) if self.ckcss16.isChecked() is True else txt
txt = condense_pixel_values(txt) if self.ckcss17.isChecked() is True else txt
txt = remove_url_quotes(txt) if self.ckcss18.isChecked() is True else txt
txt = add_encoding(txt) if self.ckcss19.isChecked() is True else txt
txt = " ".join(txt.strip().split()) if self.chckbx2.isChecked() is True else txt
self.after.setValue(len(txt))
self.output.setPlainText(txt)
self.output.show()
self.output.setFocus()
self.output.selectAll()
示例9: NetWorkSettingWidget
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
#.........这里部分代码省略.........
if not os.path.isfile(self.originalNetConfigFile):
os.system("mkdir -p %s" % os.path.dirname(self.originalNetConfigFile))
os.mknod(self.originalNetConfigFile)
if not os.path.isfile(self.originalBridgerNetConfigFile):
os.system("mkdir -p %s" % os.path.dirname(self.originalBridgerNetConfigFile))
os.mknod(self.originalBridgerNetConfigFile)
else:
if not os.path.exists(self.networkconfigFile):
os.system("mkdir -p %s" % os.path.dirname(self.networkconfigFile))#create dir
os.mknod(self.networkconfigFile)#create empty file
#os.system("echo \"%s\" >> /config/files" % self.originalNetConfigFile)#mark
if not os.path.exists(self.bridgeNetworkconfigFile):
#os.system("mkdir -p %s" % os.path.dirname(self.networkconfigFile))#create dir
os.mknod(self.bridgeNetworkconfigFile)#create empty file
#os.system("echo \"%s\" >> /config/files" % self.originalNetConfigFile)#mark
if not os.path.isfile(self.originalNetConfigFile):
os.system("mkdir -p %s" % os.path.dirname(self.originalNetConfigFile))
os.mknod(self.originalNetConfigFile)
if not os.path.isfile(self.originalBridgerNetConfigFile):
os.system("mkdir -p %s" % os.path.dirname(self.originalBridgerNetConfigFile))
os.mknod(self.originalBridgerNetConfigFile)
if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:#running
globalfunc.umountFile(self.originalNetConfigFile)
globalfunc.umountFile(self.originalBridgerNetConfigFile)
if self.autoGetIpCheckbox.isChecked():
if not self.setDynamicNetwork():
if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:
globalfunc.mountFile(self.originalNetConfigFile)
globalfunc.mountFile(self.originalBridgerNetConfigFile)
return
elif self.staticIpGroupbox.isChecked():
if not self.setStaticNetwork():
if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:
globalfunc.mountFile(self.originalNetConfigFile)
globalfunc.mountFile(self.originalBridgerNetConfigFile)
return
if globalvariable.PROGRAM_RUNNING_TYPE == common.OPERATION_ENV_TYPE:
globalfunc.mountFile(self.originalNetConfigFile)
globalfunc.mountFile(self.originalBridgerNetConfigFile)
#重新启动网络
self.restartNetworkTD.start()
return
def initCheckBoxStatus(self):
"""读取网络配置文件,初始化相应的checkbox的状态"""
[netType, DNSType] = self.getNetworkType()
if netType == "dhcp":
self.autoGetIpCheckbox.setChecked(True)
self.staticIpGroupbox.setChecked(False)
else:
self.autoGetIpCheckbox.setChecked(False)
self.staticIpGroupbox.setChecked(True)
[ip, netmask, gateway] = self.getStaticNetworkInfo()
示例10: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
#.........这里部分代码省略.........
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>Selenium Tests'), self.group0,
self.group1, self.group4, QLabel('<b>Log'), self.output, self.runs,
self.failures, 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)
ec.addTab(self.dock, "Selenium")
QPushButton(QIcon.fromTheme("help-about"), 'About', self.dock
).clicked.connect(lambda: QMessageBox.information(self.dock, __doc__,
HELPMSG))
QPushButton(QIcon.fromTheme("media-record"), 'Record', self.group1,
).clicked.connect(lambda: QMessageBox.information(self.dock, __doc__,
'Not working. If you know how to make it Record, send me Pull Request'))
def run(self):
' run '
self.RUNS = self.RUNS + 1
self.runs.setText('<font color="green"><b>Runs: {}'.format(self.RUNS))
self.output.clear()
self.output.append(self.formatInfoMsg('INFO:{}'.format(datetime.now())))
self.button.setDisabled(True)
self.output.append(self.formatInfoMsg(' INFO: OK: Parsing Data '))
selenium_test = SELENIUM_TEMPLATE.format(
HEADER if self.chckbx3.isChecked() is True else '',
self.chrmedrv.text() if self.ckcss15.isChecked() is True else '',
self.baseurl.text(),
self.authdata.text() if str(self.authdata.text()) is not '' else {},
self.formdata.text() if str(self.formdata.text()) is not '' else {},
self.iframurl.text(), self.javascript.text(), self.titletxt.text(),
self.webdriver.currentText(),
'# ' if self.ckcss1.isChecked() is not True else '',
'# ' if self.ckcss2.isChecked() is not True else '',
'# ' if self.ckcss2.isChecked() is not True else '',
'# ' if self.ckcss3.isChecked() is not True else '',
'# ' if self.ckcss4.isChecked() is not True else '',
'# ' if self.ckcss5.isChecked() is not True else '',
'# ' if self.ckcss6.isChecked() is not True else '',
'# ' if self.ckcss7.isChecked() is not True else '',
'# ' if self.ckcss8.isChecked() is not True else '',
'# ' if self.ckcss9.isChecked() is not True else '',
'# ' if self.ckcss10.isChecked() is not True else '',
'# ' if self.ckcss11.isChecked() is not True else '',
'# ' if self.ckcss12.isChecked() is not True else '',
'# ' if self.ckcss13.isChecked() is not True else '',
'# ' if self.ckcss14.isChecked() is not True else '',
self.timeout.value()
)
with open(path.abspath(self.outfile.text()), 'w') as f:
self.output.append(self.formatInfoMsg(' INFO: OK: Writing Tests '))
f.write(selenium_test)
if self.chckbx2.isChecked() is True:
self.output.append(self.formatInfoMsg(' INFO: OK: Opening Tests '))
try:
startfile(str(path.abspath(self.outfile.text())))
except:
Popen(["ninja-ide", str(path.abspath(self.outfile.text()))])
示例11: Main
# 需要导入模块: from PyQt4.QtGui import QGroupBox [as 别名]
# 或者: from PyQt4.QtGui.QGroupBox import isChecked [as 别名]
#.........这里部分代码省略.........
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))
def run(self):
' run the compile '
target = path.abspath(str(self.infile.text()).strip())
self.button.setDisabled(True)
self.output.clear()
self.output.show()
self.output.setFocus()
self.output.append(self.formatInfoMsg('INFO:{}'.format(datetime.now())))
self.output.append(self.formatInfoMsg(' INFO: Dumping Internal Tree'))
try:
self.dumptree.setPlainText(
getoutput('nuitka --dump-tree {}'.format(target)))
self.dumptree.setMinimumSize(100, 500)
except:
self.output.append(self.formatErrorMsg('ERROR:FAIL: Internal Tree'))
self.output.append(self.formatInfoMsg(' INFO: OK: Parsing Arguments'))
cmd = ' '.join(('nice --adjustment={} nuitka'.format(self.nice.value()),
# output
'--remove-output' if self.ckcgn2.isChecked() is True else '',
# general
'--exe' if self.ckgrl1.isChecked() is True else '',
'--python-debug' if self.ckgrl2.isChecked() is True else '',
'--verbose' if self.cktrc3.isChecked() is True else '',
'--windows-target' if self.ckgrl3.isChecked() is True else '',
'--windows-disable-console' if self.ckgrl4.isChecked() is True else '',
'--lto' if self.ckgrl5.isChecked() is True else '',
'--clang' if self.ckgrl6.isChecked() is True else '',
'--improved' if self.ckgrl7.isChecked() is True else '',
'--warn-implicit-exceptions' if self.ckgrl8.isChecked() is True else '',
# recursion control
'--recurse-stdlib' if self.ckrec0.isChecked() is True else '',
'--recurse-none' if self.ckrec1.isChecked() is True else '',
'--recurse-all' if self.ckrec2.isChecked() is True else '',
# execution after compilation
'--execute' if self.ckexe0.isChecked() is True else '',
'--keep-pythonpath' if self.ckexe1.isChecked() is True else '',
# code generation
'--code-gen-no-statement-lines' if self.chdmp1.isChecked() is True else '',
'--no-optimization' if self.chdmp2.isChecked() is True else '',
# debug
'--debug' if self.ckdbg1.isChecked() is True else '',
'--unstripped' if self.ckdbg2.isChecked() is True else '',
'--trace-execution' if self.ckdbg3.isChecked() is True else '',
'--c++-only' if self.ckdbg4.isChecked() is True else '',
'--experimental' if self.ckdbg5.isChecked() is True else '',