/
MainWindow.py
39 lines (27 loc) · 1.01 KB
/
MainWindow.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
from Cocoa import NSWindowController, NSLog, objc, NSApplication, NSApp
from Foundation import NSObject
from PyObjCTools import AppHelper
import sqlite3
class Media(NSWindowController):
tableView = objc.IBOutlet()
conn = None
def awakeFromNib(self):
NSLog('awakeFromNib')
def windowDidLoad(self):
NSWindowController.windowDidLoad(self)
NSLog('windowDidLoad')
def windowShouldClose_(self, sender):
NSLog('windowShouldClose')
return True
def windowWillClose_(self, notification):
NSLog('windowWillClose')
AppHelper.stopEventLoop()
def applicationShouldTerminateAfterLastWindowClosed_(self, sender):
NSLog('applicationShouldTerminateAfterLastWindowClosed')
return True
if __name__ == '__main__':
app = NSApplication.sharedApplication()
viewController = Media.alloc().initWithWindowNibName_('Media')
viewController.showWindow_(viewController)
NSApp.activateIgnoringOtherApps_(True)
AppHelper.runEventLoop()