1 """Skype client user interface control.
2 """
3 __docformat__ = 'restructuredtext en'
4
5
6 import weakref
7
8 from enums import *
9 from errors import SkypeError
10 from utils import *
11
12
14 """Represents a Skype client. Access using `skype.Skype.Client`.
15 """
16
18 """__init__.
19
20 :Parameters:
21 Skype : `Skype`
22 Skype
23 """
24 self._SkypeRef = weakref.ref(Skype)
25
34
43
45 """Creates a custom event displayed in Skype client's events pane.
46
47 :Parameters:
48 EventId : unicode
49 Unique identifier for the event.
50 Caption : unicode
51 Caption text.
52 Hint : unicode
53 Hint text. Shown when mouse hoovers over the event.
54
55 :return: Event object.
56 :rtype: `PluginEvent`
57 """
58 self._Skype._DoCommand('CREATE EVENT %s CAPTION %s HINT %s' % (tounicode(EventId),
59 quote(tounicode(Caption)), quote(tounicode(Hint))))
60 return PluginEvent(self._Skype, EventId)
61
64 """Creates custom menu item in Skype client's "Do More" menus.
65
66 :Parameters:
67 MenuItemId : unicode
68 Unique identifier for the menu item.
69 PluginContext : `enums`.pluginContext*
70 Menu item context. Allows to choose in which client windows will the menu item appear.
71 CaptionText : unicode
72 Caption text.
73 HintText : unicode
74 Hint text (optional). Shown when mouse hoovers over the menu item.
75 IconPath : unicode
76 Path to the icon (optional).
77 Enabled : bool
78 Initial state of the menu item. True by default.
79 ContactType : `enums`.pluginContactType*
80 In case of `enums.pluginContextContact` tells which contacts the menu item should appear
81 for. Defaults to `enums.pluginContactTypeAll`.
82 MultipleContacts : bool
83 Set to True if multiple contacts should be allowed (defaults to False).
84
85 :return: Menu item object.
86 :rtype: `PluginMenuItem`
87 """
88 cmd = 'CREATE MENU_ITEM %s CONTEXT %s CAPTION %s ENABLED %s' % (tounicode(MenuItemId), PluginContext,
89 quote(tounicode(CaptionText)), cndexp(Enabled, 'true', 'false'))
90 if HintText:
91 cmd += ' HINT %s' % quote(tounicode(HintText))
92 if IconPath:
93 cmd += ' ICON %s' % quote(path2unicode(IconPath))
94 if MultipleContacts:
95 cmd += ' ENABLE_MULTIPLE_CONTACTS true'
96 if PluginContext == pluginContextContact:
97 cmd += ' CONTACT_TYPE_FILTER %s' % ContactType
98 self._Skype._DoCommand(cmd)
99 return PluginMenuItem(self._Skype, MenuItemId, CaptionText, HintText, Enabled)
100
102 """Brings the client window into focus.
103 """
104 self._Skype._Api.allow_focus(self._Skype.Timeout)
105 self._Skype._DoCommand('FOCUS')
106
108 """Hides Skype application window.
109 """
110 self._Skype._DoCommand('MINIMIZE')
111
120
122 """Opens authorization dialog.
123
124 :Parameters:
125 Username : str
126 Skypename of the user to authenticate.
127 """
128 self.OpenDialog('AUTHORIZATION', Username)
129
131 """Opens blocked users dialog.
132 """
133 self.OpenDialog('BLOCKEDUSERS')
134
136 """Opens call history tab.
137 """
138 self.OpenDialog('CALLHISTORY')
139
141 """Opens create conference dialog.
142 """
143 self.OpenDialog('CONFERENCE')
144
149
151 """Open dialog. Use this method to open dialogs added in newer Skype versions if there is no
152 dedicated method in Skype4Py.
153
154 :Parameters:
155 Name : str
156 Dialog name.
157 Params : unicode
158 One or more optional parameters.
159 """
160 self._Skype._Api.allow_focus(self._Skype.Timeout)
161 params = filter(None, (str(Name),) + Params)
162 self._Skype._DoCommand('OPEN %s' % tounicode(' '.join(params)))
163
165 """Opens dial pad tab.
166 """
167 self.OpenDialog('DIALPAD')
168
170 """Opens file transfer dialog.
171
172 :Parameters:
173 Username : str
174 Skypename of the user.
175 Folder : str
176 Path to initial directory.
177 """
178 self.OpenDialog('FILETRANSFER', Username, 'IN', path2unicode(Folder))
179
181 """Opens getting started wizard.
182 """
183 self.OpenDialog('GETTINGSTARTED')
184
189
191 """OpenLiveTab.
192 """
193 self.OpenDialog('LIVETAB')
194
196 """Opens "Send an IM Message" dialog.
197
198 :Parameters:
199 Username : str
200 Message target.
201 Text : unicode
202 Message text.
203 """
204 self.OpenDialog('IM', Username, tounicode(Text))
205
207 """Opens options dialog.
208
209 :Parameters:
210 Page : str
211 Page name to open.
212
213 :see: See https://developer.skype.com/Docs/ApiDoc/OPEN_OPTIONS for known Page values.
214 """
215 self.OpenDialog('OPTIONS', Page)
216
218 """Opens current user profile dialog.
219 """
220 self.OpenDialog('PROFILE')
221
223 """Opens search dialog.
224 """
225 self.OpenDialog('SEARCH')
226
235
237 """Opens SMS window
238
239 :Parameters:
240 SmsId : int
241 SMS message Id.
242 """
243 self.OpenDialog('SMS', str(SmsId))
244
246 """Opens user information dialog.
247
248 :Parameters:
249 Username : str
250 Skypename of the user.
251 """
252 self.OpenDialog('USERINFO', Username)
253
255 """Opens video test dialog.
256 """
257 self.OpenDialog('VIDEOTEST')
258
260 """Closes Skype application.
261 """
262 self._Skype._Api.shutdown()
263
264 - def Start(self, Minimized=False, Nosplash=False):
265 """Starts Skype application.
266
267 :Parameters:
268 Minimized : bool
269 If True, Skype is started minimized in system tray.
270 Nosplash : bool
271 If True, no splash screen is displayed upon startup.
272 """
273 self._Skype._Api.startup(Minimized, Nosplash)
274
280
281 _Skype = property(_Get_Skype)
282
285
286 IsRunning = property(_GetIsRunning,
287 doc="""Tells if Skype client is running.
288
289 :type: bool
290 """)
291
294
297
298 Wallpaper = property(_GetWallpaper, _SetWallpaper,
299 doc="""Path to client wallpaper bitmap.
300
301 :type: str
302 """)
303
305 return str(self._Skype.Variable('WINDOWSTATE'))
306
308 self._Skype.Variable('WINDOWSTATE', Value)
309
310 WindowState = property(_GetWindowState, _SetWindowState,
311 doc="""Client window state.
312
313 :type: `enums`.wnd*
314 """)
315
316
318 """Represents an event displayed in Skype client's events pane.
319 """
323
325 return '<%s with Id=%s>' % (object.__repr__(self)[1:-1], repr(self.Id))
326
328 """Deletes the event from the events pane in the Skype client.
329 """
330 self._Skype._DoCommand('DELETE EVENT %s' % self.Id)
331
334
335 Id = property(_GetId,
336 doc="""Unique event Id.
337
338 :type: unicode
339 """)
340
341
343 """Represents a menu item displayed in Skype client's "Do More" menus.
344 """
352
354 return '<%s with Id=%s>' % (object.__repr__(self)[1:-1], repr(self.Id))
355
357 if Set is None:
358 return self._CacheDict[PropName]
359 self._Skype._Property('MENU_ITEM', self.Id, PropName, Set)
360 self._CacheDict[PropName] = unicode(Set)
361
363 """Removes the menu item from the "Do More" menus.
364 """
365 self._Skype._DoCommand('DELETE MENU_ITEM %s' % self.Id)
366
368 return self._Property('CAPTION')
369
371 self._Property('CAPTION', tounicode(Value))
372
373 Caption = property(_GetCaption, _SetCaption,
374 doc="""Menu item caption text.
375
376 :type: unicode
377 """)
378
380 return (self._Property('ENABLED') == 'TRUE')
381
383 self._Property('ENABLED', cndexp(Value, 'TRUE', 'FALSE'))
384
385 Enabled = property(_GetEnabled, _SetEnabled,
386 doc="""Defines whether the menu item is enabled when a user launches Skype. If no value is defined,
387 the menu item will be enabled.
388
389 :type: bool
390 """)
391
393 return self._Property('HINT')
394
397
398 Hint = property(_GetHint, _SetHint,
399 doc="""Menu item hint text.
400
401 :type: unicode
402 """)
403
406
407 Id = property(_GetId,
408 doc="""Unique menu item Id.
409
410 :type: unicode
411 """)
412