Converted PyStatsLabel to a core instance mode.

--HG--
branch : objp
This commit is contained in:
Virgil Dupras 2012-01-09 11:15:20 -05:00
parent f636333938
commit 989026051c
7 changed files with 18 additions and 15 deletions

View File

@ -8,11 +8,13 @@ http://www.hardcoded.net/licenses/bsd_license
#import <Cocoa/Cocoa.h>
#import "PyResultTable.h"
#import "PyStatsLabel.h"
#import "PyApp.h"
@interface PyDupeGuruBase : PyApp
- (void)bindCocoa:(id)cocoa;
- (PyResultTable *)resultTable;
- (PyStatsLabel *)statsLabel;
//Actions
- (NSNumber *)addDirectory:(NSString *)name;
- (void)loadResultsFrom:(NSString *)filename;

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] initWithPyParent:py labelView:stats];
statsLabel = [[StatsLabel alloc] initWithPy:[py statsLabel] labelView:stats];
problemDialog = [[ProblemDialog alloc] initWithPy:py];
[self initResultColumns];
[self fillColumnsMenu];

View File

@ -10,10 +10,8 @@ http://www.hardcoded.net/licenses/bsd_license
#import "HSGUIController.h"
#import "PyStatsLabel.h"
@interface StatsLabel : HSGUIController
{
NSTextField *labelView;
}
- (id)initWithPyParent:(id)aPyParent labelView:(NSTextField *)aLabelView;
@interface StatsLabel : HSGUIController {}
- (id)initWithPy:(id)aPy labelView:(NSTextField *)aLabelView;
- (PyStatsLabel *)py;
- (NSTextField *)labelView;
@end

View File

@ -10,10 +10,9 @@ http://www.hardcoded.net/licenses/bsd_license
#import "Utils.h"
@implementation StatsLabel
- (id)initWithPyParent:(id)aPyParent labelView:(NSTextField *)aLabelView
- (id)initWithPy:(id)aPy labelView:(NSTextField *)aLabelView
{
self = [super initWithPyClassName:@"PyStatsLabel" pyParent:aPyParent];
labelView = [aLabelView retain];
self = [super initWithPy:aPy view:aLabelView];
[self connect];
return self;
}
@ -21,7 +20,6 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)dealloc
{
[self disconnect];
[labelView release];
[super dealloc];
}
@ -30,9 +28,14 @@ http://www.hardcoded.net/licenses/bsd_license
return (PyStatsLabel *)py;
}
- (NSTextField *)labelView
{
return (NSTextField *)[self view];
}
/* Python --> Cocoa */
- (void)refresh
{
[labelView setStringValue:[[self py] display]];
[[self labelView] setStringValue:[[self py] display]];
}
@end

View File

@ -8,6 +8,7 @@ from hscommon.trans import trget
from core.app import JobType
from .result_table import PyResultTable
from .stats_label import PyStatsLabel
tr = trget('ui')
@ -31,6 +32,7 @@ class PyDupeGuruBase(PyFairware):
self.cocoa = cocoa
resultTable = subproxy('resultTable', 'result_table', PyResultTable)
statsLabel = subproxy('statsLabel', 'stats_label', PyStatsLabel)
#---Directories
def addDirectory_(self, directory):

View File

@ -1,9 +1,5 @@
from cocoa.inter import PyGUIObject
from core.gui.stats_label import StatsLabel
class PyStatsLabel(PyGUIObject):
py_class = StatsLabel
def display(self):
return self.py.display

View File

@ -24,6 +24,7 @@ from hscommon.util import (delete_if_empty, first, escape, nonone, format_time_d
from hscommon.trans import tr
from . import directories, results, scanner, export, fs
from .gui.stats_label import StatsLabel
HAD_FIRST_LAUNCH_PREFERENCE = 'HadFirstLaunch'
DEBUG_MODE_PREFERENCE = 'DebugMode'
@ -100,6 +101,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
'ignore_hardlink_matches': False,
}
self.selected_dupes = []
self.stats_label = StatsLabel(None, self)
# subclasses must create self.result_table
#--- Virtual