File: iphone.py

package info (click to toggle)
taskcoach 1.4.1-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,496 kB
  • ctags: 17,810
  • sloc: python: 72,170; makefile: 254; ansic: 120; xml: 29; sh: 16
file content (108 lines) | stat: -rw-r--r-- 4,590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2014 Task Coach developers <developers@taskcoach.org>

Task Coach is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Task Coach is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import wx
import wx.lib.hyperlink as hl

from taskcoachlib.i18n import _
from taskcoachlib import operating_system


class IPhoneSyncTypeDialog(wx.Dialog):
    def __init__(self, *args, **kwargs):
        super(IPhoneSyncTypeDialog, self).__init__(*args, **kwargs)

        vsz = wx.BoxSizer(wx.VERTICAL)
        vsz.Add(wx.StaticText(self, wx.ID_ANY,
                              _('''An iPhone or iPod Touch device is trying
to synchronize with this task file for
the first time. What kind of synchronization
would you like to use?''')), 1, wx.EXPAND|wx.ALL, 5)

        hsz = wx.BoxSizer(wx.HORIZONTAL)
        btn = wx.Button(self, wx.ID_ANY, _('Refresh from desktop'))
        hsz.Add(btn, 0, wx.ALL, 3)
        wx.EVT_BUTTON(btn, wx.ID_ANY, self.OnType1)
        btn = wx.Button(self, wx.ID_ANY, _('Refresh from device'))
        hsz.Add(btn, 0, wx.ALL, 3)
        wx.EVT_BUTTON(btn, wx.ID_ANY, self.OnType2)
        btn = wx.Button(self, wx.ID_ANY, _('Cancel'))
        hsz.Add(btn, 0, wx.ALL, 3)
        wx.EVT_BUTTON(btn, wx.ID_ANY, self.OnCancel)
        vsz.Add(hsz, 0, wx.ALIGN_RIGHT)

        self.SetSizer(vsz)
        self.Fit()
        self.CentreOnScreen()
        self.RequestUserAttention()

        self.value = 3 # cancel

    def OnType1(self, evt):
        self.value = 1
        self.EndModal(wx.ID_OK)

    def OnType2(self, evt):
        self.value = 2
        self.EndModal(wx.ID_OK)

    def OnCancel(self, evt):
        self.EndModal(wx.ID_CANCEL)


class IPhoneBonjourDialog(wx.Dialog):
    def __init__(self, *args, **kwargs):
        super(IPhoneBonjourDialog, self).__init__(*args, **kwargs)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        vsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                 _('You have enabled the iPhone synchronization feature, which\n'
                                   'needs Bonjour. Bonjour does not seem to be installed on\n'
                                   'your system.')), 0, wx.ALL, 3)
        if operating_system.isWindows(): # pragma: no cover
            vsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                     _('Please download and install Bonjour for Windows from\n')), 0, wx.ALL, 3)
            vsizer.Add(hl.HyperLinkCtrl(self, wx.ID_ANY,
                                        _('Apple\'s web site'),
                                        URL='http://support.apple.com/downloads/Bonjour_for_Windows'), 0, wx.ALL, 3)
        else: # pragma: no cover
            # MacOS does support Bonjour in all cases, so we're probably running Linux.
            vsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                     _('Bonjour support for Linux is generally provided by\n'
                                       'Avahi.')), 0, wx.ALL, 3)
            vsizer.Add(hl.HyperLinkCtrl(self, wx.ID_ANY,
                                        _('You may find details for your distribution here'),
                                        URL='http://avahi.org/wiki/AboutAvahi#Distributions'), 0, wx.ALL, 3)
            vsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                     _('Note that under some systems (Fedora), you may have to\n'
                                       'install the avahi-compat-libdns_sd package as well as Avahi in order\n'
                                       'for this to work.')), 0, wx.ALL, 3)
            vsizer.Add(wx.StaticText(self, wx.ID_ANY,
                                     _('In addition, if you have a firewall, check that ports 4096-4100 are open.')))

        btnOK = wx.Button(self, wx.ID_ANY, _('OK'))
        vsizer.Add(btnOK, 0, wx.ALIGN_CENTRE|wx.ALL, 3)

        self.SetSizer(vsizer)
        self.Fit()
        self.CentreOnScreen()

        wx.EVT_BUTTON(btnOK, wx.ID_ANY, self.OnDismiss)

    def OnDismiss(self, evt):
        self.EndModal(wx.ID_OK)