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

Source Code for Module Skype4Py.settings

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