~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to openlp/core/projectors/editform.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
29
29
 
30
30
from openlp.core.common import verify_ip_address
31
31
from openlp.core.common.i18n import translate
32
 
from openlp.core.ui.icons import UiIcons
33
32
from openlp.core.projectors.constants import PJLINK_PORT
34
33
from openlp.core.projectors.db import Projector
 
34
from openlp.core.ui.icons import UiIcons
 
35
 
35
36
 
36
37
log = logging.getLogger(__name__)
37
38
log.debug('editform loaded')
38
39
 
 
40
# TODO: Fix db entries for input source(s)
 
41
 
39
42
 
40
43
class Ui_ProjectorEditForm(object):
41
44
    """
42
45
    The :class:`~openlp.core.lib.ui.projector.editform.Ui_ProjectorEditForm` class defines
43
46
    the user interface for the ProjectorEditForm dialog.
44
47
    """
45
 
    def setupUi(self, edit_projector_dialog):
 
48
    def setup_ui(self, edit_projector_dialog):
46
49
        """
47
50
        Create the interface layout.
48
51
        """
108
111
                                                     QtWidgets.QDialogButtonBox.Cancel)
109
112
        self.dialog_layout.addWidget(self.button_box, 8, 0, 1, 2)
110
113
 
111
 
    def retranslateUi(self, edit_projector_dialog):
 
114
    def retranslate_ui(self, edit_projector_dialog):
112
115
        if self.new_projector:
113
116
            title = translate('OpenLP.ProjectorEditForm', 'Add New Projector')
114
117
            self.projector.port = PJLINK_PORT
150
153
        super(ProjectorEditForm, self).__init__(parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint |
151
154
                                                QtCore.Qt.WindowCloseButtonHint)
152
155
        self.projectordb = projectordb
153
 
        self.setupUi(self)
 
156
        self.setup_ui(self)
154
157
        self.button_box.accepted.connect(self.accept_me)
155
158
        self.button_box.helpRequested.connect(self.help_me)
156
159
        self.button_box.rejected.connect(self.cancel_me)
169
172
            self.ip_text_label.setVisible(True)
170
173
            # Since it's already defined, IP address is unchangeable, so focus on port number
171
174
            self.port_text.setFocus()
172
 
        self.retranslateUi(self)
 
175
        self.retranslate_ui(self)
173
176
        reply = QtWidgets.QDialog.exec(self)
174
177
        return reply
175
178
 
179
182
        Validate input before accepting input.
180
183
        """
181
184
        log.debug('accept_me() signal received')
 
185
        valid = True
182
186
        if len(self.name_text.text().strip()) < 1:
183
187
            QtWidgets.QMessageBox.warning(self,
184
188
                                          translate('OpenLP.ProjectorEdit', 'Name Not Set'),