forked from openlp/openlp
Update projector UI strings to Python3 format
This commit is contained in:
parent
6398e217df
commit
278ec2bed2
@ -182,9 +182,10 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
|
||||
QtWidgets.QMessageBox.warning(self,
|
||||
translate('OpenLP.ProjectorEdit', 'Duplicate Name'),
|
||||
translate('OpenLP.ProjectorEdit',
|
||||
'There is already an entry with name "%s" in '
|
||||
'the database as ID "%s". <br />'
|
||||
'Please enter a different name.' % (name, record.id)))
|
||||
'There is already an entry with name "{name}" in '
|
||||
'the database as ID "{record}". <br />'
|
||||
'Please enter a different name.'.format(name=name,
|
||||
record=record.id)))
|
||||
valid = False
|
||||
return
|
||||
adx = self.ip_text.text()
|
||||
@ -198,17 +199,17 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
|
||||
QtWidgets.QMessageBox.warning(self,
|
||||
translate('OpenLP.ProjectorWizard', 'Duplicate IP Address'),
|
||||
translate('OpenLP.ProjectorWizard',
|
||||
'IP address "%s"<br />is already in the database as ID %s.'
|
||||
'<br /><br />Please Enter a different IP address.' %
|
||||
(adx, ip.id)))
|
||||
'IP address "{ip}"<br />is already in the database '
|
||||
'as ID {data}.<br /><br />Please Enter a different '
|
||||
'IP address.'.format(ip=adx, data=ip.id)))
|
||||
valid = False
|
||||
return
|
||||
else:
|
||||
QtWidgets.QMessageBox.warning(self,
|
||||
translate('OpenLP.ProjectorWizard', 'Invalid IP Address'),
|
||||
translate('OpenLP.ProjectorWizard',
|
||||
'IP address "%s"<br>is not a valid IP address.'
|
||||
'<br /><br />Please enter a valid IP address.' % adx))
|
||||
'IP address "{ip}"<br>is not a valid IP address.'
|
||||
'<br /><br />Please enter a valid IP address.'.format(ip=adx)))
|
||||
valid = False
|
||||
return
|
||||
port = int(self.port_text.text())
|
||||
@ -219,8 +220,8 @@ class ProjectorEditForm(QDialog, Ui_ProjectorEditForm):
|
||||
'Port numbers below 1000 are reserved for admin use only, '
|
||||
'<br />and port numbers above 32767 are not currently usable.'
|
||||
'<br /><br />Please enter a valid port number between '
|
||||
' 1000 and 32767.'
|
||||
'<br /><br />Default PJLink port is %s' % PJLINK_PORT))
|
||||
'1000 and 32767.<br /><br />'
|
||||
'Default PJLink port is {port}'.format(port=PJLINK_PORT)))
|
||||
valid = False
|
||||
if valid:
|
||||
self.projector.ip = self.ip_text.text()
|
||||
|
@ -344,7 +344,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
real_projector = item.data(QtCore.Qt.UserRole)
|
||||
projector_name = str(item.text())
|
||||
visible = real_projector.link.status_connect >= S_CONNECTED
|
||||
log.debug('(%s) Building menu - visible = %s' % (projector_name, visible))
|
||||
log.debug('({name}) Building menu - visible = {visible}'.format(name=projector_name, visible=visible))
|
||||
self.delete_action.setVisible(True)
|
||||
self.edit_action.setVisible(True)
|
||||
self.connect_action.setVisible(not visible)
|
||||
@ -394,7 +394,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
projectordb=self.projectordb,
|
||||
edit=edit)
|
||||
source = source_select_form.exec(projector.link)
|
||||
log.debug('(%s) source_select_form() returned %s' % (projector.link.ip, source))
|
||||
log.debug('({ip}) source_select_form() returned {data}'.format(ip=projector.link.ip, data=source))
|
||||
if source is not None and source > 0:
|
||||
projector.link.set_input_source(str(source))
|
||||
return
|
||||
@ -473,8 +473,9 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
return
|
||||
projector = list_item.data(QtCore.Qt.UserRole)
|
||||
msg = QtWidgets.QMessageBox()
|
||||
msg.setText(translate('OpenLP.ProjectorManager', 'Delete projector (%s) %s?') % (projector.link.ip,
|
||||
projector.link.name))
|
||||
msg.setText(translate('OpenLP.ProjectorManager',
|
||||
'Delete projector ({ip}) {name}?'.format(ip=projector.link.ip,
|
||||
name=projector.link.name)))
|
||||
msg.setInformativeText(translate('OpenLP.ProjectorManager', 'Are you sure you want to delete this projector?'))
|
||||
msg.setStandardButtons(msg.Cancel | msg.Ok)
|
||||
msg.setDefaultButton(msg.Cancel)
|
||||
@ -522,7 +523,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
list_item = None
|
||||
deleted = self.projectordb.delete_projector(projector.db_item)
|
||||
for item in self.projector_list:
|
||||
log.debug('New projector list - item: %s %s' % (item.link.ip, item.link.name))
|
||||
log.debug('New projector list - item: {ip} {name}'.format(ip=item.link.ip, name=item.link.name))
|
||||
|
||||
def on_disconnect_projector(self, opt=None):
|
||||
"""
|
||||
@ -627,53 +628,58 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
"""
|
||||
lwi = self.projector_list_widget.item(self.projector_list_widget.currentRow())
|
||||
projector = lwi.data(QtCore.Qt.UserRole)
|
||||
message = '<b>%s</b>: %s<BR />' % (translate('OpenLP.ProjectorManager', 'Name'),
|
||||
projector.link.name)
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'IP'),
|
||||
projector.link.ip)
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'Port'),
|
||||
projector.link.port)
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'Notes'),
|
||||
projector.link.notes)
|
||||
message = '%s<hr /><br >' % message
|
||||
message = '<b>{title}</b>: {data}<BR />'.format(title=translate('OpenLP.ProjectorManager', 'Name'),
|
||||
data=projector.link.name)
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'IP'),
|
||||
data=projector.link.ip)
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Port'),
|
||||
data=projector.link.port)
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Notes'),
|
||||
data=projector.link.notes)
|
||||
message += '<hr /><br >'
|
||||
if projector.link.manufacturer is None:
|
||||
message = '%s%s' % (message, translate('OpenLP.ProjectorManager',
|
||||
'Projector information not available at this time.'))
|
||||
message += translate('OpenLP.ProjectorManager', 'Projector information not available at this time.')
|
||||
else:
|
||||
message = '%s<b>%s</b>: %s<BR />' % (message, translate('OpenLP.ProjectorManager', 'Projector Name'),
|
||||
projector.link.pjlink_name)
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'Manufacturer'),
|
||||
projector.link.manufacturer)
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'Model'),
|
||||
projector.link.model)
|
||||
message = '%s<b>%s</b>: %s<br /><br />' % (message, translate('OpenLP.ProjectorManager', 'Other info'),
|
||||
projector.link.other_info)
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'Power status'),
|
||||
ERROR_MSG[projector.link.power])
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, translate('OpenLP.ProjectorManager', 'Shutter is'),
|
||||
translate('OpenLP.ProjectorManager', 'Closed')
|
||||
if projector.link.shutter else translate('OpenLP', 'Open'))
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager',
|
||||
'Projector Name'),
|
||||
data=projector.link.pjlink_name)
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Manufacturer'),
|
||||
data=projector.link.manufacturer)
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Model'),
|
||||
data=projector.link.model)
|
||||
message += '<b>{title}</b>: {data}<br /><br />'.format(title=translate('OpenLP.ProjectorManager',
|
||||
'Other info'),
|
||||
data=projector.link.other_info)
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Power status'),
|
||||
data=ERROR_MSG[projector.link.power])
|
||||
message += '<b>{title}</b>: {data}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Shutter is'),
|
||||
data=translate('OpenLP.ProjectorManager', 'Closed')
|
||||
if projector.link.shutter
|
||||
else translate('OpenLP', 'Open'))
|
||||
message = '%s<b>%s</b>: %s<br />' % (message,
|
||||
translate('OpenLP.ProjectorManager', 'Current source input is'),
|
||||
projector.link.source)
|
||||
count = 1
|
||||
for item in projector.link.lamp:
|
||||
message = '%s <b>%s %s</b> (%s) %s: %s<br />' % (message,
|
||||
translate('OpenLP.ProjectorManager', 'Lamp'),
|
||||
count,
|
||||
translate('OpenLP.ProjectorManager', 'On')
|
||||
if item['On']
|
||||
else translate('OpenLP.ProjectorManager', 'Off'),
|
||||
translate('OpenLP.ProjectorManager', 'Hours'),
|
||||
item['Hours'])
|
||||
count = count + 1
|
||||
message = '%s<hr /><br />' % message
|
||||
message += '<b>{title} {count}</b> {status} '.format(title=translate('OpenLP.ProjectorManager',
|
||||
'Lamp'),
|
||||
count=count,
|
||||
status=translate('OpenLP.ProjectorManager',
|
||||
' is on')
|
||||
if item['On']
|
||||
else translate('OpenLP.ProjectorManager',
|
||||
'is off'))
|
||||
|
||||
message += '<b>{title}</b>: {hours}<br />'.format(title=translate('OpenLP.ProjectorManager', 'Hours'),
|
||||
hours=item['Hours'])
|
||||
count += 1
|
||||
message += '<hr /><br />'
|
||||
if projector.link.projector_errors is None:
|
||||
message = '%s%s' % (message, translate('OpenLP.ProjectorManager', 'No current errors or warnings'))
|
||||
message += translate('OpenLP.ProjectorManager', 'No current errors or warnings')
|
||||
else:
|
||||
message = '%s<b>%s</b>' % (message, translate('OpenLP.ProjectorManager', 'Current errors/warnings'))
|
||||
message += '<b>{data}</b>'.format(data=translate('OpenLP.ProjectorManager', 'Current errors/warnings'))
|
||||
for (key, val) in projector.link.projector_errors.items():
|
||||
message = '%s<b>%s</b>: %s<br />' % (message, key, ERROR_MSG[val])
|
||||
message += '<b>{key}</b>: {data}<br />'.format(key=key, data=ERROR_MSG[val])
|
||||
QtWidgets.QMessageBox.information(self, translate('OpenLP.ProjectorManager', 'Projector Information'), message)
|
||||
|
||||
def _add_projector(self, projector):
|
||||
@ -743,7 +749,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
if start:
|
||||
item.link.connect_to_host()
|
||||
for item in self.projector_list:
|
||||
log.debug('New projector list - item: (%s) %s' % (item.link.ip, item.link.name))
|
||||
log.debug('New projector list - item: ({ip}) {name}'.format(ip=item.link.ip, name=item.link.name))
|
||||
|
||||
@pyqtSlot(str)
|
||||
def add_projector_from_wizard(self, ip, opts=None):
|
||||
@ -753,7 +759,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
:param ip: IP address of new record item to find
|
||||
:param opts: Needed by PyQt5
|
||||
"""
|
||||
log.debug('add_projector_from_wizard(ip=%s)' % ip)
|
||||
log.debug('add_projector_from_wizard(ip={ip})'.format(ip=ip))
|
||||
item = self.projectordb.get_projector_by_ip(ip)
|
||||
self.add_projector(item)
|
||||
|
||||
@ -764,7 +770,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
|
||||
:param projector: Projector() instance of projector with updated information
|
||||
"""
|
||||
log.debug('edit_projector_from_wizard(ip=%s)' % projector.ip)
|
||||
log.debug('edit_projector_from_wizard(ip={ip})'.format(ip=projector.ip))
|
||||
self.old_projector.link.name = projector.name
|
||||
self.old_projector.link.ip = projector.ip
|
||||
self.old_projector.link.pin = None if projector.pin == '' else projector.pin
|
||||
@ -816,7 +822,9 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
else:
|
||||
status_code = status
|
||||
message = ERROR_MSG[status] if msg is None else msg
|
||||
log.debug('(%s) updateStatus(status=%s) message: "%s"' % (item.link.name, status_code, message))
|
||||
log.debug('({name}) updateStatus(status={status}) message: "{message}"'.format(name=item.link.name,
|
||||
status=status_code,
|
||||
message=message))
|
||||
if status in STATUS_ICONS:
|
||||
if item.status == status:
|
||||
return
|
||||
@ -826,14 +834,14 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
status_code = ERROR_STRING[status]
|
||||
elif status in STATUS_STRING:
|
||||
status_code = STATUS_STRING[status]
|
||||
log.debug('(%s) Updating icon with %s' % (item.link.name, status_code))
|
||||
log.debug('({name}) Updating icon with {code}'.format(name=item.link.name, code=status_code))
|
||||
item.widget.setIcon(item.icon)
|
||||
self.update_icons()
|
||||
|
||||
def get_toolbar_item(self, name, enabled=False, hidden=False):
|
||||
item = self.one_toolbar.findChild(QtWidgets.QAction, name)
|
||||
if item == 0:
|
||||
log.debug('No item found with name "%s"' % name)
|
||||
log.debug('No item found with name "{name}"'.format(name=name))
|
||||
return
|
||||
item.setVisible(False if hidden else True)
|
||||
item.setEnabled(True if enabled else False)
|
||||
@ -918,11 +926,13 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
|
||||
:param name: Name from QListWidgetItem
|
||||
"""
|
||||
QtWidgets.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
|
||||
'"%s" Authentication Error' % name),
|
||||
# Build the title separately so we can make it easier for translators
|
||||
title = '"{name}" '.format(name=name)
|
||||
title += translate('OpenLP.ProjectorManager', 'Authentication Error')
|
||||
QtWidgets.QMessageBox.warning(self, title,
|
||||
'<br />There was an authentication error while trying to connect.'
|
||||
'<br /><br />Please verify your PIN setting '
|
||||
'for projector item "%s"' % name)
|
||||
'for projector item "{name}"'.format(name=name))
|
||||
|
||||
@pyqtSlot(str)
|
||||
def no_authentication_error(self, name):
|
||||
@ -932,11 +942,13 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QWidget, Ui_ProjectorManager,
|
||||
|
||||
:param name: Name from QListWidgetItem
|
||||
"""
|
||||
QtWidgets.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
|
||||
'"%s" No Authentication Error' % name),
|
||||
# Build the title separately so we can make it easier for translators
|
||||
title = '"{name}" '.format(name=name)
|
||||
title += translate('OpenLP.ProjectorManager', 'No Authentication Error')
|
||||
QtWidgets.QMessageBox.warning(self, title,
|
||||
'<br />PIN is set and projector does not require authentication.'
|
||||
'<br /><br />Please verify your PIN setting '
|
||||
'for projector item "%s"' % name)
|
||||
'for projector item "{name}"'.format(name=name))
|
||||
|
||||
|
||||
class ProjectorItem(QObject):
|
||||
@ -972,5 +984,5 @@ def not_implemented(function):
|
||||
QtWidgets.QMessageBox.information(None,
|
||||
translate('OpenLP.ProjectorManager', 'Not Implemented Yet'),
|
||||
translate('OpenLP.ProjectorManager',
|
||||
'Function "%s"<br />has not been implemented yet.'
|
||||
'<br />Please check back again later.' % function))
|
||||
'Function "{function}"<br />has not been implemented yet.'
|
||||
'<br />Please check back again later.'.format(function=function)))
|
||||
|
@ -115,7 +115,7 @@ def Build_Tab(group, source_key, default, projector, projectordb, edit=False):
|
||||
if edit:
|
||||
for key in sourcelist:
|
||||
item = QLineEdit()
|
||||
item.setObjectName('source_key_%s' % key)
|
||||
item.setObjectName('source_key_{key}'.format(key=key))
|
||||
source_item = projectordb.get_source_by_code(code=key, projector_id=projector.db_item.id)
|
||||
if source_item is None:
|
||||
item.setText(PJLINK_DEFAULT_CODES[key])
|
||||
@ -161,7 +161,7 @@ def set_button_tooltip(bar):
|
||||
button.setToolTip(translate('OpenLP.SourceSelectForm',
|
||||
'Save changes and return to OpenLP'))
|
||||
else:
|
||||
log.debug('No tooltip for button {}'.format(button.text()))
|
||||
log.debug('No tooltip for button {text}'.format(text=button.text()))
|
||||
|
||||
|
||||
class FingerTabBarWidget(QTabBar):
|
||||
@ -359,16 +359,20 @@ class SourceSelectTabs(QDialog):
|
||||
continue
|
||||
item = self.projectordb.get_source_by_code(code=code, projector_id=projector.id)
|
||||
if item is None:
|
||||
log.debug("(%s) Adding new source text %s: %s" % (projector.ip, code, text))
|
||||
log.debug("({ip}) Adding new source text {code}: {text}".format(ip=projector.ip,
|
||||
code=code,
|
||||
text=text))
|
||||
item = ProjectorSource(projector_id=projector.id, code=code, text=text)
|
||||
else:
|
||||
item.text = text
|
||||
log.debug('(%s) Updating source code %s with text="%s"' % (projector.ip, item.code, item.text))
|
||||
log.debug('({ip}) Updating source code {code} with text="{text}"'.format(ip=projector.ip,
|
||||
code=item.code,
|
||||
text=item.text))
|
||||
self.projectordb.add_source(item)
|
||||
selected = 0
|
||||
else:
|
||||
selected = self.button_group.checkedId()
|
||||
log.debug('SourceSelectTabs().accepted() Setting source to %s' % selected)
|
||||
log.debug('SourceSelectTabs().accepted() Setting source to {selected}'.format(selected=selected))
|
||||
self.done(selected)
|
||||
|
||||
|
||||
@ -417,7 +421,7 @@ class SourceSelectSingle(QDialog):
|
||||
if self.edit:
|
||||
for key in keys:
|
||||
item = QLineEdit()
|
||||
item.setObjectName('source_key_%s' % key)
|
||||
item.setObjectName('source_key_{key}'.format(key=key))
|
||||
source_item = self.projectordb.get_source_by_code(code=key, projector_id=self.projector.db_item.id)
|
||||
if source_item is None:
|
||||
item.setText(PJLINK_DEFAULT_CODES[key])
|
||||
@ -498,14 +502,18 @@ class SourceSelectSingle(QDialog):
|
||||
continue
|
||||
item = self.projectordb.get_source_by_code(code=code, projector_id=projector.id)
|
||||
if item is None:
|
||||
log.debug("(%s) Adding new source text %s: %s" % (projector.ip, code, text))
|
||||
log.debug("({ip}) Adding new source text {code}: {text}".format(ip=projector.ip,
|
||||
code=code,
|
||||
text=text))
|
||||
item = ProjectorSource(projector_id=projector.id, code=code, text=text)
|
||||
else:
|
||||
item.text = text
|
||||
log.debug('(%s) Updating source code %s with text="%s"' % (projector.ip, item.code, item.text))
|
||||
log.debug('({ip}) Updating source code {code} with text="{text}"'.format(ip=projector.ip,
|
||||
code=item.code,
|
||||
text=item.text))
|
||||
self.projectordb.add_source(item)
|
||||
selected = 0
|
||||
else:
|
||||
selected = self.button_group.checkedId()
|
||||
log.debug('SourceSelectDialog().accepted() Setting source to %s' % selected)
|
||||
log.debug('SourceSelectDialog().accepted() Setting source to {selected}'.format(selected=selected))
|
||||
self.done(selected)
|
||||
|
Loading…
Reference in New Issue
Block a user