本文整理汇总了Python中puddlestuff.translations.translate函数的典型用法代码示例。如果您正苦于以下问题:Python translate函数的具体用法?Python translate怎么用?Python translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了translate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, title='Add Action', shortcut=u'', actions=None, names=None, shortcuts=None, parent=None):
super(Editor, self).__init__(parent)
self.setWindowTitle(title)
self._items = {}
self._name = QLineEdit('Name')
if shortcut and shortcut in shortcuts:
shortcuts.remove(shortcut)
self._shortcut = puddleobjects.ShortcutEditor(shortcuts)
self._shortcut.setText(shortcut)
clear = QPushButton(translate('Shortcuts', '&Clear'))
self.connect(clear, SIGNAL('clicked()'), self._shortcut.clear)
if names is None:
names = []
self._names = names
self._actionList = ListBox()
self.connect(self._actionList,
SIGNAL('itemDoubleClicked (QListWidgetItem *)'), self._addAction)
self._newActionList = ListBox()
listbuttons = ListButtons()
listbuttons.duplicate.hide()
listbuttons.insertStretch(0)
self.connect(listbuttons, SIGNAL('add'), self._addAction)
self._newActionList.connectToListButtons(listbuttons)
okcancel = OKCancel()
self.connect(okcancel, SIGNAL('ok'), self.okClicked)
self.connect(okcancel, SIGNAL('cancel'), self.close)
self._ok = okcancel.ok
self.connect(self._name, SIGNAL('textChanged(const QString)'), self.enableOk)
scut_status = QLabel('')
self.connect(self._shortcut, SIGNAL('validityChanged'),
lambda v: scut_status.setText(u'') if v or (not self._shortcut.text()) else
scut_status.setText(translate('Shortcuts', "Invalid shortcut sequence.")))
okcancel.insertWidget(0, scut_status)
hbox = QHBoxLayout()
hbox.addLayout(
create_buddy('Actions', self._actionList, QVBoxLayout()), 1)
hbox.addLayout(listbuttons, 0)
hbox.addLayout(create_buddy('Actions to run for shortcut',
self._newActionList, QVBoxLayout()), 1)
layout = QVBoxLayout()
layout.addLayout(create_buddy('Shortcut &Name: ', self._name))
scut_layout = create_buddy('&Keyboard Shortcut: ', self._shortcut)
scut_layout.addWidget(clear)
layout.addLayout(scut_layout)
layout.addLayout(hbox)
layout.addLayout(okcancel)
self.setLayout(layout)
if actions:
self.setActions(actions)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:60,代码来源:action_shortcuts.py
示例2: __init__
def __init__(self, parent = None, cenwid = None, status=None):
QFrame.__init__(self, parent)
self.title = translate('Settings', "Patterns")
connect = lambda c, signal, s: self.connect(c, SIGNAL(signal), s)
self.setFrameStyle(QFrame.Box)
self.listbox = ListBox()
self.listbox.setSelectionMode(self.listbox.ExtendedSelection)
buttons = ListButtons()
self.listbox.addItems(status['patterns'])
hbox = QHBoxLayout()
hbox.addWidget(self.listbox)
self.setLayout(hbox)
vbox = QVBoxLayout()
sortlistbox = QPushButton(translate("Pattern Settings", '&Sort'))
self._sortOrder = Qt.AscendingOrder
connect(sortlistbox, 'clicked()', self._sortListBox)
vbox.addWidget(sortlistbox)
vbox.addLayout(buttons)
vbox.addStretch()
hbox.addLayout(vbox)
connect(buttons, "add", self.addPattern)
connect(buttons, "edit", self.editItem)
buttons.duplicate.setVisible(False)
self.listbox.connectToListButtons(buttons)
self.listbox.editButton = buttons.edit
connect(self.listbox, 'itemDoubleClicked(QListWidgetItem *)',
self._doubleClicked)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:31,代码来源:patterncombo.py
示例3: setReleases
def setReleases(self, releases, files=None):
from puddlestuff.masstag import find_best
self.model().setupModelData(releases)
#FIXME: The expander isn't shown if I don't do this. However
#I can still click on it...Qt bug probably.
QApplication.processEvents()
if files:
matches = find_best(releases, files, self.albumBound)
if not matches:
self.emit(SIGNAL('statusChanged'), translate(
'WebDB', 'No matching albums were found.'))
elif len(matches) > 1:
self.emit(SIGNAL('statusChanged'), translate(
'WebDB', 'More than one album matches. None will be retrieved.'))
else:
self.emit(SIGNAL('statusChanged'), translate(
'WebDB', 'Retrieving album.'))
model = self.model()
children = [z.itemData for z in model.rootItem.childItems]
if children:
row = children.index(matches[0][0])
index = model.index(row, 0, QModelIndex())
x = lambda: self.emitExactMatches(
model.rootItem.childItems[row], files)
model.retrieve(index, x)
开发者ID:chincheta0815,项目名称:puddletag,代码行数:26,代码来源:releasewidget.py
示例4: loadLib
def loadLib(self):
"""Loads the currently selected library.
Emits 'adddock' signal if successful with a LibraryTree class as its
widget.
"""
p = ProgressWin(self, 0,
translate('MusicLib', 'Loading music library...'), False)
p.show()
t = PuddleThread(self._loadLib, self)
t.start()
while t.isRunning():
QApplication.processEvents()
library = t.retval
p.close()
QApplication.processEvents()
if isinstance(library, basestring):
error_msg = library
msg = translate('MusicLib',
'An error occured while loading the %1 library: <b>%2</b>')
msg = msg.arg(self.currentlib['name']).arg(error_msg)
QMessageBox.critical(self, translate('Defaults', "Error"),
msg, QMessageBox.Ok, QMessageBox.NoButton,
QMessageBox.NoButton)
else:
dialog = partial(LibraryDialog, library)
self.emit(SIGNAL('adddock'),
translate('MusicLib', 'Music Library'), dialog, RIGHTDOCK)
self.close()
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:30,代码来源:musiclib.py
示例5: contextMenuEvent
def contextMenuEvent(self, event):
connect = lambda o,s: self.connect(o, SIGNAL('triggered()'), s)
menu = QMenu(self)
refresh = QAction(translate("Dirview",
'Refresh Directory'), self)
index = self.indexAt(event.pos())
connect(refresh, lambda: self.model().refresh(index))
header = self.header()
if self.header().isHidden():
show_header = QAction(translate("Dirview",
'Show Header'), self)
connect(show_header, header.show)
else:
show_header = QAction(translate("Dirview",
'Hide Header'), self)
connect(show_header, header.hide)
open_dir = QAction(translate(
'Dirview', 'Open in File Manager'), self)
connect(open_dir, lambda: self.openExtern(index))
menu.addAction(refresh)
menu.addAction(show_header)
menu.addAction(open_dir)
menu.exec_(event.globalPos())
super(DirView, self).contextMenuEvent(event)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:31,代码来源:dirview.py
示例6: __init__
def __init__(self, parent = None):
QWidget.__init__(self, parent)
def hbox(*widgets):
box = QHBoxLayout()
[box.addWidget(z) for z in widgets]
box.addStretch()
return box
vbox = QVBoxLayout()
startlabel = QLabel(translate('Autonumbering Wizard', "&Start: "))
self._start = QSpinBox()
startlabel.setBuddy(self._start)
self._start.setValue(1)
self._start.setMaximum(65536)
vbox.addLayout(hbox(startlabel, self._start))
label = QLabel(translate('Autonumbering Wizard', 'Max length after padding with zeroes: '))
self._padlength = QSpinBox()
label.setBuddy(self._padlength)
self._padlength.setValue(1)
self._padlength.setMaximum(65535)
self._padlength.setMinimum(1)
vbox.addLayout(hbox(label, self._padlength))
self._restart_numbering = QCheckBox(translate('Autonumbering Wizard', "&Restart numbering at each directory."))
vbox.addWidget(self._restart_numbering)
vbox.addStretch()
self.setLayout(vbox)
开发者ID:frnogueira,项目名称:puddletag,代码行数:33,代码来源:functions_dialogs.py
示例7: openFile
def openFile(self, filename=None, dirpath=None):
"""Open the file and fills the textboxes."""
if not dirpath:
dirpath = self.lastDir
if not filename:
filedlg = QFileDialog()
filename = unicode(filedlg.getOpenFileName(self,
'OpenFolder', dirpath))
if not filename:
return True
try:
f = open(filename, 'r')
except (IOError, OSError), detail:
errormsg = translate('Text File -> Tag',
"The file <b>%1</b> couldn't be loaded.<br /> "
"Do you want to choose another?")
ret = QMessageBox.question(self,
translate('Text File -> Tag', "Error"),
translate('Text File -> Tag', errormsg.arg(filename)),
translate('Text File -> Tag', "&Yes"),
translate('Text File -> Tag', "&No"))
if ret == 0:
return self.openFile()
else:
return detail
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:30,代码来源:helperwin.py
示例8: _dirChanged
def _dirChanged(self, dirs):
if not dirs:
self.setWindowTitle('puddletag')
return
if isinstance(dirs, basestring):
dirs = [dirs]
dirs = [encode_fn(d) for d in dirs]
if self._lastdir:
initial = self._lastdir[0]
else:
initial = None
if initial not in dirs:
initial = dirs[0]
if isinstance(initial, str):
initial = initial.decode('utf8', 'replace')
if len(dirs) > 1:
self.setWindowTitle(translate("Main Window", 'puddletag: %1 + others').arg(initial))
else:
self.setWindowTitle(translate("Main Window", 'puddletag: %1').arg(initial))
self._lastdir = dirs
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:27,代码来源:puddletag.py
示例9: __init__
def __init__(self,parent = None, filename = None, clipboard = None):
QDialog.__init__(self, parent)
self.setWindowTitle(
translate('Text File -> Tag', "Import tags from text file"))
winsettings('importwin', self)
grid = QGridLayout()
self.label = QLabel(translate('Text File -> Tag', "Text"))
grid.addWidget(self.label, 0, 0)
self.label = QLabel(translate('Text File -> Tag', "Tag preview"))
grid.addWidget(self.label, 0, 2)
self.file = QTextEdit()
grid.addWidget(self.file, 1, 0, 1, 2)
self.tags = QTextEdit()
grid.addWidget(self.tags,1, 2, 1, 2)
self.tags.setLineWrapMode(QTextEdit.NoWrap)
hbox = QHBoxLayout()
self.patterncombo = QComboBox()
self.patterncombo.setEditable(True)
self.patterncombo.setDuplicatesEnabled(False)
okcancel = OKCancel()
self.ok = okcancel.ok
self.cancel = okcancel.cancel
self.openfile = QPushButton(
translate('Text File -> Tag', "&Select File"))
getclip = QPushButton(
translate('Text File -> Tag', "&Paste Clipboard"))
self.connect(getclip, SIGNAL('clicked()'), self.openClipBoard)
hbox.addWidget(self.openfile)
hbox.addWidget(getclip)
hbox.addWidget(self.patterncombo,1)
hbox.addLayout(okcancel)
grid.addLayout(hbox, 3, 0, 1, 4)
self.setLayout(grid)
self.connect(self.openfile,SIGNAL("clicked()"),self.openFile)
self.connect(self.cancel, SIGNAL("clicked()"),self.close)
self.connect(self.ok, SIGNAL("clicked()"), self.emitValues)
if clipboard:
self.openClipBoard()
return
self.lastDir = HOMEDIR
if filename is not None:
self.openFile(filename)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:59,代码来源:helperwin.py
示例10: __init__
def __init__(self, parent=None, status=None):
ButtonsAndList.__init__(self, parent,
translate('ViewAllFields', 'View All Fields'),
translate("ViewAllFields", 'Add Field'),
translate("ViewAllFields", 'Edit fields for "View All Fields"'),
)
self.addItems(load_fields())
self.status = status
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:8,代码来源:__init__.py
示例11: enableNumTracks
def enableNumTracks(self, state):
if state == Qt.Checked:
self._numtracks.setVisible(False)
self._separator.setText(translate('Autonumbering Wizard',
"Add track &separator ['/']"))
else:
self._numtracks.setVisible(True)
self._separator.setText(translate('Autonumbering Wizard',
"Add track &separator ['/']: Number of tracks"))
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:9,代码来源:helperwin.py
示例12: __init__
def __init__(self, actions, parent=None):
super(ActionEditorDialog, self).__init__(parent)
self.actions = actions
help = QLabel(translate("Shortcut Settings", '<b>Double click a cell in the Shortcut Column' \
' to <br />modify the key sequence.</b>'))
self.actionTable = QTableWidget(self)
self.actionTable.setSelectionBehavior(QTableWidget.SelectRows)
self.actionTable.setEditTriggers(QTableWidget.DoubleClicked)
self.actionTable.setColumnCount(2)
self.actionTable.setHorizontalHeaderLabels(
[translate("Shortcut Settings", "Description"),
translate("Shortcut Settings", "Shortcut")]
)
self.actionTable.horizontalHeader().setStretchLastSection(True)
self.actionTable.verticalHeader().hide()
self.actionTable.setItemDelegate(ActionEditorDelegate(self))
self.connect(self.actionTable, SIGNAL("cellChanged(int, int)"),
self.validateAction)
row = 0
for action in self.actions:
if action.text().isEmpty():
continue
self.actionTable.insertRow(self.actionTable.rowCount())
item = QTableWidgetItem()
item.setText(action.text())
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
self.actionTable.setItem(row, 0, item)
item = QTableWidgetItem()
item.setText(action.shortcut().toString())
item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable)
item.oldShortcutText = item.text()
self.actionTable.setItem(row, 1, item)
row += 1
self.actionTable.resizeColumnsToContents()
mainLayout = QVBoxLayout()
mainLayout.addWidget(help)
mainLayout.setMargin(8)
mainLayout.setSpacing(8)
mainLayout.addWidget(self.actionTable)
self.setLayout(mainLayout)
self._model = self.actionTable.model()
self._model.edited = False
self.actionTable.model().edited = False
self.setWindowTitle(translate("Shortcut Settings", "Edit Shortcuts"))
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:57,代码来源:shortcutsettings.py
示例13: changeInfo
def changeInfo(self, info):
labels = [translate('Plugin Settings', 'Name'),
translate('Plugin Settings', 'Author'),
translate('Plugin Settings', 'Description'),
translate('Plugin Settings', 'Version')]
properties = [NAME, AUTHOR, DESC, VERSION]
text = u'<br />'.join([u'<b>%s:</b> %s' % (disp, info[prop]) for
disp, prop in zip(labels, properties)])
self.setText(text)
开发者ID:chincheta0815,项目名称:puddletag,代码行数:10,代码来源:pluginloader.py
示例14: lookup
def lookup(self):
button = self.sender()
if self._startButton.text() != translate('Masstagging', '&Stop'):
self.__flag.stop = False
self._log.clear()
self._startButton.setText(translate('Masstagging', '&Stop'))
self._start()
else:
self._startButton.setText(translate('Masstagging', '&Search'))
self.__flag.stop = True
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:10,代码来源:dialogs.py
示例15: __init__
def __init__(self):
object.__init__(self)
self.min_score = 0.80
self.preferences = [
[translate("AcoustID", 'Minimum Score'), SPINBOX, [0, 100, 80]],
[translate("AcoustID", "AcoustID Key"), TEXT, u""]
]
self.__lasttime = time.time()
acoustid._send_request = self._send_request
self.__user_key = ""
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:10,代码来源:acoust_id.py
示例16: _start
def _start(self):
mtp = self.profile
tag_groups = split_files(self._status['selectedfiles'],
mtp.file_pattern)
search_msg = translate('Masstagging',
'An error occured during the search: <b>%s</b>')
retrieve_msg = translate('Masstagging',
'An error occured during album retrieval: <b>%s</b>')
def search_error(error, mtp):
thread.emit(SIGNAL('statusChanged'),
search_msg % unicode(error))
def retrieval_error(error, mtp):
thread.emit(SIGNAL('statusChanged'),
retrieve_msg % unicode(error))
def run_masstag():
replace_fields = []
for files in tag_groups:
mtp.clear()
masstag(mtp, files, self.__flag, search_error,
retrieval_error)
retrieved = merge_tsp_tracks(mtp.profiles)
ret = match_files(files, retrieved,
mtp.track_bound, mtp.fields,
mtp.jfdi, mtp.leave_existing, True)[0]
if ret:
thread.emit(SIGNAL('enable_preview_mode'))
thread.emit(SIGNAL('setpreview'), ret)
set_status('<hr width="45%" /><br />')
def finished(value):
if not (value is True):
set_status(translate('Masstagging',
'<b>Lookups completed.</b>'))
self._startButton.setText(translate('Masstagging', '&Search'))
self.__flag.stop = False
thread = PuddleThread(run_masstag, self)
self.connect(thread, SIGNAL('setpreview'), SIGNAL('setpreview'))
self.connect(thread, SIGNAL('enable_preview_mode'),
SIGNAL('enable_preview_mode'))
self.connect(thread, SIGNAL('threadfinished'), finished)
self.connect(thread, SIGNAL('statusChanged'), set_status)
thread.start()
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:54,代码来源:dialogs.py
示例17: add
def add(self):
table = self._table
row = table.rowCount()
table.insertRow(row)
for column, v in enumerate([
translate("Mapping Settings", 'Tag'),
translate("Mapping Settings", 'Source'),
translate("Mapping Settings", 'Target')]):
table.setItem(row, column, QTableWidgetItem(v))
item = table.item(row, 0)
table.setCurrentItem(item)
table.editItem(item)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:12,代码来源:puddlesettings.py
示例18: __init__
def __init__(self, controls, parent = None):
QWidget.__init__(self, parent)
settings = []
for control in controls:
if hasattr(control, 'gensettings'):
settings.extend(load_gen_settings(control.gensettings, True))
self._controls = []
def create_control(desc, val):
if isinstance(val, bool):
return SettingsCheckBox(val, desc)
elif isinstance(val, basestring):
return SettingsLineEdit(desc, val)
vbox = QVBoxLayout()
for desc, val in settings:
widget = create_control(desc, val)
vbox.addWidget(widget)
self._controls.append(widget)
edit_sort_options = QPushButton(
translate("GenSettings", '&Edit sort options'))
self._lang_combo = QComboBox()
self._lang_combo.addItems([translate('GenSettings', '<Autodetect>'),
translate('GenSettings', 'Default')])
self._lang_combo.setCurrentIndex(0)
lang = PuddleConfig().get('main', 'lang', u'auto')
self._lang_combo.addItems(list(get_languages([TRANSDIR])))
if lang != u'auto':
i = self._lang_combo.findText(lang, Qt.MatchFixedString)
if i > 0:
self._lang_combo.setCurrentIndex(i)
self.connect(edit_sort_options, SIGNAL('clicked()'),
self.editSortOptions)
hbox = QHBoxLayout()
hbox.addWidget(edit_sort_options)
hbox.addStretch()
vbox.addLayout(hbox)
if self._lang_combo.count() > 2:
vbox.addLayout(create_buddy(
translate('GenSettings', 'Language (Requires a restart)'),
self._lang_combo))
else:
self._lang_combo.setCurrentIndex(0)
vbox.addStretch()
self.setLayout(vbox)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:52,代码来源:puddlesettings.py
示例19: showDirectorySplittingOptions
def showDirectorySplittingOptions(self, state):
is_checked = state==Qt.Checked
for widget in self.custom_numbering_widgets:
widget.setVisible(is_checked)
if is_checked:
self._numtracks.setVisible(False)
self._separator.setText(translate('Autonumbering Wizard',
"Add track &separator ['/']"))
else:
self._numtracks.setVisible(True)
self._separator.setText(translate('Autonumbering Wizard',
"Add track &separator ['/']: Number of tracks"))
开发者ID:frnogueira,项目名称:puddletag,代码行数:13,代码来源:helperwin.py
示例20: loadPlayList
def loadPlayList(self):
filedlg = QFileDialog()
dirname = self._lastdir[0] if self._lastdir else QDir.homePath()
filename = unicode(filedlg.getOpenFileName(self,
translate("Playlist", translate("Playlist", 'Select m3u file...')), ))
if not filename:
return
try:
files = m3u.readm3u(filename)
self.emit(SIGNAL('loadFiles'), files, None, None, None, filename)
except (OSError, IOError), e:
QMessageBox.information(self._table,
translate("Defaults", 'Error'),
translate("Playlist", 'An error occured while reading <b>%1</b> (%2)').arg(filename).arg(e.strerror),
QMessageBox.Ok, QMessageBox.NoButton)
开发者ID:RaphaelRochet,项目名称:puddletag,代码行数:15,代码来源:puddletag.py
注:本文中的puddlestuff.translations.translate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论