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

Converted stats_label to objp.

--HG--
branch : objp
This commit is contained in:
Virgil Dupras
2012-01-11 15:14:59 -05:00
parent a7eeb7db89
commit 0c7d73854d
10 changed files with 82 additions and 30 deletions

View File

@@ -1,14 +0,0 @@
/*
Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
This software is licensed under the "BSD" License as described in the "LICENSE" file,
which should be included with this package. The terms are also available at
http://www.hardcoded.net/licenses/bsd_license
*/
#import <Cocoa/Cocoa.h>
#import "PyGUI.h"
@interface PyStatsLabel : PyGUI
- (NSString *)display;
@end

View File

@@ -25,7 +25,7 @@ http://www.hardcoded.net/licenses/bsd_license
/* Put a cute iTunes-like bottom bar */
[[self window] setContentBorderThickness:28 forEdge:NSMinYEdge];
table = [[ResultTable alloc] initWithPy:[py resultTable] view:matches];
statsLabel = [[StatsLabel alloc] initWithPy:[py statsLabel] labelView:stats];
statsLabel = [[StatsLabel alloc] initWithLabelView:stats];
problemDialog = [[ProblemDialog alloc] initWithPy:py];
[self initResultColumns];
[self fillColumnsMenu];

View File

@@ -7,11 +7,13 @@ http://www.hardcoded.net/licenses/bsd_license
*/
#import <Cocoa/Cocoa.h>
#import "HSGUIController.h"
#import "PyStatsLabel.h"
@interface StatsLabel : HSGUIController {}
- (id)initWithPy:(id)aPy labelView:(NSTextField *)aLabelView;
@interface StatsLabel : NSObject {
PyStatsLabel *py;
NSTextField *view;
}
- (id)initWithLabelView:(NSTextField *)aLabelView;
- (PyStatsLabel *)py;
- (NSTextField *)labelView;
@end

View File

@@ -6,20 +6,31 @@ 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 "Utils.h"
#import "ObjP.h"
@implementation StatsLabel
- (id)initWithPy:(id)aPy labelView:(NSTextField *)aLabelView
- (id)initWithLabelView:(NSTextField *)aLabelView
{
self = [super initWithPy:aPy view:aLabelView];
[self connect];
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);
[[self py] connect];
return self;
}
- (void)dealloc
{
[self disconnect];
[[self py] disconnect];
[py release];
[view release];
[super dealloc];
}
@@ -30,7 +41,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (NSTextField *)labelView
{
return (NSTextField *)[self view];
return (NSTextField *)view;
}
/* Python --> Cocoa */

View File

@@ -0,0 +1,5 @@
#import <Cocoa/Cocoa.h>
@protocol StatsLabelView <NSObject>
- (void)refresh;
@end