1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-23 07:01:39 +00:00

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;
}