本文整理汇总了Python中userguide.addButton函数的典型用法代码示例。如果您正苦于以下问题:Python addButton函数的具体用法?Python addButton怎么用?Python addButton使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addButton函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, mainwindow):
super(SessionManagerDialog, self).__init__(mainwindow)
self.setWindowModality(Qt.WindowModal)
layout = QVBoxLayout()
self.setLayout(layout)
self.sessions = SessionList(self)
layout.addWidget(self.sessions)
self.imp = QPushButton(self)
self.exp = QPushButton(self)
self.act = QPushButton(self)
self.imp.clicked.connect(self.importSession)
self.exp.clicked.connect(self.exportSession)
self.act.clicked.connect(self.activateSession)
self.sessions.layout().addWidget(self.imp, 5, 1)
self.sessions.layout().addWidget(self.exp, 6, 1)
self.sessions.layout().addWidget(self.act, 7, 1)
layout.addWidget(widgets.Separator())
self.buttons = b = QDialogButtonBox(self)
layout.addWidget(b)
b.setStandardButtons(QDialogButtonBox.Close)
b.rejected.connect(self.accept)
userguide.addButton(b, "sessions")
self.sessions.load()
app.translateUI(self)
self.sessions.changed.connect(self.enableButtons)
self.sessions.listBox.itemSelectionChanged.connect(self.enableButtons)
self.enableButtons()
开发者ID:brumleygap,项目名称:frescobaldi,代码行数:32,代码来源:dialog.py
示例2: __init__
def __init__(self, mainwindow):
super(ScoreWizardDialog, self).__init__(mainwindow)
self.addAction(mainwindow.actionCollection.help_whatsthis)
self._pitchLanguage = None
layout = QVBoxLayout()
self.setLayout(layout)
self.tabs = QTabWidget()
b = self.dialogButtons = QDialogButtonBox()
b.setStandardButtons(
QDialogButtonBox.Reset
| QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
b.accepted.connect(self.accept)
b.rejected.connect(self.reject)
userguide.addButton(b, "scorewiz")
b.button(QDialogButtonBox.Reset).clicked.connect(self.reset)
self.previewButton = b.addButton('', QDialogButtonBox.ActionRole)
self.previewButton.clicked.connect(self.showPreview)
layout.addWidget(self.tabs)
layout.addWidget(b)
self.header = Header(self)
self.tabs.addTab(self.header, '')
self.parts = Parts(self)
self.tabs.addTab(self.parts, '')
self.settings = Settings(self)
self.tabs.addTab(self.settings, '')
self.tabs.setCurrentIndex(0)
self.tabs.widget(0).widget() # activate it
self.tabs.currentChanged.connect(self.slotCurrentChanged)
qutil.saveDialogSize(self, "scorewiz/dialog/size")
app.translateUI(self)
self.accepted.connect(self.slotAccepted)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:35,代码来源:dialog.py
示例3: __init__
def __init__(self, parent=None):
super(SessionEditor, self).__init__(parent)
self.setWindowModality(Qt.WindowModal)
layout = QVBoxLayout()
self.setLayout(layout)
grid = QGridLayout()
layout.addLayout(grid)
self.name = QLineEdit()
self.nameLabel = l = QLabel()
l.setBuddy(self.name)
grid.addWidget(l, 0, 0)
grid.addWidget(self.name, 0, 1)
self.autosave = QCheckBox()
grid.addWidget(self.autosave, 1, 1)
self.basedir = widgets.urlrequester.UrlRequester()
self.basedirLabel = l = QLabel()
l.setBuddy(self.basedir)
grid.addWidget(l, 2, 0)
grid.addWidget(self.basedir, 2, 1)
layout.addWidget(widgets.Separator())
self.buttons = b = QDialogButtonBox(self)
layout.addWidget(b)
b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
b.accepted.connect(self.accept)
b.rejected.connect(self.reject)
userguide.addButton(b, "sessions")
app.translateUI(self)
开发者ID:arnaldorusso,项目名称:frescobaldi,代码行数:33,代码来源:dialog.py
示例4: __init__
def __init__(self, parent=None):
super(ModeShiftDialog, self).__init__(parent)
mainLayout = QGridLayout()
self.setLayout(mainLayout)
self.keyLabel = QLabel()
self.keyInput = QLineEdit()
self.modeCombo = QComboBox()
self.modeLabel = QLabel()
self.buttons = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
userguide.addButton(self.buttons, "mode_shift")
for m in sorted(modes.keys()):
self.modeCombo.addItem(m)
mainLayout.addWidget(self.keyLabel, 0, 0, 1, 1)
mainLayout.addWidget(self.keyInput, 0, 1, 1, 1)
mainLayout.addWidget(self.modeLabel, 1, 0, 1, 1)
mainLayout.addWidget(self.modeCombo, 1, 1, 1, 1)
mainLayout.addWidget(self.buttons, 9, 0, 2, 2)
app.translateUI(self)
qutil.saveDialogSize(self, "mode_shift/dialog/size", QSize(80, 60))
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
self.keyInput.textEdited.connect(self.readKeyInput)
self.modeCombo.currentIndexChanged.connect(self.readSettings)
self.loadSettings()
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:33,代码来源:dialog.py
示例5: __init__
def __init__(self, parent=None):
super(SessionEditor, self).__init__(parent)
self.setWindowModality(Qt.WindowModal)
layout = QVBoxLayout()
self.setLayout(layout)
grid = QGridLayout()
layout.addLayout(grid)
self.name = QLineEdit()
self.nameLabel = l = QLabel()
l.setBuddy(self.name)
grid.addWidget(l, 0, 0)
grid.addWidget(self.name, 0, 1)
self.autosave = QCheckBox()
grid.addWidget(self.autosave, 1, 1)
self.basedir = widgets.urlrequester.UrlRequester()
self.basedirLabel = l = QLabel()
l.setBuddy(self.basedir)
grid.addWidget(l, 2, 0)
grid.addWidget(self.basedir, 2, 1)
self.setPaths = QCheckBox()
grid.addWidget(self.setPaths, 3, 1)
self.inclPaths = ip = QWidget(self)
ipLayout = QVBoxLayout()
ip.setLayout(ipLayout)
self.include = widgets.listedit.FilePathEdit()
self.include.listBox.setDragDropMode(QAbstractItemView.InternalMove)
ipLayout.addWidget(self.include)
grid.addWidget(ip, 4, 1)
self.revt = QPushButton(self)
self.clean = QPushButton(self)
self.revt.clicked.connect(self.revertPaths)
self.clean.clicked.connect(self.cleanPaths)
self.include.layout().addWidget(self.revt, 5, 1)
self.include.layout().addWidget(self.clean, 6, 1)
self.setPaths.toggled.connect(self.showInclPaths)
layout.addWidget(widgets.Separator())
self.buttons = b = QDialogButtonBox(self)
layout.addWidget(b)
b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
b.accepted.connect(self.accept)
b.rejected.connect(self.reject)
userguide.addButton(b, "sessions")
app.translateUI(self)
开发者ID:cognot,项目名称:frescobaldi,代码行数:56,代码来源:dialog.py
示例6: openEditor
def openEditor(self, item):
dlg = widgets.dialog.TextDialog(None,
_("Enter a regular expression to match:"),
app.caption("Outline"))
userguide.addButton(dlg.buttonBox(), "outline_configure")
dlg.setValidateFunction(is_regex)
dlg.setText(item.text())
if dlg.exec_():
item.setText(dlg.text())
return True
return False
开发者ID:19joho66,项目名称:frescobaldi,代码行数:11,代码来源:tools.py
示例7: getText
def getText(
parent = None,
title = "",
message = "",
text = "",
icon = None,
help = None,
validate = None,
regexp = None,
wordWrap = True,
complete = None,
):
"""Asks a string of text from the user.
Arguments:
parent: parent widget or None
title: dialog window title (without appname)
message: message, question
text: pre-entered text in the line edit
icon: which icon to show
help: help page or name
validate: a function that accepts text and returns whether it is valid.
regexp: a regular expression string. If given it provides an alternate
validation method using a QRegExpValidator.
wordWrap: whether to word-wrap the message text (default: True).
complete: a string list or QAbstractItemModel to provide completions.
"""
dlg = widgets.dialog.TextDialog(parent,
title=app.caption(title), message=message, icon=icon)
dlg.setText(text)
dlg.setMinimumWidth(320)
dlg.messageLabel().setWordWrap(wordWrap)
if help is not None:
userguide.addButton(dlg.buttonBox(), help)
dlg.setWindowModality(Qt.WindowModal)
else:
dlg.setWindowModality(Qt.ApplicationModal)
if regexp:
dlg.setValidateRegExp(regexp)
elif validate:
dlg.setValidateFunction(validate)
if complete:
c = QCompleter(complete, dlg.lineEdit())
dlg.lineEdit().setCompleter(c)
if dlg.exec_():
return dlg.text()
开发者ID:19joho66,项目名称:frescobaldi,代码行数:48,代码来源:inputdialog.py
示例8: __init__
def __init__(self, parent):
super(InfoDialog, self).__init__(parent)
self.setWindowModality(Qt.WindowModal)
layout = QVBoxLayout()
layout.setSpacing(10)
self.setLayout(layout)
grid = QGridLayout()
grid.setSpacing(4)
layout.addLayout(grid)
self.lilyname = QLineEdit()
self.lilynameLabel = l = QLabel()
l.setBuddy(self.lilyname)
grid.addWidget(l, 0, 0)
grid.addWidget(self.lilyname, 0, 1)
self.lilypond = widgets.urlrequester.UrlRequester()
self.lilypond.setFileMode(QFileDialog.ExistingFile)
self.lilypondLabel = l = QLabel()
l.setBuddy(self.lilypond)
grid.addWidget(l, 1, 0, 1, 2)
grid.addWidget(self.lilypond, 2, 0, 1, 2)
self.convert_ly = QLineEdit()
self.convert_lyLabel = l = QLabel()
l.setBuddy(self.convert_ly)
grid.addWidget(l, 3, 0)
grid.addWidget(self.convert_ly, 3, 1)
self.lilypond_book = QLineEdit()
self.lilypond_bookLabel = l = QLabel()
l.setBuddy(self.lilypond_book)
grid.addWidget(l, 4, 0)
grid.addWidget(self.lilypond_book, 4, 1)
self.auto = QCheckBox()
grid.addWidget(self.auto, 5, 1)
layout.addWidget(widgets.Separator())
b = self.buttons = QDialogButtonBox(self)
layout.addWidget(b)
b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
b.accepted.connect(self.accept)
b.rejected.connect(self.reject)
userguide.addButton(b, "prefs_lilypond")
app.translateUI(self)
开发者ID:rdoursenaud,项目名称:frescobaldi,代码行数:48,代码来源:lilypond.py
示例9: __init__
def __init__(self, parent=None):
super(RestoreDialog, self).__init__(parent)
self.messageLabel().setWordWrap(True)
userguide.addButton(self.buttonBox(), "snippets")
self.tree = QTreeWidget(headerHidden=True, rootIsDecorated=False)
self.setMainWidget(self.tree)
self.deletedItem = QTreeWidgetItem(self.tree)
self.deletedItem.setFlags(Qt.ItemIsUserCheckable)
self.changedItem = QTreeWidgetItem(self.tree)
self.changedItem.setFlags(Qt.ItemIsUserCheckable)
self.tree.itemChanged.connect(self.slotItemChanged)
app.translateUI(self)
app.languageChanged.connect(self.populate)
self.accepted.connect(self.updateSnippets)
qutil.saveDialogSize(self, "snippettool/restoredialog/size")
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:17,代码来源:restore.py
示例10: __init__
def __init__(self):
super(ChangedDocumentsListDialog, self).__init__(buttons=('close',))
self.setWindowModality(Qt.NonModal)
self.setAttribute(Qt.WA_QuitOnClose, False)
layout = QGridLayout(margin=0)
self.mainWidget().setLayout(layout)
self.tree = QTreeWidget(headerHidden=True, rootIsDecorated=False,
columnCount=2, itemsExpandable=False)
self.tree.setSelectionMode(QTreeWidget.ExtendedSelection)
self.buttonReload = QPushButton()
self.buttonReloadAll = QPushButton()
self.buttonSave = QPushButton()
self.buttonSaveAll = QPushButton()
self.buttonShowDiff = QPushButton()
self.checkWatchingEnabled = QCheckBox(checked=enabled())
layout.addWidget(self.tree, 0, 0, 6, 1)
layout.addWidget(self.buttonReload, 0, 1)
layout.addWidget(self.buttonReloadAll, 1, 1)
layout.addWidget(self.buttonSave, 2, 1)
layout.addWidget(self.buttonSaveAll, 3, 1)
layout.addWidget(self.buttonShowDiff, 4, 1)
layout.addWidget(self.checkWatchingEnabled, 6, 0, 1, 2)
layout.setRowStretch(5, 10)
app.documentClosed.connect(self.removeDocument)
app.documentSaved.connect(self.removeDocument)
app.documentUrlChanged.connect(self.removeDocument)
app.documentLoaded.connect(self.removeDocument)
self.tree.itemSelectionChanged.connect(self.updateButtons)
self.buttonReload.clicked.connect(self.slotButtonReload)
self.buttonReloadAll.clicked.connect(self.slotButtonReloadAll)
self.buttonSave.clicked.connect(self.slotButtonSave)
self.buttonSaveAll.clicked.connect(self.slotButtonSaveAll)
self.buttonShowDiff.clicked.connect(self.slotButtonShowDiff)
self.checkWatchingEnabled.toggled.connect(setEnabled)
app.translateUI(self)
qutil.saveDialogSize(self, 'externalchanges/dialog/size', QSize(400, 200))
userguide.addButton(self.buttonBox(), "externalchanges")
self.button('close').setFocus()
开发者ID:arnaldorusso,项目名称:frescobaldi,代码行数:43,代码来源:widget.py
示例11: __init__
def __init__(self, mainwindow):
super(HyphenDialog, self).__init__(mainwindow)
self.setWindowModality(Qt.WindowModal)
layout = QVBoxLayout()
self.setLayout(layout)
self.topLabel = QLabel()
self.listWidget = QListWidget()
layout.addWidget(self.topLabel)
layout.addWidget(self.listWidget)
layout.addWidget(widgets.Separator())
self.buttons = b = QDialogButtonBox()
layout.addWidget(b)
b.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
userguide.addButton(b, "lyrics")
b.rejected.connect(self.reject)
b.accepted.connect(self.accept)
self.load()
app.translateUI(self)
qutil.saveDialogSize(self, "hyphenation/dialog/size")
开发者ID:19joho66,项目名称:frescobaldi,代码行数:22,代码来源:hyphendialog.py
示例12: __init__
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self._document = None
self.messageLabel().setWordWrap(True)
self.document = d = QTextDocument()
d.setDocumentLayout(QPlainTextDocumentLayout(d))
self.highlighter = highlighter.highlighter(d)
self.view = View(d)
self.matcher = Matcher(self.view)
self.completer = Completer(self.view)
self.setMainWidget(self.view)
userguide.addButton(self.buttonBox(), "musicview_editinplace")
# action for completion popup
self._showPopupAction = QAction(None, triggered=self.slotCompletionPopup)
self.addAction(self._showPopupAction)
# make Ctrl+Return accept the dialog
self.button("ok").setShortcut(QKeySequence("Ctrl+Return"))
qutil.saveDialogSize(self, "editinplace/dialog/size")
self.accepted.connect(self.save)
app.translateUI(self)
app.settingsChanged.connect(self.readSettings)
self.readSettings()
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:23,代码来源:editinplace.py
示例13: __init__
def __init__(self, parent=None):
super(Dialog, self).__init__(parent)
self._document = None
self._path = None
mainLayout = QGridLayout()
self.setLayout(mainLayout)
tabs = QTabWidget()
import_tab = QWidget()
post_tab = QWidget()
itabLayout = QGridLayout(import_tab)
ptabLayout = QGridLayout(post_tab)
tabs.addTab(import_tab, "musicxml2ly")
tabs.addTab(post_tab, "after import")
self.noartCheck = QCheckBox()
self.norestCheck = QCheckBox()
self.nolayoutCheck = QCheckBox()
self.nobeamCheck = QCheckBox()
self.useAbsCheck = QCheckBox()
self.commMidiCheck = QCheckBox()
self.langCombo = QComboBox()
self.langLabel = QLabel()
self.impChecks = [self.noartCheck,
self.norestCheck,
self.nolayoutCheck,
self.nobeamCheck,
self.useAbsCheck,
self.commMidiCheck]
self.formatCheck = QCheckBox()
self.trimDurCheck = QCheckBox()
self.removeScalesCheck = QCheckBox()
self.runEngraverCheck = QCheckBox()
self.postChecks = [self.formatCheck,
self.trimDurCheck,
self.removeScalesCheck,
self.runEngraverCheck]
self.commandLineLabel = QLabel()
self.commandLine = QTextEdit(acceptRichText=False)
self.setChecksObjectNames()
self.buttons = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
userguide.addButton(self.buttons, "musicxml_import")
self.langCombo.addItem('')
self.langCombo.addItems(_langlist)
itabLayout.addWidget(self.noartCheck, 0, 0, 1, 2)
itabLayout.addWidget(self.norestCheck, 1, 0, 1, 2)
itabLayout.addWidget(self.nolayoutCheck, 2, 0, 1, 2)
itabLayout.addWidget(self.nobeamCheck, 3, 0, 1, 2)
itabLayout.addWidget(self.useAbsCheck, 4, 0, 1, 2)
itabLayout.addWidget(self.commMidiCheck, 5, 0, 1, 2)
itabLayout.addWidget(self.langLabel, 6, 0, 1, 2)
itabLayout.addWidget(self.langCombo, 7, 0, 1, 2)
itabLayout.addWidget(widgets.Separator(), 8, 0, 1, 2)
itabLayout.addWidget(self.commandLineLabel, 9, 0, 1, 2)
itabLayout.addWidget(self.commandLine, 10, 0, 1, 2)
ptabLayout.addWidget(self.formatCheck, 0, 0, 1, 2)
ptabLayout.addWidget(self.trimDurCheck, 1, 0, 1, 2)
ptabLayout.addWidget(self.removeScalesCheck, 2, 0, 1, 2)
ptabLayout.addWidget(self.runEngraverCheck, 3, 0, 1, 2)
ptabLayout.setRowStretch(4, 10)
mainLayout.addWidget(tabs, 0, 0, 9, 2)
mainLayout.addWidget(self.buttons, 10, 0, 1, 2)
app.translateUI(self)
qutil.saveDialogSize(self, "xml_import/dialog/size", QSize(480, 260))
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
self.noartCheck.toggled.connect(self.makeCommandLine)
self.norestCheck.toggled.connect(self.makeCommandLine)
self.nolayoutCheck.toggled.connect(self.makeCommandLine)
self.nobeamCheck.toggled.connect(self.makeCommandLine)
self.useAbsCheck.toggled.connect(self.makeCommandLine)
self.commMidiCheck.toggled.connect(self.makeCommandLine)
self.langCombo.currentIndexChanged.connect(self.makeCommandLine)
self.makeCommandLine()
self.loadSettings()
开发者ID:brumleygap,项目名称:frescobaldi,代码行数:94,代码来源:musicxml.py
示例14: __init__
def __init__(self, parent=None):
super(ToLyDialog, self).__init__(parent)
self._info = None
self._document = None
self._path = None
mainLayout = QGridLayout()
self.setLayout(mainLayout)
tabs = QTabWidget()
import_tab = QWidget()
post_tab = QWidget()
itabLayout = QGridLayout(import_tab)
ptabLayout = QGridLayout(post_tab)
tabs.addTab(import_tab, self.imp_prgm)
tabs.addTab(post_tab, "after import")
self.formatCheck = QCheckBox()
self.trimDurCheck = QCheckBox()
self.removeScalesCheck = QCheckBox()
self.runEngraverCheck = QCheckBox()
self.postChecks = [self.formatCheck,
self.trimDurCheck,
self.removeScalesCheck,
self.runEngraverCheck]
self.versionLabel = QLabel()
self.lilyChooser = lilychooser.LilyChooser()
self.commandLineLabel = QLabel()
self.commandLine = QTextEdit(acceptRichText=False)
self.formatCheck.setObjectName("reformat")
self.trimDurCheck.setObjectName("trim-durations")
self.removeScalesCheck.setObjectName("remove-scaling")
self.runEngraverCheck.setObjectName("engrave-directly")
self.buttons = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
userguide.addButton(self.buttons, self.userg)
row = 0
for r, w in enumerate(self.impChecks):
row += r
itabLayout.addWidget(w, row, 0, 1, 2)
w.toggled.connect(self.makeCommandLine)
row += 1
for r, w in enumerate(self.impExtra):
row += r
itabLayout.addWidget(w, row, 0, 1, 2)
itabLayout.addWidget(widgets.Separator(), row + 1, 0, 1, 2)
itabLayout.addWidget(self.versionLabel, row + 2, 0, 1, 0)
itabLayout.addWidget(self.lilyChooser, row + 3, 0, 1, 2)
itabLayout.addWidget(widgets.Separator(), row + 4, 0, 1, 2)
itabLayout.addWidget(self.commandLineLabel, row + 5, 0, 1, 2)
itabLayout.addWidget(self.commandLine, row + 6, 0, 1, 2)
ptabLayout.addWidget(self.formatCheck, 0, 0, 1, 2)
ptabLayout.addWidget(self.trimDurCheck, 1, 0, 1, 2)
ptabLayout.addWidget(self.removeScalesCheck, 2, 0, 1, 2)
ptabLayout.addWidget(self.runEngraverCheck, 3, 0, 1, 2)
ptabLayout.setRowStretch(4, 10)
mainLayout.addWidget(tabs, 0, 0, 9, 2)
mainLayout.addWidget(self.buttons, 10, 0, 1, 2)
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
self.lilyChooser.currentIndexChanged.connect(self.slotLilyPondVersionChanged)
self.slotLilyPondVersionChanged()
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:76,代码来源:toly_dialog.py
示例15: load
def load(filename, widget):
"""Loads snippets from a file, displaying them in a list.
The user can then choose:
- overwrite builtin snippets or not
- overwrite own snippets with same title or not
- select and view snippets contents.
"""
try:
d = ET.parse(filename)
elements = list(d.findall('snippet'))
if not elements:
raise ValueError(_("No snippets found."))
except Exception as e:
QMessageBox.critical(widget, app.caption(_("Error")),
_("Can't read from source:\n\n{url}\n\n{error}").format(
url=filename, error=e))
return
dlg = widgets.dialog.Dialog(widget)
dlg.setWindowModality(Qt.WindowModal)
dlg.setWindowTitle(app.caption(_("dialog title", "Import Snippets")))
tree = QTreeWidget(headerHidden=True, rootIsDecorated=False)
dlg.setMainWidget(tree)
userguide.addButton(dlg.buttonBox(), "snippet_import_export")
allnames = frozenset(snippets.names())
builtins = frozenset(builtin.builtin_snippets)
titles = dict((snippets.title(n), n) for n in allnames if n not in builtins)
new = QTreeWidgetItem(tree, [_("New Snippets")])
updated = QTreeWidgetItem(tree, [_("Updated Snippets")])
unchanged = QTreeWidgetItem(tree, [_("Unchanged Snippets")])
new.setFlags(Qt.ItemIsEnabled)
updated.setFlags(Qt.ItemIsEnabled)
unchanged.setFlags(Qt.ItemIsEnabled)
new.setExpanded(True)
updated.setExpanded(True)
items = []
for snip in elements:
item = QTreeWidgetItem()
item.body = snip.find('body').text
item.title = snip.find('title').text
item.shortcuts = list(e.text for e in snip.findall('shortcuts/shortcut'))
title = item.title or snippets.maketitle(snippets.parse(item.body).text)
item.setText(0, title)
name = snip.get('id')
name = name if name in builtins else None
# determine if new, updated or unchanged
if not name:
name = titles.get(title)
item.name = name
if not name or name not in allnames:
new.addChild(item)
items.append(item)
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
item.setCheckState(0, Qt.Checked)
elif name:
if (item.body != snippets.text(name)
or title != snippets.title(name)
or (item.shortcuts and item.shortcuts !=
[s.toString() for s in model.shortcuts(name) or ()])):
updated.addChild(item)
items.append(item)
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
item.setCheckState(0, Qt.Checked)
else:
unchanged.addChild(item)
item.setFlags(Qt.ItemIsEnabled)
# count:
for i in new, updated, unchanged:
i.setText(0, i.text(0) + " ({0})".format(i.childCount()))
for i in new, updated:
if i.childCount():
i.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
i.setCheckState(0, Qt.Checked)
def changed(item):
if item in (new, updated):
for i in range(item.childCount()):
c = item.child(i)
c.setCheckState(0, item.checkState(0))
tree.itemChanged.connect(changed)
importShortcuts = QTreeWidgetItem([_("Import Keyboard Shortcuts")])
if items:
tree.addTopLevelItem(importShortcuts)
importShortcuts.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
#.........这里部分代码省略.........
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:101,代码来源:import_export.py
示例16: __init__
def __init__(self,
parent=None,
job_class=job.Job,
imp_prgm='',
input=None,
userg=''):
super(ToLyDialog, self).__init__(parent)
self._info = None
self._imp_prgm = imp_prgm
self._userg = userg
self._input = input
self._path = None
self._job_class = job_class
self._job = None
self.addAction(parent.actionCollection.help_whatsthis)
self.setWindowModality(Qt.WindowModal)
mainLayout = QGridLayout()
self.setLayout(mainLayout)
tabs = QTabWidget()
import_tab = QWidget()
post_tab = QWidget()
itabLayout = QGridLayout(import_tab)
ptabLayout = QGridLayout(post_tab)
tabs.addTab(import_tab, self._imp_prgm)
tabs.addTab(post_tab, _("After Import"))
self.formatCheck = QCheckBox()
self.trimDurCheck = QCheckBox()
self.removeScalesCheck = QCheckBox()
self.runEngraverCheck = QCheckBox()
self.postChecks = [self.formatCheck,
self.trimDurCheck,
self.removeScalesCheck,
self.runEngraverCheck]
self.versionLabel = QLabel()
self.lilyChooser = lilychooser.LilyChooser()
self.formatCheck.setObjectName("reformat")
self.trimDurCheck.setObjectName("trim-durations")
self.removeScalesCheck.setObjectName("remove-scaling")
self.runEngraverCheck.setObjectName("engrave-directly")
self.buttons = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
userguide.addButton(self.buttons, self._userg)
row = 0
for r, w in enumerate(self.impChecks):
row += r
itabLayout.addWidget(w, row, 0, 1, 2)
row += 1
for r, w in enumerate(self.impExtra):
row += r
itabLayout.addWidget(w, row, 0, 1, 2)
itabLayout.addWidget(widgets.Separator(), row + 1, 0, 1, 2)
itabLayout.addWidget(self.versionLabel, row + 2, 0, 1, 0)
itabLayout.addWidget(self.lilyChooser, row + 3, 0, 1, 2)
itabLayout.setRowStretch(row + 4, 10)
ptabLayout.addWidget(self.formatCheck, 0, 0, 1, 2)
ptabLayout.addWidget(self.trimDurCheck, 1, 0, 1, 2)
ptabLayout.addWidget(self.removeScalesCheck, 2, 0, 1, 2)
ptabLayout.addWidget(self.runEngraverCheck, 3, 0, 1, 2)
ptabLayout.setRowStretch(4, 6)
mainLayout.addWidget(tabs, 0, 0, 6, 2)
mainLayout.addWidget(self.buttons, 7, 0, 1, 2)
self.buttons.accepted.connect(self.about_to_accept)
self.buttons.rejected.connect(self.reject)
self.lilyChooser.currentIndexChanged.connect(self.slot_lilypond_version_changed)
self.slot_lilypond_version_changed()
开发者ID:19joho66,项目名称:frescobaldi,代码行数:81,代码来源:toly_dialog.py
示例17: __init__
def __init__(self, mainwindow):
super(Dialog, self).__init__(mainwindow)
self._document = None
layout = QGridLayout()
self.setLayout(layout)
self.versionLabel = QLabel()
self.lilyChooser = lilychooser.LilyChooser()
self.outputLabel = QLabel()
self.outputCombo = QComboBox()
self.resolutionLabel = QLabel()
self.resolutionCombo = QComboBox(editable=True)
self.antialiasLabel = QLabel()
self.antialiasSpin = QSpinBox(minimum=1, maximum=128, value=1)
self.modeLabel = QLabel()
self.modeCombo = QComboBox()
self.englishCheck = QCheckBox()
self.deleteCheck = QCheckBox()
self.commandLineLabel = QLabel()
self.commandLine = QTextEdit(acceptRichText=False)
self.buttons = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttons.button(QDialogButtonBox.Ok).setIcon(icons.get("lilypond-run"))
userguide.addButton(self.buttons, "engrave_custom")
self.resolutionCombo.addItems(['100', '200', '300', '600', '1200'])
self.resolutionCombo.setCurrentIndex(2)
self.modeCombo.addItems(['preview', 'publish', 'debug'])
layout.addWidget(self.versionLabel, 0, 0)
layout.addWidget(self.lilyChooser, 0, 1, 1, 3)
layout.addWidget(self.outputLabel, 1, 0)
layout.addWidget(self.outputCombo, 1, 1, 1, 3)
layout.addWidget(self.resolutionLabel, 2, 0)
layout.addWidget(self.resolutionCombo, 2, 1)
layout.addWidget(self.antialiasLabel, 2, 2, Qt.AlignRight)
layout.addWidget(self.antialiasSpin, 2, 3)
layout.addWidget(self.modeLabel, 3, 0)
layout.addWidget(self.modeCombo, 3, 1, 1, 3)
layout.addWidget(self.englishCheck, 4, 0, 1, 4)
layout.addWidget(self.deleteCheck, 5, 0, 1, 4)
layout.addWidget(self.commandLineLabel, 6, 0, 1, 4)
layout.addWidget(self.commandLine, 7, 0, 1, 4)
layout.addWidget(widgets.Separator(), 8, 0, 1, 4)
layout.addWidget(self.buttons, 9, 0, 1, 4)
app.translateUI(self)
qutil.saveDialogSize(self, "engrave/custom/dialog/size", QSize(480, 260))
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.reject)
model = listmodel.ListModel(formats, display=lambda f: f.title(),
icon=lambda f: icons.file_type(f.type))
self.outputCombo.setModel(model)
s = QSettings()
s.beginGroup("lilypond_settings")
self.englishCheck.setChecked(
s.value("no_translation", False, bool))
self.deleteCheck.setChecked(
s.value("delete_intermediate_files", True, bool))
if s.value("default_output_target", "pdf", type("")) == "svg":
self.outputCombo.setCurrentIndex(3)
app.jobFinished.connect(self.slotJobFinished)
self.outputCombo.currentIndexChanged.connect(self.makeCommandLine)
self.modeCombo.currentIndexChanged.connect(self.makeCommandLine)
self.deleteCheck.toggled.connect(self.makeCommandLine)
self.resolutionCombo.editTextChanged.connect(self.makeCommandLine)
self.antialiasSpin.valueChanged.connect(self.makeCommandLine)
self.makeCommandLine()
panelmanager.manager(mainwindow).layoutcontrol.widget().optionsChanged.connect(self.makeCommandLine)
开发者ID:brumleygap,项目名称:frescobaldi,代码行数:81,代码来源:custom.py
示例18: __init__
def __init__(self, widget, name, text=""):
super(Edit, self).__init__(widget)
self._name = name
layout = QVBoxLayout()
self.setLayout(layout)
self.topLabel = QLabel()
self.text = QTextEdit(cursorWidth=2, acceptRichText=False)
self.titleLabel = QLabel()
self.titleEntry = QLineEdit()
self.shortcutLabel = QLabel()
self.shortcutButton = ShortcutButton(clicked=self.editShortcuts)
layout.addWidget(self.topLabel)
layout.addWidget(self.text)
grid = QGridLayout()
layout.addLayout(grid)
grid.addWidget(self.titleLabel, 0, 0)
grid.addWidget(self.titleEntry, 0, 1)
grid.addWidget(self.shortcutLabel, 1, 0)
grid.addWidget(self.shortcutButton, 1, 1)
layout.addWidget(widgets.Separator())
b = QDialogButtonBox(accepted=self.accept, rejected=self.reject)
layout.addWidget(b)
buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel
if name and name in builtin.builtin_snippets:
b.setStandardButtons(buttons | QDialogButtonBox.RestoreDefaults)
b.button(QDialogButtonBox.RestoreDefaults).clicked.connect(self.slotDefaults)
else:
b.setStandardButtons(buttons)
userguide.addButton(b, "snippet_editor")
# PyQt5.10 en sip4.14.5 delete the Highlighter, even though it is
# constructed with a parent, that's why we save it in an unused attribute.
self._highlighter = highlight.Highlighter(self.text.document())
Matcher(self.text)
gadgets.indenter.Indenter(self.text)
self.text.installEventFilter(cursorkeys.handler)
wordboundary.handler.install_textedit(self.text)
completer.Completer(self.text)
if name:
self.titleEntry.setText(snippets.title(name, False) or '')
self.text.setPlainText(snippets.text(name))
ac = self.parent().parent().snippetActions
self.setShortcuts(ac.shortcuts(name))
else:
self.text.setPlainText(text)
self.setShortcuts(None)
app.translateUI(self)
self.readSettings()
app.settingsChanged.connect(self.readSettings)
qutil.saveDialogSize(self, "snippettool/editor/size", QSize(400, 300))
self.show()
开发者ID:19joho66,项目名称:frescobaldi,代码行数:63,代码来源:edit.py
注:本文中的userguide.addButton函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论