forked from openlp/openlp
Docstrings cleanup
This commit is contained in:
parent
d8f94ac3df
commit
10c415cf1a
@ -27,7 +27,9 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`projector` module
|
||||
:mod:`openlp.core.lib.projector.constants` module
|
||||
|
||||
Provides the constants used for projector errors/status/defaults
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
@ -27,8 +27,18 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`projector.db` module provides the database functions for the
|
||||
Projector module.
|
||||
:mod:`openlp.core.lib.projector.db` module
|
||||
|
||||
Provides the database functions for the Projector module.
|
||||
|
||||
The Manufacturer, Model, Source tables keep track of the video source
|
||||
strings used for display of input sources. The Source table maps
|
||||
manufacturer-defined or user-defined strings from PJLink default strings
|
||||
to end-user readable strings; ex: PJLink code 11 would map "RGB 1"
|
||||
default string to "RGB PC (analog)" string.
|
||||
(Future feature).
|
||||
|
||||
The Projector table keeps track of entries for controlled projectors.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -37,12 +47,10 @@ log.debug('projector.lib.db module loaded')
|
||||
|
||||
from os import path
|
||||
|
||||
from sqlalchemy import Column, ForeignKey, Integer, MetaData, String, and_
|
||||
from sqlalchemy import Column, ForeignKey, Integer, MetaData, String
|
||||
from sqlalchemy.ext.declarative import declarative_base, declared_attr
|
||||
from sqlalchemy.orm import backref, relationship
|
||||
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
||||
|
||||
from openlp.core.common import translate
|
||||
from openlp.core.lib.db import Manager, init_db, init_url
|
||||
from openlp.core.lib.projector.constants import PJLINK_DEFAULT_SOURCES
|
||||
|
||||
@ -57,16 +65,26 @@ class CommonBase(object):
|
||||
@declared_attr
|
||||
def __tablename__(cls):
|
||||
return cls.__name__.lower()
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
|
||||
|
||||
class Manufacturer(CommonBase, Base):
|
||||
"""
|
||||
Manufacturer table.
|
||||
Projector manufacturer table.
|
||||
|
||||
Manufacturer:
|
||||
name: Column(String(30))
|
||||
models: Relationship(Model.id)
|
||||
|
||||
Model table is related.
|
||||
"""
|
||||
def __repr__(self):
|
||||
"""
|
||||
Returns a basic representation of a Manufacturer table entry.
|
||||
"""
|
||||
return '<Manufacturer(name="%s")>' % self.name
|
||||
|
||||
name = Column(String(30))
|
||||
models = relationship('Model',
|
||||
order_by='Model.name',
|
||||
@ -78,12 +96,22 @@ class Manufacturer(CommonBase, Base):
|
||||
|
||||
class Model(CommonBase, Base):
|
||||
"""
|
||||
Model table.
|
||||
Projector model table.
|
||||
|
||||
Model:
|
||||
name: Column(String(20))
|
||||
sources: Relationship(Source.id)
|
||||
manufacturer_id: Foreign_key(Manufacturer.id)
|
||||
|
||||
Manufacturer table links here.
|
||||
Source table is related.
|
||||
"""
|
||||
def __repr__(self):
|
||||
"""
|
||||
Returns a basic representation of a Model table entry.
|
||||
"""
|
||||
return '<Model(name=%s)>' % self.name
|
||||
|
||||
manufacturer_id = Column(Integer, ForeignKey('manufacturer.id'))
|
||||
name = Column(String(20))
|
||||
sources = relationship('Source',
|
||||
@ -96,12 +124,22 @@ class Model(CommonBase, Base):
|
||||
|
||||
class Source(CommonBase, Base):
|
||||
"""
|
||||
Input source table.
|
||||
Projector video source table.
|
||||
|
||||
Source:
|
||||
pjlink_name: Column(String(15))
|
||||
pjlink_code: Column(String(2))
|
||||
text: Column(String(30))
|
||||
model_id: Foreign_key(Model.id)
|
||||
|
||||
Model table links here.
|
||||
|
||||
These entries map PJLink source codes to text strings.
|
||||
These entries map PJLink input video source codes to text strings.
|
||||
"""
|
||||
def __repr__(self):
|
||||
"""
|
||||
Return basic representation of Source table entry.
|
||||
"""
|
||||
return '<Source(pjlink_name="%s", pjlink_code="%s", text="%s")>' % \
|
||||
(self.pjlink_name, self.pjlink_code, self.text)
|
||||
model_id = Column(Integer, ForeignKey('model.id'))
|
||||
@ -114,7 +152,18 @@ class Projector(CommonBase, Base):
|
||||
"""
|
||||
Projector table.
|
||||
|
||||
No relation. This keeps track of installed projectors.
|
||||
Projector:
|
||||
ip: Column(String(100)) # Allow for IPv6 or FQDN
|
||||
port: Column(String(8))
|
||||
pin: Column(String(20)) # Allow for test strings
|
||||
name: Column(String(20))
|
||||
location: Column(String(30))
|
||||
notes: Column(String(200))
|
||||
pjlink_name: Column(String(128)) # From projector (future)
|
||||
manufacturer: Column(String(128)) # From projector (future)
|
||||
model: Column(String(128)) # From projector (future)
|
||||
other: Column(String(128)) # From projector (future)
|
||||
sources: Column(String(128)) # From projector (future)
|
||||
"""
|
||||
ip = Column(String(100))
|
||||
port = Column(String(8))
|
||||
@ -143,7 +192,7 @@ class ProjectorDB(Manager):
|
||||
"""
|
||||
Setup the projector database and initialize the schema.
|
||||
|
||||
Change to Declarative means we really don't do much here.
|
||||
Declarative uses table classes to define schema.
|
||||
"""
|
||||
url = init_url('projector')
|
||||
session, metadata = init_db(url, base=Base)
|
||||
@ -154,7 +203,7 @@ class ProjectorDB(Manager):
|
||||
"""
|
||||
Locate a DB record by record ID.
|
||||
|
||||
:param dbid: DB record
|
||||
:param dbid: DB record id
|
||||
:returns: Projector() instance
|
||||
"""
|
||||
log.debug('get_projector_by_id(id="%s")' % dbid)
|
||||
@ -168,8 +217,9 @@ class ProjectorDB(Manager):
|
||||
|
||||
def get_projector_all(self):
|
||||
"""
|
||||
Retrieve all projector entries so they can be added to the Projector
|
||||
Manager list pane.
|
||||
Retrieve all projector entries.
|
||||
|
||||
:returns: List with Projector() instances used in Manager() QListWidget.
|
||||
"""
|
||||
log.debug('get_all() called')
|
||||
return_list = []
|
||||
@ -217,10 +267,10 @@ class ProjectorDB(Manager):
|
||||
"""
|
||||
Add a new projector entry
|
||||
|
||||
NOTE: Will not add new entry if IP is the same as already in the table.
|
||||
|
||||
:param projector: Projector() instance to add
|
||||
:returns: bool
|
||||
True if entry added
|
||||
False if entry already in DB or db error
|
||||
"""
|
||||
old_projector = self.get_object_filtered(Projector, Projector.ip == projector.ip)
|
||||
if old_projector is not None:
|
||||
@ -239,6 +289,8 @@ class ProjectorDB(Manager):
|
||||
|
||||
:param projector: Projector() instance with new information
|
||||
:returns: bool
|
||||
True if DB record updated
|
||||
False if entry not in DB or DB error
|
||||
"""
|
||||
if projector is None:
|
||||
log.error('No Projector() instance to update - cancelled')
|
||||
@ -266,6 +318,8 @@ class ProjectorDB(Manager):
|
||||
|
||||
:param projector: Projector() instance to delete
|
||||
:returns: bool
|
||||
True if record deleted
|
||||
False if DB error
|
||||
"""
|
||||
deleted = self.delete_object(Projector, projector.id)
|
||||
if deleted:
|
||||
@ -282,7 +336,10 @@ class ProjectorDB(Manager):
|
||||
|
||||
:param make: Manufacturer name as retrieved from projector
|
||||
:param model: Manufacturer model as retrieved from projector
|
||||
:param sources: List of available sources (from projector)
|
||||
:returns: dict
|
||||
key: (str) PJLink code for source
|
||||
value: (str) From Sources table or default PJLink strings
|
||||
"""
|
||||
source_dict = {}
|
||||
model_list = self.get_all_objects(Model, Model.name == model)
|
||||
|
@ -27,19 +27,19 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`projector.pjlink1` module provides the necessary functions
|
||||
for connecting to a PJLink-capable projector.
|
||||
:mod:`openlp.core.lib.projector.pjlink1` module
|
||||
Provides the necessary functions for connecting to a PJLink-capable projector.
|
||||
|
||||
See PJLink Specifications for Class 1 for details.
|
||||
See PJLink Class 1 Specifications for details.
|
||||
http://pjlink.jbmia.or.jp/english/dl.html
|
||||
Section 5-1 PJLink Specifications
|
||||
Section 5-5 Guidelines for Input Terminals
|
||||
|
||||
NOTE:
|
||||
Function names follow the following syntax:
|
||||
def process_CCCC(...):
|
||||
WHERE:
|
||||
CCCC = PJLink command being processed.
|
||||
|
||||
See PJLINK_FUNC(...) for command returned from projector.
|
||||
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -49,11 +49,10 @@ log.debug('rpjlink1 loaded')
|
||||
|
||||
__all__ = ['PJLink1']
|
||||
|
||||
from time import sleep
|
||||
from codecs import decode, encode
|
||||
from codecs import decode
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4.QtCore import QObject, pyqtSignal, pyqtSlot
|
||||
from PyQt4.QtCore import pyqtSignal, pyqtSlot
|
||||
from PyQt4.QtNetwork import QAbstractSocket, QTcpSocket
|
||||
|
||||
from openlp.core.common import translate, qmd5_hash
|
||||
@ -73,6 +72,7 @@ class PJLink1(QTcpSocket):
|
||||
"""
|
||||
Socket service for connecting to a PJLink-capable projector.
|
||||
"""
|
||||
# Signals sent by this module
|
||||
changeStatus = pyqtSignal(str, int, str)
|
||||
projectorNetwork = pyqtSignal(int) # Projector network activity
|
||||
projectorStatus = pyqtSignal(int) # Status update
|
||||
@ -151,7 +151,7 @@ class PJLink1(QTcpSocket):
|
||||
self.send_queue = []
|
||||
self.send_busy = False
|
||||
self.socket_timer = None # Test for send_busy and brain-dead projectors
|
||||
# Map command returned to function
|
||||
# Map command to function
|
||||
self.PJLINK1_FUNC = {'AVMT': self.process_avmt,
|
||||
'CLSS': self.process_clss,
|
||||
'ERST': self.process_erst,
|
||||
@ -167,6 +167,9 @@ class PJLink1(QTcpSocket):
|
||||
}
|
||||
|
||||
def reset_information(self):
|
||||
"""
|
||||
Reset projector-specific information to default
|
||||
"""
|
||||
log.debug('(%s) reset_information() connect status is %s' % (self.ip, self.state()))
|
||||
self.power = S_OFF
|
||||
self.pjlink_name = None
|
||||
@ -224,14 +227,15 @@ class PJLink1(QTcpSocket):
|
||||
def socket_abort(self):
|
||||
"""
|
||||
Aborts connection and closes socket in case of brain-dead projectors.
|
||||
Should normally be called by socket_timer().
|
||||
"""
|
||||
log.debug('(%s) socket_abort() - Killing connection' % self.ip)
|
||||
self.disconnect_from_host(abort=True)
|
||||
|
||||
def poll_loop(self):
|
||||
"""
|
||||
Called by QTimer in ProjectorManager.ProjectorItem.
|
||||
Retrieves status information.
|
||||
Retrieve information from projector that changes.
|
||||
Normally called by timer().
|
||||
"""
|
||||
if self.state() != self.ConnectedState:
|
||||
return
|
||||
@ -260,8 +264,10 @@ class PJLink1(QTcpSocket):
|
||||
def _get_status(self, status):
|
||||
"""
|
||||
Helper to retrieve status/error codes and convert to strings.
|
||||
|
||||
:param status: Status/Error code
|
||||
:returns: (Status/Error code, String)
|
||||
"""
|
||||
# Return the status code as a string
|
||||
if status in ERROR_STRING:
|
||||
return (ERROR_STRING[status], ERROR_MSG[status])
|
||||
elif status in STATUS_STRING:
|
||||
@ -273,6 +279,9 @@ class PJLink1(QTcpSocket):
|
||||
"""
|
||||
Check connection/error status, set status for projector, then emit status change signal
|
||||
for gui to allow changing the icons.
|
||||
|
||||
:param status: Status code
|
||||
:param msg: Optional message
|
||||
"""
|
||||
message = translate('OpenLP.PJLink1', 'No message') if msg is None else msg
|
||||
(code, message) = self._get_status(status)
|
||||
@ -298,6 +307,11 @@ class PJLink1(QTcpSocket):
|
||||
def check_command(self, cmd):
|
||||
"""
|
||||
Verifies command is valid based on PJLink class.
|
||||
|
||||
:param cmd: PJLink command to validate.
|
||||
:returns: bool
|
||||
True if command is valid PJLink command
|
||||
False if command is not a valid PJLink command
|
||||
"""
|
||||
return self.pjlink_class in PJLINK_VALID_CMD and \
|
||||
cmd in PJLINK_VALID_CMD[self.pjlink_class]
|
||||
@ -306,6 +320,9 @@ class PJLink1(QTcpSocket):
|
||||
def check_login(self, data=None):
|
||||
"""
|
||||
Processes the initial connection and authentication (if needed).
|
||||
Starts poll timer if connection is established.
|
||||
|
||||
:param data: Optional data if called from another routine
|
||||
"""
|
||||
log.debug('(%s) check_login(data="%s")' % (self.ip, data))
|
||||
if data is None:
|
||||
@ -426,7 +443,10 @@ class PJLink1(QTcpSocket):
|
||||
@pyqtSlot(int)
|
||||
def get_error(self, err):
|
||||
"""
|
||||
Process error from SocketError signal
|
||||
Process error from SocketError signal.
|
||||
Remaps system error codes to projector error codes.
|
||||
|
||||
:param err: Error code
|
||||
"""
|
||||
log.debug('(%s) get_error(err=%s): %s' % (self.ip, err, self.errorString()))
|
||||
if err <= 18:
|
||||
@ -449,7 +469,12 @@ class PJLink1(QTcpSocket):
|
||||
|
||||
def send_command(self, cmd, opts='?', salt=None, queue=False):
|
||||
"""
|
||||
Add command to output queue if not already in queue
|
||||
Add command to output queue if not already in queue.
|
||||
|
||||
:param cmd: Command to send
|
||||
:param opts: Optional command option - defaults to '?' (get information)
|
||||
:param salt: Optional salt for md5 hash for initial authentication
|
||||
:param queue: Option to force add to queue rather than sending directly
|
||||
"""
|
||||
if self.state() != self.ConnectedState:
|
||||
log.warn('(%s) send_command(): Not connected - returning' % self.ip)
|
||||
@ -484,7 +509,6 @@ class PJLink1(QTcpSocket):
|
||||
Socket interface to send data. If data=None, then check queue.
|
||||
|
||||
:param data: Immediate data to send
|
||||
:returns: None
|
||||
"""
|
||||
log.debug('(%s) _send_string()' % self.ip)
|
||||
log.debug('(%s) _send_string(): Connection status: %s' % (self.ip, self.state()))
|
||||
@ -526,6 +550,9 @@ class PJLink1(QTcpSocket):
|
||||
def process_command(self, cmd, data):
|
||||
"""
|
||||
Verifies any return error code. Calls the appropriate command handler.
|
||||
|
||||
:param cmd: Command to process
|
||||
:param data: Data being processed
|
||||
"""
|
||||
log.debug('(%s) Processing command "%s"' % (self.ip, cmd))
|
||||
if data in PJLINK_ERRORS:
|
||||
@ -575,6 +602,10 @@ class PJLink1(QTcpSocket):
|
||||
def process_lamp(self, data):
|
||||
"""
|
||||
Lamp(s) status. See PJLink Specifications for format.
|
||||
Data may have more than 1 lamp to process.
|
||||
Update self.lamp dictionary with lamp status.
|
||||
|
||||
:param data: Lamp(s) status.
|
||||
"""
|
||||
lamps = []
|
||||
data_dict = data.split()
|
||||
@ -594,6 +625,9 @@ class PJLink1(QTcpSocket):
|
||||
def process_powr(self, data):
|
||||
"""
|
||||
Power status. See PJLink specification for format.
|
||||
Update self.power with status. Update icons if change from previous setting.
|
||||
|
||||
:param data: Power status
|
||||
"""
|
||||
if data in PJLINK_POWR_STATUS:
|
||||
power = PJLINK_POWR_STATUS[data]
|
||||
@ -612,7 +646,10 @@ class PJLink1(QTcpSocket):
|
||||
|
||||
def process_avmt(self, data):
|
||||
"""
|
||||
Shutter open/closed. See PJLink specification for format.
|
||||
Process shutter and speaker status. See PJLink specification for format.
|
||||
Update self.mute (audio) and self.shutter (video shutter).
|
||||
|
||||
:param data: Shutter and audio status
|
||||
"""
|
||||
shutter = self.shutter
|
||||
mute = self.mute
|
||||
@ -641,6 +678,9 @@ class PJLink1(QTcpSocket):
|
||||
def process_inpt(self, data):
|
||||
"""
|
||||
Current source input selected. See PJLink specification for format.
|
||||
Update self.source
|
||||
|
||||
:param data: Currently selected source
|
||||
"""
|
||||
self.source = data
|
||||
return
|
||||
@ -648,6 +688,9 @@ class PJLink1(QTcpSocket):
|
||||
def process_clss(self, data):
|
||||
"""
|
||||
PJLink class that this projector supports. See PJLink specification for format.
|
||||
Updates self.class.
|
||||
|
||||
:param data: Class that projector supports.
|
||||
"""
|
||||
self.pjlink_class = data
|
||||
log.debug('(%s) Setting pjlink_class for this projector to "%s"' % (self.ip, self.pjlink_class))
|
||||
@ -655,28 +698,40 @@ class PJLink1(QTcpSocket):
|
||||
|
||||
def process_name(self, data):
|
||||
"""
|
||||
Projector name set by customer.
|
||||
Projector name set in projector.
|
||||
Updates self.pjlink_name
|
||||
|
||||
:param data: Projector name
|
||||
"""
|
||||
self.pjlink_name = data
|
||||
return
|
||||
|
||||
def process_inf1(self, data):
|
||||
"""
|
||||
Manufacturer name set by manufacturer.
|
||||
Manufacturer name set in projector.
|
||||
Updates self.manufacturer
|
||||
|
||||
:param data: Projector manufacturer
|
||||
"""
|
||||
self.manufacturer = data
|
||||
return
|
||||
|
||||
def process_inf2(self, data):
|
||||
"""
|
||||
Projector Model set by manufacturer.
|
||||
Projector Model set in projector.
|
||||
Updates self.model.
|
||||
|
||||
:param data: Model name
|
||||
"""
|
||||
self.model = data
|
||||
return
|
||||
|
||||
def process_info(self, data):
|
||||
"""
|
||||
Any extra info set by manufacturer.
|
||||
Any extra info set in projector.
|
||||
Updates self.other_info.
|
||||
|
||||
:param data: Projector other info
|
||||
"""
|
||||
self.other_info = data
|
||||
return
|
||||
@ -684,6 +739,9 @@ class PJLink1(QTcpSocket):
|
||||
def process_inst(self, data):
|
||||
"""
|
||||
Available source inputs. See PJLink specification for format.
|
||||
Updates self.source_available
|
||||
|
||||
:param data: Sources list
|
||||
"""
|
||||
sources = []
|
||||
check = data.split()
|
||||
@ -696,6 +754,9 @@ class PJLink1(QTcpSocket):
|
||||
def process_erst(self, data):
|
||||
"""
|
||||
Error status. See PJLink Specifications for format.
|
||||
Updates self.projector_errors
|
||||
|
||||
:param data: Error status
|
||||
"""
|
||||
try:
|
||||
datacheck = int(data)
|
||||
@ -734,7 +795,7 @@ class PJLink1(QTcpSocket):
|
||||
|
||||
def connect_to_host(self):
|
||||
"""
|
||||
Initiate connection.
|
||||
Initiate connection to projector.
|
||||
"""
|
||||
if self.state() == self.ConnectedState:
|
||||
log.warn('(%s) connect_to_host(): Already connected - returning' % self.ip)
|
||||
@ -832,6 +893,8 @@ class PJLink1(QTcpSocket):
|
||||
"""
|
||||
Verify input source available as listed in 'INST' command,
|
||||
then send the command to select the input source.
|
||||
|
||||
:param src: Video source to select in projector
|
||||
"""
|
||||
if self.source_available is None:
|
||||
return
|
||||
|
@ -28,8 +28,9 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod: `editform` module provides the functions for adding/editing the
|
||||
list of controlled projectors.
|
||||
:mod: `openlp.core.ui.projector.editform` module
|
||||
|
||||
Provides the functions for adding/editing entries in the projector database.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
@ -27,8 +27,9 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod: projectormanager` module provides the functions for
|
||||
the display/control of Projectors.
|
||||
:mod: openlp.core.ui.projector.manager` module
|
||||
|
||||
Provides the functions for the display/control of Projectors.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -232,6 +233,12 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Manage the projectors.
|
||||
"""
|
||||
def __init__(self, parent=None, projectordb=None):
|
||||
"""
|
||||
Basic initialization.
|
||||
|
||||
:param parent: Who I belong to.
|
||||
:param projectordb: Database session inherited from superclass.
|
||||
"""
|
||||
log.debug('__init__()')
|
||||
super().__init__(parent)
|
||||
self.settings_section = 'projector'
|
||||
@ -239,6 +246,9 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
self.projector_list = []
|
||||
|
||||
def bootstrap_initialise(self):
|
||||
"""
|
||||
Pre-initialize setups.
|
||||
"""
|
||||
self.setup_ui(self)
|
||||
if self.projectordb is None:
|
||||
# Work around for testing creating a ~/.openlp.data.projector.projector.sql file
|
||||
@ -255,12 +265,10 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
del(settings)
|
||||
|
||||
def bootstrap_post_set_up(self):
|
||||
"""
|
||||
Post-initialize setups.
|
||||
"""
|
||||
self.load_projectors()
|
||||
'''
|
||||
self.projector_form = ProjectorWizard(self, projectordb=self.projectordb)
|
||||
self.projector_form.edit_page.newProjector.connect(self.add_projector_from_wizard)
|
||||
self.projector_form.edit_page.editProjector.connect(self.edit_projector_from_wizard)
|
||||
'''
|
||||
self.projector_form = ProjectorEditForm(self, projectordb=self.projectordb)
|
||||
self.projector_form.newProjector.connect(self.add_projector_from_wizard)
|
||||
self.projector_form.editProjector.connect(self.edit_projector_from_wizard)
|
||||
@ -273,7 +281,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
|
||||
:param point: The position of the mouse so the correct item can be found.
|
||||
"""
|
||||
# QListWidgetItem
|
||||
# QListWidgetItem to build menu for.
|
||||
item = self.projector_list_widget.itemAt(point)
|
||||
if item is None:
|
||||
return
|
||||
@ -340,7 +348,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
item to change input source.
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow())
|
||||
projector = list_item.data(QtCore.Qt.UserRole)
|
||||
@ -386,10 +393,9 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
|
||||
def on_add_projector(self, opt=None):
|
||||
"""
|
||||
Calls wizard to add a new projector to the database
|
||||
Calls edit dialog to add a new projector to the database
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
self.projector_form.exec_()
|
||||
|
||||
@ -398,7 +404,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Calls projector thread to send blank screen command
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
try:
|
||||
ip = opt.link.ip
|
||||
@ -415,6 +420,12 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
continue
|
||||
|
||||
def on_doubleclick_item(self, item, opt=None):
|
||||
"""
|
||||
When item is doubleclicked, will connect to projector.
|
||||
|
||||
:param item: List widget item for connection.
|
||||
:param opt: Needed by PyQt4
|
||||
"""
|
||||
projector = item.data(QtCore.Qt.UserRole)
|
||||
if projector.link.state() != projector.link.ConnectedState:
|
||||
try:
|
||||
@ -428,7 +439,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Calls projector thread to connect to projector
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
try:
|
||||
ip = opt.link.ip
|
||||
@ -449,7 +459,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Deletes a projector from the list and the database
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow())
|
||||
if list_item is None:
|
||||
@ -511,7 +520,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Calls projector thread to disconnect from projector
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
try:
|
||||
ip = opt.link.ip
|
||||
@ -529,10 +537,9 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
|
||||
def on_edit_projector(self, opt=None):
|
||||
"""
|
||||
Calls wizard with selected projector to edit information
|
||||
Calls edit dialog with selected projector to edit information
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
list_item = self.projector_list_widget.item(self.projector_list_widget.currentRow())
|
||||
projector = list_item.data(QtCore.Qt.UserRole)
|
||||
@ -549,7 +556,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Calls projector link to send Power Off command
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
try:
|
||||
ip = opt.link.ip
|
||||
@ -570,7 +576,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Calls projector link to send Power On command
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
try:
|
||||
ip = opt.link.ip
|
||||
@ -591,7 +596,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Calls projector thread to send open shutter command
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
try:
|
||||
ip = opt.link.ip
|
||||
@ -612,7 +616,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Builds message box with projector status information
|
||||
|
||||
:param opt: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
lwi = self.projector_list_widget.item(self.projector_list_widget.currentRow())
|
||||
projector = lwi.data(QtCore.Qt.UserRole)
|
||||
@ -670,7 +673,7 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
Helper app to build a projector instance
|
||||
|
||||
:param p: Dict of projector database information
|
||||
:returns: PJLink() instance
|
||||
:returns: PJLink1() instance
|
||||
"""
|
||||
log.debug('_add_projector()')
|
||||
return PJLink1(dbid=projector.id,
|
||||
@ -698,9 +701,8 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
We are not concerned with the wizard instance,
|
||||
just the projector item
|
||||
|
||||
:param opt1: See docstring
|
||||
:param opt2: See docstring
|
||||
:returns: None
|
||||
:param opt1: See above
|
||||
:param opt2: See above
|
||||
"""
|
||||
if opt1 is None:
|
||||
return
|
||||
@ -751,11 +753,10 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
@pyqtSlot(str)
|
||||
def add_projector_from_wizard(self, ip, opts=None):
|
||||
"""
|
||||
Add a projector from the wizard
|
||||
Add a projector from the edit dialog
|
||||
|
||||
:param ip: IP address of new record item
|
||||
:param ip: IP address of new record item to find
|
||||
:param opts: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
log.debug('load_projector(ip=%s)' % ip)
|
||||
item = self.projectordb.get_projector_by_ip(ip)
|
||||
@ -768,7 +769,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
|
||||
:param projector: Projector() instance of projector with updated information
|
||||
:param opts: Needed by PyQt4
|
||||
:returns: None
|
||||
"""
|
||||
|
||||
self.old_projector.link.name = projector.name
|
||||
@ -804,7 +804,6 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
:param ip: IP address of projector
|
||||
:param status: Optional status code
|
||||
:param msg: Optional status message
|
||||
:returns: None
|
||||
"""
|
||||
if status is None:
|
||||
return
|
||||
@ -903,6 +902,11 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
|
||||
@pyqtSlot(str)
|
||||
def authentication_error(self, name):
|
||||
"""
|
||||
Display warning dialog when attempting to connect with invalid pin
|
||||
|
||||
:param name: Name from QListWidgetItem
|
||||
"""
|
||||
QtGui.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
|
||||
'"%s" Authentication Error' % name),
|
||||
'<br />There was an authentictaion error while trying to connect.'
|
||||
@ -911,6 +915,12 @@ class ProjectorManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ProjectorMa
|
||||
|
||||
@pyqtSlot(str)
|
||||
def no_authentication_error(self, name):
|
||||
"""
|
||||
Display warning dialog when pin saved for item but projector does not
|
||||
require pin.
|
||||
|
||||
:param name: Name from QListWidgetItem
|
||||
"""
|
||||
QtGui.QMessageBox.warning(self, translate('OpenLP.ProjectorManager',
|
||||
'"%s" No Authentication Error' % name),
|
||||
'<br />PIN is set and projector does not require authentication.'
|
||||
@ -924,6 +934,11 @@ class ProjectorItem(QObject):
|
||||
NOTE: Actual PJLink class instance should be saved as self.link
|
||||
"""
|
||||
def __init__(self, link=None):
|
||||
"""
|
||||
Initialization for ProjectorItem instance
|
||||
|
||||
:param link: PJLink1 instance for QListWidgetItem
|
||||
"""
|
||||
self.link = link
|
||||
self.thread = None
|
||||
self.icon = None
|
||||
@ -942,7 +957,6 @@ def not_implemented(function):
|
||||
Temporary function to build an information message box indicating function not implemented yet
|
||||
|
||||
:param func: Function name
|
||||
:returns: None
|
||||
"""
|
||||
QtGui.QMessageBox.information(None,
|
||||
translate('OpenLP.ProjectorManager', 'Not Implemented Yet'),
|
||||
|
@ -27,8 +27,9 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`projector.ui.projectortab` module provides the settings tab in the
|
||||
settings dialog.
|
||||
:mod:`openlp.core.ui.projector.tab`
|
||||
|
||||
Provides the settings tab in the settings dialog.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@ -46,6 +47,11 @@ class ProjectorTab(SettingsTab):
|
||||
Openlp Settings -> Projector settings
|
||||
"""
|
||||
def __init__(self, parent):
|
||||
"""
|
||||
ProjectorTab initialization
|
||||
|
||||
:param parent: Parent widget
|
||||
"""
|
||||
self.icon_path = ':/projector/projector_manager.png'
|
||||
projector_translated = translate('OpenLP.ProjectorTab', 'Projector')
|
||||
super(ProjectorTab, self).__init__(parent, 'Projector', projector_translated)
|
||||
|
Loading…
Reference in New Issue
Block a user