1 '''Skype client user interface control.
2 '''
3
4 from enums import *
5 from errors import ISkypeError
6 from utils import *
7 import weakref
8
9
11 '''Represents a Skype client. Access using L{ISkype.Client<skype.ISkype.Client>}.
12 '''
13
15 '''__init__.
16
17 @param Skype: Skype
18 @type Skype: L{ISkype}
19 '''
20 self._SkypeRef = weakref.ref(Skype)
21
29
37
39 '''Creates a custom event displayed in Skype client's events pane.
40
41 @param EventId: Unique identifier for the event.
42 @type EventId: unicode
43 @param Caption: Caption text.
44 @type Caption: unicode
45 @param Hint: Hint text. Shown when mouse hoovers over the event.
46 @type Hint: unicode
47 @return: Event object.
48 @rtype: L{IPluginEvent}
49 '''
50 self._Skype._DoCommand('CREATE EVENT %s CAPTION %s HINT %s' % (EventId, quote(Caption), quote(Hint)))
51 return IPluginEvent(EventId, self._Skype)
52
55 '''Creates custom menu item in Skype client's "Do More" menus.
56
57 @param MenuItemId: Unique identifier for the menu item.
58 @type MenuItemId: unicode
59 @param PluginContext: Menu item context. Allows to choose in which client windows will
60 the menu item appear.
61 @type PluginContext: L{Plug-in context<enums.pluginContextUnknown>}
62 @param CaptionText: Caption text.
63 @type CaptionText: unicode
64 @param HintText: Hint text (optional). Shown when mouse hoovers over the menu item.
65 @type HintText: unicode
66 @param IconPath: Path to the icon (optional).
67 @type IconPath: unicode
68 @param Enabled: Initial state of the menu item. True by default.
69 @type Enabled: bool
70 @param ContactType: In case of L{pluginContextContact<enums.pluginContextContact>} tells which contacts
71 the menu item should appear for. Defaults to L{pluginContactTypeAll<enums.pluginContactTypeAll>}.
72 @type ContactType: L{Plug-in contact type<enums.pluginContactTypeUnknown>}
73 @param MultipleContacts: Set to True if multiple contacts should be allowed (defaults to False).
74 @type MultipleContacts: bool
75 @return: Menu item object.
76 @rtype: L{IPluginMenuItem}
77 '''
78 com = 'CREATE MENU_ITEM %s CONTEXT %s CAPTION %s ENABLED %s' % (MenuItemId, PluginContext, quote(CaptionText), cndexp(Enabled, 'true', 'false'))
79 if HintText:
80 com += ' HINT %s' % quote(HintText)
81 if IconPath:
82 com += ' ICON %s' % quote(IconPath)
83 if MultipleContacts:
84 com += ' ENABLE_MULTIPLE_CONTACTS true'
85 if PluginContext == pluginContextContact:
86 com += ' CONTACT_TYPE_FILTER %s' % ContactType
87 self._Skype._DoCommand(com)
88 return IPluginMenuItem(MenuItemId, self._Skype, CaptionText, HintText, Enabled)
89
91 '''Brings the client window into focus.
92 '''
93 self._Skype._DoCommand('FOCUS')
94
96 '''Hides Skype application window.
97 '''
98 self._Skype._DoCommand('MINIMIZE')
99
107
109 '''Opens authorization dialog.
110
111 @param Username: Skypename of the user to authenticate.
112 @type Username: unicode
113 '''
114 self.OpenDialog('AUTHORIZATION', Username)
115
117 '''Opens blocked users dialog.
118 '''
119 self.OpenDialog('BLOCKEDUSERS')
120
122 '''Opens call history tab.
123 '''
124 self.OpenDialog('CALLHISTORY')
125
127 '''Opens create conference dialog.
128 '''
129 self.OpenDialog('CONFERENCE')
130
135
137 '''Open dialog. Use this method to open dialogs added in newer Skype versions if there is no
138 dedicated method in Skype4Py.
139
140 @param Name: Dialog name.
141 @type Name: unicode
142 @param Params: One or more optional parameters.
143 @type Params: unicode
144 '''
145 self._Skype._DoCommand('OPEN %s %s' % (Name, ' '.join(Params)))
146
148 '''Opens dial pad tab.
149 '''
150 self.OpenDialog('DIALPAD')
151
153 '''Opens file transfer dialog.
154
155 @param Username: Skypename of the user.
156 @type Username: unicode
157 @param Folder: Path to initial directory.
158 @type Folder: unicode
159 '''
160 self.OpenDialog('FILETRANSFER', Username, 'IN %s' % Folder)
161
163 '''Opens getting started wizard.
164 '''
165 self.OpenDialog('GETTINGSTARTED')
166
171
173 '''OpenLiveTab.
174 '''
175 self.OpenDialog('LIVETAB')
176
178 '''Opens "Send an IM Message" dialog.
179
180 @param Username: Message target.
181 @type Username: unicode
182 @param Text: Message text.
183 @type Text: unicode
184 '''
185 self.OpenDialog('IM', Username, Text)
186
188 '''Opens options dialog.
189
190 @param Page: Page name to open.
191 @type Page: unicode
192 '''
193 self.OpenDialog('OPTIONS', Page)
194
196 '''Opens current user profile dialog.
197 '''
198 self.OpenDialog('PROFILE')
199
201 '''Opens search dialog.
202 '''
203 self.OpenDialog('SEARCH')
204
212
214 '''Opens SMS window
215
216 @param SmsId: SMS message Id.
217 @type SmsId: int
218 '''
219 self.OpenDialog('SMS', SmsId)
220
222 '''Opens user information dialog.
223
224 @param Username: Skypename of the user.
225 @type Username: unicode
226 '''
227 self.OpenDialog('USERINFO', Username)
228
230 '''Opens video test dialog.
231 '''
232 self.OpenDialog('VIDEOTEST')
233
235 '''Closes Skype application.
236 '''
237 self._Skype._API.Shutdown()
238
239 - def Start(self, Minimized=False, Nosplash=False):
240 '''Starts Skype application.
241
242 @param Minimized: If True, Skype is started minized in system tray.
243 @type Minimized: bool
244 @param Nosplash: If True, no splash screen is displayed upon startup.
245 @type Nosplash: bool
246 '''
247 self._Skype._API.Start(Minimized, Nosplash)
248
254
255 _Skype = property(_Get_Skype)
256
259
260 IsRunning = property(_GetIsRunning,
261 doc='''Tells if Skype client is running.
262
263 @type: bool
264 ''')
265
267 return self._Skype.Variable('WALLPAPER')
268
270 self._Skype.Variable('WALLPAPER', value)
271
272 Wallpaper = property(_GetWallpaper, _SetWallpaper,
273 doc='''Path to client wallpaper bitmap.
274
275 @type: unicode
276 ''')
277
279 return self._Skype.Variable('WINDOWSTATE')
280
282 self._Skype.Variable('WINDOWSTATE', value)
283
284 WindowState = property(_GetWindowState, _SetWindowState,
285 doc='''Client window state.
286
287 @type: L{Window state<enums.wndUnknown>}
288 ''')
289
290
292 '''Represents an event displayed in Skype client's events pane.
293 '''
294
297
298 - def _Init(self, Id, Skype):
299 self._Skype = Skype
300 self._Id = unicode(Id)
301
303 '''Deletes the event from the events pane in the Skype client.
304 '''
305 self._Skype._DoCommand('DELETE EVENT %s' % self._Id)
306
309
310 Id = property(_GetId,
311 doc='''Unique event Id.
312
313 @type: unicode
314 ''')
315
316
318 '''Represents a menu item displayed in Skype client's "Do More" menus.
319 '''
320
323
325 self._Skype = Skype
326 self._Id = unicode(Id)
327 self._CacheDict = {}
328 if Caption != None:
329 self._CacheDict['CAPTION'] = unicode(Caption)
330 if Hint != None:
331 self._CacheDict['HINT'] = unicode(Hint)
332 if Enabled != None:
333 self._CacheDict['ENABLED'] = cndexp(Enabled, u'TRUE', u'FALSE')
334
336 if Set == None:
337 return self._CacheDict[PropName]
338 self._Skype._Property('MENU_ITEM', self._Id, PropName, Set)
339 self._CacheDict[PropName] = unicode(Set)
340
342 '''Removes the menu item from the "Do More" menus.
343 '''
344 self._Skype._DoCommand('DELETE MENU_ITEM %s' % self._Id)
345
347 return self._Property('CAPTION')
348
350 self._Property('CAPTION', value)
351
352 Caption = property(_GetCaption, _SetCaption,
353 doc='''Menu item caption text.
354
355 @type: unicode
356 ''')
357
359 return self._Property('ENABLED') == 'TRUE'
360
362 self._Property('ENABLED', cndexp(value, 'TRUE', 'FALSE'))
363
364 Enabled = property(_GetEnabled, _SetEnabled,
365 doc='''Defines whether the menu item is enabled when a user launches Skype. If no value is defined,
366 the menu item will be enabled.
367
368 @type: bool
369 ''')
370
372 return self._Property('HINT')
373
375 self._Property('HINT', value)
376
377 Hint = property(_GetHint, _SetHint,
378 doc='''Menu item hint text.
379
380 @type: unicode
381 ''')
382
385
386 Id = property(_GetId,
387 doc='''Unique menu item Id.
388
389 @type: unicode
390 ''')
391