本文整理汇总了Python中ufwi_rpcd.common.tr函数的典型用法代码示例。如果您正苦于以下问题:Python tr函数的具体用法?Python tr怎么用?Python tr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, rules):
Menu.__init__(self)
window = rules.window
self.debug = window.debug
self.create_before = self.add(":/icons/add.png",
tr("Create before"), self.createAclBefore)
self.create_after = self.add(":/icons/add.png",
tr("Create after"), self.createAclAfter)
self.edit = self.add(":/icons/edit.png",
tr("Edit"), self.editAcl)
self.up = self.add(":/icons/up.png",
tr("Move up"), self.moveUp)
if window.compatibility.has_move_rule:
self.move_at = self.add(":/icons/updown.png",
tr("Move to line..."), self.moveAt)
else:
self.move_at = None
self.down = self.add(":/icons/down.png",
tr("Move down"), self.moveDown)
self.clone = self.add(":/icons/copy.png",
tr("Clone"), self.cloneAcl)
self.delete = self.add(":/icons/delete.png",
tr("Delete"), self.deleteAcl)
self.iptables = self.add(":/icons/apply_rules.png",
tr("Iptables rules"), self.iptablesRules)
self.ldap = self.add(":/icons/apply_rules.png",
tr("LDAP rules"), self.ldapRules)
self.rules = rules
self.rule_id = None
self.identifiers = None
开发者ID:maximerobin,项目名称:Ufwi,代码行数:30,代码来源:menu.py
示例2: test_ldap
def test_ldap(self):
dc, base, uri, filter, password = self.specific_config.generateTest()
if uri is None or uri == '':
QMessageBox.critical(
self,
"Missing data",
"Please fill URI field"
)
return
if dc is None:
dc == ''
filter, ok = QInputDialog.getText(
self,
tr("LDAP Filter"),
tr("Please enter a filter:"),
QLineEdit.Normal,
filter
)
if not ok:
return
async = self.mainwindow.client.async()
async.call(
'nuauth',
'testLDAP',
dc, base, uri, unicode(filter), password,
callback = self.success_test,
errback = self.error_test
)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:31,代码来源:ldap_widget.py
示例3: _setethernetspeed
def _setethernetspeed(self, ethernet):
if ethernet.eth_auto:
cmd = "/usr/sbin/ethtool -s %s autoneg on" % ethernet.system_name
self.responsible.feedback(
tr("Setting up speed for interface %(DESCRIPTION)s: auto"),
DESCRIPTION=ethernet.fullName()
)
else:
args = {
'name': ethernet.system_name,
'duplex': "full" if ethernet.eth_duplex == Ethernet.FULL else "half",
'speed': ethernet.eth_speed
}
cmd = "/usr/sbin/ethtool -s %(name)s autoneg off speed "\
"%(speed)s duplex %(duplex)s" % args
self.responsible.feedback(
tr(
"Setting up speed for interface %(DESCRIPTION)s: "
"speed: %(SPEED)s, duplex: %(DUPLEX)s."),
DESCRIPTION=ethernet.fullName(),
SPEED=args['speed'],
DUPLEX=args['duplex']
)
process = createProcess(self, cmd.split(),
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
env={})
retcode, stdout, stderr = communicateProcess(self, process, 30)
if retcode == 0:
return
else:
self.responsible.feedback("Could not set speed.")
#Explicitely catched
raise EthernetSpeedError("Error while running [%s]." % cmd)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:34,代码来源:network.py
示例4: printServerTime
def printServerTime(self, time):
server_time = unicode(datetime.fromtimestamp(float(time)))
server_time = unicode(htmlBold(server_time))
html = tr("Server time: %s") % server_time
html = Html(html, escape=False)
self.addToInfoArea(html)
QMessageBox.information(self, tr("Server time"), tr("Server time: %s") % server_time)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:7,代码来源:ntp.py
示例5: _update_gui
def _update_gui(self):
if self.last_updated == ADStatus.UNKNOWN:
self.status_text.setText(ADStatus.UNKNOWN)
for widget in (
self.status_icon,
self.additional_info,
):
widget.hide()
return
if not self.status:
self.status_icon.show()
self.additional_info.hide()
self.status_icon.setPixmap(ADStatus.NOT_MEMBER_PIXMAP)
self.status_text.setText(ADStatus.NOT_MEMBER)
for widget in (
self.status_icon,
self.additional_info,
):
widget.show()
self.status_text.setText(
tr("AD information:")
)
info = (
tr("Domain name: %s") % self.realm,
tr("Parent server name: %s") % self.parent_server,
tr("Last updated: %s") % self.last_updated,
tr("EdenWall/Active Directory time delta: %s second(s)")
% self.time_offset,
)
self.additional_info.setText("\n".join(info))
开发者ID:maximerobin,项目名称:Ufwi,代码行数:33,代码来源:ad_widget.py
示例6: isValid
def isValid(self):
self.message.setNoMessage()
self.error_message = ''
hasInvalidData = False
for widget in [self.dns1, self.dns2]:
if not widget.isValid():
hasInvalidData = True
error = "'%s' : must be '%s'<br />" % (widget.text(), widget.getFieldInfo())
self.error_message += error
self.message.setMessage('', "<ul>%s" % error, status=MessageArea.WARNING)
confs = {
tr("hostname"): self.qhostnamecfg.cfg,
tr("DNS"): self.qresolvcfg.cfg
}
for name, item in confs.iteritems():
if not item.isValid():
hasInvalidData = True
error = tr("%s configuration is invalid<br />") % name
self.message.setMessage('', error, status=MessageArea.WARNING)
self.error_message += error
if not hasInvalidData:
error = self.qresolvcfg.resolvcfg.isInvalid()
if error:
hasInvalidData = True
self.error_message = error
self.message.setMessage('', error, status=MessageArea.WARNING)
if hasInvalidData:
self.mainwindow.addToInfoArea(tr("'Hostname and DNS : invalid configuration'"))
return False
else:
return True
开发者ID:maximerobin,项目名称:Ufwi,代码行数:35,代码来源:resolv_panel.py
示例7: check_join
def check_join(logger, responsible):
"""
'net ads testjoin' should be sufficient in most cases.
'net rpc testjoin' is a fallback to 'net ads testjoin'
"""
responsible.feedback(tr("Checking that the group mappings exist."))
if not exists("/var/lib/samba/winbindd_idmap.tdb"):
raise NuauthException(NO_MAPPING_EXISTS, "The group mappings don't exist")
try:
cmd = ('/usr/bin/net', 'ads', 'testjoin')
runCommandAndCheck(logger, cmd)
except RunCommandError:
pass # another test
else:
responsible.feedback(tr("The junction to the Active Directory domain is functional"))
return # ok
try:
cmd = ('/usr/bin/net', 'rpc', 'testjoin')
runCommandAndCheck(logger, cmd)
except RunCommandError:
if responsible is not None:
responsible.feedback(
tr("No junction to an Active Directory domain.")
)
raise NuauthException(NUAUTH_INVALID_CONF,
"Domain not available")
responsible.feedback(tr("The junction to the Active Directory domain is functional"))
开发者ID:maximerobin,项目名称:Ufwi,代码行数:28,代码来源:ad_join.py
示例8: accept_suppression
def accept_suppression(dhcprange, parent_widget):
"""
The net we refer to is not available anymore, do we want this or not
Let the user choose.
"""
deletable_tr = tr("Consequence: the following DHCP range will be deleted:")
deletable_html = u"<ul>"
deletable_html += "<li>%s %s: %s > %s</li>" % (
deletable_tr,
unicode(dhcprange.net),
unicode(dhcprange.start),
unicode(dhcprange.end)
)
deletable_html += u"</ul>"
title = tr("DHCP configuration")
message_box = QMessageBox(parent_widget)
message_box.setWindowTitle(title)
message_box.setText(_GENERIC_TEXT)
message_box.setInformativeText(deletable_html)
message_box.setStandardButtons(
QMessageBox.Yes | QMessageBox.Cancel
)
clicked_button = message_box.exec_()
if clicked_button == QMessageBox.Yes:
return True, _DELETE_RANGE
return False
开发者ID:maximerobin,项目名称:Ufwi,代码行数:27,代码来源:changes_handling.py
示例9: setupWindow
def setupWindow(self):
self.setButtons()
self.setContainer(self.list)
self.setMenu(UserGroupMenu(self,
tr("New user group"),
tr("Edit this user group"),
tr("Delete this user group")))
开发者ID:maximerobin,项目名称:Ufwi,代码行数:7,代码来源:user_groups.py
示例10: build
def build(self, description):
self.layout().addWidget(self.list)
cancel = QPushButton(QIcon(":/icons/wrong.png"), tr("Cancel"), self)
save = QPushButton(QIcon(":/icons/apply.png"), tr("OK"), self)
save.setDefault(True)
self.connect(cancel, SIGNAL("clicked()"), self.doClose)
self.connect(save, SIGNAL("clicked()"), self.doSave)
self.grid = QWidget(self)
self.setMinimumWidth(700)
QGridLayout(self.grid)
self.grid.layout().addWidget(save, 0, 0, Qt.AlignHCenter)
self.grid.layout().addWidget(cancel, 0, 1, Qt.AlignHCenter)
self.layout().addWidget(self.grid)
self.info.setReadOnly(True)
if description:
self.info.append(description)
else:
self.info.setVisible(False)
self.error.setReadOnly(True)
self.error.setVisible(False)
self.grid.layout().addWidget(self.info, 1, 0, 1, 0, Qt.AlignHCenter)
self.grid.layout().addWidget(self.error, 2, 0, 1, 0, Qt.AlignHCenter)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:28,代码来源:list_edit.py
示例11: buildInterface
def buildInterface(self):
frame = QFrame()
layout = QVBoxLayout(frame)
self.setWidget(frame)
self.setWidgetResizable(True)
title = u'<h1>%s</h1>' % self.tr('EdenWall activation keys')
layout.addWidget(QLabel(title))
sn = "<strong>%s</strong>" % self.ID
self.IDLabel = QLabel(tr('This appliance serial number is %s.') % sn)
self.IDLabel.setTextInteractionFlags(
Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse)
sendLicenseButton = NuConfPageKit.createButton(
tr('Upload an activation key'), frame, self.mainwindow,
self.chooseAndSendFile, QIcon(":/icons/up"))
self.mainwindow.writeAccessNeeded(sendLicenseButton)
self.table = QTableWidget(0, 4, frame)
self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
self.table.setSelectionMode(QAbstractItemView.NoSelection)
self.table.horizontalHeader().setStretchLastSection(True)
self.table.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
self.table.setHorizontalHeaderLabels([
unicode(translate('MainWindow', 'Activation key owner')),
unicode(translate('MainWindow', 'Valid until')),
unicode(translate('MainWindow', 'Days left')),
unicode(translate('MainWindow', 'Type'))])
for widget in (self.IDLabel, sendLicenseButton, self.table):
layout.addWidget(widget)
layout.addStretch(100)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:32,代码来源:license.py
示例12: createInformation
def createInformation(self):
window = self.library.window
networks = window.object_libraries["resources"]
protocols = window.object_libraries["protocols"]
title = tr("Platform")
items = []
for item in self["items"]:
network = item["network"]
network = networks[network]
protocol = item["protocol"]
protocol = protocols[protocol]
html = "(%s, %s)" % (
network.createHTML(tooltip=True, icon=False),
protocol.createHTML(tooltip=True, icon=False),
)
html = Html(html, escape=False)
items.append(html)
items = BR.join(items)
interface = networks[self["interface"]]
options = [
(tr("Identifier"), self["id"]),
(tr("Interface"), interface.createHTML(tooltip=True)),
(tr("Items"), items),
(tr("References"), self.createReferencesHTML()),
]
return (title, options)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:27,代码来源:platform.py
示例13: sort_label
def sort_label(self):
""" With my args, get a label to say on what field my list is ordered. """
if not self.args.has_key('sortby') or not arg_types.has_key(self.args['sortby']):
return tr('No sorting')
return tr(u'Sorted by %s') % (arg_types[self.args['sortby']].label)
开发者ID:maximerobin,项目名称:Ufwi,代码行数:7,代码来源:__init__.py
示例14: release
def release(self, context, key):
self.thread_lock.acquire()
try:
key = self.cleanKey(key)
# Get the lock
if key in self.permanent_locks:
lock = self.permanent_locks[key]
else:
raise LockError(tr('The "%s" lock is not acquired!'), key)
# PersistentLock owned by another user?
if isinstance(lock, PersistentLock):
session = context.getSession()
lock_session = lock.getSession()
if lock_session != session:
raise LockError(
tr('The "%s" lock, owned by %s, can not be released!'),
key, unicode(lock_session.user))
elif isinstance(lock, ComponentLock):
if lock.getComponentName() != context.component.name:
raise LockError(
tr('The "%s" lock, owned by the %s component, can not be released!'),
key, unicode(lock.getComponentName()))
# Delete the lock
self.destroyLock(key)
finally:
self.thread_lock.release()
开发者ID:maximerobin,项目名称:Ufwi,代码行数:28,代码来源:lock.py
示例15: _edit_hostname
def _edit_hostname(self):
changeable = self.qhostnamecfg.hostnamecfg.changeable
if not self._can_edit_hostname:
QMessageBox.critical(
self,
_CANNOT_CHANGE_HOSTNAME_TITLE,
_CANNOT_CHANGE_HOSTNAME,
)
return
if changeable == CHANGE_DISCOURAGED:
if not self._continue_edit(
tr("About hostname change", "popup title"),
_HOSTNAME_CHANGE_DISCLAIMER
):
return
hostname, ok = self.__editFieldDialog(
tr("Edit hostname"),
tr("Enter new hostname"),
self.qhostnamecfg.hostnamecfg.hostname
)
if ok:
hostname = unicode(hostname).strip()
if hostname == self.qhostnamecfg.hostnamecfg.hostname:
return
self.qhostnamecfg.pre_modify()
self.qhostnamecfg.hostnamecfg.hostname = hostname
self.qhostnamecfg.post_modify()
self.setModified()
开发者ID:maximerobin,项目名称:Ufwi,代码行数:32,代码来源:resolv_panel.py
示例16: check_proto_not_cleartext
def check_proto_not_cleartext(self, options):
if options['protocol'] == 'http':
ret = QMessageBox.warning( self, tr("Insecure protocol"),
tr("You are connecting using an insecure protocol. Everything will be transmitted in clear, including your login and password.\nDo you really want to do that ?"),
QMessageBox.Ok | QMessageBox.Cancel)
if ret != QMessageBox.Ok:
raise RpcdError("UserError", tr("Aborted by user"))
开发者ID:maximerobin,项目名称:Ufwi,代码行数:7,代码来源:auth_window.py
示例17: full_test
def full_test(self):
fields = {
self.test_group.server_input: tr("test server field"),
self.test_group.query_input: tr("test query field"),
}
default_test = True
for item in fields:
if not item.isEmpty():
default_test = False
if not item.isValid():
self.mainwindow.addToInfoArea(
tr("Wrong value in %s, can not test.") % fields[item]
)
return
if default_test:
self.default_test()
return
self.deactivate_tests()
async = self.client.async()
async.call('resolv', 'test',
{
'server': unicode(self.test_group.server_input.text()).strip(),
'query': unicode(self.test_group.query_input.text()).strip()
},
callback=self.test_success,
errback=self.test_error
)
self.mainwindow.addToInfoArea(tr("Testing DNS server with custom parameters..."))
开发者ID:maximerobin,项目名称:Ufwi,代码行数:35,代码来源:resolv_panel.py
示例18: _getTraceback
def _getTraceback(err, errtype, traceback):
# Get server traceback (if any)
if hasattr(err, "traceback") and err.traceback:
server = list(err.traceback)
server = _cleanupTraceback(server, tr("Server backtrace:"))
else:
server = u''
# Get client (local) traceback
info = None
if traceback is None:
try:
info = sys.exc_info()
sys.exc_clear()
except Exception:
info = None
else:
info = (errtype, err, traceback)
if info:
client = formatTraceback(info)
client = _cleanupTraceback(client, tr("Client backtrace:"))
else:
client = u''
return server + client
开发者ID:maximerobin,项目名称:Ufwi,代码行数:25,代码来源:error.py
示例19: createInformation
def createInformation(self):
options = [
(tr('Identifier'), self['id']),
(tr('Duration'), self.getText()),
(tr('References'), self.createReferencesHTML()),
]
return tr('Duration'), options
开发者ID:maximerobin,项目名称:Ufwi,代码行数:7,代码来源:durations.py
示例20: buildInterface
def buildInterface(self):
main_widget = QWidget()
self.setWidget(main_widget)
self.setWidgetResizable(True)
self.form = QFormLayout(main_widget)
title = u'<h1>%s</h1>' % \
self.tr('Outgoing HTTP and HTTPS proxy configuration')
self.form.addRow(QLabel(title))
self.use_proxy = self.addField(tr("Use proxy"), QCheckBox)
self.host = self.addField(tr("Host"), IpOrHostnameOrFqdnEdit)
self.port = self.addField(tr("Port"), PortEdit)
self.user = self.addField(tr("User"), QLineEdit)
self.password = self.addField(tr("Password"), PasswordInput)
self.connect(self.use_proxy, SIGNAL('stateChanged(int)'),
self.setUseProxy)
for pair in (
(self.host, self.setHost),
(self.port, self.setPort),
(self.user, self.setUser),
(self.password, self.setPassword),
):
self.connect(pair[0], SIGNAL('textEdited(QString)'), pair[1])
开发者ID:maximerobin,项目名称:Ufwi,代码行数:25,代码来源:httpout.py
注:本文中的ufwi_rpcd.common.tr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论