|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 - 2016 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the synchronization host type wizard page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from PyQt5.QtWidgets import QWizardPage |
|
13 |
|
14 from . import SyncGlobals |
|
15 |
|
16 from .Ui_SyncHostTypePage import Ui_SyncHostTypePage |
|
17 |
|
18 import Preferences |
|
19 |
|
20 |
|
21 class SyncHostTypePage(QWizardPage, Ui_SyncHostTypePage): |
|
22 """ |
|
23 Class implementing the synchronization host type wizard page. |
|
24 """ |
|
25 def __init__(self, parent=None): |
|
26 """ |
|
27 Constructor |
|
28 |
|
29 @param parent reference to the parent widget (QWidget) |
|
30 """ |
|
31 super(SyncHostTypePage, self).__init__(parent) |
|
32 self.setupUi(self) |
|
33 |
|
34 if Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeFtp: |
|
35 self.ftpRadioButton.setChecked(True) |
|
36 elif Preferences.getWebBrowser("SyncType") == \ |
|
37 SyncGlobals.SyncTypeDirectory: |
|
38 self.directoryRadioButton.setChecked(True) |
|
39 else: |
|
40 self.noneRadioButton.setChecked(True) |
|
41 |
|
42 def nextId(self): |
|
43 """ |
|
44 Public method returning the ID of the next wizard page. |
|
45 |
|
46 @return next wizard page ID (integer) |
|
47 """ |
|
48 # save the settings |
|
49 if self.ftpRadioButton.isChecked(): |
|
50 Preferences.setWebBrowser("SyncType", SyncGlobals.SyncTypeFtp) |
|
51 return SyncGlobals.PageFTPSettings |
|
52 elif self.directoryRadioButton.isChecked(): |
|
53 Preferences.setWebBrowser( |
|
54 "SyncType", SyncGlobals.SyncTypeDirectory) |
|
55 return SyncGlobals.PageDirectorySettings |
|
56 else: |
|
57 Preferences.setWebBrowser("SyncType", SyncGlobals.SyncTypeNone) |
|
58 return SyncGlobals.PageCheck |