|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2010 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Cooperation configuration page. |
|
8 """ |
|
9 |
|
10 from .ConfigurationPageBase import ConfigurationPageBase |
|
11 from .Ui_CooperationPage import Ui_CooperationPage |
|
12 |
|
13 import Preferences |
|
14 |
|
15 class CooperationPage(ConfigurationPageBase, Ui_CooperationPage): |
|
16 """ |
|
17 Class implementing the Cooperation configuration page. |
|
18 """ |
|
19 def __init__(self): |
|
20 """ |
|
21 Constructor |
|
22 """ |
|
23 ConfigurationPageBase.__init__(self) |
|
24 self.setupUi(self) |
|
25 self.setObjectName("CooperationPage") |
|
26 |
|
27 # set initial values |
|
28 self.autostartCheckBox.setChecked( |
|
29 Preferences.getCooperation("AutoStartServer")) |
|
30 self.otherPortsCheckBox.setChecked( |
|
31 Preferences.getCooperation("TryOtherPorts")) |
|
32 self.serverPortSpin.setValue( |
|
33 Preferences.getCooperation("ServerPort")) |
|
34 self.portToTrySpin.setValue( |
|
35 Preferences.getCooperation("MaxPortsToTry")) |
|
36 |
|
37 def save(self): |
|
38 """ |
|
39 Public slot to save the Cooperation configuration. |
|
40 """ |
|
41 Preferences.setCooperation("AutoStartServer", |
|
42 self.autostartCheckBox.isChecked()) |
|
43 Preferences.setCooperation("TryOtherPorts", |
|
44 self.otherPortsCheckBox.isChecked()) |
|
45 Preferences.setCooperation("ServerPort", |
|
46 self.serverPortSpin.value()) |
|
47 Preferences.setCooperation("MaxPortsToTry", |
|
48 self.portToTrySpin.value()) |
|
49 |
|
50 def create(dlg): |
|
51 """ |
|
52 Module function to create the configuration page. |
|
53 |
|
54 @param dlg reference to the configuration dialog |
|
55 """ |
|
56 page = CooperationPage() |
|
57 return page |