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:
@@ -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
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
@@ -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 */
|
||||
|
||||
5
cocoa/base/bridge/StatsLabelView.h
Normal file
5
cocoa/base/bridge/StatsLabelView.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@protocol StatsLabelView <NSObject>
|
||||
- (void)refresh;
|
||||
@end
|
||||
Reference in New Issue
Block a user