~alisonken1/openlp/pjlink2-i

« back to all changes in this revision

Viewing changes to openlp/plugins/presentations/lib/presentationtab.py

  • Committer: Tim Bentley
  • Author(s): Phill
  • Date: 2017-08-11 20:31:09 UTC
  • mfrom: (2754.1.11 pathlib2)
  • Revision ID: tim.bentley@gmail.com-20170811203109-0idjanfltutf8n38
Definitely ready for merging, unless, of course you guys find some more issues!

Part 2

Changed the pathedit widget over to using pathlib
Added a 'patched' file dialog
Added a few utility methods

lp:~phill-ridout/openlp/pathlib2 (revision 2763)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2125/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2033/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1938/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis...

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
# Temple Place, Suite 330, Boston, MA 02111-1307 USA                          #
21
21
###############################################################################
22
22
 
23
 
from PyQt5 import QtGui, QtWidgets
 
23
from PyQt5 import QtWidgets
24
24
 
25
25
from openlp.core.common import Settings, UiStrings, translate
26
 
from openlp.core.lib import SettingsTab, build_icon
 
26
from openlp.core.common.path import path_to_str, str_to_path
 
27
from openlp.core.lib import SettingsTab
27
28
from openlp.core.lib.ui import critical_error_message_box
28
29
from openlp.core.ui.lib import PathEdit
29
30
from openlp.plugins.presentations.lib.pdfcontroller import PdfController
156
157
        self.program_path_edit.setEnabled(enable_pdf_program)
157
158
        pdf_program = Settings().value(self.settings_section + '/pdf_program')
158
159
        if pdf_program:
159
 
            self.program_path_edit.path = pdf_program
 
160
            self.program_path_edit.path = str_to_path(pdf_program)
160
161
 
161
162
    def save(self):
162
163
        """
192
193
            Settings().setValue(setting_key, self.ppt_window_check_box.checkState())
193
194
            changed = True
194
195
        # Save pdf-settings
195
 
        pdf_program = self.program_path_edit.path
 
196
        pdf_program = path_to_str(self.program_path_edit.path)
196
197
        enable_pdf_program = self.pdf_program_check_box.checkState()
197
198
        # If the given program is blank disable using the program
198
199
        if pdf_program == '':
219
220
            checkbox.setEnabled(controller.is_available())
220
221
            self.set_controller_text(checkbox, controller)
221
222
 
222
 
    def on_program_path_edit_path_changed(self, filename):
 
223
    def on_program_path_edit_path_changed(self, new_path):
223
224
        """
224
225
        Select the mudraw or ghostscript binary that should be used.
225
226
        """
226
 
        if filename:
227
 
            if not PdfController.process_check_binary(filename):
 
227
        new_path = path_to_str(new_path)
 
228
        if new_path:
 
229
            if not PdfController.process_check_binary(new_path):
228
230
                critical_error_message_box(UiStrings().Error,
229
231
                                           translate('PresentationPlugin.PresentationTab',
230
232
                                                     'The program is not ghostscript or mudraw which is required.'))