Package Skype4Py :: Module settings
[frames] | no frames]

Source Code for Module Skype4Py.settings

  1  """Skype client settings. 
  2  """ 
  3  __docformat__ = 'restructuredtext en' 
  4   
  5   
  6  import sys 
  7  import weakref 
  8   
  9  from utils import * 
 10   
 11   
12 -class Settings(object):
13 """Represents Skype settings. Access using `skype.Skype.Settings`. 14 """ 15
16 - def __init__(self, Skype):
17 """__init__. 18 19 :Parameters: 20 Skype : `Skype` 21 Skype 22 """ 23 self._SkypeRef = weakref.ref(Skype)
24
25 - def Avatar(self, Id=1, Set=None):
26 """Sets user avatar picture from file. 27 28 :Parameters: 29 Id : int 30 Optional avatar Id. 31 Set : str 32 New avatar file name. 33 34 :deprecated: Use `LoadAvatarFromFile` instead. 35 """ 36 from warnings import warn 37 warn('Settings.Avatar: Use Settings.LoadAvatarFromFile instead.', DeprecationWarning, stacklevel=2) 38 if Set is None: 39 raise TypeError('Argument \'Set\' is mandatory!') 40 self.LoadAvatarFromFile(Set, Id)
41
42 - def LoadAvatarFromFile(self, Filename, AvatarId=1):
43 """Loads user avatar picture from file. 44 45 :Parameters: 46 Filename : str 47 Name of the avatar file. 48 AvatarId : int 49 Optional avatar Id. 50 """ 51 s = 'AVATAR %s %s' % (AvatarId, path2unicode(Filename)) 52 self._Skype._DoCommand('SET %s' % s, s)
53
54 - def ResetIdleTimer(self):
55 """Reset Skype idle timer. 56 """ 57 self._Skype._DoCommand('RESETIDLETIMER')
58
59 - def RingTone(self, Id=1, Set=None):
60 """Returns/sets a ringtone. 61 62 :Parameters: 63 Id : int 64 Ringtone Id 65 Set : str 66 Path to new ringtone or None if the current path should be queried. 67 68 :return: Current path if Set=None, None otherwise. 69 :rtype: str or None 70 """ 71 if Set is None: 72 return unicode2path(self._Skype._Property('RINGTONE', Id, '')) 73 self._Skype._Property('RINGTONE', Id, '', path2unicode(Set))
74
75 - def RingToneStatus(self, Id=1, Set=None):
76 """Enables/disables a ringtone. 77 78 :Parameters: 79 Id : int 80 Ringtone Id 81 Set : bool 82 True/False if the ringtone should be enabled/disabled or None if the current status 83 should be queried. 84 85 :return: Current status if Set=None, None otherwise. 86 :rtype: bool 87 """ 88 if Set is None: 89 return (self._Skype._Property('RINGTONE', Id, 'STATUS') == 'ON') 90 self._Skype._Property('RINGTONE', Id, 'STATUS', cndexp(Set, 'ON', 'OFF'))
91
92 - def SaveAvatarToFile(self, Filename, AvatarId=1):
93 """Saves user avatar picture to file. 94 95 :Parameters: 96 Filename : str 97 Destination path. 98 AvatarId : int 99 Avatar Id 100 """ 101 s = 'AVATAR %s %s' % (AvatarId, path2unicode(Filename)) 102 self._Skype._DoCommand('GET %s' % s, s)
103
104 - def _Get_Skype(self):
105 skype = self._SkypeRef() 106 if skype: 107 return skype 108 raise ISkypeError('Skype4Py internal error')
109 110 _Skype = property(_Get_Skype) 111
112 - def _GetAEC(self):
113 return (self._Skype.Variable('AEC') == 'ON')
114
115 - def _SetAEC(self, Value):
116 self._Skype.Variable('AEC', cndexp(Value, 'ON', 'OFF'))
117 118 AEC = property(_GetAEC, _SetAEC, 119 doc="""Automatic echo cancellation state. 120 121 :type: bool 122 123 :warning: Starting with Skype for Windows 3.6, this property has no effect. It can still be set 124 for backwards compatibility reasons. 125 """) 126
127 - def _GetAGC(self):
128 return (self._Skype.Variable('AGC') == 'ON')
129
130 - def _SetAGC(self, Value):
131 self._Skype.Variable('AGC', cndexp(Value, 'ON', 'OFF'))
132 133 AGC = property(_GetAGC, _SetAGC, 134 doc="""Automatic gain control state. 135 136 :type: bool 137 138 :warning: Starting with Skype for Windows 3.6, this property has no effect. It can still be set 139 for backwards compatibility reasons. 140 """) 141
142 - def _GetAudioIn(self):
143 return self._Skype.Variable('AUDIO_IN')
144
145 - def _SetAudioIn(self, Value):
146 self._Skype.Variable('AUDIO_IN', Value)
147 148 AudioIn = property(_GetAudioIn, _SetAudioIn, 149 doc="""Name of an audio input device. 150 151 :type: unicode 152 """) 153
154 - def _GetAudioOut(self):
155 return self._Skype.Variable('AUDIO_OUT')
156
157 - def _SetAudioOut(self, Value):
158 self._Skype.Variable('AUDIO_OUT', Value)
159 160 AudioOut = property(_GetAudioOut, _SetAudioOut, 161 doc="""Name of an audio output device. 162 163 :type: unicode 164 """) 165
166 - def _GetAutoAway(self):
167 return (self._Skype.Variable('AUTOAWAY') == 'ON')
168
169 - def _SetAutoAway(self, Value):
170 self._Skype.Variable('AUTOAWAY', cndexp(Value, 'ON', 'OFF'))
171 172 AutoAway = property(_GetAutoAway, _SetAutoAway, 173 doc="""Auto away status. 174 175 :type: bool 176 """) 177
178 - def _GetLanguage(self):
179 return str(self._Skype.Variable('UI_LANGUAGE'))
180
181 - def _SetLanguage(self, Value):
182 self._Skype.Variable('UI_LANGUAGE', Value)
183 184 Language = property(_GetLanguage, _SetLanguage, 185 doc="""Language of the Skype client as an ISO code. 186 187 :type: str 188 """) 189
190 - def _GetPCSpeaker(self):
191 return (self._Skype.Variable('PCSPEAKER') == 'ON')
192
193 - def _SetPCSpeaker(self, Value):
194 self._Skype.Variable('PCSPEAKER', cndexp(Value, 'ON', 'OFF'))
195 196 PCSpeaker = property(_GetPCSpeaker, _SetPCSpeaker, 197 doc="""PCSpeaker status. 198 199 :type: bool 200 """) 201
202 - def _GetRinger(self):
203 return self._Skype.Variable('RINGER')
204
205 - def _SetRinger(self, Value):
206 self._Skype.Variable('RINGER', Value)
207 208 Ringer = property(_GetRinger, _SetRinger, 209 doc="""Name of a ringer device. 210 211 :type: unicode 212 """) 213
214 - def _GetVideoIn(self):
215 return self._Skype.Variable('VIDEO_IN')
216
217 - def _SetVideoIn(self, Value):
218 self._Skype.Variable('VIDEO_IN', Value)
219 220 VideoIn = property(_GetVideoIn, _SetVideoIn, 221 doc="""Name of a video input device. 222 223 :type: unicode 224 """)
225