-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConferenceConfigurationPanel.py
49 lines (39 loc) · 1.49 KB
/
ConferenceConfigurationPanel.py
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
# Copyright (C) 2011 AG Projects. See LICENSE for details.
#
from AppKit import NSApp, NSCancelButton, NSOKButton
from Foundation import NSBundle, NSObject, NSLocalizedString
import objc
class ConferenceConfigurationPanel(NSObject):
window = objc.IBOutlet()
caption = objc.IBOutlet()
nameText = objc.IBOutlet()
def __new__(cls, *args, **kwargs):
return cls.alloc().init()
def init(self):
NSBundle.loadNibNamed_owner_("ConferenceConfigurationPanel", self)
return self
def runModal(self):
self.window.makeKeyAndOrderFront_(None)
rc = NSApp.runModalForWindow_(self.window)
self.window.orderOut_(self)
if rc == NSOKButton:
return unicode(self.nameText.stringValue())
return None
def runModalForRename_(self, name):
self.nameText.setStringValue_(name)
self.window.setTitle_(NSLocalizedString("Rename Conference Configuration", "Window title"))
self.window.makeKeyAndOrderFront_(None)
rc = NSApp.runModalForWindow_(self.window)
self.window.orderOut_(self)
if rc == NSOKButton:
return unicode(self.nameText.stringValue())
return None
@objc.IBAction
def okClicked_(self, sender):
NSApp.stopModalWithCode_(NSOKButton)
@objc.IBAction
def cancelClicked_(self, sender):
NSApp.stopModalWithCode_(NSCancelButton)
def windowShouldClose_(self, sender):
NSApp.stopModalWithCode_(NSCancelButton)
return True