Pushed common py wrapper creation code to cocoalib.

--HG--
branch : objp
This commit is contained in:
Virgil Dupras 2012-01-12 10:23:31 -05:00
parent e6819781f6
commit f6dd1a6a42
4 changed files with 8 additions and 27 deletions

View File

@ -6,22 +6,15 @@ which should be included with this package. The terms are also available at
http://www.hardcoded.net/licenses/bsd_license
*/
#import <Python.h>
#import "DetailsPanel.h"
#import "ObjP.h"
#import "Utils.h"
@implementation DetailsPanel
- (id)init
{
self = [super initWithWindowNibName:@"DetailsPanel"];
[self window]; //So the detailsTable is initialized.
PyGILState_STATE gilState = PyGILState_Ensure();
PyObject *pModule = PyImport_AddModule("__main__");
PyObject *pAppInstance = PyObject_GetAttrString(pModule, "APP_INSTANCE");
PyObject *pDetailsPanel = PyObject_GetAttrString(pAppInstance, "details_panel");
PyObject *pCallback = ObjP_classInstanceWithRef(@"DetailsPanelView", @"inter.DetailsPanelView", self);
py = [[PyDetailsPanel alloc] initWithModel:pDetailsPanel Callback:pCallback];
PyGILState_Release(gilState);
py = createPyWrapper(@"PyDetailsPanel", @"details_panel", @"DetailsPanelView", self);
[py connect];
return self;
}

View File

@ -6,9 +6,8 @@ which should be included with this package. The terms are also available at
http://www.hardcoded.net/licenses/bsd_license
*/
#import <Python.h>
#import "ExtraFairwareReminder.h"
#import "ObjP.h"
#import "Utils.h"
@implementation ExtraFairwareReminder
- (id)init
@ -16,13 +15,7 @@ http://www.hardcoded.net/licenses/bsd_license
self = [super initWithWindowNibName:@"ExtraFairwareReminder"];
[self window];
[continueButton setEnabled:NO];
PyGILState_STATE gilState = PyGILState_Ensure();
PyObject *pModule = PyImport_AddModule("__main__");
PyObject *pAppInstance = PyObject_GetAttrString(pModule, "APP_INSTANCE");
PyObject *pExtraFairwareReminder = PyObject_GetAttrString(pAppInstance, "extra_fairware_reminder");
PyObject *pCallback = ObjP_classInstanceWithRef(@"ExtraFairwareReminderView", @"inter.ExtraFairwareReminderView", self);
py = [[PyExtraFairwareReminder alloc] initWithModel:pExtraFairwareReminder Callback:pCallback];
PyGILState_Release(gilState);
py = createPyWrapper(@"PyExtraFairwareReminder", @"extra_fairware_reminder", @"ExtraFairwareReminderView", self);
return self;
}

View File

@ -6,22 +6,15 @@ which should be included with this package. The terms are also available at
http://www.hardcoded.net/licenses/bsd_license
*/
#import <Python.h>
#import "StatsLabel.h"
#import "ObjP.h"
#import "Utils.h"
@implementation StatsLabel
- (id)initWithLabelView:(NSTextField *)aLabelView
{
self = [self init];
view = [aLabelView retain];
PyGILState_STATE gilState = PyGILState_Ensure();
PyObject *pModule = PyImport_AddModule("__main__");
PyObject *pAppInstance = PyObject_GetAttrString(pModule, "APP_INSTANCE");
PyObject *pStatsLabel = PyObject_GetAttrString(pAppInstance, "stats_label");
PyObject *pCallback = ObjP_classInstanceWithRef(@"StatsLabelView", @"inter.StatsLabelView", self);
py = [[PyStatsLabel alloc] initWithModel:pStatsLabel Callback:pCallback];
PyGILState_Release(gilState);
py = createPyWrapper(@"PyStatsLabel", @"stats_label", @"StatsLabelView", self);
[[self py] connect];
return self;
}

View File

@ -244,6 +244,7 @@
CECFFF2013CDF8D0003A4518 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = ../base/de.lproj/ProblemDialog.xib; sourceTree = SOURCE_ROOT; };
CECFFF2113CDF8D0003A4518 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = ../base/de.lproj/ResultWindow.xib; sourceTree = SOURCE_ROOT; };
CECFFF2413CDF8E5003A4518 /* de */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = de; path = de.lproj/Preferences.xib; sourceTree = "<group>"; };
CED569C614BF312900C6AC25 /* PyGUI2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PyGUI2.h; sourceTree = "<group>"; };
CED64CEB145EF06000572B00 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = ../base/cs.lproj/Localizable.strings; sourceTree = "<group>"; };
CED64CF8145EF07700572B00 /* cs */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = cs; path = ../base/cs.lproj/DetailsPanel.xib; sourceTree = "<group>"; };
CED64CF9145EF07700572B00 /* cs */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = cs; path = ../base/cs.lproj/DirectoryPanel.xib; sourceTree = "<group>"; };
@ -452,6 +453,7 @@
children = (
CE54A87A14804687008EEA77 /* PyColumns.h */,
CE76FDCD111EE38E006618EA /* PyGUI.h */,
CED569C614BF312900C6AC25 /* PyGUI2.h */,
CE76FDCE111EE38E006618EA /* PyOutline.h */,
CE8C53B61173248F0011B41F /* PyTable.h */,
CE9777D2141F9D6500C13FB5 /* PySelectableList.h */,